feat(supabase): add draft_last_save to the sheet admin read (M8, sandbox only)

This commit is contained in:
bchanot committed 2026-11-04 11:40:22 +01:00
1 parent 2571978780
commit 2f824a947c
7 files changed
+269 -2

No files matched your search

@@ -95,6 +95,7 @@ const summary = {
const overview = {
...summary,
working_copy_source: null,
draft_last_save: { revision: 3, saved_at: '2026-11-02T11:00:00Z', saved_by: person },
versions: [{
version_id: VERSION, version_number: 1, status: 'published', revision: 1, change_note: null,
created_at: '2026-11-01T09:00:00Z', published_at: '2026-11-01T10:00:00Z', deprecated_at: null,
@@ -172,6 +173,11 @@ describe('sheet admin wrappers: answers', () => {
expect(rpcCalls).toEqual([['get_official_sheet_admin', { sheet_id: SHEET }]])
})
it('accepts a draft nobody saved: draft_last_save is null', async () => {
const { client } = stubClient({ rpc: { data: { ...overview, draft_last_save: null } } })
expect((await getOfficialSheetAdmin(client, SHEET)).draft_last_save).toBeNull()
})
it('parses grants, the account lookup and the species', async () => {
expect(await listCatalogGrants(stubClient({ rpc: { data: [grant] } }).client)).toEqual([grant])
const account = {
+2 -1
View File
@@ -5,7 +5,7 @@ import { migrationsDir } from './db/harness'
/**
* The closed failure kinds of the sheet workflow (V1-2.1). The census reads
* every closed code M4, M5 and M7 raise (`raise exception '<code>'`, a lowercase
* every closed code M4, M5, M7 and M8 raise (`raise exception '<code>'`, a lowercase
* dotted word; free-text messages are not codes) so a code added on the server
* can never reach a page as `unavailable` for want of a kind.
*/
@@ -13,6 +13,7 @@ const SHEET_MIGRATIONS = [
'20261028100000_sheet_access_hardening.sql',
'20261028110000_sheet_review_workflow.sql',
'20261102100000_sheet_admin_reads.sql',
'20261103100000_sheet_draft_last_save.sql',
]
async function raisedCodes(): Promise<string[]> {