refactor and update get url logic
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"name": "epess-web-backend",
|
"name": "epess-web-backend",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "@tuankiet2s",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { CategorySchema } from './category.schema';
|
import { CategorySchema } from './category.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [CategorySchema],
|
providers: [CategorySchema],
|
||||||
exports: [CategorySchema],
|
exports: [CategorySchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { CenterSchema } from './center.schema';
|
import { CenterSchema } from './center.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [CenterSchema],
|
providers: [CenterSchema],
|
||||||
exports: [CenterSchema],
|
exports: [CenterSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { CenterStaffSchema } from './centerstaff.schema';
|
import { CenterStaffSchema } from './centerstaff.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [CenterStaffSchema],
|
providers: [CenterStaffSchema],
|
||||||
exports: [CenterStaffSchema],
|
exports: [CenterStaffSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ChatroomSchema } from './chatroom.schema';
|
import { ChatroomSchema } from './chatroom.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [ChatroomSchema],
|
providers: [ChatroomSchema],
|
||||||
exports: [ChatroomSchema],
|
exports: [ChatroomSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { MilestoneSchema } from './milestone.schema';
|
import { MilestoneSchema } from './milestone.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [MilestoneSchema],
|
providers: [MilestoneSchema],
|
||||||
exports: [MilestoneSchema],
|
exports: [MilestoneSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { OrderSchema } from './order.schema';
|
import { OrderSchema } from './order.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [OrderSchema],
|
providers: [OrderSchema],
|
||||||
exports: [OrderSchema],
|
exports: [OrderSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { PaymentSchema } from './payment.schema';
|
import { PaymentSchema } from './payment.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [PaymentSchema],
|
providers: [PaymentSchema],
|
||||||
exports: [PaymentSchema],
|
exports: [PaymentSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { RefundTicketSchema } from './refundticket.schema';
|
import { RefundTicketSchema } from './refundticket.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [RefundTicketSchema],
|
providers: [RefundTicketSchema],
|
||||||
exports: [RefundTicketSchema],
|
exports: [RefundTicketSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ResumeSchema } from './resume.schema';
|
import { ResumeSchema } from './resume.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [ResumeSchema],
|
providers: [ResumeSchema],
|
||||||
exports: [ResumeSchema],
|
exports: [ResumeSchema],
|
||||||
|
|||||||
@@ -53,8 +53,18 @@ export class ResumeSchema extends PothosSchema {
|
|||||||
resumeId: t.exposeID('resumeId', {
|
resumeId: t.exposeID('resumeId', {
|
||||||
description: 'The ID of the resume.',
|
description: 'The ID of the resume.',
|
||||||
}),
|
}),
|
||||||
fileUrl: t.exposeString('fileUrl', {
|
fileUrl: t.string({
|
||||||
description: 'The URL of the resume file.',
|
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', {
|
type: t.exposeString('type', {
|
||||||
description: 'The type of the resume file.',
|
description: 'The type of the resume file.',
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ScheduleSchema } from './schedule.schema';
|
import { ScheduleSchema } from './schedule.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [ScheduleSchema],
|
providers: [ScheduleSchema],
|
||||||
exports: [ScheduleSchema],
|
exports: [ScheduleSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ServiceSchema } from './service.schema';
|
import { ServiceSchema } from './service.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [ServiceSchema],
|
providers: [ServiceSchema],
|
||||||
exports: [ServiceSchema],
|
exports: [ServiceSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ServiceAndCategorySchema } from './serviceandcategory.schema';
|
import { ServiceAndCategorySchema } from './serviceandcategory.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [ServiceAndCategorySchema],
|
providers: [ServiceAndCategorySchema],
|
||||||
exports: [ServiceAndCategorySchema],
|
exports: [ServiceAndCategorySchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ServiceFeedbackSchema } from './servicefeedback.schema';
|
import { ServiceFeedbackSchema } from './servicefeedback.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [ServiceFeedbackSchema],
|
providers: [ServiceFeedbackSchema],
|
||||||
exports: [ServiceFeedbackSchema],
|
exports: [ServiceFeedbackSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { ServiceMeetingRoomSchema } from './servicemeetingroom.schema';
|
import { ServiceMeetingRoomSchema } from './servicemeetingroom.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [ServiceMeetingRoomSchema],
|
providers: [ServiceMeetingRoomSchema],
|
||||||
exports: [ServiceMeetingRoomSchema],
|
exports: [ServiceMeetingRoomSchema],
|
||||||
|
|||||||
@@ -39,7 +39,19 @@ export class UploadedFileSchema extends PothosSchema {
|
|||||||
nullable: false,
|
nullable: false,
|
||||||
description: 'The type of the file.',
|
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', {
|
uploadedAt: t.expose('uploadedAt', {
|
||||||
type: 'DateTime',
|
type: 'DateTime',
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { UserSchema } from './user.schema';
|
import { UserSchema } from './user.schema';
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [UserSchema],
|
providers: [UserSchema],
|
||||||
exports: [UserSchema],
|
exports: [UserSchema],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable, Logger } from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
Pothos,
|
Pothos,
|
||||||
PothosRef,
|
PothosRef,
|
||||||
@@ -99,7 +99,7 @@ export class UserSchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
// check if the token is valid
|
// check if the token is valid
|
||||||
const session = await clerkClient.sessions.getSession(args.sessionId);
|
const session = await clerkClient.sessions.getSession(args.sessionId);
|
||||||
console.log(session);
|
Logger.log(session, 'Session');
|
||||||
return await this.prisma.user.findFirst({
|
return await this.prisma.user.findFirst({
|
||||||
...query,
|
...query,
|
||||||
where: {
|
where: {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { WorkshopOrganizationSchema } from './workshoporganization.schema';
|
import { WorkshopOrganizationSchema } from './workshoporganization.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [WorkshopOrganizationSchema],
|
providers: [WorkshopOrganizationSchema],
|
||||||
exports: [WorkshopOrganizationSchema],
|
exports: [WorkshopOrganizationSchema],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Global, Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { WorkshopSubscriptionSchema } from './workshopsubscription.schema';
|
import { WorkshopSubscriptionSchema } from './workshopsubscription.schema';
|
||||||
|
|
||||||
@Global()
|
|
||||||
@Module({
|
@Module({
|
||||||
providers: [WorkshopSubscriptionSchema],
|
providers: [WorkshopSubscriptionSchema],
|
||||||
exports: [WorkshopSubscriptionSchema],
|
exports: [WorkshopSubscriptionSchema],
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import { RestfulModule } from './Restful/restful.module';
|
|||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
GraphqlModule,
|
|
||||||
ClerkModule,
|
ClerkModule,
|
||||||
|
GraphqlModule,
|
||||||
RestfulModule,
|
RestfulModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user