feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes
This commit is contained in:
parent
01ef3293cf
commit
66b6b45ba9
399 changed files with 17828 additions and 11330 deletions
|
|
@ -48,7 +48,7 @@ export class FakeSyncRemote implements SyncRemote {
|
|||
|
||||
mobileInsert(table: string, row: RemoteRow): RemoteRow {
|
||||
const at = this.now()
|
||||
const full = { user_id: this.userId, created_at: at, updated_at: at, ...row }
|
||||
const full = { user_id: this.userId, revision: 1, created_at: at, updated_at: at, ...row }
|
||||
this.rows(table).push(full)
|
||||
return full
|
||||
}
|
||||
|
|
@ -56,7 +56,11 @@ export class FakeSyncRemote implements SyncRemote {
|
|||
mobileUpdate(table: string, id: string, patch: RemoteRow): void {
|
||||
const row = this.find(table, id)
|
||||
if (!row) throw new Error(`no ${table}/${id}`)
|
||||
const changed = Object.keys(patch).some((k) => k !== 'updated_at' && row[k] !== patch[k])
|
||||
Object.assign(row, patch, { updated_at: this.now() })
|
||||
if ((table === 'history' || table === 'meeting_memos') && changed) {
|
||||
row.revision = Number(row.revision ?? 1) + 1
|
||||
}
|
||||
}
|
||||
|
||||
mobileDelete(table: string, id: string): void {
|
||||
|
|
@ -232,7 +236,9 @@ export class FakeSyncRemote implements SyncRemote {
|
|||
if (existing) {
|
||||
const changed = Object.keys(row).some((k) => k !== 'updated_at' && existing[k] !== row[k])
|
||||
Object.assign(existing, row, { updated_at: this.now() })
|
||||
if (table === 'history' && changed) existing.revision = Number(existing.revision ?? 1) + 1
|
||||
if ((table === 'history' || table === 'meeting_memos') && changed) {
|
||||
existing.revision = Number(existing.revision ?? 1) + 1
|
||||
}
|
||||
} else {
|
||||
const at = this.now()
|
||||
this.rows(table).push({ id: crypto.randomUUID(), revision: 1, created_at: at, ...row, updated_at: row.updated_at ?? at })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue