server: fix project_shares audit logging and add share transfer

- Fix PATCH /api/projects/:id/shares/:userId: query SELECT 1 instead of
  SELECT id (project_shares has a composite PK, no id column)
- Add audit logging to existing share grant/revoke routes
- Add POST /api/projects/:id/transfer for ownership handoff
- Remove inline admin user/audit routes from routes.ts (now in admin.ts)
- Remove unused requireAdmin import and userPatch schema from routes.ts
This commit is contained in:
Schwitzz
2026-10-29 10:44:58 -05:00
parent 1e16b0d5d2
commit fc8eaa86c3
7 changed files with 327 additions and 36 deletions
+13
View File
@@ -24,6 +24,19 @@ export interface User {
createdAt: string;
}
/** A single row in the instance audit log (CHUNK #10). */
export interface AuditLogEntry {
id: string;
/** ISO-8601 UTC timestamp of when the action occurred. */
at: string;
/** Id of the acting user, or `null` for system actions. */
userId: string | null;
/** Machine-readable action name, e.g. `user_create`, `share_grant`. */
action: string;
/** Free-form context for the action (email, targetId, perm, …). */
detail: Record<string, unknown>;
}
export interface Project {
id: string;
projectId: string;