push code push code

This commit is contained in:
2024-10-17 15:02:25 +07:00
parent 053fb38273
commit 59923b02cb
18 changed files with 106 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ export class CategorySchema extends PothosSchema {
@PothosRef()
category() {
return this.builder.prismaObject('Category', {
description: 'A category of services.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
@@ -31,6 +32,7 @@ export class CategorySchema extends PothosSchema {
@PothosRef()
subCategory() {
return this.builder.prismaObject('SubCategory', {
description: 'A subcategory of services.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
@@ -45,6 +47,8 @@ export class CategorySchema extends PothosSchema {
init(): void {
this.builder.queryFields((t) => ({
categories: t.prismaField({
description:
'Retrieve a list of categories with optional filtering, ordering, and pagination.',
type: [this.category()],
args: this.builder.generator.findManyArgs('Category'),
resolve: async (query, root, args) => {
@@ -58,6 +62,7 @@ export class CategorySchema extends PothosSchema {
},
}),
category: t.prismaField({
description: 'Retrieve a single category by its unique identifier.',
type: this.category(),
args: this.builder.generator.findUniqueArgs('Category'),
resolve: async (query, root, args) => {
@@ -68,6 +73,8 @@ export class CategorySchema extends PothosSchema {
},
}),
subCategories: t.prismaField({
description:
'Retrieve a list of subcategories with optional filtering, ordering, and pagination.',
type: [this.subCategory()],
args: this.builder.generator.findManyArgs('SubCategory'),
resolve: async (query, root, args) => {
@@ -85,6 +92,7 @@ export class CategorySchema extends PothosSchema {
// mutation
this.builder.mutationFields((t) => ({
createCategory: t.prismaField({
description: 'Create a new category.',
type: this.category(),
args: {
input: t.arg({
@@ -99,6 +107,7 @@ export class CategorySchema extends PothosSchema {
},
}),
createManyCategories: t.prismaField({
description: 'Create multiple new categories.',
type: [this.category()],
args: {
data: t.arg({
@@ -115,6 +124,7 @@ export class CategorySchema extends PothosSchema {
}),
createSubCategory: t.prismaField({
description: 'Create a new subcategory.',
type: this.subCategory(),
args: {
input: t.arg({

View File

@@ -20,6 +20,7 @@ export class CenterSchema extends PothosSchema {
@PothosRef()
center() {
return this.builder.prismaObject('Center', {
description: 'A center in the system.',
fields: (t) => ({
id: t.exposeID('id'),
centerOwnerId: t.exposeID('centerOwnerId'),
@@ -45,6 +46,8 @@ export class CenterSchema extends PothosSchema {
init(): void {
this.builder.queryFields((t) => ({
centers: t.prismaField({
description:
'Retrieve a list of centers with optional filtering, ordering, and pagination.',
type: [this.center()],
args: this.builder.generator.findManyArgs('Center'),
resolve: async (query, root, args, ctx, info) => {
@@ -59,6 +62,7 @@ export class CenterSchema extends PothosSchema {
}),
center: t.prismaField({
type: this.center(),
description: 'Retrieve a single center by its unique identifier.',
args: this.builder.generator.findUniqueArgs('Center'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.center.findUnique({
@@ -70,6 +74,7 @@ export class CenterSchema extends PothosSchema {
// get current center of centerstaff by providing userId
centerByCenterStaff: t.prismaField({
type: this.center(),
description: 'Retrieve a single center by its unique identifier.',
args: {
userId: t.arg({ type: 'String', required: true }),
},
@@ -90,6 +95,7 @@ export class CenterSchema extends PothosSchema {
// mutation section
this.builder.mutationFields((t) => ({
createCenter: t.prismaField({
description: 'Create a new center.',
type: this.center(),
args: {
input: t.arg({
@@ -106,6 +112,7 @@ export class CenterSchema extends PothosSchema {
}),
updateCenter: t.prismaField({
type: this.center(),
description: 'Update an existing center.',
args: {
input: t.arg({
type: this.builder.generator.getUpdateInput('Center'),
@@ -126,6 +133,7 @@ export class CenterSchema extends PothosSchema {
}),
deleteCenter: t.prismaField({
type: this.center(),
description: 'Delete an existing center.',
args: {
where: t.arg({
type: this.builder.generator.getWhereUnique('Center'),

View File

@@ -20,6 +20,7 @@ export class CenterStaffSchema extends PothosSchema {
@PothosRef()
centerStaff() {
return this.builder.prismaObject('CenterStaff', {
description: 'A staff member of a center.',
fields: (t) => ({
staffId: t.exposeID('staffId'),
centerId: t.exposeID('centerId'),
@@ -36,6 +37,8 @@ export class CenterStaffSchema extends PothosSchema {
init(): void {
this.builder.queryFields((t) => ({
centerStaff: t.prismaField({
description:
'Retrieve a list of center staff members with optional filtering, ordering, and pagination.',
type: [this.centerStaff()],
args: this.builder.generator.findManyArgs('CenterStaff'),
resolve: async (query, root, args) => {
@@ -54,6 +57,7 @@ export class CenterStaffSchema extends PothosSchema {
this.builder.mutationFields((t) => ({
createCenterStaff: t.prismaField({
type: this.centerStaff(),
description: 'Create a new center staff member.',
args: {
data: t.arg({
type: this.builder.generator.getCreateInput('CenterStaff'),
@@ -70,6 +74,7 @@ export class CenterStaffSchema extends PothosSchema {
updateCenterStaff: t.prismaField({
type: this.centerStaff(),
description: 'Update an existing center staff member.',
args: {
where: t.arg({
type: this.builder.generator.getWhereUnique('CenterStaff'),
@@ -91,6 +96,7 @@ export class CenterStaffSchema extends PothosSchema {
deleteCenterStaff: t.prismaField({
type: this.centerStaff(),
description: 'Delete an existing center staff member.',
args: {
where: t.arg({
type: this.builder.generator.getWhereUnique('CenterStaff'),

View File

@@ -20,6 +20,7 @@ export class ChatroomSchema extends PothosSchema {
@PothosRef()
chatRoom() {
return this.builder.prismaObject('ChatRoom', {
description: 'A chat room in the system.',
fields: (t) => ({
id: t.exposeID('id'),
type: t.exposeString('type'),
@@ -41,6 +42,7 @@ export class ChatroomSchema extends PothosSchema {
this.builder.queryFields((t) => ({
chatRoom: t.prismaField({
type: this.chatRoom(),
description: 'Retrieve a single chat room by its unique identifier.',
args: this.builder.generator.findUniqueArgs('ChatRoom'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.chatRoom.findUnique({
@@ -52,6 +54,8 @@ export class ChatroomSchema extends PothosSchema {
chatRooms: t.prismaField({
type: [this.chatRoom()],
description:
'Retrieve a list of chat rooms with optional filtering, ordering, and pagination.',
args: this.builder.generator.findManyArgs('ChatRoom'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.chatRoom.findMany({

View File

@@ -20,6 +20,7 @@ export class MessageSchema extends PothosSchema {
@PothosRef()
message() {
return this.builder.prismaObject('Message', {
description: 'A message in the system.',
fields: (t) => ({
id: t.exposeID('id'),
senderId: t.exposeID('senderId'),
@@ -38,6 +39,7 @@ export class MessageSchema extends PothosSchema {
this.builder.queryFields((t) => ({
message: t.prismaField({
type: this.message(),
description: 'Retrieve a single message by its unique identifier.',
args: this.builder.generator.findUniqueArgs('Message'),
resolve: async (query, root, args) => {
return await this.prisma.message.findUnique({
@@ -48,6 +50,8 @@ export class MessageSchema extends PothosSchema {
}),
messages: t.prismaField({
type: [this.message()],
description:
'Retrieve a list of messages with optional filtering, ordering, and pagination.',
args: this.builder.generator.findManyArgs('Message'),
resolve: async (query, root, args) => {
return await this.prisma.message.findMany({

View File

@@ -20,6 +20,7 @@ export class MilestoneSchema extends PothosSchema {
@PothosRef()
milestone() {
return this.builder.prismaObject('Milestone', {
description: 'A milestone in the system.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
@@ -38,6 +39,8 @@ export class MilestoneSchema extends PothosSchema {
milestones: t.prismaField({
type: [this.milestone()],
args: this.builder.generator.findManyArgs('Milestone'),
description:
'Retrieve a list of milestones with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.milestone.findMany({
...query,
@@ -51,6 +54,7 @@ export class MilestoneSchema extends PothosSchema {
milestone: t.prismaField({
type: this.milestone(),
args: this.builder.generator.findUniqueArgs('Milestone'),
description: 'Retrieve a single milestone by its unique identifier.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.milestone.findUnique({
...query,

View File

@@ -21,6 +21,7 @@ export class OrderSchema extends PothosSchema {
@PothosRef()
order() {
return this.builder.prismaObject('Order', {
description: 'An order in the system.',
fields: (t) => ({
id: t.exposeID('id'),
paymentId: t.exposeString('paymentId'),
@@ -47,6 +48,8 @@ export class OrderSchema extends PothosSchema {
this.builder.queryFields((t) => ({
orders: t.prismaField({
type: [this.order()],
description:
'Retrieve a list of orders with optional filtering, ordering, and pagination.',
args: this.builder.generator.findManyArgs('Order'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.order.findMany({
@@ -61,6 +64,7 @@ export class OrderSchema extends PothosSchema {
order: t.prismaField({
type: this.order(),
args: this.builder.generator.findUniqueArgs('Order'),
description: 'Retrieve a single order by its unique identifier.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.order.findUnique({
...query,
@@ -73,6 +77,7 @@ export class OrderSchema extends PothosSchema {
this.builder.mutationFields((t) => ({
createOrder: t.prismaField({
type: this.order(),
description: 'Create a new order.',
args: {
data: t.arg({
type: this.builder.generator.getCreateInput('Order'),
@@ -88,6 +93,7 @@ export class OrderSchema extends PothosSchema {
}),
deleteOrder: t.prismaField({
type: this.order(),
description: 'Delete an existing order.',
args: {
where: t.arg({
type: this.builder.generator.getWhereUnique('Order'),
@@ -103,6 +109,7 @@ export class OrderSchema extends PothosSchema {
}),
updateOrder: t.prismaField({
type: this.order(),
description: 'Update an existing order.',
args: {
data: t.arg({
type: this.builder.generator.getUpdateInput('Order'),

View File

@@ -22,6 +22,7 @@ export class PaymentSchema extends PothosSchema {
@PothosRef()
payment() {
return this.builder.prismaObject('Payment', {
description: 'A payment in the system.',
fields: (t) => ({
id: t.exposeID('id'),
amount: t.exposeFloat('amount'),
@@ -42,6 +43,7 @@ export class PaymentSchema extends PothosSchema {
this.builder.queryFields((t) => ({
payment: t.prismaField({
type: this.payment(),
description: 'Retrieve a single payment by its unique identifier.',
args: this.builder.generator.findUniqueArgs('Payment'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.payment.findUnique({
@@ -53,6 +55,8 @@ export class PaymentSchema extends PothosSchema {
payments: t.prismaField({
type: [this.payment()],
args: this.builder.generator.findManyArgs('Payment'),
description:
'Retrieve a list of payments with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.payment.findMany({
...query,

View File

@@ -22,6 +22,7 @@ export class ResumeSchema extends PothosSchema {
@PothosRef()
resume() {
return this.builder.prismaObject('Resume', {
description: 'A resume in the system.',
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
@@ -44,6 +45,7 @@ export class ResumeSchema extends PothosSchema {
@PothosRef()
resumeFile() {
return this.builder.prismaObject('ResumeFile', {
description: 'A file associated with a resume.',
fields: (t) => ({
id: t.exposeID('id'),
resumeId: t.exposeID('resumeId'),
@@ -65,6 +67,8 @@ export class ResumeSchema extends PothosSchema {
init(): void {
this.builder.queryFields((t) => ({
resumes: t.prismaField({
description:
'Retrieve a list of resumes with optional filtering, ordering, and pagination.',
type: [this.resume()],
args: this.builder.generator.findManyArgs('Resume'),
resolve: async (query, root, args) => {
@@ -79,6 +83,7 @@ export class ResumeSchema extends PothosSchema {
}),
resume: t.prismaField({
description: 'Retrieve a single resume by its unique identifier.',
type: this.resume(),
args: this.builder.generator.findUniqueArgs('Resume'),
resolve: async (query, root, args) => {
@@ -91,6 +96,7 @@ export class ResumeSchema extends PothosSchema {
}),
resumeFile: t.prismaField({
description: 'Retrieve a single resume file by its unique identifier.',
type: this.resumeFile(),
args: this.builder.generator.findUniqueArgs('ResumeFile'),
resolve: async (query, root, args) => {
@@ -105,6 +111,8 @@ export class ResumeSchema extends PothosSchema {
},
}),
resumeFiles: t.prismaField({
description:
'Retrieve a list of resume files with optional filtering, ordering, and pagination.',
type: [this.resumeFile()],
args: this.builder.generator.findManyArgs('ResumeFile'),
resolve: async (query, root, args) => {
@@ -124,6 +132,7 @@ export class ResumeSchema extends PothosSchema {
this.builder.mutationFields((t) => ({
upsertResume: t.prismaField({
type: this.resume(),
description: 'Create or update a resume.',
args: {
resumeFile: t.arg({
type: 'Upload',
@@ -183,6 +192,7 @@ export class ResumeSchema extends PothosSchema {
updateResumeStatus: t.prismaField({
type: this.resume(),
description: 'Update the status of a resume.',
args: {
resumeId: t.arg({
type: 'String',

View File

@@ -20,6 +20,7 @@ export class ScheduleSchema extends PothosSchema {
@PothosRef()
schedule() {
return this.builder.prismaObject('Schedule', {
description: 'A schedule in the system.',
fields: (t) => ({
id: t.exposeID('id'),
serviceId: t.exposeID('serviceId'),
@@ -35,6 +36,7 @@ export class ScheduleSchema extends PothosSchema {
this.builder.queryFields((t) => ({
schedule: t.prismaField({
type: this.schedule(),
description: 'Retrieve a single schedule by its unique identifier.',
args: this.builder.generator.findUniqueArgs('Schedule'),
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.schedule.findUnique({
@@ -47,6 +49,8 @@ export class ScheduleSchema extends PothosSchema {
schedules: t.prismaField({
type: [this.schedule()],
args: this.builder.generator.findManyArgs('Schedule'),
description:
'Retrieve a list of schedules with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.schedule.findMany({
...query,

View File

@@ -20,6 +20,7 @@ export class ServiceSchema extends PothosSchema {
@PothosRef()
service() {
return this.builder.prismaObject('Service', {
description: 'A service offered by a center.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
@@ -54,6 +55,8 @@ export class ServiceSchema extends PothosSchema {
init() {
this.builder.queryFields((t) => ({
services: t.prismaField({
description:
'Retrieve a list of services with optional filtering, ordering, and pagination.',
type: [this.service()],
args: this.builder.generator.findManyArgs('Service'),
resolve: async (query, root, args, ctx, info) => {
@@ -67,6 +70,7 @@ export class ServiceSchema extends PothosSchema {
},
}),
service: t.prismaField({
description: 'Retrieve a single service by its unique identifier.',
type: this.service(),
args: {
input: t.arg({
@@ -86,6 +90,7 @@ export class ServiceSchema extends PothosSchema {
// Mutation section
this.builder.mutationFields((t) => ({
createService: t.prismaField({
description: 'Create a new service.',
type: this.service(),
args: {
input: t.arg({
@@ -100,6 +105,7 @@ export class ServiceSchema extends PothosSchema {
},
}),
updateService: t.prismaField({
description: 'Update an existing service.',
type: this.service(),
args: {
input: t.arg({
@@ -120,6 +126,7 @@ export class ServiceSchema extends PothosSchema {
},
}),
deleteService: t.prismaField({
description: 'Delete an existing service.',
type: this.service(),
args: {
where: t.arg({

View File

@@ -20,6 +20,7 @@ export class ServiceAndCategorySchema extends PothosSchema {
@PothosRef()
serviceAndCategory() {
return this.builder.prismaObject('ServiceAndCategory', {
description: 'A service and category in the system.',
fields: (t) => ({
serviceId: t.exposeID('serviceId'),
service: t.relation('service'),
@@ -35,6 +36,8 @@ export class ServiceAndCategorySchema extends PothosSchema {
serviceAndCategories: t.prismaField({
type: [this.serviceAndCategory()],
args: this.builder.generator.findManyArgs('ServiceAndCategory'),
description:
'Retrieve a list of service and categories with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.serviceAndCategory.findMany({
...query,

View File

@@ -20,6 +20,7 @@ export class ServiceFeedbackSchema extends PothosSchema {
@PothosRef()
serviceFeedback() {
return this.builder.prismaObject('ServiceFeedback', {
description: 'A feedback for a service.',
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
@@ -40,6 +41,8 @@ export class ServiceFeedbackSchema extends PothosSchema {
serviceFeedbacks: t.prismaField({
type: [this.serviceFeedback()],
args: this.builder.generator.findManyArgs('ServiceFeedback'),
description:
'Retrieve a list of service feedbacks with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.serviceFeedback.findMany({
...query,

View File

@@ -20,6 +20,7 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
@PothosRef()
serviceMeetingRoom() {
return this.builder.prismaObject('ServiceMeetingRoom', {
description: 'A service meeting room in the system.',
fields: (t) => ({
id: t.exposeID('id'),
chattingRoomId: t.exposeString('chattingRoomId'),
@@ -34,6 +35,8 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
serviceMeetingRoom: t.prismaField({
type: this.serviceMeetingRoom(),
args: this.builder.generator.findUniqueArgs('ServiceMeetingRoom'),
description:
'Retrieve a single service meeting room by its unique identifier.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.serviceMeetingRoom.findUnique({
...query,
@@ -44,6 +47,8 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
serviceMeetingRooms: t.prismaField({
type: [this.serviceMeetingRoom()],
args: this.builder.generator.findManyArgs('ServiceMeetingRoom'),
description:
'Retrieve a list of service meeting rooms with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.serviceMeetingRoom.findMany({
...query,

View File

@@ -22,6 +22,7 @@ export class UploadedFileSchema extends PothosSchema {
@PothosRef()
uploadedFile() {
return this.builder.prismaObject('UploadedFile', {
description: 'A file uploaded by a user.',
fields: (t) => ({
id: t.exposeID('id'),
userId: t.exposeID('userId'),
@@ -42,6 +43,8 @@ export class UploadedFileSchema extends PothosSchema {
init(): void {
this.builder.queryFields((t) => ({
uploadedFile: t.prismaField({
description:
'Retrieve a single uploaded file by its unique identifier.',
type: this.uploadedFile(),
args: this.builder.generator.findUniqueArgs('UploadedFile'),
resolve: async (query, root, args) => {
@@ -64,6 +67,8 @@ export class UploadedFileSchema extends PothosSchema {
},
}),
uploadedFiles: t.prismaField({
description:
'Retrieve a list of uploaded files with optional filtering, ordering, and pagination.',
type: [this.uploadedFile()],
args: this.builder.generator.findManyArgs('UploadedFile'),
resolve: async (query, root, args) => {
@@ -90,6 +95,7 @@ export class UploadedFileSchema extends PothosSchema {
// Mutations section
this.builder.mutationFields((t) => ({
singleUpload: t.prismaField({
description: 'Upload a single file for a user.',
type: this.uploadedFile(),
args: {
userId: t.arg({
@@ -140,6 +146,7 @@ export class UploadedFileSchema extends PothosSchema {
}),
multipleUpload: t.prismaField({
description: 'Upload multiple files for a user.',
type: [this.uploadedFile()],
args: {
userId: t.arg({
@@ -194,6 +201,7 @@ export class UploadedFileSchema extends PothosSchema {
}),
deleteUploadedFile: t.prismaField({
description: 'Delete a single uploaded file by its unique identifier.',
type: this.uploadedFile(),
args: {
id: t.arg({
@@ -221,6 +229,8 @@ export class UploadedFileSchema extends PothosSchema {
}),
deleteUploadedFiles: t.prismaField({
description:
'Delete multiple uploaded files by their unique identifiers.',
type: [this.uploadedFile()],
args: {
ids: t.arg({

View File

@@ -21,6 +21,7 @@ export class UserSchema extends PothosSchema {
@PothosRef()
user() {
return this.builder.prismaObject('User', {
description: 'A user in the system.',
fields: (t) => ({
id: t.exposeID('id'),
name: t.exposeString('name'),
@@ -40,6 +41,8 @@ export class UserSchema extends PothosSchema {
init(): void {
this.builder.queryFields((t) => ({
users: t.prismaField({
description:
'Retrieve a list of users with optional filtering, ordering, and pagination.',
type: [this.user()],
args: this.builder.generator.findManyArgs('User'),
resolve: async (query, root, args, ctx, info) => {
@@ -54,6 +57,7 @@ export class UserSchema extends PothosSchema {
}),
user: t.prismaField({
description: 'Retrieve a single user by their unique identifier.',
type: this.user(),
args: this.builder.generator.findUniqueArgs('User'),
resolve: async (query, root, args, ctx, info) => {
@@ -64,6 +68,7 @@ export class UserSchema extends PothosSchema {
},
}),
userBySession: t.prismaField({
description: 'Retrieve a single user by their session ID.',
type: this.user(),
args: {
sessionId: t.arg({ type: 'String', required: true }),
@@ -85,6 +90,7 @@ export class UserSchema extends PothosSchema {
// Mutation section
this.builder.mutationFields((t) => ({
updateUser: t.prismaField({
description: 'Update an existing user.',
type: this.user(),
args: {
input: t.arg({

View File

@@ -20,6 +20,7 @@ export class WorkshopSchema extends PothosSchema {
@PothosRef()
workshop() {
return this.builder.prismaObject('Workshop', {
description: 'A workshop in the system.',
fields: (t) => ({
id: t.exposeID('id'),
title: t.exposeString('title'),
@@ -54,6 +55,7 @@ export class WorkshopSchema extends PothosSchema {
workshop: t.prismaField({
type: this.workshop(),
args: this.builder.generator.findUniqueArgs('Workshop'),
description: 'Retrieve a single workshop by its unique identifier.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.findUnique({
...query,
@@ -65,6 +67,8 @@ export class WorkshopSchema extends PothosSchema {
workshops: t.prismaField({
type: [this.workshop()],
args: this.builder.generator.findManyArgs('Workshop'),
description:
'Retrieve a list of workshops with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.findMany({
...query,
@@ -87,6 +91,7 @@ export class WorkshopSchema extends PothosSchema {
required: true,
}),
},
description: 'Create a new workshop.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.create({
...query,
@@ -107,6 +112,7 @@ export class WorkshopSchema extends PothosSchema {
required: true,
}),
},
description: 'Update an existing workshop.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshop.update({
...query,

View File

@@ -19,6 +19,7 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
@PothosRef()
workshopSubscription() {
return this.builder.prismaObject('WorkshopSubscription', {
description: 'A workshop subscription in the system.',
fields: (t) => ({
userId: t.exposeID('userId'),
workshopId: t.exposeID('workshopId'),
@@ -34,6 +35,8 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
workshopSubscription: t.prismaField({
type: this.workshopSubscription(),
args: this.builder.generator.findUniqueArgs('WorkshopSubscription'),
description:
'Retrieve a single workshop subscription by its unique identifier.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshopSubscription.findUnique({
...query,
@@ -44,6 +47,8 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
workshopSubscriptions: t.prismaField({
type: [this.workshopSubscription()],
args: this.builder.generator.findManyArgs('WorkshopSubscription'),
description:
'Retrieve a list of workshop subscriptions with optional filtering, ordering, and pagination.',
resolve: async (query, root, args, ctx, info) => {
return await this.prisma.workshopSubscription.findMany({
...query,