[resumes][feat] add resumeprofiles model (#316)

* [resumes][feat] add resumeprofiles model

* [resumes][fix] fix typo

* [resumes][chore] update migration file
This commit is contained in:
Keane Chan
2022-10-07 14:30:27 +08:00
committed by GitHub
parent 0933cce7b5
commit b2b8f3b553
3 changed files with 146 additions and 51 deletions

View File

@ -15,14 +15,23 @@ export const resumesResumeUserRouter = createProtectedRouter().mutation(
}),
async resolve({ ctx, input }) {
const userId = ctx.session?.user.id;
const resumeProfile = await ctx.prisma.resumesProfile.upsert({
create: {
userId,
},
update: {},
where: {
userId,
},
});
// TODO: Store file in file storage and retrieve URL
return await ctx.prisma.resumesResume.create({
data: {
...input,
resumesProfileId: resumeProfile.id,
url: '',
userId,
},
});
},