diff --git a/biome.json b/biome.json index 0a68a8d..a877fc7 100644 --- a/biome.json +++ b/biome.json @@ -16,7 +16,7 @@ "indentStyle": "space", "indentWidth": 2, "lineEnding": "lf", - "lineWidth": 80, + "lineWidth": 120, "attributePosition": "auto", "bracketSpacing": true }, diff --git a/src/Workshop/workshop.schema.ts b/src/Workshop/workshop.schema.ts index e6c36c8..79aff7b 100644 --- a/src/Workshop/workshop.schema.ts +++ b/src/Workshop/workshop.schema.ts @@ -1,10 +1,5 @@ import { Inject, Injectable } from '@nestjs/common' -import { - Pothos, - PothosRef, - PothosSchema, - SchemaBuilderToken, -} from '@smatch-corp/nestjs-pothos' +import { Pothos, PothosRef, PothosSchema, SchemaBuilderToken } from '@smatch-corp/nestjs-pothos' import { Builder } from '../Graphql/graphql.builder' import { PrismaService } from '../Prisma/prisma.service' import { MinioService } from 'src/Minio/minio.service' @@ -98,8 +93,7 @@ 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.', + 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, @@ -123,7 +117,10 @@ export class WorkshopSchema extends PothosSchema { }), }, description: 'Create a new workshop.', - resolve: async (query, _root, args, _ctx, _info) => { + resolve: async (query, _root, args, ctx, _info) => { + if (ctx.isSubscription) throw new Error('Workshops cannot be created in subscription context') + if (!ctx.http.me) throw new Error('User is not authenticated to create a workshop') + return await this.prisma.workshop.create({ ...query, data: args.input,