diff --git a/src/controllers/entries.ts b/src/controllers/entries.ts index 19d58d69..5542cb4f 100644 --- a/src/controllers/entries.ts +++ b/src/controllers/entries.ts @@ -148,6 +148,7 @@ export default { meta: body.meta, recursion: body.recursion, hidden: body.hidden, + mirrored: body.mirrored, data: body.data, unversionedData: body.unversionedData, links: body.links, @@ -174,6 +175,7 @@ export default { mode: body.mode, type: body.type, hidden: body.hidden, + mirrored: body.mirrored, revId: body.revId, lockToken: body.lockToken, skipSyncLinks: body.skipSyncLinks, diff --git a/src/db/models/entry/index.ts b/src/db/models/entry/index.ts index fc08e858..c5cc0829 100644 --- a/src/db/models/entry/index.ts +++ b/src/db/models/entry/index.ts @@ -146,6 +146,7 @@ class Entry extends Model { innerMeta = null, unversionedData, hidden = false, + mirrored = false, recursion, requestedBy, data, @@ -173,6 +174,7 @@ class Entry extends Model { meta, links, hidden, + mirrored, recursion, createdBy, requestedBy, @@ -208,6 +210,7 @@ class Entry extends Model { unversionedData, permissionsMode, initialPermissions, + mirrored, }); if (!isValid) { @@ -341,6 +344,7 @@ class Entry extends Model { isDeleted, deletedAt, hidden, + mirrored, }) .returning('*'); @@ -452,6 +456,7 @@ class Entry extends Model { isDeleted, deletedAt, hidden, + mirrored, }) .returning('*'); @@ -539,6 +544,7 @@ class Entry extends Model { key, meta, hidden = false, + mirrored = false, recursion, requestedBy, data, @@ -561,6 +567,7 @@ class Entry extends Model { meta, links, hidden, + mirrored, recursion, permissionsMode, initialPermissions, @@ -581,6 +588,7 @@ class Entry extends Model { key, meta, hidden, + mirrored, recursion, data, unversionedData, diff --git a/src/db/models/entry/scheme.ts b/src/db/models/entry/scheme.ts index 133dbf35..f4c4fefb 100644 --- a/src/db/models/entry/scheme.ts +++ b/src/db/models/entry/scheme.ts @@ -48,6 +48,9 @@ export const validateCreateEntry = compileSchema({ initialPermissions: { type: 'object', }, + mirrored: { + type: 'boolean', + }, }, }); diff --git a/src/services/entry.service.ts b/src/services/entry.service.ts index 9cb25a0a..4370daad 100644 --- a/src/services/entry.service.ts +++ b/src/services/entry.service.ts @@ -29,6 +29,7 @@ export default class EntryService { meta, recursion, hidden, + mirrored, data, unversionedData, links, @@ -46,6 +47,7 @@ export default class EntryService { type, links, hidden, + mirrored, unversionedData, meta, data, @@ -67,6 +69,7 @@ export default class EntryService { meta, recursion, hidden, + mirrored, requestedBy: user, data, unversionedData, @@ -91,6 +94,7 @@ export default class EntryService { meta, recursion, hidden, + mirrored, data, unversionedData, links, @@ -107,6 +111,7 @@ export default class EntryService { type, links, hidden, + mirrored, unversionedData, meta, data, @@ -137,6 +142,7 @@ export default class EntryService { meta, recursion, hidden, + mirrored, requestedBy, data, unversionedData: unversionedData, diff --git a/src/services/entry/actions/create-in-workbook.ts b/src/services/entry/actions/create-in-workbook.ts index 0dcf9cdd..82a21b32 100644 --- a/src/services/entry/actions/create-in-workbook.ts +++ b/src/services/entry/actions/create-in-workbook.ts @@ -44,6 +44,9 @@ export const validateCreateEntryInWorkbook = makeSchemaValidator({ hidden: { type: 'boolean', }, + mirrored: { + type: 'boolean', + }, meta: { type: ['object', 'null'], patternProperties: AJV_PATTERN_KEYS_NOT_OBJECT, @@ -73,6 +76,7 @@ export type CreateEntryInWorkbookData = { type?: EntryColumns['type']; links?: SyncLinks; hidden?: EntryColumns['hidden']; + mirrored?: EntryColumns['mirrored']; unversionedData?: EntryColumns['unversionedData']; meta?: RevisionColumns['meta']; data?: RevisionColumns['data']; @@ -88,6 +92,7 @@ export async function createEntryInWorkbook( type = '', links, hidden, + mirrored, unversionedData, meta, data, @@ -140,6 +145,7 @@ export async function createEntryInWorkbook( updatedBy: createdBy, deletedAt: null, hidden, + mirrored, }); await Revision.query(trx).insert({ diff --git a/src/services/entry/actions/update-entry.ts b/src/services/entry/actions/update-entry.ts index a76703a4..ea0b0196 100644 --- a/src/services/entry/actions/update-entry.ts +++ b/src/services/entry/actions/update-entry.ts @@ -84,6 +84,7 @@ type UpdateEntryData = { type?: EntryColumns['type']; unversionedData?: EntryColumns['unversionedData']; hidden?: EntryColumns['hidden']; + mirrored?: EntryColumns['mirrored']; meta?: RevisionColumns['meta']; data?: RevisionColumns['data']; revId?: RevisionColumns['revId']; @@ -106,6 +107,7 @@ export async function updateEntry(ctx: CTX, updateData: UpdateEntryData) { mode = 'save', type, hidden, + mirrored, revId, lockToken, skipSyncLinks, @@ -119,6 +121,7 @@ export async function updateEntry(ctx: CTX, updateData: UpdateEntryData) { mode, type, hidden, + mirrored, revId, lockToken, skipSyncLinks, @@ -215,11 +218,14 @@ export async function updateEntry(ctx: CTX, updateData: UpdateEntryData) { const revId = revision.revId; const hiddenNext = typeof hidden === 'undefined' ? entry.hidden : hidden; + const mirroredNext = + typeof mirrored === 'undefined' ? entry.mirrored : mirrored; const patch: Partial = { savedId: revId, updatedBy: updatedBy, hidden: hiddenNext, + mirrored: mirroredNext, }; if (type) { diff --git a/src/types/models/entries.ts b/src/types/models/entries.ts index 74306d96..40ffae17 100644 --- a/src/types/models/entries.ts +++ b/src/types/models/entries.ts @@ -49,6 +49,7 @@ export interface CreationEntryConfig extends BasicRequestParams { verbose?: any; trxOverride?: any; useLegacyLogin?: boolean; + mirrored?: boolean; } export interface PrivateCreationEntryConfig extends CreationEntryConfig { masterToken?: any; diff --git a/src/types/models/tables-columns.ts b/src/types/models/tables-columns.ts index 1dc57e9e..24ef5ddd 100644 --- a/src/types/models/tables-columns.ts +++ b/src/types/models/tables-columns.ts @@ -42,6 +42,7 @@ export interface EntryColumns { isDeleted: boolean; deletedAt: string | null; hidden: boolean; + mirrored: boolean; entryId: string; savedId: string; publishedId: string | null; diff --git a/src/types/services.types.ts b/src/types/services.types.ts index 5d02ca57..b86cb752 100644 --- a/src/types/services.types.ts +++ b/src/types/services.types.ts @@ -28,6 +28,7 @@ export interface CreateEntry extends StdServiceParams { key?: any; meta?: any; hidden?: any; + mirrored?: boolean; recursion?: any; createdBy?: any; data?: any;