diff --git a/src/common/schema/profile.ts b/src/common/schema/profile.ts index e66e42bd3..f5c442373 100644 --- a/src/common/schema/profile.ts +++ b/src/common/schema/profile.ts @@ -15,7 +15,7 @@ export const userExperienceInputBaseSchema = z.object({ description: z.string().max(5000).optional(), subtitle: z.string().max(1000).optional(), startedAt: z.date(), - endedAt: z.date().optional(), + endedAt: z.date().optional().nullable().default(null), companyId: z.string().nullable().optional().default(null), customCompanyName: z .string() diff --git a/src/schema/profile.ts b/src/schema/profile.ts index c112f7459..e140f49e3 100644 --- a/src/schema/profile.ts +++ b/src/schema/profile.ts @@ -26,7 +26,6 @@ import { getNonExistingSkills, insertOrIgnoreUserExperienceSkills, } from '../entity/user/experiences/UserExperienceSkill'; - interface GQLUserExperience { id: string; type: UserExperienceType; @@ -184,9 +183,7 @@ const generateExperienceToSave = async < where: { id: companyId }, }); toSave.customCompanyName = null; - } - - if (customCompanyName) { + } else if (customCompanyName) { const existingCompany = await ctx.con .getRepository(Company) .createQueryBuilder('c')