mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
Gates the previously open support-agent, procurement, compliance, facilities, list-users and trade-access controllers, separates customer from staff routes across bookings, contracts, companies, billing, warehouses, files and train scheduling, and moves billing, overview, reports and the settings controllers onto their own keys instead of the blanket admin key. Drops the demo-permissions module and the untested notification test route.
60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
import { Controller, Post, Get, Patch, Delete, Body, Param, Query } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
import { BookingStaff } from '../../common/booking-guards';
|
|
import { FREIGHT_PERMS } from '../../seed/freight-permissions.registry';
|
|
import { ComplianceService } from './compliance.service';
|
|
import {
|
|
CreateComplianceRecordDto,
|
|
UpdateComplianceRecordDto,
|
|
} from './dto/create-compliance-record.dto';
|
|
import { ComplianceType } from './entities/compliance-record.entity';
|
|
|
|
@ApiTags('Vehicle Compliance')
|
|
@Controller('compliance')
|
|
@BookingStaff(FREIGHT_PERMS.compliance.view)
|
|
export class ComplianceController {
|
|
constructor(private readonly complianceService: ComplianceService) {}
|
|
|
|
@Post()
|
|
@BookingStaff(FREIGHT_PERMS.compliance.manage)
|
|
@ApiOperation({ summary: 'Create a compliance record' })
|
|
create(@Body() dto: CreateComplianceRecordDto) {
|
|
return this.complianceService.create(dto);
|
|
}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: 'List compliance records' })
|
|
findAll(
|
|
@Query('vehicleId') vehicleId?: string,
|
|
@Query('type') type?: ComplianceType,
|
|
) {
|
|
return this.complianceService.findAll({ vehicleId, type });
|
|
}
|
|
|
|
@Get('alerts')
|
|
@ApiOperation({ summary: 'List overdue / due-soon compliance & expiry alerts' })
|
|
getAlerts() {
|
|
return this.complianceService.getAlerts();
|
|
}
|
|
|
|
@Get(':id')
|
|
@ApiOperation({ summary: 'Get a compliance record by ID' })
|
|
findOne(@Param('id') id: string) {
|
|
return this.complianceService.findById(id);
|
|
}
|
|
|
|
@Patch(':id')
|
|
@BookingStaff(FREIGHT_PERMS.compliance.manage)
|
|
@ApiOperation({ summary: 'Update a compliance record' })
|
|
update(@Param('id') id: string, @Body() dto: UpdateComplianceRecordDto) {
|
|
return this.complianceService.update(id, dto);
|
|
}
|
|
|
|
@Delete(':id')
|
|
@BookingStaff(FREIGHT_PERMS.compliance.manage)
|
|
@ApiOperation({ summary: 'Soft-delete a compliance record' })
|
|
remove(@Param('id') id: string) {
|
|
return this.complianceService.remove(id);
|
|
}
|
|
}
|