Thêm tính năng xóa thành viên ra khỏi tour

This commit is contained in:
2026-06-14 17:43:28 +07:00
parent 4bec095a40
commit bb15b2bf15
15 changed files with 154 additions and 21 deletions
+21
View File
@@ -346,6 +346,18 @@ let TourController = class TourController {
include: { user: { select: { id: true, name: true, email: true } } },
});
}
async removeMember(tourId, userId) {
const participation = await this.prisma.tourParticipant.findUnique({
where: { tourId_userId: { tourId, userId } },
});
if (!participation) {
throw new NotFoundException('Thành viên này không có trong tour');
}
await this.prisma.tourParticipant.delete({
where: { tourId_userId: { tourId, userId } },
});
return { message: 'Đã xóa thành viên khỏi tour' };
}
};
__decorate([
UseGuards(JwtAuthGuard),
@@ -447,6 +459,15 @@ __decorate([
__metadata("design:paramtypes", [String, Object, Object]),
__metadata("design:returntype", Promise)
], TourController.prototype, "addMember", null);
__decorate([
UseGuards(JwtAuthGuard, TourRoleGuard),
Delete(':tourId/members/:userId'),
__param(0, Param('tourId', ParseUUIDPipe)),
__param(1, Param('userId', ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, String]),
__metadata("design:returntype", Promise)
], TourController.prototype, "removeMember", null);
TourController = __decorate([
Controller('v1/tours'),
__metadata("design:paramtypes", [PrismaService])