Open vidbina opened 8 years ago
The records
table has the fields:
description STRING
(mandatory)category STRING
(not being used at the moment)attachment STRING
(a base64 encoded payload of the file)value_cents BIGINT
stores all monetary values in cents in order to eliminate rounding errors that may surface when floats are used (with 32 bit integers this should set us up for at most 4294967295 cent units which should work for currencies that aren't inflated like crazy)value_currency CHAR(3)
in ISO 4217:2015 (use the string EUR
for euros, USD
for US dollars and XTS
as a test currency)datetime_string CHAR(29)
in ISO 8601 which should allow us to save a localised timedatetime_epoch DATETIME DEFAULT CURRENT_TIMESTAMP
automatically saves the elapsed seconds since epochcreated_at
the first time this record was created in ISO 8601updated_at
the last time this record was modified in ISO 8601synced_at
the last time this record was synchronised in ISO 8601version
the version of the recordsynced
BOOLEAN is false by default, this way the codebase can easily pick up all non-synchronized records and sync them.uuid
CHAR(24) is the base64 representation of the UUID. The client will have to generate its own uuid's, the implementation of the uuid generator at this stage isn't too important, just provide a helper that returns a UUID. We can modify the implementation of it later. Use the implementation demonstrated here (listed below for convenience's sake). Perhaps you can store it in helpers/uuid.js
. Feel free to propose better alternatives.let uuid = () => {
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);
});
};
records
element in the state should reflect a list of all records from the local databaseSYNC_RECORDS
action needs to be set up, but will be implemented later. This part will retrieve information from the backend and synchronise that with the locally stored dataset.SAVE_RECORD
that save new information (from form #13 #5) into the database