Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/renderer/src/crud/loadData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ export async function insertData(
if (Array.isArray(rec)) rec = rec[0] as InitializedRecord; //won't be...
rec.attributes = { ...item.attributes };
oparray.push(tb.updateRecord(rec).toOperation());
if (rec.type === 'project') {
if (isProject) project = rec as ProjectD;
if (rec.type === 'project' && isProject) {
project = rec as ProjectD;
await saveOfflineProject(
rec as ProjectD,
memory,
backup,
isProject ? snapshotDate : undefined,
isImport && isProject
snapshotDate,
isImport
);
}
for (const rel in item.relationships) {
Expand Down Expand Up @@ -206,14 +206,15 @@ export async function insertData(
try {
if (typeof item.id === 'number') item = rn.normalizeRecord(item);
oparray.push(tb.addRecord(item).toOperation());
if (item.type === 'project') {
if (isProject) project = item as ProjectD;
//don't mess with any offline project data for supporting projects
if (item.type === 'project' && isProject) {
project = item as ProjectD;
await saveOfflineProject(
item as ProjectD,
memory,
backup,
isProject ? snapshotDate : undefined,
isImport && isProject
snapshotDate,
isImport
);
}
} catch (errResult: unknown) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/model/orgKeyterm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface OrgKeyterm extends BaseModel {
domain: string;
definition: string;
category: string;
offlineid: string;
offlineId: string;
dateCreated: string;
dateUpdated: string;
lastModifiedBy: number;
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/model/sectionResourceUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface SectionResourceUser extends BaseModel {
dateCreated: string;
dateUpdated: string;
lastModifiedBy: number;
offlineId: string;
};
relationships?: {
sectionresource: RecordRelationship;
Expand Down
1 change: 1 addition & 0 deletions src/renderer/src/schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ if (requestedSchema > 3 && schemaDefinition.models) {
dateCreated: { type: 'string' }, // datetime
dateUpdated: { type: 'string' }, // datetime
lastModifiedBy: { type: 'number' }, //bkwd compat only
offlineId: { type: 'string' },
},
relationships: {
sectionresource: {
Expand Down
Loading
Loading