update fields

This commit is contained in:
2024-10-15 02:39:06 +07:00
parent 7cfab52e77
commit 80743b0973
5 changed files with 67 additions and 7 deletions

View File

@@ -25,6 +25,8 @@ export class CenterSchema extends PothosSchema {
centerOwnerId: t.exposeID('centerOwnerId'), centerOwnerId: t.exposeID('centerOwnerId'),
name: t.exposeString('name'), name: t.exposeString('name'),
description: t.exposeString('description'), description: t.exposeString('description'),
logoUrl: t.exposeString('logoUrl'),
logoFile: t.relation('logoFile'),
location: t.exposeString('location'), location: t.exposeString('location'),
individual: t.exposeBoolean('individual'), individual: t.exposeBoolean('individual'),
createdAt: t.expose('createdAt', { type: 'DateTime' }), createdAt: t.expose('createdAt', { type: 'DateTime' }),
@@ -34,6 +36,7 @@ export class CenterSchema extends PothosSchema {
chatRoom: t.relation('chatRoom'), chatRoom: t.relation('chatRoom'),
centerStaff: t.relation('CenterStaff'), centerStaff: t.relation('CenterStaff'),
resume: t.relation('Resume'), resume: t.relation('Resume'),
uploadedFileId: t.exposeID('uploadedFileId'),
}), }),
}); });
} }

View File

@@ -26,6 +26,9 @@ export class ServiceSchema extends PothosSchema {
description: t.exposeString('description'), description: t.exposeString('description'),
price: t.exposeFloat('price'), price: t.exposeFloat('price'),
rating: t.exposeFloat('rating'), rating: t.exposeFloat('rating'),
imageFile: t.relation('imageFile'),
imageFileId: t.exposeID('imageFileId'),
imageFileUrl: t.exposeString('imageFileUrl'),
createdAt: t.expose('createdAt', { createdAt: t.expose('createdAt', {
type: 'DateTime', type: 'DateTime',
nullable: true, nullable: true,
@@ -34,6 +37,15 @@ export class ServiceSchema extends PothosSchema {
type: 'DateTime', type: 'DateTime',
nullable: true, 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'),
}), }),
}); });
} }

View File

@@ -26,7 +26,7 @@ export class UploadedFileSchema extends PothosSchema {
id: t.exposeID('id'), id: t.exposeID('id'),
userId: t.exposeID('userId'), userId: t.exposeID('userId'),
fileName: t.exposeString('fileName'), fileName: t.exposeString('fileName'),
type: t.exposeString('type'), fileType: t.expose('fileType', { type: this.uploadedFileType() }),
fileUrl: t.exposeString('fileUrl'), fileUrl: t.exposeString('fileUrl'),
uploadedAt: t.expose('uploadedAt', { type: 'DateTime' }), uploadedAt: t.expose('uploadedAt', { type: 'DateTime' }),
user: t.relation('user'), user: t.relation('user'),
@@ -34,6 +34,13 @@ export class UploadedFileSchema extends PothosSchema {
}); });
} }
@PothosRef()
uploadedFileType() {
return this.builder.enumType('UploadedFileType', {
values: ['IMAGE', 'OTHER'],
});
}
@Pothos() @Pothos()
init(): void { init(): void {
this.builder.queryFields((t) => ({ this.builder.queryFields((t) => ({
@@ -96,6 +103,10 @@ export class UploadedFileSchema extends PothosSchema {
type: 'Upload', type: 'Upload',
required: true, required: true,
}), }),
fileType: t.arg({
type: this.uploadedFileType(),
required: true,
}),
}, },
resolve: async (query, root, args, ctx, info) => { resolve: async (query, root, args, ctx, info) => {
const user = await this.prisma.user.findUnique({ const user = await this.prisma.user.findUnique({
@@ -122,6 +133,7 @@ export class UploadedFileSchema extends PothosSchema {
userId: user.id, userId: user.id,
fileName: filename, fileName: filename,
type: mimetype, type: mimetype,
fileType: args.fileType,
fileUrl: fileUrl, fileUrl: fileUrl,
uploadedAt: new Date(), uploadedAt: new Date(),
}, },

View File

@@ -26,6 +26,9 @@ export class WorkshopSchema extends PothosSchema {
description: t.exposeString('description'), description: t.exposeString('description'),
staffId: t.exposeID('staffId'), staffId: t.exposeID('staffId'),
serviceId: t.exposeID('serviceId'), serviceId: t.exposeID('serviceId'),
imageFile: t.relation('imageFile'),
imageFileId: t.exposeID('imageFileId'),
imageFileUrl: t.exposeString('imageFileUrl'),
date: t.expose('date', { date: t.expose('date', {
type: 'DateTime', type: 'DateTime',
}), }),

File diff suppressed because one or more lines are too long