Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 5.6 with latest dev. #4314

Merged
merged 64 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6d12f29
PSP-8704 changes (#4259)
ap-quartech Aug 12, 2024
0ed070a
PSP-8879/PSP-7696 : Lease compensation requisition (#4266)
eddherrera Aug 23, 2024
8c4365d
CI: Bump version to v5.5.0-87.8
github-actions[bot] Aug 23, 2024
b647b9b
PSP-8969 Allow for region to be auto populated when adding a property…
asanchezr Aug 23, 2024
7b61d96
CI: Bump version to v5.5.0-87.9
github-actions[bot] Aug 23, 2024
0c8d742
Add the GST number to the compensation detail view. (#4284)
devinleighsmith Aug 26, 2024
d233334
CI: Bump version to v5.5.0-87.10
github-actions[bot] Aug 26, 2024
b50cc23
correct update lease form from not displaying warning when lease inva…
devinleighsmith Aug 26, 2024
1b795cc
CI: Bump version to v5.5.0-87.11
github-actions[bot] Aug 26, 2024
64a41fd
psp-9041 fix issues with PIN-only properties. (#4288)
devinleighsmith Aug 26, 2024
64a8e67
CI: Bump version to v5.5.0-87.12
github-actions[bot] Aug 26, 2024
f426ecb
psp-9058, psp-9059 ensure that the gst calculation does not override …
devinleighsmith Aug 26, 2024
5446afe
CI: Bump version to v5.5.0-87.13
github-actions[bot] Aug 26, 2024
319d7c5
psp-9080 add missing LEASE_STAKEHOLDER_TYPE codes. (#4286)
devinleighsmith Aug 27, 2024
5bcda45
CI: Bump version to v5.5.0-87.14
github-actions[bot] Aug 27, 2024
3531d02
PSP-9122 : Lease compensation does not have access to new payees with…
eddherrera Aug 27, 2024
37ad2ef
CI: Bump version to v5.5.0-87.15
github-actions[bot] Aug 27, 2024
52137cd
PSP-8316 | Lease consultation updates (#4281)
FuriousLlama Aug 27, 2024
026a028
CI: Bump version to v5.5.0-87.16
github-actions[bot] Aug 27, 2024
fbc2999
Fixed lease filter (#4289)
FuriousLlama Aug 27, 2024
29cc924
CI: Bump version to v5.5.0-87.17
github-actions[bot] Aug 27, 2024
1da8acc
Added message when changing period flexible type (#4290)
FuriousLlama Aug 27, 2024
f7e33ee
CI: Bump version to v5.5.0-87.18
github-actions[bot] Aug 27, 2024
e461f42
Updated primary button border to match size of buttons (#4294)
FuriousLlama Aug 27, 2024
642e117
CI: Bump version to v5.5.0-87.19
github-actions[bot] Aug 27, 2024
02da38b
PSP-9083, PSP-9062 Document file upload fixes (#4295)
asanchezr Aug 28, 2024
d577799
CI: Bump version to v5.5.0-87.20
github-actions[bot] Aug 28, 2024
a2d3c13
psp-8955 add file streaming back to PIMS. (#4282)
devinleighsmith Aug 29, 2024
5cd2822
CI: Bump version to v5.5.0-87.21
github-actions[bot] Aug 29, 2024
d14caa1
psp-8982 Display pin in header. (#4293)
devinleighsmith Aug 29, 2024
3dcd3af
CI: Bump version to v5.5.0-87.22
github-actions[bot] Aug 29, 2024
c1bd43b
PSP-8932 | Added checks to create pages so navigating with data shows…
FuriousLlama Aug 29, 2024
48ce968
CI: Bump version to v5.5.0-87.23
github-actions[bot] Aug 29, 2024
40a41d1
Merge branch 'test' into dev
devinleighsmith Aug 29, 2024
7e62dd7
psp-9058 gst calculation corrections. (#4297)
devinleighsmith Aug 29, 2024
7b59f47
CI: Bump version to v5.5.0-87.24
github-actions[bot] Aug 29, 2024
dd6fb8b
Fixed backend. Updated frontend (#4299)
FuriousLlama Aug 30, 2024
342b45c
CI: Bump version to v5.5.0-87.25
github-actions[bot] Aug 30, 2024
0fc71c6
PSP-9053 Update L/L H1005A with additional fields (#4291)
asanchezr Aug 30, 2024
10115ad
CI: Bump version to v5.5.0-87.26
github-actions[bot] Aug 30, 2024
324a825
PSP-8977 : Add Total Allowable Compensation to Compensation Section (…
eddherrera Aug 30, 2024
a7d6461
CI: Bump version to v5.5.0-87.27
github-actions[bot] Aug 30, 2024
c9d1e88
IS-88.00 Database Schema (#4278)
dfilteau Sep 3, 2024
85897c3
CI: Bump version to v5.5.0-87.28
github-actions[bot] Sep 3, 2024
753bc10
Regenerated Scaffold (#4301)
FuriousLlama Sep 3, 2024
7d58876
CI: Bump version to v5.5.0-87.29
github-actions[bot] Sep 3, 2024
907cf4d
Version bump - IS88 (#4302)
asanchezr Sep 3, 2024
62ac009
CI: Bump version to v5.5.0-88.1
github-actions[bot] Sep 3, 2024
81a1548
PSP-9002 : Generate H120 Lease/Licence (#4303)
eddherrera Sep 4, 2024
706d471
CI: Bump version to v5.5.0-88.2
github-actions[bot] Sep 4, 2024
249e60b
PSP-9047 : Add product for L/L payable lease and show on h120 (#4304)
eddherrera Sep 4, 2024
622b915
CI: Bump version to v5.5.0-88.3
github-actions[bot] Sep 4, 2024
fac6aed
PSP-9065 UI cleanup (#4305)
asanchezr Sep 5, 2024
4ba86b9
CI: Bump version to v5.5.0-88.4
github-actions[bot] Sep 5, 2024
976e3f1
PSP-8880: Fixes based on last PR comments (#4308)
stairaku Sep 9, 2024
cd69420
CI: Bump version to v5.5.0-88.5
github-actions[bot] Sep 9, 2024
b653244
PSP-9164 : FT:Reg:Lease&Licence File: In the update mode if user dese…
eddherrera Sep 9, 2024
029695f
CI: Bump version to v5.5.0-88.6
github-actions[bot] Sep 9, 2024
f3fc9f1
Updated Lease list report (#4309)
FuriousLlama Sep 9, 2024
c85fa53
CI: Bump version to v5.5.0-88.7
github-actions[bot] Sep 9, 2024
6f1b250
PSP-8988 Add Crown Details tab for any property that has Tantalis rec…
asanchezr Sep 9, 2024
76b1dfe
CI: Bump version to v5.5.0-88.8
github-actions[bot] Sep 9, 2024
2eb388a
Update payee options model to correctly handle null/undefined. (#4311)
devinleighsmith Sep 9, 2024
ca3c22a
CI: Bump version to v5.5.0-88.9
github-actions[bot] Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<DataTransformationsUserConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Configurations>
<Configuration>
<Name>Development</Name>
<Options>
<AssessmentRuleSuppressionSetting />
<UseWinAuth>false</UseWinAuth>
<WinAuthUserName />
<WinAuthDomain />
<ServerName>ssistst.th.gov.bc.ca</ServerName>
<PathOnServer>/SSISDB/PIMS_TST/PIMS_PROPERTY_FIX_DUPLICATE_ADDRESSIDs</PathOnServer>
<UserIDs />
<UserPasswords />
<OfflineMode>false</OfflineMode>
<ProgressReporting>true</ProgressReporting>
<ParameterConfigurationSensitiveValues>
<ConfigurationSetting>
<Id>LastModifiedTime</Id>
<Name>LastModifiedTime</Name>
<Value xsi:type="xsd:dateTime">2024-08-06T21:23:40.864741Z</Value>
</ConfigurationSetting>
</ParameterConfigurationSensitiveValues>
</Options>
</Configuration>
</Configurations>
</DataTransformationsUserConfiguration>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.34729.46
MinimumVisualStudioVersion = 10.0.40219.1
Project("{C9674DCB-5085-4A16-B785-4C70DD1589BD}") = "PIMS_PROPERTY_FIX_DUPLICATE_ADDRESSIDs", "PIMS_PROPERTY_FIX_DUPLICATE_ADDRESSIDs.dtproj", "{CC2C02AD-C5BE-401E-84A8-E6FE4C4F3C6F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Development|Default = Development|Default
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CC2C02AD-C5BE-401E-84A8-E6FE4C4F3C6F}.Development|Default.ActiveCfg = Development
{CC2C02AD-C5BE-401E-84A8-E6FE4C4F3C6F}.Development|Default.Build.0 = Development
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EAEE040D-0140-4DF4-B040-43B62E31004A}
EndGlobalSection
EndGlobal

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions etl/PIMS_PROPERTY_FIX_DUPLICATE_ADDRESSIDs/Project.params
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0"?>
<SSIS:Parameters xmlns:SSIS="www.microsoft.com/SqlServer/SSIS" />
Original file line number Diff line number Diff line change
Expand Up @@ -224,76 +224,6 @@ public IActionResult GetAcquisitionTeamMembers()
return new JsonResult(_mapper.Map<IEnumerable<AcquisitionFileTeamModel>>(team));
}

/// <summary>
/// Get all the compensations corresponding to the passed file id.
/// </summary>
/// <param name="id">The file to retrieve compensations for.</param>
/// <returns></returns>
[HttpGet("{id:long}/compensation-requisitions")]
[HasPermission(Permissions.CompensationRequisitionView)]
[Produces("application/json")]
[ProducesResponseType(typeof(List<CompensationRequisitionModel>), 200)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetFileCompensations(long id)
{
var pimsCompensations = _acquisitionService.GetAcquisitionCompensations(id);
var compensations = _mapper.Map<List<CompensationRequisitionModel>>(pimsCompensations);
return new JsonResult(compensations);
}

/// <summary>
/// Gets all the compensation requisition financials for an acq file.
/// </summary>
/// <returns></returns>
[HttpGet("{id:long}/comp-req-h120s")]
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<CompensationFinancialModel>), 200)]
[SwaggerOperation(Tags = new[] { "comp-req-h120s" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetFileCompReqH120(long id, bool? finalOnly)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(AcquisitionFileController),
nameof(GetFileCompReqH120),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation("Dispatching to service: {Service}", _compReqFinancialService.GetType());

var h120s = _compReqFinancialService.GetAllByAcquisitionFileId(id, finalOnly);

return new JsonResult(_mapper.Map<IEnumerable<CompensationFinancialModel>>(h120s));
}

/// <summary>
/// Add a Compensation Requisition to an Acquisition File.
/// </summary>
/// <param name="id"></param>
/// <param name="compensationRequisition"></param>
/// <returns></returns>
[HttpPost("{id:long}/compensation-requisitions")]
[HasPermission(Permissions.CompensationRequisitionAdd)]
[Produces("application/json")]
[ProducesResponseType(typeof(CompensationRequisitionModel), 201)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult AddCompensationRequisition([FromRoute] long id, [FromBody] CompensationRequisitionModel compensationRequisition)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(AcquisitionFileController),
nameof(AddCompensationRequisition),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation($"Dispatching to service: {_acquisitionService.GetType()}");

var compensationReqEntity = _mapper.Map<PimsCompensationRequisition>(compensationRequisition);
var newCompensationRequisition = _acquisitionService.AddCompensationRequisition(id, compensationReqEntity);

return new JsonResult(_mapper.Map<CompensationRequisitionModel>(newCompensationRequisition));
}

/// <summary>
/// Get all Expropriation Payments from the Acquisition File.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Pims.Api.Helpers.Exceptions;
using Pims.Api.Models.CodeTypes;
using Pims.Api.Models.Concepts.AcquisitionFile;
using Pims.Api.Models.Concepts.CompensationRequisition;
using Pims.Api.Models.Concepts.Lease;
using Pims.Api.Policies;
using Pims.Api.Services;
using Pims.Core.Extensions;
using Pims.Core.Json;
using Pims.Dal.Entities;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;

Expand Down Expand Up @@ -64,13 +67,35 @@ public IActionResult GetCompensationRequisitionById([FromRoute] long id)
return new JsonResult(_mapper.Map<CompensationRequisitionModel>(compensationRequisition));
}

[HttpPut("{id:long}")]
[HttpPost("{fileType}")]
[HasPermission(Permissions.CompensationRequisitionAdd)]
[Produces("application/json")]
[ProducesResponseType(typeof(CompensationRequisitionModel), 201)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult AddFileCompensationRequisition([FromRoute] FileTypes fileType, [FromBody] CompensationRequisitionModel compensationRequisition)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(CompensationRequisitionController),
nameof(AddFileCompensationRequisition),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation($"Dispatching to service: {_compensationRequisitionService.GetType()}");

var compensationReqEntity = _mapper.Map<PimsCompensationRequisition>(compensationRequisition);
var newCompensationRequisition = _compensationRequisitionService.AddCompensationRequisition(fileType, compensationReqEntity);

return new JsonResult(_mapper.Map<CompensationRequisitionModel>(newCompensationRequisition));
}

[HttpPut("{fileType}/{id:long}")]
[HasPermission(Permissions.CompensationRequisitionEdit)]
[Produces("application/json")]
[ProducesResponseType(typeof(CompensationRequisitionModel), 200)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult UpdateCompensationRequisition([FromRoute] long id, [FromBody] CompensationRequisitionModel compensationRequisition)
public IActionResult UpdateCompensationRequisition([FromRoute] FileTypes fileType, [FromRoute] long id, [FromBody] CompensationRequisitionModel compensationRequisition)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
Expand All @@ -85,33 +110,54 @@ public IActionResult UpdateCompensationRequisition([FromRoute] long id, [FromBod
throw new BadRequestException("Invalid compensationRequisitionId.");
}

var compensationReqEntity = _mapper.Map<Dal.Entities.PimsCompensationRequisition>(compensationRequisition);
var compensation = _compensationRequisitionService.Update(compensationReqEntity);
var compensationReqEntity = _mapper.Map<PimsCompensationRequisition>(compensationRequisition);
var compensation = _compensationRequisitionService.Update(fileType, compensationReqEntity);

return new JsonResult(_mapper.Map<CompensationRequisitionModel>(compensation));
}

[HttpGet("{id:long}/properties")]
[HttpGet("acquisition/{id:long}/properties")]
[HasPermission(Permissions.CompensationRequisitionView)]
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<AcquisitionFilePropertyModel>), 200)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetCompensationRequisitionProperties([FromRoute] long id)
public IActionResult GetAcquisitionCompensationRequisitionProperties([FromRoute] long id)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(CompensationRequisitionController),
nameof(GetCompensationRequisitionProperties),
nameof(GetAcquisitionCompensationRequisitionProperties),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation("Dispatching to service: {Service}", _compensationRequisitionService.GetType());

var compensationReqProperties = _compensationRequisitionService.GetProperties(id);
var compensationReqProperties = _compensationRequisitionService.GetAcquisitionProperties(id);

return new JsonResult(_mapper.Map<IEnumerable<AcquisitionFilePropertyModel>>(compensationReqProperties));
}

[HttpGet("lease/{id:long}/properties")]
[HasPermission(Permissions.CompensationRequisitionView)]
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<PropertyLeaseModel>), 200)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetLeaseCompensationRequisitionProperties([FromRoute] long id)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(CompensationRequisitionController),
nameof(GetLeaseCompensationRequisitionProperties),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation("Dispatching to service: {Service}", _compensationRequisitionService.GetType());

var compensationReqProperties = _compensationRequisitionService.GetLeaseProperties(id);

return new JsonResult(_mapper.Map<IEnumerable<PropertyLeaseModel>>(compensationReqProperties));
}

/// <summary>
/// Deletes the compensation with the matching id.
/// </summary>
Expand All @@ -125,8 +171,59 @@ public IActionResult GetCompensationRequisitionProperties([FromRoute] long id)
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult DeleteCompensation([FromRoute] long id)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(CompensationRequisitionController),
nameof(DeleteCompensation),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation($"Dispatching to service: {_compensationRequisitionService.GetType()}");

var result = _compensationRequisitionService.DeleteCompensation(id);
return new JsonResult(result);
}

[HttpGet("{fileType}/{fileId:long}")]
[HasPermission(Permissions.CompensationRequisitionView)]
[Produces("application/json")]
[ProducesResponseType(typeof(List<CompensationRequisitionModel>), 200)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetFileCompensations([FromRoute]FileTypes fileType, [FromRoute]long fileId)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(CompensationRequisitionController),
nameof(GetFileCompensations),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation($"Dispatching to service: {_compensationRequisitionService.GetType()}");

var pimsCompensations = _compensationRequisitionService.GetFileCompensationRequisitions(fileType, fileId);
var compensations = _mapper.Map<List<CompensationRequisitionModel>>(pimsCompensations);

return new JsonResult(compensations);
}

[HttpGet("{id:long}/financials")]
[HasPermission(Permissions.CompensationRequisitionView)]
[Produces("application/json")]
[ProducesResponseType(typeof(List<CompensationFinancialModel>), 200)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetCompensationRequisitionFinancials([FromRoute] long id)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(CompensationRequisitionController),
nameof(GetCompensationRequisitionFinancials),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation("Dispatching to service: {Service}", _compensationRequisitionService.GetType());

var compReqFinancials = _compensationRequisitionService.GetCompensationRequisitionFinancials(id);

return new JsonResult(_mapper.Map<IEnumerable<CompensationFinancialModel>>(compReqFinancials));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public DocumentGenerationController(IDocumentGenerationService documentGeneratio

// [HasPermission(Permissions.GenerateDocuments)]
[Produces("application/json")]
[ProducesResponseType(typeof(ExternalResponse<Models.Cdogs.FileTypes>), 200)]
[ProducesResponseType(typeof(ExternalResponse<Models.Cdogs.CdogsFileTypes>), 200)]
[SwaggerOperation(Tags = new[] { "document-generation" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public async Task<IActionResult> GetSupportedDocumentTypes()
Expand Down
41 changes: 40 additions & 1 deletion source/backend/api/Areas/Documents/DocumentController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using MapsterMapper;
using Microsoft.AspNetCore.Authorization;
Expand Down Expand Up @@ -125,6 +126,25 @@ public async Task<IActionResult> DownloadFile(long mayanDocumentId, long mayanFi
return new FileContentResult(fileBytes, result.Payload.Mimetype) { FileDownloadName = result.Payload.FileName };
}

/// <summary>
/// Stream the file for the corresponding file and document id and return a stream.
/// </summary>
[HttpGet("storage/{mayanDocumentId}/files/{mayanFileId}/stream")]
[HasPermission(Permissions.DocumentView)]
[ProducesResponseType(typeof(File), 200)]
[SwaggerOperation(Tags = new[] { "storage-documents" })]
public async Task<IActionResult> StreamFile(long mayanDocumentId, long mayanFileId)
{
var result = await _documentService.StreamFileAsync(mayanDocumentId, mayanFileId);

if (result?.Payload == null)
{
return new NotFoundResult();
}

return File(result.Payload.FilePayload, "application/octet-stream", $"{result.Payload.FileName}");
}

/// <summary>
/// Retrieves a list of documents.
/// </summary>
Expand Down Expand Up @@ -208,7 +228,7 @@ public async Task<IActionResult> DownloadWrappedFile(long mayanDocumentId)
[ProducesResponseType(typeof(FileContentResult), 200)]
[SwaggerOperation(Tags = new[] { "storage-documents" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public async Task<IActionResult> DownloadFile(long mayanDocumentId)
public async Task<IActionResult> DownloadFileLatest(long mayanDocumentId)
{
var result = await _documentService.DownloadFileLatestAsync(mayanDocumentId);
if (result?.Payload == null)
Expand All @@ -220,6 +240,25 @@ public async Task<IActionResult> DownloadFile(long mayanDocumentId)
return new FileContentResult(fileBytes, result.Payload.Mimetype) { FileDownloadName = result.Payload.FileName };
}

/// <summary>
/// Streams the latest file for the corresponding document id.
/// </summary>
[HttpGet("storage/{mayanDocumentId}/stream")]
[HasPermission(Permissions.DocumentView)]
[ProducesResponseType(typeof(File), 200)]
[SwaggerOperation(Tags = new[] { "storage-documents" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public async Task<IActionResult> StreamFileLatest(long mayanDocumentId)
{
var result = await _documentService.StreamFileLatestAsync(mayanDocumentId);
if (result?.Payload == null)
{
return new NotFoundResult();
}

return File(result.Payload.FilePayload, "application/octet-stream", $"{result.Payload.FileName}");
}

/// <summary>
/// Retrieves a external document metadata.
/// </summary>
Expand Down
Loading
Loading