66using ECER . Managers . Registry . Contract . Registrants ;
77using ECER . Utilities . Security ;
88using AutoMapper ;
9- using ECER . Clients . RegistryPortal . Server . Applications ;
109using ECER . Managers . Registry . Contract . Applications ;
1110using Bogus ;
1211
@@ -48,19 +47,19 @@ public void Register(IEndpointRouteBuilder endpointRouteBuilder)
4847 return TypedResults . BadRequest ( new ProblemDetails { Title = "Missing header: APPLICATION-TYPE" } ) ;
4948 }
5049
51- RegistryPortal . Server . Applications . CertificationType certificationType ;
50+ CertificationType certificationType ;
5251 switch ( applicationType . ToString ( ) )
5352 {
5453 case "Assistant" :
55- certificationType = RegistryPortal . Server . Applications . CertificationType . EceAssistant ;
54+ certificationType = CertificationType . EceAssistant ;
5655 break ;
5756
5857 case "OneYear" :
59- certificationType = RegistryPortal . Server . Applications . CertificationType . OneYear ;
58+ certificationType = CertificationType . OneYear ;
6059 break ;
6160
6261 case "5Years" :
63- certificationType = RegistryPortal . Server . Applications . CertificationType . FiveYears ;
62+ certificationType = CertificationType . FiveYears ;
6463 break ;
6564
6665 default :
@@ -72,17 +71,15 @@ public void Register(IEndpointRouteBuilder endpointRouteBuilder)
7271 if ( profile == null ) return TypedResults . NotFound ( ) ;
7372 var contact_id = profile . UserId ;
7473
75- var draftApplicationObj = new Faker < DraftApplication > ( "en_CA" )
74+ var draftApplicationObj = new Faker < Application > ( "en_CA" )
7675 . RuleFor ( f => f . CertificationTypes , f => f . Make ( 1 , ( ) => certificationType ) )
7776 . RuleFor ( f => f . SignedDate , f => f . Date . Recent ( ) )
7877 . RuleFor ( f => f . Transcripts , f => f . Make ( f . Random . Number ( 2 , 5 ) , ( ) => CreateTranscript ( ) ) )
7978 . RuleFor ( f => f . CharacterReferences , f => f . Make ( 1 , ( ) => CreateCharacterReference ( ) ) )
8079 . RuleFor ( f => f . WorkExperienceReferences , f => f . Make ( f . Random . Number ( 2 , 5 ) , ( ) => CreateWorkExperienceReference ( ) ) )
8180 . Generate ( ) ;
8281
83- var draftApplication = mapper . Map < Managers . Registry . Contract . Applications . Application > ( draftApplicationObj , opts => opts . Items . Add ( "registrantId" , contact_id ) ) ! ;
84-
85- var application = await messageBus . Send ( new SaveDraftApplicationCommand ( draftApplication ) , ct ) ;
82+ var application = await messageBus . Send ( new SaveDraftApplicationCommand ( draftApplicationObj ) , ct ) ;
8683
8784 var cmd = new SubmitApplicationCommand ( application ! . Id ! , contact_id ! ) ;
8885 var submitAppResult = await messageBus . Send ( cmd , ct ) ;
@@ -110,60 +107,62 @@ public void Register(IEndpointRouteBuilder endpointRouteBuilder)
110107 . WithParameterValidation ( ) ;
111108 }
112109
113- private static RegistryPortal . Server . Applications . Transcript CreateTranscript ( )
110+ private static Transcript CreateTranscript ( )
114111 {
115112 // Use Faker to generate values for the required parameters
116113 var faker = new Faker ( "en_CA" ) ;
117114 var educationalInstitutionName = faker . Company . CompanyName ( ) ;
118115 var programName = $ "{ faker . Hacker . Adjective ( ) } Program";
116+ var studentNumber = faker . Random . Number ( 10000000 , 99999999 ) . ToString ( ) ;
119117 var studentLastName = faker . Name . LastName ( ) ;
120118 var startDate = faker . Date . Past ( ) ;
121119 var endDate = faker . Date . Past ( ) ;
120+ var isECEAssistant = faker . Random . Bool ( ) ;
121+ var studentFirstName = faker . Name . FirstName ( ) ;
122122 var isNameUnverified = faker . Random . Bool ( ) ;
123- var educationRecognition = new RegistryPortal . Server . Applications . EducationRecognition ( ) ; // Initialize as needed
124- var educationOrigin = new RegistryPortal . Server . Applications . EducationOrigin ( ) ; // Initialize as needed
123+ var educationRecognition = EducationRecognition . Recognized ; // Initialize as needed
124+ var educationOrigin = EducationOrigin . InsideBC ; // Initialize as needed
125125
126126 // Instantiate the Transcript record with the required arguments
127- var transcript = new RegistryPortal . Server . Applications . Transcript (
127+ var transcript = new Transcript (
128+ null ,
128129 educationalInstitutionName ,
129130 programName ,
130- studentLastName ,
131+ studentNumber ,
131132 startDate ,
132133 endDate ,
134+ isECEAssistant ,
135+ studentFirstName ,
136+ studentLastName ,
133137 isNameUnverified ,
134138 educationRecognition ,
135139 educationOrigin
136140 )
137141 {
138142 // Populate optional properties
139- Id = null ,
140143 CampusLocation = faker . Address . City ( ) ,
141- StudentFirstName = faker . Name . FirstName ( ) ,
142- StudentNumber = faker . Random . Number ( 10000000 , 99999999 ) . ToString ( ) ,
143- IsECEAssistant = faker . Random . Bool ( ) ,
144- TranscriptStatusOption = RegistryPortal . Server . Applications . TranscriptStatusOptions . OfficialTranscriptRequested ,
144+ TranscriptStatusOption = TranscriptStatusOptions . OfficialTranscriptRequested ,
145145 } ;
146146
147147 return transcript ;
148148 }
149149
150- private RegistryPortal . Server . Applications . CharacterReference CreateCharacterReference ( )
150+ private CharacterReference CreateCharacterReference ( )
151151 {
152152 var faker = new Faker ( "en_CA" ) ;
153- return new RegistryPortal . Server . Applications . CharacterReference (
154- faker . Name . LastName ( ) , faker . Phone . PhoneNumber ( ) , "[email protected] " 153+ return new CharacterReference (
154+ faker . Name . FirstName ( ) , faker . Name . LastName ( ) , faker . Phone . PhoneNumber ( ) , "[email protected] " 155155 )
156- { FirstName = faker . Name . FirstName ( ) } ;
156+ { Status = CharacterReferenceStage . Draft } ;
157157 }
158158
159- private RegistryPortal . Server . Applications . WorkExperienceReference CreateWorkExperienceReference ( )
159+ private WorkExperienceReference CreateWorkExperienceReference ( )
160160 {
161161 var faker = new Faker ( "en_CA" ) ;
162- return new RegistryPortal . Server . Applications . WorkExperienceReference (
163- faker . Name . LastName ( ) , "[email protected] " , faker . Random . Number ( 10 , 150 ) 162+ return new WorkExperienceReference (
163+ faker . Name . FirstName ( ) , faker . Name . LastName ( ) , "[email protected] " , faker . Random . Number ( 10 , 150 ) 164164 )
165165 {
166- FirstName = faker . Name . FirstName ( ) ,
167166 PhoneNumber = faker . Phone . PhoneNumber ( )
168167 } ;
169168 }
0 commit comments