@@ -191,6 +191,7 @@ public async Task<PermitAppCommandResponse> Handle(PermitAppRenewCommand cmd, Ca
191
191
cancellationToken ) ;
192
192
await ValidateFilesForRenewUpdateAppAsync ( cmd . LicenceAnonymousRequest ,
193
193
cmd . LicAppFileInfos . ToList ( ) ,
194
+ existingFiles ,
194
195
cancellationToken ) ;
195
196
196
197
CreateLicenceApplicationCmd createApp = _mapper . Map < CreateLicenceApplicationCmd > ( request ) ;
@@ -404,21 +405,9 @@ private async Task<ChangeSpec> MakeChanges(LicenceResp originalLic,
404
405
405
406
private async Task ValidateFilesForRenewUpdateAppAsync ( PermitAppSubmitRequest request ,
406
407
IList < LicAppFileInfo > newFileInfos ,
408
+ IList < LicAppFileInfo > existingFileInfos ,
407
409
CancellationToken ct )
408
410
{
409
- DocumentListResp docListResps = await _documentRepository . QueryAsync ( new DocumentQry ( request . OriginalApplicationId ) , ct ) ;
410
- IList < LicAppFileInfo > existingFileInfos = Array . Empty < LicAppFileInfo > ( ) ;
411
-
412
- if ( request . PreviousDocumentIds != null )
413
- {
414
- existingFileInfos = docListResps . Items . Where ( d => request . PreviousDocumentIds . Contains ( d . DocumentUrlId ) && d . DocumentType2 != null )
415
- . Select ( f => new LicAppFileInfo ( )
416
- {
417
- FileName = f . FileName ?? String . Empty ,
418
- LicenceDocumentTypeCode = ( LicenceDocumentTypeCode ) Mappings . GetLicenceDocumentTypeCode ( f . DocumentType , f . DocumentType2 ) ,
419
- } ) . ToList ( ) ;
420
- }
421
-
422
411
if ( request . HasLegalNameChanged == true && ! newFileInfos . Any ( f => f . LicenceDocumentTypeCode == LicenceDocumentTypeCode . LegalNameChange ) )
423
412
{
424
413
throw new ApiException ( HttpStatusCode . BadRequest , "Missing LegalNameChange file" ) ;
0 commit comments