Skip to content

Commit c82511c

Browse files
feat: SRS -783 : Add App Participant feature (#843)
* Add the FE functionality for add app participant * Add CSS for the fields in modal + fix existing FE test cases * Add the logic to amend the form fields * Add logic to populate roles + few API * Add more logic to Add person names * fix search dropdown issue * correct the search query and logic for person data * Fix updating form data to be added for new participant * fix the dropdown selection issue in InputControls * Fix dropdown value for participantName * Fix the search issue for Organization * Add logic for adding the participant in DB * Fixed some issue related to adding app participant * Adding check to avoid duplicate entries * Fixing the case when the result cache could have same results stored for person and org * Added Validations and fixed save functionality * Unit tests for Adding AppParticipant * return data after adding new particpant * Removed console and hardcoded appId * remove console and revert changes made in common component * revert change made to this file * Add applicationId for cases wherein no app participants exists * prettier formatting * Update InputControls.tsx * refresh participants when added * refactor DTO class * Replace axios call with apollo * Addressing few review comments * code formatting * code cleanup and formatting * Refetching data * Change the way form needs to be updated * remove console.logs * Address comment * formatted * address comments --------- Co-authored-by: Jaspal.Singh-AOT <163812444+jaspalsingh-aot@users.noreply.github.com>
1 parent 7c405f2 commit c82511c

24 files changed

+1586
-97
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
3+
@ObjectType()
4+
export class ViewParticipantNamesDto {
5+
@Field()
6+
id: number;
7+
8+
@Field()
9+
firstName: string;
10+
11+
@Field(({ nullable: true }))
12+
middleName: string;
13+
14+
@Field()
15+
lastName: string;
16+
17+
@Field()
18+
fullName: string;
19+
}
Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,18 @@
11
import { Field, InputType, ObjectType } from '@nestjs/graphql';
2-
import { IsDate, IsString } from 'class-validator';
2+
import { IsDate, IsOptional, IsString } from 'class-validator';
33

44
@ObjectType()
55
@InputType()
66
export class BaseAppParticipantsDto {
7-
@Field()
7+
@Field({defaultValue: false})
88
isMainParticipant: boolean;
99

10-
@Field()
11-
@IsString()
12-
firstName: string;
13-
14-
@Field()
15-
@IsString()
16-
lastName: string;
17-
18-
@Field()
19-
@IsString()
20-
fullName: string;
21-
22-
@Field()
23-
@IsString()
24-
name: string;
25-
26-
@Field()
27-
@IsString()
28-
description: string;
29-
3010
@Field()
3111
@IsDate()
3212
effectiveStartDate: Date;
3313

3414
@Field({ nullable: true })
3515
@IsDate()
36-
effectiveEndDate: Date;
37-
38-
@Field()
39-
isMinistry: boolean;
16+
@IsOptional()
17+
effectiveEndDate?: Date | null;
4018
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Field, InputType, ObjectType } from '@nestjs/graphql';
2+
import { IsDate, IsString } from 'class-validator';
3+
import { BaseAppParticipantsDto } from './baseAppParticipants.dto';
4+
5+
@InputType()
6+
export class CreateAppParticipantDto extends BaseAppParticipantsDto{
7+
@Field()
8+
applicationId: number;
9+
10+
@Field()
11+
personId: number;
12+
13+
@Field()
14+
participantRoleId: number;
15+
16+
@Field({nullable: true} )
17+
organizationId: number | null;
18+
19+
@Field({nullable:true})
20+
createdBy: string;
21+
22+
@Field({nullable: true})
23+
createdDateTime: Date;
24+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { Field, InputType, ObjectType } from "@nestjs/graphql";
2+
import { IsDate } from "class-validator";
3+
4+
@ObjectType()
5+
export class ViewAppParticipantEntityDto {
6+
@Field()
7+
id: number;
8+
9+
@Field()
10+
applicationId: number;
11+
12+
@Field()
13+
personId: number;
14+
15+
@Field()
16+
participantRoleId: number;
17+
18+
@Field({nullable: true} )
19+
organizationId: number | null;
20+
21+
@Field({defaultValue: false})
22+
isMainParticipant: boolean;
23+
24+
@Field()
25+
@IsDate()
26+
effectiveStartDate: Date;
27+
28+
@Field({ nullable: true })
29+
@IsDate()
30+
effectiveEndDate: Date;
31+
32+
@Field({ nullable: true })
33+
rowVersionCount: number | null;
34+
35+
@Field()
36+
createdBy: string;
37+
38+
@Field()
39+
createdDateTime: Date;
40+
41+
@Field({ nullable: true })
42+
updatedBy: string | null;
43+
44+
@Field({ nullable: true })
45+
updatedDateTime: Date | null;
46+
47+
// @Field()
48+
// ts: Buffer | null;
49+
}

backend/cats/src/app/dto/appParticipants/viewAppParticipants.dto.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Field, ObjectType } from '@nestjs/graphql';
22
import { BaseAppParticipantsDto } from './baseAppParticipants.dto';
3+
import { IsString } from 'class-validator';
34

45
@ObjectType()
56
export class ViewAppParticipantsDto extends BaseAppParticipantsDto {
@@ -8,4 +9,42 @@ export class ViewAppParticipantsDto extends BaseAppParticipantsDto {
89

910
@Field()
1011
applicationId: number;
12+
13+
@Field()
14+
@IsString()
15+
firstName: string;
16+
17+
@Field()
18+
@IsString()
19+
lastName: string;
20+
21+
@Field()
22+
@IsString()
23+
fullName: string;
24+
25+
@Field()
26+
@IsString()
27+
name: string;
28+
29+
@Field()
30+
@IsString()
31+
description: string;
32+
33+
@Field()
34+
isMinistry: boolean;
35+
36+
@Field({ nullable: true })
37+
rowVersionCount: number | null;
38+
39+
@Field()
40+
createdBy: string;
41+
42+
@Field()
43+
createdDateTime: Date;
44+
45+
@Field({ nullable: true })
46+
updatedBy: string | null;
47+
48+
@Field({ nullable: true })
49+
updatedDateTime: Date | null;
1150
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
3+
@ObjectType()
4+
export class ViewOrganizationsDto {
5+
@Field()
6+
id: number;
7+
8+
@Field()
9+
name: string;
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
3+
@ObjectType()
4+
export class ViewParticipantsRolesDto {
5+
@Field()
6+
id: number;
7+
8+
@Field()
9+
description: string;
10+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
import { ResponseDto } from './response/response.dto';
3+
4+
@ObjectType()
5+
export class DropdownResponse extends ResponseDto {
6+
@Field(() => [DropdownDto], { nullable: true })
7+
data: DropdownDto[] | null;
8+
}
9+
10+
@ObjectType()
11+
export class DropdownDto {
12+
@Field()
13+
key: string;
14+
15+
@Field()
16+
value: string;
17+
18+
@Field()
19+
metaData?: string;
20+
}

backend/cats/src/app/dto/response/applicationParticipant/appParticipantsResponse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Field, ObjectType } from '@nestjs/graphql';
2-
3-
import { ResponseDto } from '../response.dto';
42
import { ViewAppParticipantsDto } from '../../appParticipants/viewAppParticipants.dto';
3+
import { ResponseDto } from '../response.dto';
4+
import { ViewAppParticipantEntityDto } from '../../appParticipants/viewAppParticipantEntity.dto';
55

66
@ObjectType()
77
export class AppParticipantsResponse extends ResponseDto {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Field, ObjectType } from '@nestjs/graphql';
2+
import { ViewAppParticipantsDto } from '../../appParticipants/viewAppParticipants.dto';
3+
import { ResponseDto } from '../response.dto';
4+
import { ViewAppParticipantEntityDto } from '../../appParticipants/viewAppParticipantEntity.dto';
5+
6+
@ObjectType()
7+
export class CreateAppParticipantsResponse extends ResponseDto {
8+
@Field(() => [ViewAppParticipantEntityDto], { nullable: true })
9+
data: ViewAppParticipantEntityDto[] | null;
10+
}

0 commit comments

Comments
 (0)