update subscribe to workshop
This commit is contained in:
Submodule epess-database updated: 103bee2c60...249523346b
@@ -38,6 +38,9 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
|
|||||||
description:
|
description:
|
||||||
'The date and time the workshop subscription was created.',
|
'The date and time the workshop subscription was created.',
|
||||||
}),
|
}),
|
||||||
|
notified: t.exposeBoolean('notified', {
|
||||||
|
description: 'Whether the user has been notified about the workshop.',
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -73,5 +76,27 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}))
|
}))
|
||||||
|
this.builder.mutationFields((t) => ({
|
||||||
|
subscribeToWorkshop: t.prismaField({
|
||||||
|
type: this.workshopSubscription(),
|
||||||
|
args: {
|
||||||
|
workshopId: t.arg.string({
|
||||||
|
description: 'The ID of the workshop to subscribe to.',
|
||||||
|
required: true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
resolve: async (_query, _root, args, ctx) => {
|
||||||
|
if (ctx.isSubscription) throw new Error('Not allowed in subscription')
|
||||||
|
const userId = ctx.http.me?.id
|
||||||
|
if (!userId) throw new Error('User not authenticated')
|
||||||
|
return await this.prisma.workshopSubscription.create({
|
||||||
|
data: {
|
||||||
|
userId,
|
||||||
|
workshopId: args.workshopId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user