Track offline record modify dates to help with sync processes
This commit is contained in:
parent
708c029079
commit
36ea67a9d6
@ -9,6 +9,7 @@ export interface ICodium {
|
|||||||
UUID: string;
|
UUID: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Codium extends Model<ICodium> implements ICodium {
|
export class Codium extends Model<ICodium> implements ICodium {
|
||||||
@ -20,13 +21,14 @@ export class Codium extends Model<ICodium> implements ICodium {
|
|||||||
UUID: string;
|
UUID: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'codiums';
|
return 'codiums';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, Language, NodeId, PageId, code, UUID, needsServerUpdate, deleted';
|
return '++id, Language, NodeId, PageId, code, UUID, needsServerUpdate, deleted, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -37,6 +39,7 @@ export class Codium extends Model<ICodium> implements ICodium {
|
|||||||
UUID: string,
|
UUID: string,
|
||||||
needsServerUpdate?: boolean,
|
needsServerUpdate?: boolean,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
|
offlineUpdatedAt?: string,
|
||||||
id?: number
|
id?: number
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@ -55,6 +58,10 @@ export class Codium extends Model<ICodium> implements ICodium {
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -78,6 +85,7 @@ export class Codium extends Model<ICodium> implements ICodium {
|
|||||||
UUID: this.UUID,
|
UUID: this.UUID,
|
||||||
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ export interface IDatabase {
|
|||||||
Active: boolean;
|
Active: boolean;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Database extends Model<IDatabase> implements IDatabase {
|
export class Database extends Model<IDatabase> implements IDatabase {
|
||||||
@ -22,13 +23,14 @@ export class Database extends Model<IDatabase> implements IDatabase {
|
|||||||
Active: boolean;
|
Active: boolean;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'databases';
|
return 'databases';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, Name, NodeId, PageId, ColumnIds, UUID, Active, needsServerUpdate, deleted';
|
return '++id, Name, NodeId, PageId, ColumnIds, UUID, Active, needsServerUpdate, deleted, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -40,7 +42,8 @@ export class Database extends Model<IDatabase> implements IDatabase {
|
|||||||
Active: boolean,
|
Active: boolean,
|
||||||
needsServerUpdate?: boolean,
|
needsServerUpdate?: boolean,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
id?: number
|
offlineUpdatedAt?: string,
|
||||||
|
id?: number,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -59,6 +62,10 @@ export class Database extends Model<IDatabase> implements IDatabase {
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -84,6 +91,7 @@ export class Database extends Model<IDatabase> implements IDatabase {
|
|||||||
Active: this.Active,
|
Active: this.Active,
|
||||||
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ export interface IDatabaseColumn {
|
|||||||
additionalData: string;
|
additionalData: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DatabaseColumn extends Model<IDatabaseColumn> implements IDatabaseColumn {
|
export class DatabaseColumn extends Model<IDatabaseColumn> implements IDatabaseColumn {
|
||||||
@ -22,13 +23,14 @@ export class DatabaseColumn extends Model<IDatabaseColumn> implements IDatabaseC
|
|||||||
additionalData: string;
|
additionalData: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'databaseColumns';
|
return 'databaseColumns';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, headerName, field, DatabaseId, UUID, Type, additionalData, needsServerUpdate, deleted';
|
return '++id, headerName, field, DatabaseId, UUID, Type, additionalData, needsServerUpdate, deleted, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -40,7 +42,8 @@ export class DatabaseColumn extends Model<IDatabaseColumn> implements IDatabaseC
|
|||||||
additionalData: string,
|
additionalData: string,
|
||||||
needsServerUpdate?: boolean,
|
needsServerUpdate?: boolean,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
id?: number
|
offlineUpdatedAt?: string,
|
||||||
|
id?: number,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -59,6 +62,10 @@ export class DatabaseColumn extends Model<IDatabaseColumn> implements IDatabaseC
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -84,6 +91,7 @@ export class DatabaseColumn extends Model<IDatabaseColumn> implements IDatabaseC
|
|||||||
additionalData: this.additionalData,
|
additionalData: this.additionalData,
|
||||||
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ export interface IDatabaseEntry {
|
|||||||
UUID: string;
|
UUID: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DatabaseEntry extends Model<IDatabaseEntry> implements IDatabaseEntry {
|
export class DatabaseEntry extends Model<IDatabaseEntry> implements IDatabaseEntry {
|
||||||
@ -16,13 +17,14 @@ export class DatabaseEntry extends Model<IDatabaseEntry> implements IDatabaseEnt
|
|||||||
UUID: string;
|
UUID: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'databaseEntries';
|
return 'databaseEntries';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, DatabaseId, RowDataJSON, UUID, needsServerUpdate, deleted';
|
return '++id, DatabaseId, RowDataJSON, UUID, needsServerUpdate, deleted, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -31,7 +33,8 @@ export class DatabaseEntry extends Model<IDatabaseEntry> implements IDatabaseEnt
|
|||||||
UUID: string,
|
UUID: string,
|
||||||
needsServerUpdate?: boolean,
|
needsServerUpdate?: boolean,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
id?: number
|
offlineUpdatedAt?: string,
|
||||||
|
id?: number,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -47,6 +50,10 @@ export class DatabaseEntry extends Model<IDatabaseEntry> implements IDatabaseEnt
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -73,6 +80,7 @@ export class DatabaseEntry extends Model<IDatabaseEntry> implements IDatabaseEnt
|
|||||||
UUID: this.UUID,
|
UUID: this.UUID,
|
||||||
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ export interface IFileGroup {
|
|||||||
UUID: string;
|
UUID: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FileGroup extends Model<IFileGroup> implements IFileGroup {
|
export class FileGroup extends Model<IFileGroup> implements IFileGroup {
|
||||||
@ -20,13 +21,14 @@ export class FileGroup extends Model<IFileGroup> implements IFileGroup {
|
|||||||
UUID: string;
|
UUID: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'fileGroups';
|
return 'fileGroups';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, NodeId, PageId, FileIds, filesJSON, UUID, needsServerUpdate, deleted';
|
return '++id, NodeId, PageId, FileIds, filesJSON, UUID, needsServerUpdate, deleted, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -37,7 +39,8 @@ export class FileGroup extends Model<IFileGroup> implements IFileGroup {
|
|||||||
UUID: string,
|
UUID: string,
|
||||||
needsServerUpdate?: boolean,
|
needsServerUpdate?: boolean,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
id?: number
|
offlineUpdatedAt?: string,
|
||||||
|
id?: number,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -55,6 +58,10 @@ export class FileGroup extends Model<IFileGroup> implements IFileGroup {
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -88,6 +95,7 @@ export class FileGroup extends Model<IFileGroup> implements IFileGroup {
|
|||||||
UUID: this.UUID,
|
UUID: this.UUID,
|
||||||
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ export interface IKeyValue {
|
|||||||
key: string;
|
key: string;
|
||||||
value: string;
|
value: string;
|
||||||
json: boolean;
|
json: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class KeyValue extends Model<IKeyValue> implements IKeyValue {
|
export class KeyValue extends Model<IKeyValue> implements IKeyValue {
|
||||||
@ -12,21 +13,27 @@ export class KeyValue extends Model<IKeyValue> implements IKeyValue {
|
|||||||
key: string;
|
key: string;
|
||||||
value: string;
|
value: string;
|
||||||
json: boolean;
|
json: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'keyValues';
|
return 'keyValues';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, key, value, json';
|
return '++id, key, value, json, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(key: string, value: string, json: boolean, id?: number) {
|
constructor(key: string, value: string, json: boolean, offlineUpdatedAt?: string, id?: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.json = json;
|
this.json = json;
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -56,6 +63,7 @@ export class KeyValue extends Model<IKeyValue> implements IKeyValue {
|
|||||||
key: this.key,
|
key: this.key,
|
||||||
value: this.value,
|
value: this.value,
|
||||||
json: this.json,
|
json: this.json,
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt })
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ export interface IMenuItem {
|
|||||||
type?: string;
|
type?: string;
|
||||||
shared?: boolean;
|
shared?: boolean;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MenuItem extends Model<IMenuItem> implements IMenuItem {
|
export class MenuItem extends Model<IMenuItem> implements IMenuItem {
|
||||||
@ -25,13 +26,14 @@ export class MenuItem extends Model<IMenuItem> implements IMenuItem {
|
|||||||
type?: string;
|
type?: string;
|
||||||
shared?: boolean;
|
shared?: boolean;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'menuItems';
|
return 'menuItems';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, serverId, name, childIds, noDelete, noChildren, virtual, type, shared, needsServerUpdate';
|
return '++id, serverId, name, childIds, noDelete, noChildren, virtual, type, shared, needsServerUpdate, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static deflateTree(nodes: any[]): MenuItem[] {
|
public static deflateTree(nodes: any[]): MenuItem[] {
|
||||||
@ -111,6 +113,7 @@ export class MenuItem extends Model<IMenuItem> implements IMenuItem {
|
|||||||
type?: string,
|
type?: string,
|
||||||
shared?: boolean,
|
shared?: boolean,
|
||||||
needsServerUpdate?: boolean,
|
needsServerUpdate?: boolean,
|
||||||
|
offlineUpdatedAt?: string,
|
||||||
id?: number
|
id?: number
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@ -145,6 +148,10 @@ export class MenuItem extends Model<IMenuItem> implements IMenuItem {
|
|||||||
this.needsServerUpdate = needsServerUpdate;
|
this.needsServerUpdate = needsServerUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -166,6 +173,7 @@ export class MenuItem extends Model<IMenuItem> implements IMenuItem {
|
|||||||
...(typeof this.type !== 'undefined' ? { type: this.type } : {}),
|
...(typeof this.type !== 'undefined' ? { type: this.type } : {}),
|
||||||
...(typeof this.shared !== 'undefined' ? { shared: this.shared } : {}),
|
...(typeof this.shared !== 'undefined' ? { shared: this.shared } : {}),
|
||||||
...(typeof this.needsServerUpdate !== 'undefined' ? { needsServerUpdate: this.needsServerUpdate } : {}),
|
...(typeof this.needsServerUpdate !== 'undefined' ? { needsServerUpdate: this.needsServerUpdate } : {}),
|
||||||
|
...(typeof this.offlineUpdatedAt !== 'undefined' ? { offlineUpdatedAt: this.offlineUpdatedAt } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,26 +4,33 @@ export interface IMigration {
|
|||||||
id?: number;
|
id?: number;
|
||||||
uuid: string;
|
uuid: string;
|
||||||
applied: boolean;
|
applied: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Migration extends Model<IMigration> implements IMigration {
|
export class Migration extends Model<IMigration> implements IMigration {
|
||||||
id?: number;
|
id?: number;
|
||||||
uuid: string;
|
uuid: string;
|
||||||
applied: boolean;
|
applied: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'migrations';
|
return 'migrations';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
return '++id, uuid, applied';
|
return '++id, uuid, applied, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(uuid: string, applied: boolean, id?: number) {
|
constructor(uuid: string, applied: boolean, offlineUpdatedAt?: string, id?: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.applied = applied;
|
this.applied = applied;
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -34,6 +41,7 @@ export class Migration extends Model<IMigration> implements IMigration {
|
|||||||
...(this.id ? { id: this.id } : {}),
|
...(this.id ? { id: this.id } : {}),
|
||||||
uuid: this.uuid,
|
uuid: this.uuid,
|
||||||
applied: this.applied,
|
applied: this.applied,
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ export abstract class Model<InterfaceType> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record.offlineUpdatedAt = String(new Date());
|
||||||
|
|
||||||
this.id = await this.getDatabase().put(record);
|
this.id = await this.getDatabase().put(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ export interface IPage {
|
|||||||
virtual: boolean;
|
virtual: boolean;
|
||||||
needsServerUpdate?: 0 | 1;
|
needsServerUpdate?: 0 | 1;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Page extends Model<IPage> implements IPage {
|
export class Page extends Model<IPage> implements IPage {
|
||||||
@ -40,6 +41,7 @@ export class Page extends Model<IPage> implements IPage {
|
|||||||
virtual: boolean;
|
virtual: boolean;
|
||||||
needsServerUpdate?: 0 | 1;
|
needsServerUpdate?: 0 | 1;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'pages';
|
return 'pages';
|
||||||
@ -47,7 +49,7 @@ export class Page extends Model<IPage> implements IPage {
|
|||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
return '++id, UUID, Name, OrgUserId, IsPublic, IsVisibleInMenu, ParentId, NodeIds, CreatedAt, UpdatedAt, Active, CreatedUserId, UpdateUserId, ChildPageIds, noDelete, virtual, needsServerUpdate, deleted';
|
return '++id, UUID, Name, OrgUserId, IsPublic, IsVisibleInMenu, ParentId, NodeIds, CreatedAt, UpdatedAt, Active, CreatedUserId, UpdateUserId, ChildPageIds, noDelete, virtual, needsServerUpdate, deleted, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -68,6 +70,7 @@ export class Page extends Model<IPage> implements IPage {
|
|||||||
virtual: boolean,
|
virtual: boolean,
|
||||||
needsServerUpdate?: 0 | 1,
|
needsServerUpdate?: 0 | 1,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
|
offlineUpdatedAt?: string,
|
||||||
id?: number
|
id?: number
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@ -96,6 +99,10 @@ export class Page extends Model<IPage> implements IPage {
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -141,6 +148,7 @@ export class Page extends Model<IPage> implements IPage {
|
|||||||
virtual: this.virtual,
|
virtual: this.virtual,
|
||||||
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ export interface IPageNode {
|
|||||||
UpdateUserId: string;
|
UpdateUserId: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PageNode extends Model<IPageNode> implements IPageNode {
|
export class PageNode extends Model<IPageNode> implements IPageNode {
|
||||||
@ -26,6 +27,7 @@ export class PageNode extends Model<IPageNode> implements IPageNode {
|
|||||||
UpdateUserId: string;
|
UpdateUserId: string;
|
||||||
needsServerUpdate?: boolean;
|
needsServerUpdate?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
offlineUpdatedAt?: string;
|
||||||
|
|
||||||
public static getTableName() {
|
public static getTableName() {
|
||||||
return 'pageNodes';
|
return 'pageNodes';
|
||||||
@ -33,7 +35,7 @@ export class PageNode extends Model<IPageNode> implements IPageNode {
|
|||||||
|
|
||||||
public static getSchema() {
|
public static getSchema() {
|
||||||
// tslint:disable-next-line:max-line-length
|
// tslint:disable-next-line:max-line-length
|
||||||
return '++id, UUID, Type, ValueJSON, PageId, CreatedAt, UpdatedAt, CreatedUserId, UpdateUserId, needsServerUpdate, deleted';
|
return '++id, UUID, Type, ValueJSON, PageId, CreatedAt, UpdatedAt, CreatedUserId, UpdateUserId, needsServerUpdate, deleted, offlineUpdatedAt';
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -47,6 +49,7 @@ export class PageNode extends Model<IPageNode> implements IPageNode {
|
|||||||
UpdateUserId: string,
|
UpdateUserId: string,
|
||||||
needsServerUpdate?: boolean,
|
needsServerUpdate?: boolean,
|
||||||
deleted?: boolean,
|
deleted?: boolean,
|
||||||
|
offlineUpdatedAt?: string,
|
||||||
id?: number
|
id?: number
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@ -68,6 +71,10 @@ export class PageNode extends Model<IPageNode> implements IPageNode {
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( typeof offlineUpdatedAt !== 'undefined' ) {
|
||||||
|
this.offlineUpdatedAt = offlineUpdatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@ -104,6 +111,7 @@ export class PageNode extends Model<IPageNode> implements IPageNode {
|
|||||||
UpdateUserId: this.UpdateUserId,
|
UpdateUserId: this.UpdateUserId,
|
||||||
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
...(typeof this.needsServerUpdate === 'undefined' ? {} : { needsServerUpdate: this.needsServerUpdate }),
|
||||||
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
...(typeof this.deleted === 'undefined' ? {} : { deleted: this.deleted }),
|
||||||
|
...(typeof this.offlineUpdatedAt === 'undefined' ? {} : { offlineUpdatedAt: this.offlineUpdatedAt }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ export class DatabaseService extends Dexie {
|
|||||||
schema[ModelClass.getTableName()] = ModelClass.getSchema();
|
schema[ModelClass.getTableName()] = ModelClass.getSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.version(14).stores(schema);
|
await this.version(15).stores(schema);
|
||||||
await this.open();
|
await this.open();
|
||||||
|
|
||||||
this.migrations = this.table('migrations');
|
this.migrations = this.table('migrations');
|
||||||
|
Loading…
Reference in New Issue
Block a user