Bổ sung tính năng sửa chữa, cập nhật địa điểm trong chặng

This commit is contained in:
2026-06-14 10:16:09 +07:00
parent ec650fb45d
commit 838aec562f
19 changed files with 285 additions and 45 deletions
+30 -1
View File
@@ -333,6 +333,35 @@ class TourController {
}
}
@Controller('v1/locations')
@UseGuards(JwtAuthGuard)
class LocationController {
constructor(private prisma: PrismaService) {}
@Patch(':id')
async updateLocation(@Param('id', ParseUUIDPipe) id: string, @Body() body: any) {
return this.prisma.location.update({
where: { id },
data: {
name: body.name,
address: body.address,
latitude: body.latitude,
longitude: body.longitude,
type: body.type,
plannedStart: body.plannedStart ? new Date(body.plannedStart) : undefined,
plannedEnd: body.plannedEnd ? new Date(body.plannedEnd) : undefined,
status: body.status,
}
});
}
@Delete(':id')
async deleteLocation(@Param('id', ParseUUIDPipe) id: string) {
await this.prisma.location.delete({ where: { id } });
return { success: true };
}
}
@Controller('v1/legs')
@UseGuards(JwtAuthGuard)
class LegController {
@@ -546,7 +575,7 @@ class UserController {
signOptions: { expiresIn: '1d' },
}),
],
controllers: [AppController, AuthController, TourController, UserController, RoutingController, LegController],
controllers: [AppController, AuthController, TourController, UserController, RoutingController, LegController, LocationController],
providers: [PrismaService, JwtStrategy],
exports: [PrismaService]
})