Sửa lỗi người nhận được liên kết chia sẻ không xem được nội dung Tour

This commit is contained in:
2026-06-16 09:54:32 +07:00
parent 63da413b3c
commit 302a82e887
7 changed files with 217 additions and 183 deletions
+45 -36
View File
@@ -157,6 +157,49 @@ AuthController = __decorate([
(0, common_1.Controller)('auth'),
__metadata("design:paramtypes", [prisma_service_1.PrismaService, jwt_1.JwtService])
], AuthController);
let PublicTourController = class PublicTourController {
constructor(prisma) {
this.prisma = prisma;
}
async getPublicTourDetails(id) {
const tour = await this.prisma.tour.findUnique({
where: { id },
include: {
participants: {
include: {
user: {
select: { id: true, name: true, email: true }
}
}
},
photos: true,
legs: {
orderBy: { sequence: 'asc' },
include: {
locations: {
orderBy: { plannedStart: 'asc' },
include: { _count: { select: { comments: true } } }
},
},
},
},
});
if (!tour)
throw new common_1.NotFoundException(`Không tìm thấy Tour`);
return tour;
}
};
__decorate([
(0, common_1.Get)(':id/public'),
__param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], PublicTourController.prototype, "getPublicTourDetails", null);
PublicTourController = __decorate([
(0, common_1.Controller)('tours'),
__metadata("design:paramtypes", [prisma_service_1.PrismaService])
], PublicTourController);
let TourController = class TourController {
constructor(prisma) {
this.prisma = prisma;
@@ -374,33 +417,6 @@ let TourController = class TourController {
}
});
}
async getPublicTourDetails(id) {
const tour = await this.prisma.tour.findUnique({
where: { id },
include: {
participants: {
include: {
user: {
select: { id: true, name: true, email: true }
}
}
},
photos: true,
legs: {
orderBy: { sequence: 'asc' },
include: {
locations: {
orderBy: { plannedStart: 'asc' },
include: { _count: { select: { comments: true } } }
},
},
},
},
});
if (!tour)
throw new common_1.NotFoundException(`Không tìm thấy Tour`);
return tour;
}
async getTourDetails(id) {
const tour = await this.prisma.tour.findUnique({
where: { id },
@@ -677,13 +693,6 @@ __decorate([
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], TourController.prototype, "getPublicTours", null);
__decorate([
(0, common_1.Get)(':id/public'),
__param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], TourController.prototype, "getPublicTourDetails", null);
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, rbac_middleware_1.TourRoleGuard),
(0, common_1.Get)(':id'),
@@ -1131,6 +1140,7 @@ __decorate([
__metadata("design:returntype", Promise)
], CommentController.prototype, "getComments", null);
__decorate([
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
(0, common_1.Post)(':locationId/comments'),
__param(0, (0, common_1.Param)('locationId', common_1.ParseUUIDPipe)),
__param(1, (0, common_1.Body)()),
@@ -1141,7 +1151,6 @@ __decorate([
], CommentController.prototype, "addComment", null);
CommentController = __decorate([
(0, common_1.Controller)('locations'),
(0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard),
__metadata("design:paramtypes", [prisma_service_1.PrismaService,
CommentGateway])
], CommentController);
@@ -1155,7 +1164,7 @@ AppModule = __decorate([
signOptions: { expiresIn: '1d' },
}),
],
controllers: [AppController, AuthController, TourController, UserController, RoutingController, LegController, LocationController, CommentController],
controllers: [AppController, AuthController, PublicTourController, TourController, UserController, RoutingController, LegController, LocationController, CommentController],
providers: [prisma_service_1.PrismaService, jwt_strategy_1.JwtStrategy, rbac_middleware_1.TourRoleGuard, jwt_auth_guard_1.JwtAuthGuard, admin_guard_1.AdminGuard, CommentGateway],
exports: [prisma_service_1.PrismaService]
})