Sửa lỗi backend để chạy phần đăng ký

This commit is contained in:
2026-06-13 17:41:11 +07:00
parent c08aad3f68
commit 6913bbae48
70 changed files with 1296 additions and 210 deletions
+9 -12
View File
@@ -1,4 +1,3 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -8,10 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TourRoleGuard = void 0;
const common_1 = require("@nestjs/common");
const prisma_service_1 = require("./prisma.service");
import { Injectable, ForbiddenException } from '@nestjs/common';
import { PrismaService } from './prisma.service.js';
let TourRoleGuard = class TourRoleGuard {
constructor(prisma) {
this.prisma = prisma;
@@ -22,7 +19,7 @@ let TourRoleGuard = class TourRoleGuard {
const tourId = parseInt(request.params.id || request.params.tourId);
const path = request.url;
if (!user || isNaN(tourId)) {
throw new common_1.ForbiddenException("Thông tin xác thực hoặc mã Tour không hợp lệ.");
throw new ForbiddenException("Thông tin xác thực hoặc mã Tour không hợp lệ.");
}
const membership = await this.prisma.tourMember.findUnique({
where: {
@@ -33,7 +30,7 @@ let TourRoleGuard = class TourRoleGuard {
},
});
if (!membership) {
throw new common_1.ForbiddenException("Bạn không phải là thành viên của tour này.");
throw new ForbiddenException("Bạn không phải là thành viên của tour này.");
}
request.tourMembership = membership;
const role = membership.role;
@@ -41,14 +38,14 @@ let TourRoleGuard = class TourRoleGuard {
const isExpensePath = path.includes('/expenses');
if ((role === 'MEMBER_PHOTO_ONLY' || role === 'VIEWER_EXTERNAL') &&
(isPlanPath || isExpensePath)) {
throw new common_1.ForbiddenException("Bạn không có quyền xem kế hoạch và chi phí của tour này.");
throw new ForbiddenException("Bạn không có quyền xem kế hoạch và chi phí của tour này.");
}
return true;
}
};
exports.TourRoleGuard = TourRoleGuard;
exports.TourRoleGuard = TourRoleGuard = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [prisma_service_1.PrismaService])
TourRoleGuard = __decorate([
Injectable(),
__metadata("design:paramtypes", [PrismaService])
], TourRoleGuard);
export { TourRoleGuard };
//# sourceMappingURL=rbac.middleware.js.map