fix approve resume
This commit is contained in:
@@ -107,6 +107,49 @@ export class AppConfigSchema extends PothosSchema {
|
||||
})
|
||||
},
|
||||
}),
|
||||
updateAppConfig: t.prismaField({
|
||||
type: this.appConfig(),
|
||||
description: 'Update an app config',
|
||||
args: {
|
||||
input: t.arg({
|
||||
type: this.builder.generator.getUpdateInput('Config'),
|
||||
required: true,
|
||||
}),
|
||||
where: t.arg({
|
||||
type: this.builder.generator.getWhereUnique('Config'),
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, _root, args) => {
|
||||
return await this.prisma.config.update({
|
||||
...query,
|
||||
data: args.input,
|
||||
where: args.where ?? undefined,
|
||||
})
|
||||
},
|
||||
}),
|
||||
/* The `updateAppConfigs` field in the `AppConfigSchema` class is defining a mutation to update
|
||||
multiple app configs in the database. Here is a breakdown of what it is doing: */
|
||||
// updateAppConfigs: t.prismaField({
|
||||
// type: [this.appConfig()],
|
||||
// description: 'Update multiple app configs',
|
||||
// args: {
|
||||
// data: t.arg({
|
||||
// type: [this.builder.generator.getUpdateInput('Config')],
|
||||
// required: true,
|
||||
// }),
|
||||
// where: t.arg({
|
||||
// type: this.builder.generator.getWhere('Config'),
|
||||
// required: true,
|
||||
// }),
|
||||
// },
|
||||
// resolve: async (query, _root, args) => {
|
||||
// return await this.prisma.config.updateMany({
|
||||
// data: args.data,
|
||||
// where: args.where ?? undefined,
|
||||
// })
|
||||
// },
|
||||
// }),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ export class ResumeSchema extends PothosSchema {
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
resolve: async (query, _root, args, ctx, _info) => {
|
||||
try {
|
||||
if (ctx.isSubscription) {
|
||||
throw new Error('Not allowed')
|
||||
@@ -133,7 +133,7 @@ export class ResumeSchema extends PothosSchema {
|
||||
'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) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
return await this.prisma.resume.findMany({
|
||||
...query,
|
||||
skip: args.skip ?? undefined,
|
||||
@@ -148,7 +148,7 @@ export class ResumeSchema extends PothosSchema {
|
||||
description: 'Retrieve a single resume by its unique identifier.',
|
||||
type: this.resume(),
|
||||
args: this.builder.generator.findUniqueArgs('Resume'),
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
const resume = await this.prisma.resume.findUnique({
|
||||
...query,
|
||||
where: args.where,
|
||||
@@ -161,7 +161,7 @@ export class ResumeSchema extends PothosSchema {
|
||||
description: 'Retrieve a single resume file by its unique identifier.',
|
||||
type: this.resumeFile(),
|
||||
args: this.builder.generator.findUniqueArgs('ResumeFile'),
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
const resumeFile = await this.prisma.resumeFile.findUnique({
|
||||
...query,
|
||||
where: args.where,
|
||||
@@ -177,7 +177,7 @@ export class ResumeSchema extends PothosSchema {
|
||||
'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) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
const resumeFiles = await this.prisma.resumeFile.findMany({
|
||||
...query,
|
||||
skip: args.skip ?? undefined,
|
||||
@@ -209,7 +209,7 @@ export class ResumeSchema extends PothosSchema {
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args) => {
|
||||
resolve: async (query, _root, args) => {
|
||||
const { resumeFile } = args
|
||||
const { mimetype } = await resumeFile
|
||||
const { filename, actualFileName } =
|
||||
@@ -279,18 +279,19 @@ export class ResumeSchema extends PothosSchema {
|
||||
}
|
||||
const { resumeId, status, adminNote } = args
|
||||
return this.prisma.$transaction(async (tx) => {
|
||||
const resumeOwner = await tx.user.findUnique({
|
||||
where: { id: resumeId },
|
||||
})
|
||||
if (!resumeOwner) {
|
||||
throw new Error('Resume not found')
|
||||
}
|
||||
const oldResume = await tx.resume.findUnique({
|
||||
where: { id: resumeId },
|
||||
})
|
||||
if (!oldResume) {
|
||||
throw new Error('Resume not found')
|
||||
}
|
||||
const resumeOwner = await tx.user.findUnique({
|
||||
where: { id: oldResume.userId },
|
||||
})
|
||||
if (!resumeOwner) {
|
||||
throw new Error('Resume owner not found')
|
||||
}
|
||||
|
||||
// if resumeOwner.status is REQUESTED and status is REVIEWING then we need update status and return resume
|
||||
if (
|
||||
oldResume.status === ResumeStatus.REQUESTED &&
|
||||
|
||||
Reference in New Issue
Block a user