fix(notes): add company_notes.updated_at, drop createdAt substitution

company_notes was missing updated_at — every other notes table has it,
and notes.service.ts substituted created_at into the response shape so
callers wouldn't notice. Add the column (defaulted + backfilled to
created_at for existing rows), wire the update path to set it on
edit, and drop the substitution from the read + edit handlers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-09 04:14:29 +02:00
parent 502455ac04
commit 91b5a41e10
3 changed files with 10 additions and 3 deletions

View File

@@ -305,7 +305,7 @@ export async function listForEntity(portId: string, entityType: EntityType, enti
mentions: companyNotes.mentions,
isLocked: companyNotes.isLocked,
createdAt: companyNotes.createdAt,
updatedAt: companyNotes.createdAt,
updatedAt: companyNotes.updatedAt,
authorName: userProfiles.displayName,
})
.from(companyNotes)
@@ -551,7 +551,7 @@ export async function update(
}
const [updated] = await db
.update(companyNotes)
.set({ content: data.content })
.set({ content: data.content, updatedAt: new Date() })
.where(eq(companyNotes.id, noteId))
.returning();
if (!updated) throw new NotFoundError('Note');
@@ -563,7 +563,6 @@ export async function update(
return {
...updated,
authorName: profile[0]?.displayName ?? null,
updatedAt: updated.createdAt,
};
}
if (entityType === 'clients') {