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
2 changes: 1 addition & 1 deletion prime-dotnet-webapi/Controllers/SitesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ public async Task<ActionResult<string>> GetBusinessLicenceDocumentToken(int site
return NotFound($"No business licence document found for site with id {siteId}");
}

var token = await _documentService.GetDownloadTokenForBusinessLicenceDocument(siteId);
var token = await _documentService.GetDownloadTokenForBusinessLicenceDocument(siteId, businessLicenceId);

return Ok(token);
}
Expand Down
7 changes: 7 additions & 0 deletions prime-dotnet-webapi/Services/CommunitySiteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,13 @@ public async Task<BusinessLicence> GetLatestBusinessLicenceAsync(int siteId)
.SingleOrDefaultAsync();
}

public async Task<BusinessLicence> GetBusinessLicenceAsync(int siteId, int businessLicenceId)
{
return await _context.BusinessLicences
.Where(bl => bl.SiteId == siteId && bl.Id == businessLicenceId)
.SingleOrDefaultAsync();
}

public async Task<bool> SiteExistsAsync(int siteId)
{
return await _context.CommunitySites
Expand Down
4 changes: 2 additions & 2 deletions prime-dotnet-webapi/Services/DocumentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public DocumentService(
_documentManagerClient = documentManagerClient;
}

public async Task<string> GetDownloadTokenForBusinessLicenceDocument(int siteId)
public async Task<string> GetDownloadTokenForBusinessLicenceDocument(int siteId, int businessLicenceId)
{
var licence = await _communitySiteService.GetLatestBusinessLicenceAsync(siteId);
var licence = await _communitySiteService.GetBusinessLicenceAsync(siteId, businessLicenceId);
return await _documentManagerClient.CreateDownloadTokenAsync(licence.BusinessLicenceDocument.DocumentGuid);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public interface ICommunitySiteService
Task<BusinessLicence> AddBusinessLicenceAsync(int siteId, BusinessLicence businessLicence, Guid documentGuid);
Task<BusinessLicence> UpdateBusinessLicenceAsync(int businessLicenceId, BusinessLicence updateBusinessLicence);
Task<IEnumerable<BusinessLicence>> GetBusinessLicencesAsync(int siteId);
Task<BusinessLicence> GetBusinessLicenceAsync(int siteId, int businessLicenceId);
Task<BusinessLicence> GetLatestBusinessLicenceAsync(int siteId);
Task<BusinessLicenceDocument> AddOrReplaceBusinessLicenceDocumentAsync(int businessLicenceId, Guid documentGuid);
Task DeleteBusinessLicenceDocumentAsync(int businessLicenceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Prime.Services
{
public interface IDocumentService
{
Task<string> GetDownloadTokenForBusinessLicenceDocument(int siteId);
Task<string> GetDownloadTokenForBusinessLicenceDocument(int siteId, int businessLicenceId);
Task<string> GetDownloadTokenForSignedAgreementDocument(int agreementId);
Task<string> GetDownloadTokenForSelfDeclarationDocument(int selfDeclarationDocumentId);
Task<string> GetDownloadTokenForIdentificationDocument(int identificationDocumentId);
Expand Down
Loading