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
+45 -1
View File
@@ -391,6 +391,50 @@ TourController = __decorate([
Controller('v1/tours'),
__metadata("design:paramtypes", [PrismaService])
], TourController);
let LocationController = class LocationController {
constructor(prisma) {
this.prisma = prisma;
}
async updateLocation(id, body) {
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,
}
});
}
async deleteLocation(id) {
await this.prisma.location.delete({ where: { id } });
return { success: true };
}
};
__decorate([
Patch(':id'),
__param(0, Param('id', ParseUUIDPipe)),
__param(1, Body()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Object]),
__metadata("design:returntype", Promise)
], LocationController.prototype, "updateLocation", null);
__decorate([
Delete(':id'),
__param(0, Param('id', ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], LocationController.prototype, "deleteLocation", null);
LocationController = __decorate([
Controller('v1/locations'),
UseGuards(JwtAuthGuard),
__metadata("design:paramtypes", [PrismaService])
], LocationController);
let LegController = class LegController {
constructor(prisma) {
this.prisma = prisma;
@@ -620,7 +664,7 @@ AppModule = __decorate([
signOptions: { expiresIn: '1d' },
}),
],
controllers: [AppController, AuthController, TourController, UserController, RoutingController, LegController],
controllers: [AppController, AuthController, TourController, UserController, RoutingController, LegController, LocationController],
providers: [PrismaService, JwtStrategy],
exports: [PrismaService]
})