diff --git a/package.json b/package.json index 65766ce..8fba068 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "epess-web-backend", "version": "0.0.1", "description": "", - "author": "", + "author": "@tuankiet2s", "private": true, "license": "UNLICENSED", "scripts": { diff --git a/src/Category/category.module.ts b/src/Category/category.module.ts index 6fc5741..bfe309d 100644 --- a/src/Category/category.module.ts +++ b/src/Category/category.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { CategorySchema } from './category.schema'; -@Global() @Module({ providers: [CategorySchema], exports: [CategorySchema], diff --git a/src/Center/center.module.ts b/src/Center/center.module.ts index 330fab8..4beeeb7 100644 --- a/src/Center/center.module.ts +++ b/src/Center/center.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { CenterSchema } from './center.schema'; -@Global() @Module({ providers: [CenterSchema], exports: [CenterSchema], diff --git a/src/CenterStaff/centerstaff.module.ts b/src/CenterStaff/centerstaff.module.ts index 70d72ea..ca84c05 100644 --- a/src/CenterStaff/centerstaff.module.ts +++ b/src/CenterStaff/centerstaff.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { CenterStaffSchema } from './centerstaff.schema'; -@Global() @Module({ providers: [CenterStaffSchema], exports: [CenterStaffSchema], diff --git a/src/ChatRoom/chatroom.module.ts b/src/ChatRoom/chatroom.module.ts index 0a8fad2..aa14b85 100644 --- a/src/ChatRoom/chatroom.module.ts +++ b/src/ChatRoom/chatroom.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { ChatroomSchema } from './chatroom.schema'; -@Global() @Module({ providers: [ChatroomSchema], exports: [ChatroomSchema], diff --git a/src/Milestone/milestone.module.ts b/src/Milestone/milestone.module.ts index d03714d..91e3836 100644 --- a/src/Milestone/milestone.module.ts +++ b/src/Milestone/milestone.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { MilestoneSchema } from './milestone.schema'; -@Global() @Module({ providers: [MilestoneSchema], exports: [MilestoneSchema], diff --git a/src/Order/order.module.ts b/src/Order/order.module.ts index e0ca88c..f0433ab 100644 --- a/src/Order/order.module.ts +++ b/src/Order/order.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { OrderSchema } from './order.schema'; -@Global() @Module({ providers: [OrderSchema], exports: [OrderSchema], diff --git a/src/Payment/payment.module.ts b/src/Payment/payment.module.ts index 8eb8387..7a008ac 100644 --- a/src/Payment/payment.module.ts +++ b/src/Payment/payment.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { PaymentSchema } from './payment.schema'; -@Global() @Module({ providers: [PaymentSchema], exports: [PaymentSchema], diff --git a/src/RefundTicket/refundticket.module.ts b/src/RefundTicket/refundticket.module.ts index a76ad07..3c439f7 100644 --- a/src/RefundTicket/refundticket.module.ts +++ b/src/RefundTicket/refundticket.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { RefundTicketSchema } from './refundticket.schema'; -@Global() @Module({ providers: [RefundTicketSchema], exports: [RefundTicketSchema], diff --git a/src/Resume/resume.module.ts b/src/Resume/resume.module.ts index 7e2ae4e..b08a174 100644 --- a/src/Resume/resume.module.ts +++ b/src/Resume/resume.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { ResumeSchema } from './resume.schema'; -@Global() @Module({ providers: [ResumeSchema], exports: [ResumeSchema], diff --git a/src/Resume/resume.schema.ts b/src/Resume/resume.schema.ts index 67ffbec..39874be 100644 --- a/src/Resume/resume.schema.ts +++ b/src/Resume/resume.schema.ts @@ -53,8 +53,18 @@ export class ResumeSchema extends PothosSchema { resumeId: t.exposeID('resumeId', { description: 'The ID of the resume.', }), - fileUrl: t.exposeString('fileUrl', { + fileUrl: t.string({ description: 'The URL of the resume file.', + resolve: async (file, args, ctx) => { + const fileUrl = await this.minioService.getFileUrl( + file.fileUrl, + 'resumes', + ); + if (!fileUrl) { + throw new Error('Cannot retrieve file url'); + } + return fileUrl; + }, }), type: t.exposeString('type', { description: 'The type of the resume file.', diff --git a/src/Schedule/schedule.module.ts b/src/Schedule/schedule.module.ts index 2c7021d..cb7123a 100644 --- a/src/Schedule/schedule.module.ts +++ b/src/Schedule/schedule.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { ScheduleSchema } from './schedule.schema'; -@Global() @Module({ providers: [ScheduleSchema], exports: [ScheduleSchema], diff --git a/src/Service/service.module.ts b/src/Service/service.module.ts index 992752a..25c3d90 100644 --- a/src/Service/service.module.ts +++ b/src/Service/service.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { ServiceSchema } from './service.schema'; -@Global() @Module({ providers: [ServiceSchema], exports: [ServiceSchema], diff --git a/src/ServiceAndCategory/serviceandcategory.module.ts b/src/ServiceAndCategory/serviceandcategory.module.ts index 8d9d3da..900ee74 100644 --- a/src/ServiceAndCategory/serviceandcategory.module.ts +++ b/src/ServiceAndCategory/serviceandcategory.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { ServiceAndCategorySchema } from './serviceandcategory.schema'; -@Global() @Module({ providers: [ServiceAndCategorySchema], exports: [ServiceAndCategorySchema], diff --git a/src/ServiceFeedback/servicefeedback.module.ts b/src/ServiceFeedback/servicefeedback.module.ts index 9769f87..f70caac 100644 --- a/src/ServiceFeedback/servicefeedback.module.ts +++ b/src/ServiceFeedback/servicefeedback.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { ServiceFeedbackSchema } from './servicefeedback.schema'; -@Global() @Module({ providers: [ServiceFeedbackSchema], exports: [ServiceFeedbackSchema], diff --git a/src/ServiceMeetingRoom/servicemeetingroom.module.ts b/src/ServiceMeetingRoom/servicemeetingroom.module.ts index 45aae36..c814cd6 100644 --- a/src/ServiceMeetingRoom/servicemeetingroom.module.ts +++ b/src/ServiceMeetingRoom/servicemeetingroom.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { ServiceMeetingRoomSchema } from './servicemeetingroom.schema'; -@Global() @Module({ providers: [ServiceMeetingRoomSchema], exports: [ServiceMeetingRoomSchema], diff --git a/src/UploadedFile/uploadedfile.schema.ts b/src/UploadedFile/uploadedfile.schema.ts index 23f57c1..7977e86 100644 --- a/src/UploadedFile/uploadedfile.schema.ts +++ b/src/UploadedFile/uploadedfile.schema.ts @@ -39,7 +39,19 @@ export class UploadedFileSchema extends PothosSchema { nullable: false, description: 'The type of the file.', }), - fileUrl: t.exposeString('fileUrl'), + fileUrl: t.string({ + description: 'The URL of the file.', + resolve: async (file, args, ctx) => { + const fileUrl = await this.minioService.getFileUrl( + file.fileName, + 'files', + ); + if (!fileUrl) { + throw new Error('Cannot retrieve file url'); + } + return fileUrl; + }, + }), uploadedAt: t.expose('uploadedAt', { type: 'DateTime', nullable: true, diff --git a/src/User/user.module.ts b/src/User/user.module.ts index 3bce2ca..b1686fa 100644 --- a/src/User/user.module.ts +++ b/src/User/user.module.ts @@ -1,6 +1,5 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { UserSchema } from './user.schema'; -@Global() @Module({ providers: [UserSchema], exports: [UserSchema], diff --git a/src/User/user.schema.ts b/src/User/user.schema.ts index 0bf299c..ecf3559 100644 --- a/src/User/user.schema.ts +++ b/src/User/user.schema.ts @@ -1,4 +1,4 @@ -import { Inject, Injectable } from '@nestjs/common'; +import { Inject, Injectable, Logger } from '@nestjs/common'; import { Pothos, PothosRef, @@ -99,7 +99,7 @@ export class UserSchema extends PothosSchema { resolve: async (query, root, args, ctx, info) => { // check if the token is valid const session = await clerkClient.sessions.getSession(args.sessionId); - console.log(session); + Logger.log(session, 'Session'); return await this.prisma.user.findFirst({ ...query, where: { diff --git a/src/WorkshopOrganization/workshoporganization.module.ts b/src/WorkshopOrganization/workshoporganization.module.ts index d756f0e..115e244 100644 --- a/src/WorkshopOrganization/workshoporganization.module.ts +++ b/src/WorkshopOrganization/workshoporganization.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { WorkshopOrganizationSchema } from './workshoporganization.schema'; -@Global() @Module({ providers: [WorkshopOrganizationSchema], exports: [WorkshopOrganizationSchema], diff --git a/src/WorkshopSubscription/workshopsubscription.module.ts b/src/WorkshopSubscription/workshopsubscription.module.ts index 33bef21..262bf48 100644 --- a/src/WorkshopSubscription/workshopsubscription.module.ts +++ b/src/WorkshopSubscription/workshopsubscription.module.ts @@ -1,7 +1,6 @@ -import { Global, Module } from '@nestjs/common'; +import { Module } from '@nestjs/common'; import { WorkshopSubscriptionSchema } from './workshopsubscription.schema'; -@Global() @Module({ providers: [WorkshopSubscriptionSchema], exports: [WorkshopSubscriptionSchema], diff --git a/src/app.module.ts b/src/app.module.ts index 4da9836..0a476fa 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -9,8 +9,8 @@ import { RestfulModule } from './Restful/restful.module'; ConfigModule.forRoot({ isGlobal: true, }), - GraphqlModule, ClerkModule, + GraphqlModule, RestfulModule, ], })