phong bat

This commit is contained in:
2024-10-17 15:15:08 +07:00
parent 59923b02cb
commit 5c56e79d63
19 changed files with 456 additions and 145 deletions

View File

@@ -22,9 +22,15 @@ export class CategorySchema extends PothosSchema {
return this.builder.prismaObject('Category', {
description: 'A category of services.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
subCategory: t.relation('SubCategory'),
id: t.exposeID('id', {
description: 'The unique identifier of the category.',
}),
name: t.exposeString('name', {
description: 'The name of the category.',
}),
subCategory: t.relation('SubCategory', {
description: 'The subcategory of the category.',
}),
}),
});
}
@@ -35,10 +41,20 @@ export class CategorySchema extends PothosSchema {
description: 'A subcategory of services.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
categoryId: t.exposeID('categoryId'),
category: t.relation('category'),
serviceAndCategory: t.relation('serviceAndCategory'),
name: t.exposeString('name', {
description: 'The name of the subcategory.',
}),
categoryId: t.exposeID('categoryId', {
description:
'The ID of the category that the subcategory belongs to.',
}),
category: t.relation('category', {
description: 'The category that the subcategory belongs to.',
}),
serviceAndCategory: t.relation('serviceAndCategory', {
description:
'The service and category that the subcategory belongs to.',
}),
}),
});
}

View File

@@ -22,22 +22,50 @@ export class CenterSchema extends PothosSchema {
return this.builder.prismaObject('Center', {
description: 'A center in the system.',
fields: (t) => ({
id: t.exposeID('id'),
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'),
id: t.exposeID('id', {
description: 'The unique identifier of the center.',
}),
centerOwnerId: t.exposeID('centerOwnerId', {
description: 'The ID of the center owner.',
}),
name: t.exposeString('name', {
description: 'The name of the center.',
}),
description: t.exposeString('description', {
description: 'The description of the center.',
}),
logoUrl: t.exposeString('logoUrl', {
description: 'The URL of the center logo.',
}),
logoFile: t.relation('logoFile', {
description: 'The file associated with the center logo.',
}),
location: t.exposeString('location', {
description: 'The location of the center.',
}),
individual: t.exposeBoolean('individual', {
description: 'Whether the center is an individual center.',
}),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
services: t.relation('services'),
centerOwner: t.relation('centerOwner'),
chatRoom: t.relation('chatRoom'),
centerStaff: t.relation('CenterStaff'),
resume: t.relation('Resume'),
uploadedFileId: t.exposeID('uploadedFileId'),
services: t.relation('services', {
description: 'The services provided by the center.',
}),
centerOwner: t.relation('centerOwner', {
description: 'The owner of the center.',
}),
chatRoom: t.relation('chatRoom', {
description: 'The chat room associated with the center.',
}),
centerStaff: t.relation('CenterStaff', {
description: 'The staff members of the center.',
}),
resume: t.relation('Resume', {
description: 'The resume of the center.',
}),
uploadedFileId: t.exposeID('uploadedFileId', {
description: 'The ID of the uploaded file.',
}),
}),
});
}

View File

@@ -22,13 +22,18 @@ export class CenterStaffSchema extends PothosSchema {
return this.builder.prismaObject('CenterStaff', {
description: 'A staff member of a center.',
fields: (t) => ({
staffId: t.exposeID('staffId'),
centerId: t.exposeID('centerId'),
serviceId: t.exposeID('serviceId'),
staff: t.relation('staff'),
center: t.relation('center'),
service: t.relation('service'),
createdWorkshop: t.relation('createdWorkshop'),
staffId: t.exposeID('staffId', {
description: 'The ID of the staff member.',
}),
centerId: t.exposeID('centerId', {
description: 'The ID of the center.',
}),
serviceId: t.exposeID('serviceId', {
description: 'The ID of the service.',
}),
staff: t.relation('staff', {
description: 'The staff member.',
}),
}),
});
}

View File

@@ -22,17 +22,37 @@ export class ChatroomSchema extends PothosSchema {
return this.builder.prismaObject('ChatRoom', {
description: 'A chat room in the system.',
fields: (t) => ({
id: t.exposeID('id'),
type: t.exposeString('type'),
customerId: t.exposeID('customerId'),
centerId: t.exposeID('centerId'),
centerStaffId: t.exposeID('centerStaffId'),
id: t.exposeID('id', {
description: 'The ID of the chat room.',
}),
type: t.exposeString('type', {
description: 'The type of the chat room.',
}),
customerId: t.exposeID('customerId', {
description: 'The ID of the customer.',
}),
centerId: t.exposeID('centerId', {
description: 'The ID of the center.',
}),
centerStaffId: t.exposeID('centerStaffId', {
description: 'The ID of the center staff member.',
}),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
message: t.relation('message'),
customer: t.relation('customer'),
center: t.relation('center'),
centerStaff: t.relation('centerStaff'),
meetingRoom: t.relation('meetingRoom'),
message: t.relation('message', {
description: 'The messages in the chat room.',
}),
customer: t.relation('customer', {
description: 'The customer.',
}),
center: t.relation('center', {
description: 'The center.',
}),
centerStaff: t.relation('centerStaff', {
description: 'The center staff member.',
}),
meetingRoom: t.relation('meetingRoom', {
description: 'The meeting room.',
}),
}),
});
}

View File

@@ -22,14 +22,30 @@ export class MessageSchema extends PothosSchema {
return this.builder.prismaObject('Message', {
description: 'A message in the system.',
fields: (t) => ({
id: t.exposeID('id'),
senderId: t.exposeID('senderId'),
chatRoomId: t.exposeID('chatRoomId'),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
message: t.expose('message', { type: 'Json' as any }),
sentAt: t.expose('sentAt', { type: 'DateTime' }),
sender: t.relation('sender'),
chatRoom: t.relation('chatRoom'),
id: t.exposeID('id', {
description: 'The ID of the message.',
}),
senderId: t.exposeID('senderId', {
description: 'The ID of the sender.',
}),
chatRoomId: t.exposeID('chatRoomId', {
description: 'The ID of the chat room.',
}),
message: t.expose('message', {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type: 'Json' as any,
description: 'The message content.',
}),
sentAt: t.expose('sentAt', {
type: 'DateTime',
description: 'The date and time the message was sent.',
}),
sender: t.relation('sender', {
description: 'The sender of the message.',
}),
chatRoom: t.relation('chatRoom', {
description: 'The chat room.',
}),
}),
});
}

View File

@@ -22,13 +22,22 @@ export class MilestoneSchema extends PothosSchema {
return this.builder.prismaObject('Milestone', {
description: 'A milestone in the system.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
order: t.exposeInt('order'),
description: t.exposeString('description'),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
service: t.relation('service'),
id: t.exposeID('id', {
description: 'The ID of the milestone.',
}),
name: t.exposeString('name', {
description: 'The name of the milestone.',
}),
order: t.exposeInt('order', {
description: 'The order of the milestone.',
}),
description: t.exposeString('description', {
description: 'The description of the milestone.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
description: 'The date and time the milestone was created.',
}),
}),
});
}

View File

@@ -23,21 +23,46 @@ export class OrderSchema extends PothosSchema {
return this.builder.prismaObject('Order', {
description: 'An order in the system.',
fields: (t) => ({
id: t.exposeID('id'),
paymentId: t.exposeString('paymentId'),
userId: t.exposeID('userId'),
serviceId: t.exposeID('serviceId'),
id: t.exposeID('id', {
description: 'The ID of the order.',
}),
paymentId: t.exposeString('paymentId', {
description: 'The ID of the payment.',
}),
userId: t.exposeID('userId', {
description: 'The ID of the user.',
}),
serviceId: t.exposeID('serviceId', {
description: 'The ID of the service.',
}),
status: t.expose('status', {
type: OrderStatus,
nullable: false,
description: 'The status of the order.',
}),
total: t.exposeInt('total', {
description: 'The total price of the order.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
description: 'The date and time the order was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
description: 'The date and time the order was updated.',
}),
user: t.relation('user', {
description: 'The user who made the order.',
}),
payment: t.relation('payment', {
description: 'The payment for the order.',
}),
service: t.relation('service', {
description: 'The service for the order.',
}),
refundTicket: t.relation('refundTicket', {
description: 'The refund ticket for the order.',
}),
total: t.exposeInt('total'),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
user: t.relation('user'),
payment: t.relation('payment'),
service: t.relation('service'),
refundTicket: t.relation('refundTicket'),
}),
});
}

View File

@@ -24,15 +24,28 @@ export class PaymentSchema extends PothosSchema {
return this.builder.prismaObject('Payment', {
description: 'A payment in the system.',
fields: (t) => ({
id: t.exposeID('id'),
amount: t.exposeFloat('amount'),
id: t.exposeID('id', {
description: 'The ID of the payment.',
}),
amount: t.exposeFloat('amount', {
description: 'The amount of the payment.',
}),
status: t.expose('status', {
type: PaymentStatus,
nullable: false,
description: 'The status of the payment.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
description: 'The date and time the payment was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
description: 'The date and time the payment was updated.',
}),
order: t.relation('Order', {
description: 'The order for the payment.',
}),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
order: t.relation('Order'),
}),
});
}

View File

@@ -22,12 +22,26 @@ export class RefundTicketSchema extends PothosSchema {
refundTicket() {
return this.builder.prismaObject('RefundTicket', {
fields: (t) => ({
id: t.exposeID('id'),
amount: t.exposeFloat('amount'),
status: t.exposeString('status'),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
order: t.relation('order'),
id: t.exposeID('id', {
description: 'The ID of the refund ticket.',
}),
amount: t.exposeFloat('amount', {
description: 'The amount of the refund ticket.',
}),
status: t.exposeString('status', {
description: 'The status of the refund ticket.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
description: 'The date and time the refund ticket was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
description: 'The date and time the refund ticket was updated.',
}),
order: t.relation('order', {
description: 'The order for the refund ticket.',
}),
}),
});
}
@@ -38,6 +52,8 @@ export class RefundTicketSchema extends PothosSchema {
this.builder.queryFields((t) => ({
refundTickets: t.prismaField({
type: [this.refundTicket()],
description:
'Retrieve a list of refund tickets with optional filtering, ordering, and pagination.',
args: this.builder.generator.findManyArgs('RefundTicket'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.refundTicket.findMany({

View File

@@ -47,19 +47,31 @@ export class ResumeSchema extends PothosSchema {
return this.builder.prismaObject('ResumeFile', {
description: 'A file associated with a resume.',
fields: (t) => ({
id: t.exposeID('id'),
resumeId: t.exposeID('resumeId'),
fileUrl: t.exposeString('fileUrl'),
type: t.exposeString('type'),
id: t.exposeID('id', {
description: 'The ID of the resume file.',
}),
resumeId: t.exposeID('resumeId', {
description: 'The ID of the resume.',
}),
fileUrl: t.exposeString('fileUrl', {
description: 'The URL of the resume file.',
}),
type: t.exposeString('type', {
description: 'The type of the resume file.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the resume file was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the resume file was updated.',
}),
resume: t.relation('resume', {
description: 'The resume for the resume file.',
}),
resume: t.relation('resume'),
}),
});
}

View File

@@ -22,31 +22,67 @@ export class ServiceSchema extends PothosSchema {
return this.builder.prismaObject('Service', {
description: 'A service offered by a center.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
description: t.exposeString('description'),
price: t.exposeFloat('price'),
rating: t.exposeFloat('rating'),
imageFile: t.relation('imageFile'),
imageFileId: t.exposeID('imageFileId'),
imageFileUrl: t.exposeString('imageFileUrl'),
id: t.exposeID('id', {
description: 'The ID of the service.',
}),
name: t.exposeString('name', {
description: 'The name of the service.',
}),
description: t.exposeString('description', {
description: 'The description of the service.',
}),
price: t.exposeFloat('price', {
description: 'The price of the service.',
}),
rating: t.exposeFloat('rating', {
description: 'The rating of the service.',
}),
imageFile: t.relation('imageFile', {
description: 'The image file for the service.',
}),
imageFileId: t.exposeID('imageFileId', {
description: 'The ID of the image file for the service.',
}),
imageFileUrl: t.exposeString('imageFileUrl', {
description: 'The URL of the image file for the service.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the service was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the service was updated.',
}),
center: t.relation('center', {
description: 'The center that offers the service.',
}),
centerId: t.exposeID('centerId', {
description: 'The ID of the center that offers the service.',
}),
workshop: t.relation('workshop', {
description: 'The workshop for the service.',
}),
milestone: t.relation('milestone', {
description: 'The milestone for the service.',
}),
schedule: t.relation('schedule', {
description: 'The schedule for the service.',
}),
serviceAndCategory: t.relation('serviceAndCategory', {
description: 'The service and category for the service.',
}),
workshopOrganization: t.relation('workshopOrganization', {
description: 'The workshop organization for the service.',
}),
user: t.relation('user', {
description: 'The user who requested the service.',
}),
userId: t.exposeID('userId', {
description: 'The ID of the user who requested the service.',
}),
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

@@ -22,10 +22,18 @@ export class ServiceAndCategorySchema extends PothosSchema {
return this.builder.prismaObject('ServiceAndCategory', {
description: 'A service and category in the system.',
fields: (t) => ({
serviceId: t.exposeID('serviceId'),
service: t.relation('service'),
subCategory: t.relation('SubCategory'),
subCategoryId: t.exposeID('subCategoryId'),
serviceId: t.exposeID('serviceId', {
description: 'The ID of the service.',
}),
service: t.relation('service', {
description: 'The service for the service and category.',
}),
subCategory: t.relation('SubCategory', {
description: 'The sub category for the service and category.',
}),
subCategoryId: t.exposeID('subCategoryId', {
description: 'The ID of the sub category.',
}),
}),
});
}

View File

@@ -22,15 +22,37 @@ export class ServiceFeedbackSchema extends PothosSchema {
return this.builder.prismaObject('ServiceFeedback', {
description: 'A feedback for a service.',
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
serviceId: t.exposeID('serviceId'),
rating: t.exposeFloat('rating'),
comments: t.exposeString('comments'),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
user: t.relation('user'),
service: t.relation('service'),
id: t.exposeID('id', {
description: 'The ID of the service feedback.',
}),
userId: t.exposeID('userId', {
description: 'The ID of the user who provided the feedback.',
}),
serviceId: t.exposeID('serviceId', {
description: 'The ID of the service that was provided.',
}),
rating: t.exposeFloat('rating', {
description: 'The rating of the service.',
}),
comments: t.exposeString('comments', {
description: 'The comments of the service feedback.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the service feedback was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the service feedback was updated.',
}),
user: t.relation('user', {
description: 'The user who provided the feedback.',
}),
service: t.relation('service', {
description: 'The service that was provided.',
}),
}),
});
}

View File

@@ -24,17 +24,30 @@ export class UploadedFileSchema extends PothosSchema {
return this.builder.prismaObject('UploadedFile', {
description: 'A file uploaded by a user.',
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
fileName: t.exposeString('fileName'),
id: t.exposeID('id', {
description: 'The ID of the uploaded file.',
}),
userId: t.exposeID('userId', {
description: 'The ID of the user who uploaded the file.',
}),
fileName: t.exposeString('fileName', {
description: 'The name of the file.',
}),
// expose enum
fileType: t.expose('fileType', {
type: UploadedFileType,
nullable: false,
description: 'The type of the file.',
}),
fileUrl: t.exposeString('fileUrl'),
uploadedAt: t.expose('uploadedAt', { type: 'DateTime' }),
user: t.relation('user'),
uploadedAt: t.expose('uploadedAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the file was uploaded.',
}),
user: t.relation('user', {
description: 'The user who uploaded the file.',
}),
}),
});
}

View File

@@ -23,15 +23,38 @@ export class UserSchema extends PothosSchema {
return this.builder.prismaObject('User', {
description: 'A user in the system.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
email: t.exposeString('email'),
phoneNumber: t.exposeString('phoneNumber'),
oauthToken: t.exposeString('oauthToken', { nullable: true }),
role: t.exposeString('role'),
createdAt: t.expose('createdAt', { type: 'DateTime' }),
updatedAt: t.expose('updatedAt', { type: 'DateTime' }),
center: t.relation('center'),
id: t.exposeID('id', {
description: 'The ID of the user.',
}),
name: t.exposeString('name', {
description: 'The name of the user.',
}),
email: t.exposeString('email', {
description: 'The email of the user.',
}),
phoneNumber: t.exposeString('phoneNumber', {
description: 'The phone number of the user.',
}),
oauthToken: t.exposeString('oauthToken', {
nullable: true,
description: 'The OAuth token of the user.',
}),
role: t.exposeString('role', {
description: 'The role of the user.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the user was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the user was updated.',
}),
center: t.relation('center', {
description: 'The center of the user.',
}),
}),
});
}

View File

@@ -22,29 +22,58 @@ export class WorkshopSchema extends PothosSchema {
return this.builder.prismaObject('Workshop', {
description: 'A workshop in the system.',
fields: (t) => ({
id: t.exposeID('id'),
title: t.exposeString('title'),
description: t.exposeString('description'),
staffId: t.exposeID('staffId'),
serviceId: t.exposeID('serviceId'),
id: t.exposeID('id', {
description: 'The ID of the workshop.',
}),
title: t.exposeString('title', {
description: 'The title of the workshop.',
}),
description: t.exposeString('description', {
description: 'The description of the workshop.',
}),
staffId: t.exposeID('staffId', {
description:
'The ID of the staff member who is leading the workshop.',
}),
serviceId: t.exposeID('serviceId', {
description: 'The ID of the service that the workshop is for.',
}),
imageFile: t.relation('imageFile', {
nullable: true,
}),
imageFileId: t.exposeID('imageFileId'),
imageFileUrl: t.exposeString('imageFileUrl'),
imageFileId: t.exposeID('imageFileId', {
description: 'The ID of the image file for the workshop.',
}),
imageFileUrl: t.exposeString('imageFileUrl', {
description: 'The URL of the image file for the workshop.',
}),
date: t.expose('date', {
type: 'DateTime',
nullable: true,
description: 'The date and time the workshop is scheduled.',
}),
createdAt: t.expose('createdAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the workshop was created.',
}),
updatedAt: t.expose('updatedAt', {
type: 'DateTime',
nullable: true,
description: 'The date and time the workshop was updated.',
}),
service: t.relation('service', {
description: 'The service that the workshop is for.',
}),
workshopOrganization: t.relation('workshopOrganization', {
description: 'The organization that the workshop is for.',
}),
workshopSubscription: t.relation('workshopSubscription', {
description: 'The subscription that the workshop is for.',
}),
staff: t.relation('staff', {
description: 'The staff member who is leading the workshop.',
}),
service: t.relation('service'),
workshopOrganization: t.relation('workshopOrganization'),
workshopSubscription: t.relation('workshopSubscription'),
staff: t.relation('staff'),
}),
});
}

View File

@@ -21,8 +21,12 @@ export class WorkshopMeetingRoomSchema extends PothosSchema {
workshopMeetingRoom() {
return this.builder.prismaObject('WorkshopMeetingRoom', {
fields: (t) => ({
id: t.exposeID('id'),
workshopId: t.exposeID('workshopId'),
id: t.exposeID('id', {
description: 'The ID of the workshop meeting room.',
}),
workshopId: t.exposeID('workshopId', {
description: 'The ID of the workshop that the meeting room is for.',
}),
}),
});
}

View File

@@ -20,10 +20,18 @@ export class WorkshopOrganizationSchema extends PothosSchema {
workshopOrganization() {
return this.builder.prismaObject('WorkshopOrganization', {
fields: (t) => ({
workshopId: t.exposeID('workshopId'),
serviceId: t.exposeID('serviceId'),
workshop: t.relation('workshop'),
service: t.relation('service'),
workshopId: t.exposeID('workshopId', {
description: 'The ID of the workshop that the organization is for.',
}),
serviceId: t.exposeID('serviceId', {
description: 'The ID of the service that the organization is for.',
}),
workshop: t.relation('workshop', {
description: 'The workshop that the organization is for.',
}),
service: t.relation('service', {
description: 'The service that the organization is for.',
}),
}),
});
}

View File

@@ -21,10 +21,18 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
return this.builder.prismaObject('WorkshopSubscription', {
description: 'A workshop subscription in the system.',
fields: (t) => ({
userId: t.exposeID('userId'),
workshopId: t.exposeID('workshopId'),
user: t.relation('user'),
workshop: t.relation('workshop'),
userId: t.exposeID('userId', {
description: 'The ID of the user who subscribed to the workshop.',
}),
workshopId: t.exposeID('workshopId', {
description: 'The ID of the workshop that the user subscribed to.',
}),
user: t.relation('user', {
description: 'The user who subscribed to the workshop.',
}),
workshop: t.relation('workshop', {
description: 'The workshop that the user subscribed to.',
}),
}),
});
}