Skip to content

Commit

Permalink
Oops
Browse files Browse the repository at this point in the history
  • Loading branch information
benmerckx committed Feb 20, 2024
1 parent a2f597d commit ce1e5b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/backend/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,15 @@ export class Database implements Syncable {
)
}
}
await query(
EntryRow({entryId: entry.entryId, phase: entry.phase}).delete()
)
seenSeeds.add(key)
seenVersions.push(
await query(
EntryRow().insert(withHash).returning(EntryRow.versionId)
)
)
await query(
EntryRow({entryId: entry.entryId, phase: entry.phase}).delete()
)
inserted.push(`${entry.entryId}.${entry.phase}`)
} catch (e: any) {
console.log(`> skipped ${file.filePath}${e.message}`)
Expand Down
9 changes: 5 additions & 4 deletions src/core/EntryRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ export interface RequiredEntryFields extends Partial<EntryRow> {
}

export function parseRecord(record: EntryRecord) {
const oldest = record.alinea as any
const {
[META_KEY]: old,
[EntryRecord.id]: entryId = old?.entryId! ?? record.id,
[EntryRecord.type]: type = old?.type! ?? record.type,
[EntryRecord.index]: index = old?.index! ?? record.index,
[EntryRecord.i18nId]: i18nId = old?.i18nId! ?? record.i18nId,
[EntryRecord.root]: root = old?.root! ?? record.root,
[EntryRecord.seeded]: seeded = (old?.seeded as string) ?? record.seeded,
[EntryRecord.index]: index = old?.index! ?? oldest?.index,
[EntryRecord.i18nId]: i18nId = old?.i18nId! ?? oldest?.i18nId,
[EntryRecord.root]: root = old?.root! ?? oldest?.root,
[EntryRecord.seeded]: seeded = (old?.seeded as string) ?? oldest?.seeded,
...data
} = record
return {
Expand Down

0 comments on commit ce1e5b0

Please sign in to comment.