AI da dat ten cho dong song

This commit is contained in:
2024-10-26 11:10:14 +07:00
parent 2b6d3869f9
commit 48305a3948
11 changed files with 2999 additions and 63 deletions

View File

@@ -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.',