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
+2
View File
@@ -9,6 +9,7 @@ import { openDb, ensureAdmin } from "./db.js";
import { hashPassword, registerAuthHook, registerAuthRoutes } from "./auth.js";
import { registerRoutes } from "./routes.js";
import { registerWs } from "./ws.js";
import { registerAdminRoutes } from "./admin.js";
/** A Fastify error carrying a status code and a serializable payload. */
export interface HttpError extends Error {
@@ -64,6 +65,7 @@ export async function buildApp() {
registerAuthHook(app);
registerAuthRoutes(app);
registerRoutes(app);
registerAdminRoutes(app);
registerWs(app);
return app;