AI da dat ten cho dong song
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, Logger } from '@nestjs/common';
|
||||
import {
|
||||
Pothos,
|
||||
PothosRef,
|
||||
@@ -97,6 +97,31 @@ export class ResumeSchema extends PothosSchema {
|
||||
@Pothos()
|
||||
init(): void {
|
||||
this.builder.queryFields((t) => ({
|
||||
myResumes: t.prismaField({
|
||||
description: 'Retrieve a list of resumes for the current user.',
|
||||
type: [this.resume()],
|
||||
args: {
|
||||
status: t.arg({
|
||||
type: ResumeStatus,
|
||||
required: false,
|
||||
}),
|
||||
},
|
||||
resolve: async (query, root, args, ctx, info) => {
|
||||
try {
|
||||
const resumes = await this.prisma.resume.findMany({
|
||||
...query,
|
||||
where: {
|
||||
userId: ctx.me.id,
|
||||
status: args.status ?? undefined,
|
||||
},
|
||||
});
|
||||
return resumes;
|
||||
} catch (error) {
|
||||
Logger.error(error, 'myResumes');
|
||||
return [];
|
||||
}
|
||||
},
|
||||
}),
|
||||
resumes: t.prismaField({
|
||||
description:
|
||||
'Retrieve a list of resumes with optional filtering, ordering, and pagination.',
|
||||
|
||||
Reference in New Issue
Block a user