diff --git a/backend/package.json b/backend/package.json index 9e1e255..1ce2485 100644 --- a/backend/package.json +++ b/backend/package.json @@ -30,7 +30,7 @@ "@nestjs/mapped-types": "^2.0.5", "@nestjs/passport": "^10.0.3", "@nestjs/platform-express": "^10.4.4", - "@prisma/client": "^5.20.0", + "@prisma/client": "^5.21.0", "bcrypt": "^5.1.1", "bcryptjs": "^2.4.3", "class-transformer": "^0.5.1", @@ -41,7 +41,6 @@ "node-cron": "^3.0.3", "passport": "^0.7.0", "passport-jwt": "^4.0.1", - "prisma": "^5.20.0", "reflect-metadata": "^0.2.0", "rxjs": "^7.8.1", "xlsx": "^0.18.5" @@ -66,6 +65,7 @@ "eslint-plugin-prettier": "^5.0.0", "jest": "^29.5.0", "prettier": "^3.0.0", + "prisma": "^5.21.0", "source-map-support": "^0.5.21", "supertest": "^7.0.0", "ts-jest": "^29.1.0", diff --git a/backend/prisma/migrations/20241017111836_query_null/migration.sql b/backend/prisma/migrations/20241017111836_query_null/migration.sql new file mode 100644 index 0000000..90c1f94 --- /dev/null +++ b/backend/prisma/migrations/20241017111836_query_null/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Visitors" ALTER COLUMN "query" DROP NOT NULL; diff --git a/backend/prisma/migrations/20241017113127_attended_by_null/migration.sql b/backend/prisma/migrations/20241017113127_attended_by_null/migration.sql new file mode 100644 index 0000000..70d22ea --- /dev/null +++ b/backend/prisma/migrations/20241017113127_attended_by_null/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Visitors" ALTER COLUMN "attendedBy" DROP NOT NULL; diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index bf7a4f0..e17a7c5 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -54,10 +54,10 @@ model Visitors { visitorPrn String? mobile String type String - attendedBy String + attendedBy String? attendeeId String attendee Attendee @relation("visitorToAttendee", fields: [attendeeId], references: [id]) - query String + query String? status String @default("open") remark String? in Boolean @default(true) diff --git a/backend/src/modules/visitors/dto/create-visitor.dto.ts b/backend/src/modules/visitors/dto/create-visitor.dto.ts index fbf41da..c1eb8cb 100644 --- a/backend/src/modules/visitors/dto/create-visitor.dto.ts +++ b/backend/src/modules/visitors/dto/create-visitor.dto.ts @@ -12,12 +12,14 @@ export class CreateVisitorDto { @IsString() @IsOptional() mobile?: string; - + @IsString() - @IsNotEmpty() - attendeeId: string; - + @IsOptional() + // @IsNotEmpty() + attendeeId?: string; + @IsString() - @IsNotEmpty() - query: string; + @IsOptional() + // @IsNotEmpty() + query?: string; } diff --git a/backend/src/modules/visitors/visitors.service.ts b/backend/src/modules/visitors/visitors.service.ts index d46bb40..7fd007a 100644 --- a/backend/src/modules/visitors/visitors.service.ts +++ b/backend/src/modules/visitors/visitors.service.ts @@ -12,9 +12,9 @@ export class VisitorsService { const attendee = await this.prisma.attendee.findUnique({where:{id:attendeeId}}); - if(!attendee){ - throw new BadRequestException("Attendee doesn't exists"); - } + // if(!attendee){ + // throw new BadRequestException("Attendee doesn't exists"); + // } // Check if the visitor is already checked in using PRN if (visitorPrn) { @@ -37,8 +37,8 @@ export class VisitorsService { visitorName: member.name, mobile: member.mobile, type: member.type, - attendedBy: attendee.name, - attendeeId: attendeeId, + attendedBy: attendee?.name || "NAN", + attendeeId: attendeeId || "", query, status: 'open', remark: '', @@ -54,8 +54,8 @@ export class VisitorsService { visitorName, mobile: mobile || "", type: 'visitor', - attendedBy: attendee.name, - attendeeId: attendeeId, + attendedBy: attendee?.name || "NAN", + attendeeId: attendeeId || "", query, status: 'open', remark: '', diff --git a/frontend/app/(admin)/admin/layout.tsx b/frontend/app/(admin)/admin/layout.tsx index 2946a20..c4eb9b9 100644 --- a/frontend/app/(admin)/admin/layout.tsx +++ b/frontend/app/(admin)/admin/layout.tsx @@ -1,3 +1,5 @@ +import FeedbackModal from "@/components/modal/FeedbackModal"; +import FileUploadModal from "@/components/modal/FileUploadModal"; import Navbar from "@/components/Navbar"; import Sidebar from "@/components/Sidebar"; @@ -7,14 +9,18 @@ export default function AdminLayout({ children: React.ReactNode; }>) { return ( -