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,61 @@
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from '@nestjs/common';
import { OrgService } from './org.service';
import { OrgAdminGuard } from './org-admin.guard';
import { CurrentOrgAdmin } from './org-admin.decorator';
import { OrgAdminJwtPayload } from '@tower/types';
@Controller('org')
@UseGuards(OrgAdminGuard)
export class OrgController {
constructor(private readonly orgService: OrgService) {}
@Get('dashboard')
getDashboard(@CurrentOrgAdmin() admin: OrgAdminJwtPayload) {
return this.orgService.getDashboard(admin.organizationId);
}
@Get('tenants')
getTenants(@CurrentOrgAdmin() admin: OrgAdminJwtPayload) {
return this.orgService.getTenants(admin.organizationId);
}
@Post('tenants')
createTenant(
@CurrentOrgAdmin() admin: OrgAdminJwtPayload,
@Body() body: { name: string; slug: string },
) {
return this.orgService.createTenant(admin.organizationId, body, admin.role);
}
@Get('tenants/:id')
getTenant(@CurrentOrgAdmin() admin: OrgAdminJwtPayload, @Param('id') id: string) {
return this.orgService.getTenant(admin.organizationId, id);
}
@Get('rules')
getRules(@CurrentOrgAdmin() admin: OrgAdminJwtPayload) {
return this.orgService.getRules(admin.organizationId);
}
@Post('rules')
createRule(
@CurrentOrgAdmin() admin: OrgAdminJwtPayload,
@Body() body: { matchType: string; matchValue: string; action: string; priority?: number },
) {
return this.orgService.createRule(admin.organizationId, body);
}
@Patch('rules/:id')
updateRule(
@CurrentOrgAdmin() admin: OrgAdminJwtPayload,
@Param('id') id: string,
@Body() body: { matchValue?: string; action?: string; priority?: number; isActive?: boolean },
) {
return this.orgService.updateRule(admin.organizationId, id, body);
}
@Delete('rules/:id')
deleteRule(@CurrentOrgAdmin() admin: OrgAdminJwtPayload, @Param('id') id: string) {
return this.orgService.deleteRule(admin.organizationId, id);
}
}