Skip to content

Commit cea7dc0

Browse files
authored
Allow nulls on InternshipEngagement mentor & countryOfOrigin (#2978)
1 parent cb84538 commit cea7dc0

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/components/engagement/dto/engagement.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ export class InternshipEngagement extends Engagement {
208208
@Field(() => InternshipProject)
209209
declare readonly parent: BaseNode;
210210

211-
readonly countryOfOrigin: Secured<ID>;
211+
readonly countryOfOrigin: Secured<ID | null>;
212212

213213
readonly intern: Secured<ID>;
214214

215-
readonly mentor: Secured<ID>;
215+
readonly mentor: Secured<ID | null>;
216216

217217
@Field()
218218
@DbLabel('InternPosition')

src/components/engagement/dto/update-engagement.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ export abstract class UpdateLanguageEngagement extends UpdateEngagement {
8181
@InputType()
8282
export abstract class UpdateInternshipEngagement extends UpdateEngagement {
8383
@IdField({ nullable: true })
84-
readonly mentorId?: ID;
84+
readonly mentorId?: ID | null;
8585

8686
@IdField({ nullable: true })
87-
readonly countryOfOriginId?: ID;
87+
readonly countryOfOriginId?: ID | null;
8888

8989
@Field(() => InternshipPosition, { nullable: true })
9090
readonly position?: InternshipPosition;

src/components/engagement/engagement.service.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,17 @@ export class EngagementService {
358358
);
359359

360360
try {
361-
if (mentorId) {
362-
await this.repo.updateMentor(input.id, mentorId);
361+
if (mentorId !== undefined) {
362+
await this.repo.updateRelation('mentor', 'User', input.id, mentorId);
363363
}
364364

365-
if (countryOfOriginId) {
366-
await this.repo.updateCountryOfOrigin(input.id, countryOfOriginId);
365+
if (countryOfOriginId !== undefined) {
366+
await this.repo.updateRelation(
367+
'countryOfOrigin',
368+
'Location',
369+
input.id,
370+
countryOfOriginId,
371+
);
367372
}
368373

369374
await this.repo.updateInternshipProperties(

0 commit comments

Comments
 (0)