fix upload file type
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Inject, Injectable, UploadedFiles } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import {
|
||||
Pothos,
|
||||
PothosRef,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import { Builder } from '../Graphql/graphql.builder';
|
||||
import { PrismaService } from '../Prisma/prisma.service';
|
||||
import { MinioService } from 'src/Minio/minio.service';
|
||||
|
||||
import { UploadedFileType } from '@prisma/client';
|
||||
@Injectable()
|
||||
export class UploadedFileSchema extends PothosSchema {
|
||||
constructor(
|
||||
@@ -26,7 +26,11 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
id: t.exposeID('id'),
|
||||
userId: t.exposeID('userId'),
|
||||
fileName: t.exposeString('fileName'),
|
||||
fileType: t.expose('fileType', { type: this.uploadedFileType() }),
|
||||
// expose enum
|
||||
fileType: t.expose('fileType', {
|
||||
type: UploadedFileType,
|
||||
nullable: false,
|
||||
}),
|
||||
fileUrl: t.exposeString('fileUrl'),
|
||||
uploadedAt: t.expose('uploadedAt', { type: 'DateTime' }),
|
||||
user: t.relation('user'),
|
||||
@@ -34,13 +38,6 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
});
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
uploadedFileType() {
|
||||
return this.builder.enumType('UploadedFileType', {
|
||||
values: ['IMAGE', 'OTHER'],
|
||||
});
|
||||
}
|
||||
|
||||
@Pothos()
|
||||
init(): void {
|
||||
this.builder.queryFields((t) => ({
|
||||
@@ -104,7 +101,7 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
fileType: t.arg({
|
||||
type: this.uploadedFileType(),
|
||||
type: UploadedFileType,
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user