File tree Expand file tree Collapse file tree 2 files changed +41
-7
lines changed
services/apps/alcs/src/portal
application-submission-review Expand file tree Collapse file tree 2 files changed +41
-7
lines changed Original file line number Diff line number Diff line change @@ -96,14 +96,11 @@ export class ApplicationSubmissionReviewController {
9696 ) ;
9797 }
9898
99- const applicationReview =
100- await this . applicationSubmissionReviewService . getByFileNumber ( fileNumber ) ;
99+ const applicationSubmission = req . user . entity . bceidBusinessGuid
100+ ? await this . applicationSubmissionService . getForNonGovernmentBusinessByFileId ( fileNumber , req . user . entity )
101+ : await this . applicationSubmissionService . getByFileNumber ( fileNumber , req . user . entity ) ;
101102
102- const applicationSubmission =
103- await this . applicationSubmissionService . getByFileNumber (
104- fileNumber ,
105- req . user . entity ,
106- ) ;
103+ const applicationReview = await this . applicationSubmissionReviewService . getByFileNumber ( fileNumber ) ;
107104
108105 if ( ! applicationSubmission ) {
109106 throw new NotFoundException (
Original file line number Diff line number Diff line change @@ -425,6 +425,41 @@ export class ApplicationSubmissionService {
425425 return existingApplication ;
426426 }
427427
428+ async getForNonGovernmentBusinessByFileId ( fileNumber : string , user : User ) {
429+ if ( ! user . bceidBusinessGuid ) {
430+ throw new Error ( 'Must have business BCeID GUID to access this submission' ) ;
431+ }
432+
433+ const existingApplication = await this . applicationSubmissionRepository . findOne ( {
434+ where : [
435+ //Owns
436+ {
437+ fileNumber,
438+ createdBy : {
439+ bceidBusinessGuid : user . bceidBusinessGuid ,
440+ } ,
441+ isDraft : false ,
442+ } ,
443+ ] ,
444+ order : {
445+ auditUpdatedAt : 'DESC' ,
446+ owners : {
447+ firstName : 'ASC' ,
448+ parcels : {
449+ purchasedDate : 'ASC' ,
450+ } ,
451+ } ,
452+ } ,
453+ relations : { ...this . DEFAULT_RELATIONS , createdBy : true } ,
454+ } ) ;
455+
456+ if ( ! existingApplication ) {
457+ throw new ServiceNotFoundException ( `Failed to load application with File ID ${ fileNumber } ` ) ;
458+ }
459+
460+ return existingApplication ;
461+ }
462+
428463 async getByFileNumber ( fileNumber : string , user : User ) {
429464 return await this . applicationSubmissionRepository . findOne ( {
430465 where : {
@@ -482,6 +517,8 @@ export class ApplicationSubmissionService {
482517 const localGovernment = await this . localGovernmentService . getByGuid ( user . bceidBusinessGuid ) ;
483518 if ( localGovernment ) {
484519 return await this . getForGovernmentByFileId ( fileId , localGovernment ) ;
520+ } else {
521+ return await this . getForNonGovernmentBusinessByFileId ( fileId , user ) ;
485522 }
486523 }
487524
You can’t perform that action at this time.
0 commit comments