Adiciona upload/remoção de logo e cor primária por tenant (módulo tenant-profile, armazenamento local atrás de uma interface StorageService trocável por object storage depois) e um endpoint público de tema para a tela de login carregar antes da autenticação. Revisão de segurança: Helmet e CORS explícito (extraídos para security.util.ts, reutilizado pelos testes e2e que verificam os cabeçalhos), Swagger em /docs cobrindo todos os módulos via o plugin oficial, paginação em alert_templates. Corrige um achado real: o reset de senha logava o token em texto puro desde a Etapa 2 — agora envia por e-mail de verdade. Build de produção do Docker validado (imagem sem devDependencies, app e worker rodando contra Postgres/Redis reais) e README consolidado com o processo de deploy. Fecha o backlog com um teste e2e do fluxo completo: master cria tenant → login → customer/produto → venda com parcelas → parcela paga → dashboard financeiro reflete o pagamento. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
73 lines
2.2 KiB
TypeScript
73 lines
2.2 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Delete,
|
|
Get,
|
|
Param,
|
|
ParseUUIDPipe,
|
|
Post,
|
|
Put,
|
|
Query,
|
|
Req,
|
|
UseGuards,
|
|
} from '@nestjs/common';
|
|
import { Request } from 'express';
|
|
import { CurrentUser } from '../auth/decorators/current-user.decorator';
|
|
import { Roles } from '../auth/decorators/roles.decorator';
|
|
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
|
import { RolesGuard } from '../auth/guards/roles.guard';
|
|
import { TenantGuard } from '../auth/guards/tenant.guard';
|
|
import { JwtPayload } from '../auth/types/jwt-payload.type';
|
|
import { CreateTenantAlertTemplateDto } from './dto/create-tenant-alert-template.dto';
|
|
import { ListAlertTemplatesQueryDto } from './dto/list-alert-templates.query.dto';
|
|
import { UpdateTenantAlertTemplateDto } from './dto/update-tenant-alert-template.dto';
|
|
import { TenantAlertTemplatesService } from './tenant-alert-templates.service';
|
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
|
|
|
@UseGuards(JwtAuthGuard, TenantGuard, RolesGuard)
|
|
@Roles('tenant_admin')
|
|
@ApiTags('tenant/alertas')
|
|
@ApiBearerAuth('jwt')
|
|
@Controller('tenant/alertas/templates')
|
|
export class TenantAlertTemplatesController {
|
|
constructor(private readonly tenantAlertTemplatesService: TenantAlertTemplatesService) {}
|
|
|
|
@Post()
|
|
create(
|
|
@Body() dto: CreateTenantAlertTemplateDto,
|
|
@CurrentUser() user: JwtPayload,
|
|
@Req() req: Request,
|
|
) {
|
|
return this.tenantAlertTemplatesService.create(dto, user, req.ip);
|
|
}
|
|
|
|
@Get()
|
|
findAll(@Query() query: ListAlertTemplatesQueryDto, @CurrentUser() user: JwtPayload) {
|
|
return this.tenantAlertTemplatesService.findAll(query, user);
|
|
}
|
|
|
|
@Get(':id')
|
|
findOne(@Param('id', ParseUUIDPipe) id: string, @CurrentUser() user: JwtPayload) {
|
|
return this.tenantAlertTemplatesService.findOne(id, user);
|
|
}
|
|
|
|
@Put(':id')
|
|
update(
|
|
@Param('id', ParseUUIDPipe) id: string,
|
|
@Body() dto: UpdateTenantAlertTemplateDto,
|
|
@CurrentUser() user: JwtPayload,
|
|
@Req() req: Request,
|
|
) {
|
|
return this.tenantAlertTemplatesService.update(id, dto, user, req.ip);
|
|
}
|
|
|
|
@Delete(':id')
|
|
remove(
|
|
@Param('id', ParseUUIDPipe) id: string,
|
|
@CurrentUser() user: JwtPayload,
|
|
@Req() req: Request,
|
|
) {
|
|
return this.tenantAlertTemplatesService.remove(id, user, req.ip);
|
|
}
|
|
}
|