update input for upsert to avoid confuse

This commit is contained in:
2024-10-15 17:50:17 +07:00
parent 871853bef4
commit c208c27a64

View File

@@ -182,14 +182,18 @@ export class ResumeSchema extends PothosSchema {
upsertResume: t.prismaField({
type: this.resume(),
args: {
where: t.arg({
type: this.builder.generator.getWhereUnique('Resume'),
required: true,
}),
resumeFile: t.arg({
type: 'Upload',
required: true,
}),
centerId: t.arg({
type: 'String',
required: true,
}),
userId: t.arg({
type: 'String',
required: true,
}),
},
resolve: async (query, root, args, ctx, info) => {
const { resumeFile } = args;
@@ -202,10 +206,7 @@ export class ResumeSchema extends PothosSchema {
filename,
'resumes',
);
const { userId, centerId } = args.where as {
userId: string;
centerId: string | null;
};
const { userId, centerId } = args;
if (!userId || !centerId) {
throw new Error('userId and centerId are required');
}