feat(certifications): server actions + page guard

certifications.ts: create/update/delete/list cert types (gated by
certifications.manage; delete refused once granted, archive instead),
and grant/revoke/renew/listMemberCertifications/getMyCertifications
(gated by certifications.grant, the Instructor capability). Grant
verifies cert and target member are in-space and the cert is active,
computes expiry from validity_months unless overridden, and relies on
the partial unique index for one active grant per member+cert. Revoke
is soft; nothing is ever deleted. getMyCertifications takes no params
(member resolved from session; RLS restricts to own rows).

certifications-guard.ts mirrors the forms guard for the admin pages.
Barrel re-export and API_REFERENCE updated.
This commit is contained in:
Moheeb Zara
2026-05-16 18:55:17 -07:00
parent ddf6717d1b
commit f23abb0050
4 changed files with 433 additions and 0 deletions
+3
View File
@@ -47,3 +47,6 @@ export * from './permissions'
// Custom forms and waivers
export * from './forms'
// Certifications + Instructor capability
export * from './certifications'