Skip to content

Commit

Permalink
Merge pull request #1840 from asanchezr/uat_is32_release
Browse files Browse the repository at this point in the history
Test -> Master - UAT IS32 release
  • Loading branch information
asanchezr authored Aug 4, 2022
2 parents 0cdd112 + 48174cf commit e11e368
Show file tree
Hide file tree
Showing 332 changed files with 67,946 additions and 16,748 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @devinleighsmith @jdtoombs @asanchezr @rpbcg @FuriousLlama @rafaelponcedeleon @stairaku
* @devinleighsmith @asanchezr @FuriousLlama @stairaku @Maheshbabu28

# Order is important; the last matching pattern takes the most
# precedence. When someone opens a pull request that only
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ start-infra: ## Starts infrastructure containers (e.g. keycloak, database, geose
@echo "$(P) Starting up infrastructure containers..."
@"$(MAKE)" start n="keycloak database geoserver"

start up: ## Runs the local containers (n=service name)
start: ## Starts the local containers (n=service name)
@echo "$(P) Starting client and server containers..."
@docker-compose start $(n)

up: ## Runs the local containers (n=service name)
@echo "$(P) Running client and server..."
@docker-compose up -d --no-recreate $(n)

Expand Down
2 changes: 1 addition & 1 deletion auth/keycloak/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# >docker build -t keycloak .
# >docker run --env-file=../../.env -d keycloak
# https://hub.docker.com/r/jboss/keycloak/
FROM jboss/keycloak:11.0.0
FROM jboss/keycloak:16.1.1

EXPOSE 8080

Expand Down
17 changes: 16 additions & 1 deletion backend/Pims.sln
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Geocoder", "geocoder\P
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Ltsa", "ltsa\Pims.Ltsa.csproj", "{1ED5DF03-7784-44EC-B02B-516167210CCF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pims.Dal.Mock.Test", "tests\unit\mockdal\Pims.Dal.Mock.Test.csproj", "{2C31E92C-9C95-45FF-9F95-928C2962F37D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Mock.Test", "tests\unit\mockdal\Pims.Dal.Mock.Test.csproj", "{2C31E92C-9C95-45FF-9F95-928C2962F37D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Av", "clamav\Pims.Av.csproj", "{16C06BDA-112F-4D04-82FF-0BBE45072372}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -214,6 +216,18 @@ Global
{2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|x64.Build.0 = Release|Any CPU
{2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|x86.ActiveCfg = Release|Any CPU
{2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|x86.Build.0 = Release|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x64.ActiveCfg = Debug|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x64.Build.0 = Debug|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x86.ActiveCfg = Debug|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x86.Build.0 = Debug|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|Any CPU.Build.0 = Release|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x64.ActiveCfg = Release|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x64.Build.0 = Release|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x86.ActiveCfg = Release|Any CPU
{16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -232,6 +246,7 @@ Global
{BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
{1ED5DF03-7784-44EC-B02B-516167210CCF} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
{2C31E92C-9C95-45FF-9F95-928C2962F37D} = {3D70B211-74A8-484C-9B86-B0A2835C71E7}
{16C06BDA-112F-4D04-82FF-0BBE45072372} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3433C5DD-DC49-4A96-A1AE-90C1A1EBA87C}
Expand Down
45 changes: 40 additions & 5 deletions backend/api/Areas/Notes/Controllers/NoteController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

using System.Collections.Generic;
using MapsterMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
Expand All @@ -8,7 +9,6 @@
using Pims.Api.Policies;
using Pims.Api.Services;
using Pims.Dal.Security;
using System.Collections.Generic;
using Swashbuckle.AspNetCore.Annotations;

namespace Pims.Api.Areas.Notes.Controllers
Expand Down Expand Up @@ -64,12 +64,12 @@ public IActionResult AddNote(NoteType type, [FromBody] EntityNoteModel noteModel
}

/// <summary>
/// Get the notes for the specified type and entity id.
/// Gets a collection of notes for the specified type and owner id.
/// </summary>
/// <param name="type">Used to identify note type.</param>
/// <param name="entityId">Used to identify note's parent entity.</param>
/// <returns></returns>
[HttpGet("{type}/{entityId}")]
[HttpGet("{type}/owner/{entityId:long}")]
[Produces("application/json")]
[HasPermission(Permissions.NoteView)]
[ProducesResponseType(typeof(IEnumerable<NoteModel>), 200)]
Expand All @@ -81,18 +81,53 @@ public IActionResult GetNotes(NoteType type, long entityId)
return new JsonResult(mappedNotes);
}

/// <summary>
/// Retrieves the note with the specified id.
/// </summary>
/// <param name="type">Used to identify note type.</param>
/// <param name="noteId">Used to identify the note.</param>
/// <returns></returns>
[HttpGet("{type}/{noteId:long}")]
[Produces("application/json")]
[HasPermission(Permissions.NoteView)]
[ProducesResponseType(typeof(NoteModel), 200)]
[SwaggerOperation(Tags = new[] { "note" })]
public IActionResult GetNoteById(NoteType type, long noteId)
{
var note = _noteService.GetById(noteId);
return new JsonResult(note);
}

/// <summary>
/// Updates the note with the specified id.
/// </summary>
/// <param name="type">Used to identify note type.</param>
/// <param name="noteId">Used to identify the note.</param>
/// <param name="noteModel">The updated note values.</param>
/// <returns></returns>
[HttpPut("{type}/{noteId:long}")]
[Produces("application/json")]
[HasPermission(Permissions.NoteEdit)]
[ProducesResponseType(typeof(NoteModel), 200)]
[SwaggerOperation(Tags = new[] { "note" })]
public IActionResult UpdateNote(NoteType type, long noteId, [FromBody] NoteModel noteModel)
{
var updatedNote = _noteService.Update(noteModel);
return new JsonResult(updatedNote);
}

/// <summary>
/// Deletes the note for the specified type.
/// </summary>
/// <param name="type">Used to identify note type.</param>
/// <param name="noteId">Used to identify the note and delete it.</param>
/// <returns></returns>
[HttpDelete("{type}/{noteId}")]
[HttpDelete("{type}/{noteId:long}")]
[Produces("application/json")]
[HasPermission(Permissions.NoteDelete)]
[ProducesResponseType(typeof(bool), 200)]
[SwaggerOperation(Tags = new[] { "note" })]
public IActionResult DeleteNote(NoteType type, int noteId)
public IActionResult DeleteNote(NoteType type, long noteId)
{
_noteService.DeleteNote(type, noteId);
return new JsonResult(true);
Expand Down
18 changes: 9 additions & 9 deletions backend/api/Areas/Property/Controllers/PropertyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,43 +78,43 @@ public IActionResult GetProperty(int id)
}

/// <summary>
/// Get the property associations for the specified unique 'pid'.
/// Get the property associations for the specified unique 'id'.
/// </summary>
/// <returns></returns>
[HttpGet("{pid}/associations")]
[HttpGet("{id}/associations")]
[HasPermission(Permissions.PropertyView)]
[Produces("application/json")]
[ProducesResponseType(typeof(PropertyAssociationModel), 200)]
[SwaggerOperation(Tags = new[] { "property" })]
public IActionResult GetPropertyAssociationsWithPid(string pid)
public IActionResult GetPropertyAssociationsWithId(long id)
{
var property = _pimsRepository.Property.GetAssociations(pid);
var property = _pimsRepository.Property.GetAssociations(id);

return new JsonResult(_mapper.Map<PropertyAssociationModel>(property));
}
#endregion

#region Concept Endpoints
/// <summary>
/// Get the property for the specified unique 'pid'.
/// Get the property for the specified unique 'id'.
/// </summary>
/// <returns></returns>
[HttpGet("concept/{pid}")]
[HttpGet("concept/{id}")]
[HasPermission(Permissions.PropertyView)]
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<Pims.Api.Models.Concepts.PropertyModel>), 200)]
[SwaggerOperation(Tags = new[] { "property" })]
public IActionResult GetConceptPropertyWithPid(string pid)
public IActionResult GetConceptPropertyWithId(long id)
{
var property = _pimsService.PropertyService.GetByPid(pid);
var property = _pimsService.PropertyService.GetById(id);
return new JsonResult(_mapper.Map<Pims.Api.Models.Concepts.PropertyModel>(property));
}

/// <summary>
/// Update the specified property, and attached properties.
/// </summary>
/// <returns></returns>
[HttpPut("concept/{pid}")]
[HttpPut("concept/{id}")]
[HasPermission(Permissions.PropertyEdit)]
[Produces("application/json")]
[ProducesResponseType(typeof(Pims.Api.Models.Concepts.PropertyModel), 200)]
Expand Down
2 changes: 1 addition & 1 deletion backend/api/Areas/Tools/Controllers/GeocoderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task<IActionResult> FindPidsAsync(Guid siteId)
/// <summary>
/// Make a request to Data BC Geocoder for the property that is the closest to the given lat/lng point.
/// </summary>
/// <param name="point">The lat/lng of the desired property.</param>
/// <param name="point">The lat/lng of the desired property in the format 'lng,lat'.</param>
/// <returns>A single address match.</returns>
[HttpGet("nearest")]
[Produces("application/json")]
Expand Down
30 changes: 26 additions & 4 deletions backend/api/Controllers/DocumentController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Threading.Tasks;
using MapsterMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -11,6 +11,9 @@
using Pims.Dal.Entities;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
using Concepts = Pims.Api.Models.Concepts;

namespace Pims.Api.Controllers
{
Expand All @@ -27,6 +30,7 @@ public class DocumentController : ControllerBase
#region Variables
private readonly IDocumentService _documentService;
private readonly IDocumentSyncService _documentSyncService;
private readonly IMapper _mapper;
#endregion

#region Constructors
Expand All @@ -35,10 +39,12 @@ public class DocumentController : ControllerBase
/// </summary>
/// <param name="documentService"></param>
/// <param name="documentSyncService"></param>
public DocumentController(IDocumentService documentService, IDocumentSyncService documentSyncService)
/// <param name="mapper"></param>
public DocumentController(IDocumentService documentService, IDocumentSyncService documentSyncService, IMapper mapper)
{
_documentService = documentService;
_documentSyncService = documentSyncService;
_mapper = mapper;
}
#endregion

Expand Down Expand Up @@ -91,9 +97,9 @@ public IActionResult DownloadFile(int documentId, int fileId)
[HasPermission(Permissions.PropertyAdd)]
[ProducesResponseType(typeof(ExternalResult<DocumentDetail>), 200)]
[SwaggerOperation(Tags = new[] { "documents" })]
public IActionResult UploadDocument([FromForm] int documentType, [FromForm] IFormFile file)
public async Task<IActionResult> UploadDocument([FromForm] int documentType, [FromForm] IFormFile file)
{
var result = _documentService.UploadDocument(documentType, file);
var result = await _documentService.UploadDocumentAsync(documentType, file);
return new JsonResult(result);
}

Expand Down Expand Up @@ -136,6 +142,22 @@ public async Task<IActionResult> SyncDocumentTypes()
return new JsonResult(result);
}

/// <summary>
/// Get the document types.
/// </summary>
/// <returns></returns>
[HttpGet("document-types")]
[HasPermission(Permissions.DocumentView)]
[Produces("application/json")]
[ProducesResponseType(typeof(List<Concepts.DocumentTypeModel>), 200)]
[SwaggerOperation(Tags = new[] { "document-types" })]
public IActionResult GetDocumentTypeItems()
{
var documentTypes = _documentService.GetPimsDocumentTypes();
var mappedDocumentTypes = _mapper.Map<List<Concepts.DocumentTypeModel>>(documentTypes);
return new JsonResult(mappedDocumentTypes);
}

#endregion
}
}
4 changes: 3 additions & 1 deletion backend/api/Controllers/LookupController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public IActionResult GetAll()
var volumeUnitTypes = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetPropertyVolumeUnitTypes());
var propertyVolumetricTypes = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetPropertyVolumetricTypes());
var pphStatusType = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetPPHStatusType());
var documentStatusTypes = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetDocumentStatusTypes());

var codes = new List<object>();
codes.AddRange(areaUnitTypes);
Expand Down Expand Up @@ -151,7 +152,8 @@ public IActionResult GetAll()
codes.AddRange(volumeUnitTypes);
codes.AddRange(propertyVolumetricTypes);
codes.AddRange(pphStatusType);

codes.AddRange(documentStatusTypes);

return new JsonResult(codes);
}
#endregion
Expand Down
7 changes: 7 additions & 0 deletions backend/api/Helpers/Middleware/ErrorHandlingMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ private async Task HandleExceptionAsync(HttpContext context, Exception ex)

_logger.LogError(ex, "Ltsa unhandled exception.");
}
else if (ex is AvException)
{
code = HttpStatusCode.BadRequest;
message = ex.Message;

_logger.LogError(ex, "clamav unhandled exception.");
}
else if (ex is HttpClientRequestException || ex is ProxyRequestException)
{
var exception = ex as HttpClientRequestException;
Expand Down
19 changes: 19 additions & 0 deletions backend/api/Models/Concepts/Document/DocumentMap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Mapster;
using Entity = Pims.Dal.Entities;

namespace Pims.Api.Models.Concepts.Document
{
public class DocumentMap : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<Entity.PimsDocument, DocumentModel>()
.PreserveReference(true)
.Map(dest => dest.Id, src => src.DocumentId)
.Map(dest => dest.DocumentType, src => src.DocumentType)
.Map(dest => dest.DocumentStatusTypeCode, src => src.DocumentStatusTypeCodeNavigation)
.Map(dest => dest.FileName, src => src.FileName)
.Map(dest => dest.RowVersion, src => src.ConcurrencyControlNumber);
}
}
}
33 changes: 33 additions & 0 deletions backend/api/Models/Concepts/Document/DocumentModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

namespace Pims.Api.Models.Concepts
{
/// <summary>
/// DocumentModel class, provides a model to represent document associated to entities.
/// </summary>
public class DocumentModel : BaseAppModel
{

#region Properties

/// <summary>
/// get/set - Document Id.
/// </summary>
public int Id { get; set; }

/// <summary>
/// get/set - Document Type.
/// </summary>
public DocumentTypeModel DocumentType { get; set; }

/// <summary>
/// get/set - The document status type.
/// </summary>
public TypeModel<string> DocumentStatusTypeCode { get; set; }

/// <summary>
/// get/set - Document/File Name.
/// </summary>
public string FileName { get; set; }
#endregion
}
}
17 changes: 17 additions & 0 deletions backend/api/Models/Concepts/Document/DocumentTypeMap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Mapster;
using Entity = Pims.Dal.Entities;

namespace Pims.Api.Models.Concepts.Document
{
public class DocumentTypeMap : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<Entity.PimsDocumentTyp, DocumentTypeModel>()
.PreserveReference(true)
.Map(dest => dest.Id, src => src.DocumentTypeId)
.Map(dest => dest.DocumentType, src => src.DocumentType)
.Inherits<Entity.IBaseAppEntity, BaseAppModel>();
}
}
}
Loading

0 comments on commit e11e368

Please sign in to comment.