Merge dev to main #1

Open
kibin wants to merge 33 commits from dev into main
5 changed files with 15 additions and 13 deletions
Showing only changes of commit c14521a41d - Show all commits

View File

@@ -3,6 +3,7 @@ export const Role = {
TENANT_ADMIN: 'tenant_admin', TENANT_ADMIN: 'tenant_admin',
MANAGER: 'manager', MANAGER: 'manager',
TECHNICIAN: 'technician', TECHNICIAN: 'technician',
COLLECTOR: 'collector',
VIEWER: 'viewer', VIEWER: 'viewer',
} as const; } as const;
@@ -20,6 +21,7 @@ const ROLE_LEVEL: Record<string, number> = {
[Role.TENANT_ADMIN]: 80, [Role.TENANT_ADMIN]: 80,
[Role.MANAGER]: 60, [Role.MANAGER]: 60,
[Role.TECHNICIAN]: 40, [Role.TECHNICIAN]: 40,
[Role.COLLECTOR]: 30,
[Role.VIEWER]: 20, [Role.VIEWER]: 20,
}; };

View File

@@ -23,7 +23,7 @@ export class ClientController {
constructor(private readonly clientService: ClientService) {} constructor(private readonly clientService: ClientService) {}
@Get() @Get()
@Roles('technician') @Roles('technician', 'collector')
async findAll( async findAll(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Query('areaId') areaId?: string, @Query('areaId') areaId?: string,
@@ -36,7 +36,7 @@ export class ClientController {
} }
@Get(':id') @Get(':id')
@Roles('technician') @Roles('technician', 'collector')
async findById( async findById(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Param('id') id: string, @Param('id') id: string,

View File

@@ -20,7 +20,7 @@ export class InvoiceController {
constructor(private readonly invoiceService: InvoiceService) {} constructor(private readonly invoiceService: InvoiceService) {}
@Get() @Get()
@Roles('technician') @Roles('technician', 'collector')
async findAll( async findAll(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Query('clientId') clientId?: string, @Query('clientId') clientId?: string,
@@ -30,7 +30,7 @@ export class InvoiceController {
} }
@Get(':id') @Get(':id')
@Roles('technician') @Roles('technician', 'collector')
async findById( async findById(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Param('id') id: string, @Param('id') id: string,

View File

@@ -23,7 +23,7 @@ export class PaymentController {
constructor(private readonly paymentService: PaymentService) {} constructor(private readonly paymentService: PaymentService) {}
@Get() @Get()
@Roles('technician') @Roles('technician', 'collector')
async findAll( async findAll(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Query('clientId') clientId?: string, @Query('clientId') clientId?: string,
@@ -32,7 +32,7 @@ export class PaymentController {
} }
@Post() @Post()
@Roles('technician') @Roles('technician', 'collector')
async record( async record(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Body() dto: RecordPaymentDto, @Body() dto: RecordPaymentDto,
@@ -41,19 +41,19 @@ export class PaymentController {
} }
@Get('unremitted') @Get('unremitted')
@Roles('technician') @Roles('technician', 'collector')
async getUnremitted(@CurrentUser() user: CurrentUserPayload, @Query('collectorId') collectorId?: string) { async getUnremitted(@CurrentUser() user: CurrentUserPayload, @Query('collectorId') collectorId?: string) {
return this.paymentService.getUnremittedPayments(user.tenantId, collectorId || user.sub); return this.paymentService.getUnremittedPayments(user.tenantId, collectorId || user.sub);
} }
@Get('remittances') @Get('remittances')
@Roles('technician') @Roles('technician', 'collector')
async findRemittances(@CurrentUser() user: CurrentUserPayload) { async findRemittances(@CurrentUser() user: CurrentUserPayload) {
return this.paymentService.findRemittances(user.tenantId); return this.paymentService.findRemittances(user.tenantId);
} }
@Post('remittances') @Post('remittances')
@Roles('technician') @Roles('technician', 'collector')
async submitRemittance( async submitRemittance(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Body() dto: CreateRemittanceDto, @Body() dto: CreateRemittanceDto,

View File

@@ -23,7 +23,7 @@ export class TicketController {
constructor(private readonly ticketService: TicketService) {} constructor(private readonly ticketService: TicketService) {}
@Get() @Get()
@Roles('technician') @Roles('technician', 'collector')
async findAll( async findAll(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Query('clientId') clientId?: string, @Query('clientId') clientId?: string,
@@ -34,7 +34,7 @@ export class TicketController {
} }
@Get(':id') @Get(':id')
@Roles('technician') @Roles('technician', 'collector')
async findById( async findById(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Param('id') id: string, @Param('id') id: string,
@@ -52,7 +52,7 @@ export class TicketController {
} }
@Patch(':id') @Patch(':id')
@Roles('technician') @Roles('technician', 'collector')
async update( async update(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Param('id') id: string, @Param('id') id: string,
@@ -62,7 +62,7 @@ export class TicketController {
} }
@Patch(':id/resolve') @Patch(':id/resolve')
@Roles('technician') @Roles('technician', 'collector')
async resolve( async resolve(
@CurrentUser() user: CurrentUserPayload, @CurrentUser() user: CurrentUserPayload,
@Param('id') id: string, @Param('id') id: string,