update pagination
This commit is contained in:
Submodule epess-database updated: e63059910a...ea7fa4ae6f
@@ -1,15 +1,14 @@
|
|||||||
import {
|
import {
|
||||||
ConsoleLogger,
|
|
||||||
INestApplication,
|
INestApplication,
|
||||||
Injectable,
|
Injectable,
|
||||||
|
Logger,
|
||||||
OnModuleInit,
|
OnModuleInit,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { PrismaClient } from '@prisma/client';
|
import { PrismaClient } from '@prisma/client';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class PrismaService extends PrismaClient implements OnModuleInit {
|
export class PrismaService extends PrismaClient implements OnModuleInit {
|
||||||
private readonly logger = new ConsoleLogger(PrismaService.name);
|
private readonly logger = new Logger(PrismaService.name);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
log: [
|
log: [
|
||||||
@@ -22,7 +21,7 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
|
|||||||
level: 'error',
|
level: 'error',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
emit: 'event',
|
emit: 'stdout',
|
||||||
level: 'info',
|
level: 'info',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -30,6 +29,7 @@ export class PrismaService extends PrismaClient implements OnModuleInit {
|
|||||||
level: 'warn',
|
level: 'warn',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
errorFormat: 'pretty',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export class RefundTicketSchema extends PothosSchema {
|
|||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
cursor: args.cursor ?? undefined,
|
cursor: args.cursor ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class ScheduleSchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
return await this.prisma.schedule.findMany({
|
return await this.prisma.schedule.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
...query,
|
...query,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export class ServiceAndCategorySchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
return await this.prisma.serviceAndCategory.findMany({
|
return await this.prisma.serviceAndCategory.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export class ServiceFeedbackSchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
return await this.prisma.serviceFeedback.findMany({
|
return await this.prisma.serviceFeedback.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export class ServiceMeetingRoomSchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
return await this.prisma.serviceMeetingRoom.findMany({
|
return await this.prisma.serviceMeetingRoom.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export class UploadedFileSchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args) => {
|
resolve: async (query, root, args) => {
|
||||||
const files = await this.prisma.uploadedFile.findMany({
|
const files = await this.prisma.uploadedFile.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export class UserSchema extends PothosSchema {
|
|||||||
return await this.prisma.user.findMany({
|
return await this.prisma.user.findMany({
|
||||||
...query,
|
...query,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export class WorkshopSchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
return await this.prisma.workshop.findMany({
|
return await this.prisma.workshop.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
|
|||||||
@@ -30,4 +30,34 @@ export class WorkshopMeetingRoomSchema extends PothosSchema {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Pothos()
|
||||||
|
init(): void {
|
||||||
|
this.builder.queryFields((t) => ({
|
||||||
|
workshopMeetingRoom: t.prismaField({
|
||||||
|
type: this.workshopMeetingRoom(),
|
||||||
|
args: this.builder.generator.findUniqueArgs('WorkshopMeetingRoom'),
|
||||||
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
|
return await this.prisma.workshopMeetingRoom.findUnique({
|
||||||
|
...query,
|
||||||
|
where: args.where,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
workshopMeetingRooms: t.prismaField({
|
||||||
|
type: [this.workshopMeetingRoom()],
|
||||||
|
args: this.builder.generator.findManyArgs('WorkshopMeetingRoom'),
|
||||||
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
|
return await this.prisma.workshopMeetingRoom.findMany({
|
||||||
|
...query,
|
||||||
|
where: args.filter ?? undefined,
|
||||||
|
orderBy: args.orderBy ?? undefined,
|
||||||
|
cursor: args.cursor ?? undefined,
|
||||||
|
take: args.take ?? 10,
|
||||||
|
skip: args.skip ?? undefined,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export class WorkshopSubscriptionSchema extends PothosSchema {
|
|||||||
resolve: async (query, root, args, ctx, info) => {
|
resolve: async (query, root, args, ctx, info) => {
|
||||||
return await this.prisma.workshopSubscription.findMany({
|
return await this.prisma.workshopSubscription.findMany({
|
||||||
...query,
|
...query,
|
||||||
skip: args.skip ?? 0,
|
skip: args.skip ?? undefined,
|
||||||
take: args.take ?? 10,
|
take: args.take ?? 10,
|
||||||
orderBy: args.orderBy ?? undefined,
|
orderBy: args.orderBy ?? undefined,
|
||||||
where: args.filter ?? undefined,
|
where: args.filter ?? undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user