feat: add API modules for digest scheduling, org admin portal, and thread views

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 15:40:32 +05:30
parent 47f345c4bf
commit 435b0e7806
14 changed files with 605 additions and 0 deletions
@@ -0,0 +1,43 @@
import { Body, Controller, Delete, Get, Post, Put, UseGuards } from '@nestjs/common';
import { DigestService } from './digest.service';
import { JwtAuthGuard } from '../auth/jwt-auth.guard';
import { RolesGuard } from '../auth/roles.guard';
import { Roles } from '../auth/roles.decorator';
import { CurrentTenantContext } from '../auth/current-tenant.decorator';
import { TenantContext } from '../../common/tenant-context';
import { UpdateDigestConfigDto } from './digest.dto';
@Controller('admin/digest')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('OWNER', 'ADMIN')
export class DigestController {
constructor(private readonly digestService: DigestService) {}
@Get('config')
getConfig(@CurrentTenantContext() ctx: TenantContext) {
return this.digestService.getConfig(ctx.tenantId);
}
@Put('config')
upsertConfig(
@CurrentTenantContext() ctx: TenantContext,
@Body() body: UpdateDigestConfigDto,
) {
return this.digestService.upsertConfig(ctx.tenantId, body, ctx.adminId ?? 'unknown');
}
@Delete('config')
disableConfig(@CurrentTenantContext() ctx: TenantContext) {
return this.digestService.disableConfig(ctx.tenantId);
}
@Get('history')
getHistory(@CurrentTenantContext() ctx: TenantContext) {
return this.digestService.getHistory(ctx.tenantId);
}
@Post('send-now')
sendNow(@CurrentTenantContext() ctx: TenantContext) {
return this.digestService.sendNow(ctx.tenantId, ctx.adminId ?? 'unknown');
}
}