From 636ff6dd0bbdbea433747e1c689e3f89258fa94d Mon Sep 17 00:00:00 2001 From: Hendrik Date: Sun, 5 Oct 2025 15:42:43 +0200 Subject: [PATCH] Fix/channel is public api (#93) * Channel pause * Fix tenant config GET * Fixed test --- src/lib/server/services/channel-service.ts | 5 ++++- src/routes/api/tenants/[id]/config/+server.ts | 2 +- src/routes/api/tenants/tenant-routes.test.ts | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/server/services/channel-service.ts b/src/lib/server/services/channel-service.ts index d8ee1ad..0c6499b 100644 --- a/src/lib/server/services/channel-service.ts +++ b/src/lib/server/services/channel-service.ts @@ -35,6 +35,7 @@ const channelUpdateSchema = z.object({ color: z.string().optional(), descriptions: z.partialRecord(z.enum(supportedLocales), z.string().min(1)).optional(), isPublic: z.boolean().optional(), + pause: z.boolean().optional(), requiresConfirmation: z.boolean().optional(), agentIds: z.array(z.string().uuid()).optional(), slotTemplates: z @@ -125,7 +126,8 @@ export class ChannelService { names: request.names, color: request.color, descriptions: request.descriptions || {}, - isPublic: request.isPublic, + isPublic: request.isPublic ?? false, + pause: false, requiresConfirmation: request.requiresConfirmation, }) .returning(); @@ -240,6 +242,7 @@ export class ChannelService { color: updateData.color, descriptions: updateData.descriptions, isPublic: updateData.isPublic, + pause: updateData.pause, requiresConfirmation: updateData.requiresConfirmation, }; diff --git a/src/routes/api/tenants/[id]/config/+server.ts b/src/routes/api/tenants/[id]/config/+server.ts index c560f09..be2758f 100644 --- a/src/routes/api/tenants/[id]/config/+server.ts +++ b/src/routes/api/tenants/[id]/config/+server.ts @@ -192,7 +192,7 @@ export const GET: RequestHandler = async ({ locals, params }) => { checkPermission(locals, tenantId, true); const tenantService = await TenantAdminService.getTenantById(tenantId); - const config = await tenantService.configuration; + const config = await tenantService.configuration.configuration; log.debug("Tenant configuration retrieved successfully", { tenantId, diff --git a/src/routes/api/tenants/tenant-routes.test.ts b/src/routes/api/tenants/tenant-routes.test.ts index eddd2ba..e0b00a9 100644 --- a/src/routes/api/tenants/tenant-routes.test.ts +++ b/src/routes/api/tenants/tenant-routes.test.ts @@ -157,7 +157,9 @@ describe("Tenant API Routes", () => { }; const mockTenantService = { - configuration: mockConfig, + configuration: { + configuration: mockConfig, + }, }; vi.mocked(TenantAdminService.getTenantById).mockResolvedValue(mockTenantService as any);