mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: test server registration gaps, Redis subscriber cleanup, atomic settings upsert
This commit is contained in:
@@ -4,7 +4,7 @@ import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
import { db, schema } from "../../db/index.js";
|
||||
import { sharedRedis } from "../../jobs/connection.js";
|
||||
import { auditLog } from "../../lib/audit.js";
|
||||
import { getSettingString } from "../../lib/settings-helpers.js";
|
||||
import { getSettingString, upsertSetting } from "../../lib/settings-helpers.js";
|
||||
import { requirePermission } from "../../permissions.js";
|
||||
import { hashPassword, verifyPassword } from "../../plugins/auth.js";
|
||||
|
||||
@@ -179,18 +179,6 @@ function scimListResponse(
|
||||
|
||||
// ── Route Registration ───────────────────────────────────────────
|
||||
|
||||
async function upsertSetting(key: string, value: string): Promise<void> {
|
||||
const [existing] = await db.select().from(schema.settings).where(eq(schema.settings.key, key));
|
||||
if (existing) {
|
||||
await db
|
||||
.update(schema.settings)
|
||||
.set({ value, updatedAt: new Date() })
|
||||
.where(eq(schema.settings.key, key));
|
||||
} else {
|
||||
await db.insert(schema.settings).values({ key, value });
|
||||
}
|
||||
}
|
||||
|
||||
export async function registerScimRoutes(app: FastifyInstance): Promise<void> {
|
||||
// ── Token Management Endpoints ────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user