update fields
This commit is contained in:
@@ -25,6 +25,8 @@ export class CenterSchema extends PothosSchema {
|
||||
centerOwnerId: t.exposeID('centerOwnerId'),
|
||||
name: t.exposeString('name'),
|
||||
description: t.exposeString('description'),
|
||||
logoUrl: t.exposeString('logoUrl'),
|
||||
logoFile: t.relation('logoFile'),
|
||||
location: t.exposeString('location'),
|
||||
individual: t.exposeBoolean('individual'),
|
||||
createdAt: t.expose('createdAt', { type: 'DateTime' }),
|
||||
@@ -34,6 +36,7 @@ export class CenterSchema extends PothosSchema {
|
||||
chatRoom: t.relation('chatRoom'),
|
||||
centerStaff: t.relation('CenterStaff'),
|
||||
resume: t.relation('Resume'),
|
||||
uploadedFileId: t.exposeID('uploadedFileId'),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ export class ServiceSchema extends PothosSchema {
|
||||
description: t.exposeString('description'),
|
||||
price: t.exposeFloat('price'),
|
||||
rating: t.exposeFloat('rating'),
|
||||
imageFile: t.relation('imageFile'),
|
||||
imageFileId: t.exposeID('imageFileId'),
|
||||
imageFileUrl: t.exposeString('imageFileUrl'),
|
||||
createdAt: t.expose('createdAt', {
|
||||
type: 'DateTime',
|
||||
nullable: true,
|
||||
@@ -34,6 +37,15 @@ export class ServiceSchema extends PothosSchema {
|
||||
type: 'DateTime',
|
||||
nullable: true,
|
||||
}),
|
||||
center: t.relation('center'),
|
||||
centerId: t.exposeID('centerId'),
|
||||
workshop: t.relation('workshop'),
|
||||
milestone: t.relation('milestone'),
|
||||
schedule: t.relation('schedule'),
|
||||
serviceAndCategory: t.relation('serviceAndCategory'),
|
||||
workshopOrganization: t.relation('workshopOrganization'),
|
||||
user: t.relation('user'),
|
||||
userId: t.exposeID('userId'),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
id: t.exposeID('id'),
|
||||
userId: t.exposeID('userId'),
|
||||
fileName: t.exposeString('fileName'),
|
||||
type: t.exposeString('type'),
|
||||
fileType: t.expose('fileType', { type: this.uploadedFileType() }),
|
||||
fileUrl: t.exposeString('fileUrl'),
|
||||
uploadedAt: t.expose('uploadedAt', { type: 'DateTime' }),
|
||||
user: t.relation('user'),
|
||||
@@ -34,6 +34,13 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
});
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
uploadedFileType() {
|
||||
return this.builder.enumType('UploadedFileType', {
|
||||
values: ['IMAGE', 'OTHER'],
|
||||
});
|
||||
}
|
||||
|
||||
@Pothos()
|
||||
init(): void {
|
||||
this.builder.queryFields((t) => ({
|
||||
@@ -96,6 +103,10 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
type: 'Upload',
|
||||
required: true,
|
||||
}),
|
||||
fileType: t.arg({
|
||||
type: this.uploadedFileType(),
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
const user = await this.prisma.user.findUnique({
|
||||
@@ -122,6 +133,7 @@ export class UploadedFileSchema extends PothosSchema {
|
||||
userId: user.id,
|
||||
fileName: filename,
|
||||
type: mimetype,
|
||||
fileType: args.fileType,
|
||||
fileUrl: fileUrl,
|
||||
uploadedAt: new Date(),
|
||||
},
|
||||
|
||||
@@ -26,6 +26,9 @@ export class WorkshopSchema extends PothosSchema {
|
||||
description: t.exposeString('description'),
|
||||
staffId: t.exposeID('staffId'),
|
||||
serviceId: t.exposeID('serviceId'),
|
||||
imageFile: t.relation('imageFile'),
|
||||
imageFileId: t.exposeID('imageFileId'),
|
||||
imageFileUrl: t.exposeString('imageFileUrl'),
|
||||
date: t.expose('date', {
|
||||
type: 'DateTime',
|
||||
}),
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user