Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/cohortMembers/cohortMembers.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,17 @@ ON CM."userId" = U."userId" ${whereCase}`;
const savedCohortMember = await this.cohortMembersRepository.save(
cohortMembers
);

const enrichedCohortMember = {
...savedCohortMember,
AcademicYearID: academicyearId,
};

await this.publishCohortMemberEvent(
"created",
enrichedCohortMember,
apiId
);

return APIResponse.success(
res,
Expand Down Expand Up @@ -1090,6 +1101,20 @@ ${whereCase}`;
cohortMemberForAcademicYear
);
results.push(result);



const enrichedCohortMember = {
...result,
AcademicYearID: academicyearId,
customFields: (cohortMembersDto as any).customFields,
};

await this.publishCohortMemberEvent(
"created",
enrichedCohortMember,
apiId
);

// Track user for Kafka event publishing
affectedUsers.add(userId);
Expand Down
15 changes: 15 additions & 0 deletions src/cohortMembers/dto/bulkMember-create.dto.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { ApiProperty } from "@nestjs/swagger";
import { Expose, Type } from "class-transformer";
import {
IsArray,
IsUUID,
ArrayNotEmpty,
IsOptional,
IsNotEmpty,
ArrayMaxSize,
ValidateNested,
} from "class-validator";
import { FieldValuesOptionDto } from "src/user/dto/user-create.dto";

export class BulkCohortMember {
@ApiProperty({
Expand Down Expand Up @@ -42,6 +45,18 @@ export class BulkCohortMember {
@ArrayMaxSize(1000)
removeCohortId: string[];


@ApiProperty({
type: [FieldValuesOptionDto],
description: "Array of Custom fields",
})
@Expose()
@IsOptional()
@ValidateNested({ each: true })
@Type(() => FieldValuesOptionDto)
customFields?: FieldValuesOptionDto[];


constructor(obj: any) {
Object.assign(this, obj);
}
Expand Down