feat(api): add RoutesModule with GET/POST/DELETE /routes endpoints
Implements RoutesService and RoutesController for SyncRoute CRUD, wires GroupsModule and RoutesModule into AppModule; 11 new tests, all 31 pass.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Body, Controller, Delete, Get, HttpCode, Param, Post, Query } from '@nestjs/common';
|
||||
import { RoutesService } from './routes.service';
|
||||
|
||||
@Controller('routes')
|
||||
export class RoutesController {
|
||||
constructor(private readonly routesService: RoutesService) {}
|
||||
|
||||
@Get()
|
||||
list(@Query('sourceGroupId') sourceGroupId?: string) {
|
||||
return this.routesService.list(sourceGroupId);
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Body() body: { sourceGroupId?: string; targetGroupId?: string }) {
|
||||
return this.routesService.create(body.sourceGroupId ?? '', body.targetGroupId ?? '');
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@HttpCode(204)
|
||||
remove(@Param('id') id: string) {
|
||||
return this.routesService.remove(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user