NoteTemplate mirrors the DB row shape (Pick<TemplateRow, ...>):
nullable fields are T | null
bigint order is string | null (Kysely preserves bigint as string)
LegacySelectedTemplate is what the session.selected_template jsonb column
serializes to, defined by zLegacySelectedTemplate:
nullable fields are T | undefined (optional, not nullable)
order is z.number()
These converters bridge the two without an as unknown as X cast at each
call site. When the jsonb column is replaced with proper FK references
(see the TODO in sessions.table.ts), both can be deleted.
NoteTemplate mirrors the DB row shape (Pick<TemplateRow, ...>):
T | nullorderisstring | null(Kysely preserves bigint as string)LegacySelectedTemplate is what the
session.selected_templatejsonb column serializes to, defined byzLegacySelectedTemplate:T | undefined(optional, not nullable)orderisz.number()These converters bridge the two without an
as unknown as Xcast at each call site. When the jsonb column is replaced with proper FK references (see the TODO in sessions.table.ts), both can be deleted.