Skip to content

Commit

Permalink
bugfix: [#279] Include volunteerProfileId in organization-volunteer p…
Browse files Browse the repository at this point in the history
…resenter (#295)
  • Loading branch information
radulescuandrew authored Jul 15, 2024
1 parent 56f3fb4 commit 140bcf5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class OrganizationVolunteerPresenter {
this.name = organization.name;
this.logo = organization.logo;
this.volunteerId = organization.volunteerId;
this.volunteerProfileId = organization.volunteerProfileId;
}

@Expose()
Expand Down Expand Up @@ -35,4 +36,10 @@ export class OrganizationVolunteerPresenter {
description: 'The volunteer id for this organization',
})
volunteerId: string;

@Expose()
@ApiProperty({
description: 'The volunteer profile id for this organization',
})
volunteerProfileId: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IOrganizationModel } from './organization.model';

export interface IOrganizationVolunteerModel extends IOrganizationModel {
volunteerId: string;
volunteerProfileId: string;
}

export class OrganizationVolunteerTransformer {
Expand All @@ -11,6 +12,11 @@ export class OrganizationVolunteerTransformer {
userId: string,
): IOrganizationVolunteerModel {
if (!organizationEntity) return null;

const volunteer = organizationEntity.volunteers.find(
(v) => v.userId === userId,
);

return {
id: organizationEntity.id,
name: organizationEntity.name,
Expand All @@ -20,9 +26,8 @@ export class OrganizationVolunteerTransformer {
activityArea: organizationEntity.activityArea,
logo: organizationEntity.logo,
description: organizationEntity.description,
volunteerId: organizationEntity.volunteers.find(
(v) => v.userId === userId,
)?.id,
volunteerId: volunteer?.id,
volunteerProfileId: volunteer?.volunteerProfileId,
};
}
}

0 comments on commit 140bcf5

Please sign in to comment.