diff --git a/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs b/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs index 487f5a978e..8740c71857 100644 --- a/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs +++ b/source/backend/api/Areas/CompensationRequisition/Controllers/CompensationRequisitionController.cs @@ -229,22 +229,22 @@ public IActionResult GetCompensationRequisitionFinancials([FromRoute] long id) [HttpGet("{id:long}/payees")] [HasPermission(Permissions.CompensationRequisitionView)] [Produces("application/json")] - [ProducesResponseType(typeof(List), 200)] + [ProducesResponseType(typeof(List), 200)] [SwaggerOperation(Tags = new[] { "compensation-requisition" })] [TypeFilter(typeof(NullJsonResultFilter))] - public IActionResult GetCompensationRequisitionPayees([FromRoute] long id) + public IActionResult GetCompensationRequisitionAcquisitionPayees([FromRoute] long id) { _logger.LogInformation( "Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}", nameof(CompensationRequisitionController), - nameof(GetCompensationRequisitionPayees), + nameof(GetCompensationRequisitionAcquisitionPayees), User.GetUsername(), DateTime.Now); _logger.LogInformation("Dispatching to service: {Service}", _compensationRequisitionService.GetType()); - var compReqPayees = _compensationRequisitionService.GetCompensationRequisitionPayees(id); + var compReqPayees = _compensationRequisitionService.GetCompensationRequisitionAcquisitionPayees(id); - return new JsonResult(_mapper.Map>(compReqPayees)); + return new JsonResult(_mapper.Map>(compReqPayees)); } } } diff --git a/source/backend/api/Services/AcquisitionFileService.cs b/source/backend/api/Services/AcquisitionFileService.cs index 4e573872ef..7bc77a6180 100644 --- a/source/backend/api/Services/AcquisitionFileService.cs +++ b/source/backend/api/Services/AcquisitionFileService.cs @@ -859,14 +859,14 @@ private void ValidatePayeeDependency(PimsAcquisitionFile acquisitionFile) { var currentAcquisitionFile = _acqFileRepository.GetById(acquisitionFile.Internal_Id); var compensationRequisitions = _compensationRequisitionRepository.GetAllByAcquisitionFileId(acquisitionFile.Internal_Id); - var compReqPayees = compensationRequisitions.SelectMany(x => x.PimsCompReqPayees).ToList(); + var compReqAcqPayees = compensationRequisitions.SelectMany(x => x.PimsCompReqAcqPayees).ToList(); - if (compReqPayees.Count == 0) + if (compReqAcqPayees.Count == 0) { return; } - foreach (var payee in compReqPayees) + foreach (var payee in compReqAcqPayees) { // Check for Acquisition File Owner removed if (payee.AcquisitionOwnerId is not null @@ -898,14 +898,14 @@ private void ValidateInterestHoldersDependency(long acquisitionFileId, List x.PimsCompReqPayees).ToList(); + var compReqAcqPayees = compensationRequisitions.SelectMany(x => x.PimsCompReqAcqPayees).ToList(); - if (compReqPayees.Count == 0) + if (compReqAcqPayees.Count == 0) { return; } - foreach (var payee in compReqPayees) + foreach (var payee in compReqAcqPayees) { // Check for Interest Holder if (payee.InterestHolderId is not null diff --git a/source/backend/api/Services/CompensationRequisitionService.cs b/source/backend/api/Services/CompensationRequisitionService.cs index 1a7e2aba45..2d9e85f3c9 100644 --- a/source/backend/api/Services/CompensationRequisitionService.cs +++ b/source/backend/api/Services/CompensationRequisitionService.cs @@ -171,12 +171,12 @@ public IEnumerable GetCompensationRequisitionFinancials(lo return _compensationRequisitionRepository.GetCompensationRequisitionFinancials(compReqId); } - public IEnumerable GetCompensationRequisitionPayees(long compReqId) + public IEnumerable GetCompensationRequisitionAcquisitionPayees(long compReqId) { _logger.LogInformation("Getting compensations payees for id: {compReqId}", compReqId); _user.ThrowIfNotAuthorized(Permissions.CompensationRequisitionView); - return _compensationRequisitionRepository.GetCompensationRequisitionPayees(compReqId); + return _compensationRequisitionRepository.GetCompensationRequisitionAcquisitionPayees(compReqId); } private static string GetCompensationRequisitionStatusText(bool? isDraft) diff --git a/source/backend/api/Services/ICompensationRequisitionService.cs b/source/backend/api/Services/ICompensationRequisitionService.cs index d99d24979d..e55917febf 100644 --- a/source/backend/api/Services/ICompensationRequisitionService.cs +++ b/source/backend/api/Services/ICompensationRequisitionService.cs @@ -22,6 +22,6 @@ public interface ICompensationRequisitionService IEnumerable GetCompensationRequisitionFinancials(long compReqId); - IEnumerable GetCompensationRequisitionPayees(long compReqId); + IEnumerable GetCompensationRequisitionAcquisitionPayees(long compReqId); } } diff --git a/source/backend/api/Services/LeaseService.cs b/source/backend/api/Services/LeaseService.cs index e70f748e15..7ea1e8960a 100644 --- a/source/backend/api/Services/LeaseService.cs +++ b/source/backend/api/Services/LeaseService.cs @@ -768,17 +768,17 @@ private void ValidateStakeholdersDependency(long leaseId, IEnumerable x.Internal_Id.Equals(leaseStakeholderCompReq.LeaseStakeholderId)) - && currentLease.PimsLeaseStakeholders.Any(x => x.Internal_Id.Equals(leaseStakeholderCompReq.LeaseStakeholderId))) + if (!stakeholders.Any(x => x.Internal_Id.Equals(leasePayeeCompReq.LeaseStakeholderId)) + && currentLease.PimsLeaseStakeholders.Any(x => x.Internal_Id.Equals(leasePayeeCompReq.LeaseStakeholderId))) { throw new ForeignKeyDependencyException("Lease File Stakeholder can not be removed since it's assigned as a payee for a compensation requisition"); } diff --git a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqPayeeMap.cs b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqAcqPayeeMap.cs similarity index 79% rename from source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqPayeeMap.cs rename to source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqAcqPayeeMap.cs index 03d0cb3f08..d966c84f96 100644 --- a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqPayeeMap.cs +++ b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqAcqPayeeMap.cs @@ -4,12 +4,12 @@ namespace Pims.Api.Models.Concepts.CompensationRequisition { - public class CompReqPayeeMap : IRegister + public class CompReqAcqPayeeMap : IRegister { public void Register(TypeAdapterConfig config) { - config.NewConfig() - .Map(dest => dest.CompReqPayeeId, src => src.CompReqPayeeId) + config.NewConfig() + .Map(dest => dest.CompReqAcqPayeeId, src => src.CompReqAcqPayeeId) .Map(dest => dest.CompensationRequisitionId, src => src.CompensationRequisitionId) .Map(dest => dest.AcquisitionFileTeamId, src => src.AcquisitionFileTeamId) .Map(dest => dest.AcquisitionFileTeam, src => src.AcquisitionFileTeam) @@ -20,8 +20,8 @@ public void Register(TypeAdapterConfig config) .Map(dest => dest.LegacyPayee, src => src.LegacyPayee) .Inherits(); - config.NewConfig() - .Map(dest => dest.CompReqPayeeId, src => src.CompReqPayeeId) + config.NewConfig() + .Map(dest => dest.CompReqAcqPayeeId, src => src.CompReqAcqPayeeId) .Map(dest => dest.CompensationRequisitionId, src => src.CompensationRequisitionId) .Map(dest => dest.AcquisitionFileTeamId, src => src.AcquisitionFileTeamId) .Map(dest => dest.AcquisitionOwnerId, src => src.AcquisitionOwnerId) diff --git a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqPayeeModel.cs b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqAcqPayeeModel.cs similarity index 87% rename from source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqPayeeModel.cs rename to source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqAcqPayeeModel.cs index 654470d5ec..07fc69ff0c 100644 --- a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqPayeeModel.cs +++ b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqAcqPayeeModel.cs @@ -4,9 +4,9 @@ namespace Pims.Api.Models.Concepts.CompensationRequisition { - public class CompReqPayeeModel : BaseAuditModel + public class CompReqAcqPayeeModel : BaseAuditModel { - public long? CompReqPayeeId { get; set; } + public long? CompReqAcqPayeeId { get; set; } public long? CompensationRequisitionId { get; set; } diff --git a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeaseStakeholderMap.cs b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeasePayeeMap.cs similarity index 68% rename from source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeaseStakeholderMap.cs rename to source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeasePayeeMap.cs index 2041b4ff52..b05ef2ff0b 100644 --- a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeaseStakeholderMap.cs +++ b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeasePayeeMap.cs @@ -8,15 +8,15 @@ public class CompReqLeaseStakeholderMap : IRegister { public void Register(TypeAdapterConfig config) { - config.NewConfig() - .Map(dest => dest.CompReqLeaseStakeholderId, src => src.LeaseStakeholderCompReqId) + config.NewConfig() + .Map(dest => dest.CompReqLeasePayeeId, src => src.CompReqLeasePayeeId) .Map(dest => dest.CompensationRequisitionId, src => src.CompensationRequisitionId) .Map(dest => dest.LeaseStakeholderId, src => src.LeaseStakeholderId) .Map(dest => dest.LeaseStakeholder, src => src.LeaseStakeholder) .Inherits(); - config.NewConfig() - .Map(dest => dest.LeaseStakeholderCompReqId, src => src.CompReqLeaseStakeholderId) + config.NewConfig() + .Map(dest => dest.CompReqLeasePayeeId, src => src.CompReqLeasePayeeId) .Map(dest => dest.CompensationRequisitionId, src => src.CompensationRequisitionId) .Map(dest => dest.LeaseStakeholderId, src => src.LeaseStakeholderId) .Inherits(); diff --git a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeaseStakeholderModel.cs b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeasePayeeModel.cs similarity index 72% rename from source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeaseStakeholderModel.cs rename to source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeasePayeeModel.cs index c4a6905c85..fca2958a74 100644 --- a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeaseStakeholderModel.cs +++ b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompReqLeasePayeeModel.cs @@ -3,9 +3,9 @@ namespace Pims.Api.Models.Concepts.CompensationRequisition { - public class CompReqLeaseStakeholderModel : BaseAuditModel + public class CompReqLeasePayeeModel : BaseAuditModel { - public long? CompReqLeaseStakeholderId { get; set; } + public long? CompReqLeasePayeeId { get; set; } public long CompensationRequisitionId { get; set; } diff --git a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionMap.cs b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionMap.cs index e694b32687..ea531edd53 100644 --- a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionMap.cs +++ b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionMap.cs @@ -8,7 +8,8 @@ public class CompensationRequisitionMap : IRegister { public void Register(TypeAdapterConfig config) { - config.NewConfig() + config + .NewConfig() .Map(dest => dest.Id, src => src.CompensationRequisitionId) .Map(dest => dest.AcquisitionFileId, src => src.AcquisitionFileId) .Map(dest => dest.AcquisitionFile, src => src.AcquisitionFile) @@ -32,13 +33,14 @@ public void Register(TypeAdapterConfig config) .Map(dest => dest.DetailedRemarks, src => src.DetailedRemarks) .Map(dest => dest.AlternateProjectId, src => src.AlternateProjectId) .Map(dest => dest.AlternateProject, src => src.AlternateProject) - .Map(dest => dest.CompReqLeaseStakeholders, src => src.PimsLeaseStakeholderCompReqs) + //.Map(dest => dest.CompReqLeaseStakeholders, src => src.PimsLeaseStakeholderCompReqs) TODO: Needs fixing .Map(dest => dest.CompReqAcquisitionProperties, src => src.PimsPropAcqFlCompReqs) .Map(dest => dest.CompReqLeaseProperties, src => src.PimsPropLeaseCompReqs) - .Map(dest => dest.CompReqPayees, src => src.PimsCompReqPayees) + //.Map(dest => dest.CompReqPayees, src => src.PimsCompReqPayees) TODO: Needs fixing .Inherits(); - config.NewConfig() + config + .NewConfig() .Map(dest => dest.CompensationRequisitionId, src => src.Id) .Map(dest => dest.AcquisitionFileId, src => src.AcquisitionFileId) .Map(dest => dest.LeaseId, src => src.LeaseId) @@ -58,10 +60,10 @@ public void Register(TypeAdapterConfig config) .Map(dest => dest.DetailedRemarks, src => src.DetailedRemarks) .Map(dest => dest.AlternateProjectId, src => src.AlternateProjectId) .Map(dest => dest.AlternateProject, src => src.AlternateProject) - .Map(dest => dest.PimsLeaseStakeholderCompReqs, src => src.CompReqLeaseStakeholders) + //.Map(dest => dest.PimsLeaseStakeholderCompReqs, src => src.CompReqLeaseStakeholders) TODO: Needs fixing .Map(dest => dest.PimsPropAcqFlCompReqs, src => src.CompReqAcquisitionProperties) .Map(dest => dest.PimsPropLeaseCompReqs, src => src.CompReqLeaseProperties) - .Map(dest => dest.PimsCompReqPayees, src => src.CompReqPayees) + //.Map(dest => dest.PimsCompReqPayees, src => src.CompReqPayees) TODO: Needs fixing .Inherits(); } } diff --git a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionModel.cs b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionModel.cs index 5b2e6ed9c2..bb2892a34e 100644 --- a/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionModel.cs +++ b/source/backend/apimodels/Models/Concepts/CompensationRequisition/CompensationRequisitionModel.cs @@ -53,9 +53,9 @@ public class CompensationRequisitionModel : BaseAuditModel public ProjectModel AlternateProject { get; set; } - public IEnumerable CompReqPayees { get; set; } + public IEnumerable CompReqAcqPayees { get; set; } - public IEnumerable CompReqLeaseStakeholders { get; set; } + public IEnumerable CompReqLeasePayees { get; set; } public IEnumerable CompReqAcquisitionProperties { get; set; } diff --git a/source/backend/dal/Repositories/CompensationRequisitionRepository.cs b/source/backend/dal/Repositories/CompensationRequisitionRepository.cs index 067896c090..7df2ae451f 100644 --- a/source/backend/dal/Repositories/CompensationRequisitionRepository.cs +++ b/source/backend/dal/Repositories/CompensationRequisitionRepository.cs @@ -31,7 +31,7 @@ public IList GetAllByAcquisitionFileId(long acquisi { return Context.PimsCompensationRequisitions .Include(c => c.PimsCompReqFinancials) - .Include(p => p.PimsCompReqPayees) + .Include(p => p.PimsCompReqAcqPayees) .AsNoTracking() .Where(c => c.AcquisitionFileId == acquisitionFileId).ToList(); } @@ -40,7 +40,7 @@ public IList GetAllByLeaseFileId(long leaseFileId) { return Context.PimsCompensationRequisitions .Include(c => c.PimsCompReqFinancials) - .Include(c => c.PimsLeaseStakeholderCompReqs) + .Include(c => c.PimsCompReqLeasePayees) .AsNoTracking() .Where(c => c.LeaseId == leaseFileId).ToList(); } @@ -60,12 +60,12 @@ public PimsCompensationRequisition GetById(long compensationRequisitionId) .Include(x => x.Responsibility) .Include(c => c.PimsCompReqFinancials) .ThenInclude(y => y.FinancialActivityCode) - .Include(c => c.PimsCompReqPayees) + .Include(c => c.PimsCompReqAcqPayees) .Include(x => x.AlternateProject) - .Include(x => x.PimsLeaseStakeholderCompReqs) + .Include(x => x.PimsCompReqLeasePayees) .ThenInclude(y => y.LeaseStakeholder) .ThenInclude(z => z.LeaseStakeholderTypeCodeNavigation) - .Include(x => x.PimsLeaseStakeholderCompReqs) + .Include(x => x.PimsCompReqLeasePayees) .ThenInclude(y => y.LeaseStakeholder) .ThenInclude(z => z.LessorTypeCodeNavigation) .Include(x => x.PimsPropAcqFlCompReqs) @@ -89,8 +89,8 @@ public PimsCompensationRequisition Update(PimsCompensationRequisition compensati Context.UpdateChild(a => a.PimsCompReqFinancials, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsCompReqFinancials.ToArray(), true); Context.UpdateChild(a => a.PimsPropAcqFlCompReqs, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsPropAcqFlCompReqs.ToArray(), true); Context.UpdateChild(a => a.PimsPropLeaseCompReqs, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsPropLeaseCompReqs.ToArray(), true); - Context.UpdateChild(a => a.PimsLeaseStakeholderCompReqs, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsLeaseStakeholderCompReqs.ToArray(), true); - Context.UpdateChild(a => a.PimsCompReqPayees, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsCompReqPayees.ToArray(), true); + Context.UpdateChild(a => a.PimsCompReqLeasePayees, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsCompReqLeasePayees.ToArray(), true); + Context.UpdateChild(a => a.PimsCompReqLeasePayees, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsCompReqAcqPayees.ToArray(), true); return compensationRequisition; } @@ -101,8 +101,8 @@ public bool TryDelete(long compensationId) .Include(fa => fa.PimsCompReqFinancials) .Include(p => p.PimsPropAcqFlCompReqs) .Include(l => l.PimsPropLeaseCompReqs) - .Include(s => s.PimsLeaseStakeholderCompReqs) - .Include(ap => ap.PimsCompReqPayees) + .Include(s => s.PimsCompReqLeasePayees) + .Include(ap => ap.PimsCompReqAcqPayees) .AsNoTracking() .FirstOrDefault(c => c.CompensationRequisitionId == compensationId); @@ -123,14 +123,14 @@ public bool TryDelete(long compensationId) Context.PimsPropLeaseCompReqs.Remove(new PimsPropLeaseCompReq() { PropLeaseCompReqId = propLeaseFile.PropLeaseCompReqId }); } - foreach (var compReqLeaseStakeholder in deletedEntity.PimsLeaseStakeholderCompReqs) + foreach (var compReqLeaseStakeholder in deletedEntity.PimsCompReqLeasePayees) { - Context.PimsLeaseStakeholderCompReqs.Remove(new PimsLeaseStakeholderCompReq() { LeaseStakeholderCompReqId = compReqLeaseStakeholder.LeaseStakeholderCompReqId }); + Context.PimsCompReqLeasePayees.Remove(new PimsCompReqLeasePayee() { CompReqLeasePayeeId = compReqLeaseStakeholder.CompReqLeasePayeeId }); } - foreach (var compReqAcqPayee in deletedEntity.PimsCompReqPayees) + foreach (var compReqAcqPayee in deletedEntity.PimsCompReqAcqPayees) { - Context.PimsCompReqPayees.Remove(new() { CompReqPayeeId = compReqAcqPayee.CompReqPayeeId }); + Context.PimsCompReqAcqPayees.Remove(new() { CompReqAcqPayeeId = compReqAcqPayee.CompReqAcqPayeeId }); } Context.CommitTransaction(); // TODO: required to enforce delete order. Can be removed when cascade deletes are implemented. @@ -196,9 +196,9 @@ public IEnumerable GetCompensationRequisitionFinancials(lo .ToList(); } - public IEnumerable GetCompensationRequisitionPayees(long compReqId) + public IEnumerable GetCompensationRequisitionAcquisitionPayees(long compReqId) { - return Context.PimsCompReqPayees + return Context.PimsCompReqAcqPayees .AsNoTracking() .Include(x => x.AcquisitionOwner) .Include(x => x.AcquisitionFileTeam) diff --git a/source/backend/dal/Repositories/Interfaces/ICompensationRequisitionRepository.cs b/source/backend/dal/Repositories/Interfaces/ICompensationRequisitionRepository.cs index 0228966c6f..64e683f83d 100644 --- a/source/backend/dal/Repositories/Interfaces/ICompensationRequisitionRepository.cs +++ b/source/backend/dal/Repositories/Interfaces/ICompensationRequisitionRepository.cs @@ -23,6 +23,6 @@ public interface ICompensationRequisitionRepository : IRepository GetCompensationRequisitionFinancials(long compReqId); - IEnumerable GetCompensationRequisitionPayees(long compReqId); + IEnumerable GetCompensationRequisitionAcquisitionPayees(long compReqId); } } diff --git a/source/backend/entities/Partials/PimsCompReqAcqPayee.cs b/source/backend/entities/Partials/PimsCompReqAcqPayee.cs new file mode 100644 index 0000000000..ae7bcae1dc --- /dev/null +++ b/source/backend/entities/Partials/PimsCompReqAcqPayee.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace Pims.Dal.Entities +{ + + /// + /// PimsCompReqAcqPayee class, provides an entity for the datamodel to manage the relationship between Compensation Requisitions and the payee. + /// + public partial class PimsCompReqAcqPayee : StandardIdentityBaseAppEntity, IBaseAppEntity + { + [NotMapped] + public override long Internal_Id { get => CompReqAcqPayeeId; set => CompReqAcqPayeeId = value; } + } +} diff --git a/source/backend/entities/Partials/PimsCompReqLeasePayee.cs b/source/backend/entities/Partials/PimsCompReqLeasePayee.cs new file mode 100644 index 0000000000..4f4bbfc51e --- /dev/null +++ b/source/backend/entities/Partials/PimsCompReqLeasePayee.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace Pims.Dal.Entities +{ + + /// + /// PimsCompReqLeasePayee class, provides an entity for the datamodel to manage the relationship between Compensation Requisitions and the lease stakeholder. + /// + public partial class PimsCompReqLeasePayee : StandardIdentityBaseAppEntity, IBaseAppEntity + { + [NotMapped] + public override long Internal_Id { get => CompReqLeasePayeeId; set => CompReqLeasePayeeId = value; } + } +} diff --git a/source/backend/entities/Partials/PimsCompReqPayee.cs b/source/backend/entities/Partials/PimsCompReqPayee.cs deleted file mode 100644 index 13500ef14c..0000000000 --- a/source/backend/entities/Partials/PimsCompReqPayee.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - - /// - /// PimsCompReqPayee class, provides an entity for the datamodel to manage the relationship between Compensation Requisitions and the payee. - /// - public partial class PimsCompReqPayee : StandardIdentityBaseAppEntity, IBaseAppEntity - { - [NotMapped] - public override long Internal_Id { get => CompReqPayeeId; set => CompReqPayeeId = value; } - } -} diff --git a/source/backend/entities/Partials/PimsLeaseStakeholderCompReq.cs b/source/backend/entities/Partials/PimsLeaseStakeholderCompReq.cs deleted file mode 100644 index 6c698509d6..0000000000 --- a/source/backend/entities/Partials/PimsLeaseStakeholderCompReq.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace Pims.Dal.Entities -{ - - /// - /// PimsLeaseStakeholderCompReq class, provides an entity for the datamodel to manage the relationship between Compensation Requisitions and the lease stakeholder. - /// - public partial class PimsLeaseStakeholderCompReq : StandardIdentityBaseAppEntity, IBaseAppEntity - { - [NotMapped] - public override long Internal_Id { get => LeaseStakeholderCompReqId; set => LeaseStakeholderCompReqId = value; } - } -} diff --git a/source/backend/entities/PimsBaseContext.cs b/source/backend/entities/PimsBaseContext.cs index e2abd35a15..437bbb3624 100644 --- a/source/backend/entities/PimsBaseContext.cs +++ b/source/backend/entities/PimsBaseContext.cs @@ -112,11 +112,17 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsClaimHists { get; set; } + public virtual DbSet PimsCompReqAcqPayees { get; set; } + + public virtual DbSet PimsCompReqAcqPayeeHists { get; set; } + public virtual DbSet PimsCompReqFinancials { get; set; } public virtual DbSet PimsCompReqFinancialHists { get; set; } - public virtual DbSet PimsCompReqPayees { get; set; } + public virtual DbSet PimsCompReqLeasePayees { get; set; } + + public virtual DbSet PimsCompReqLeasePayeeHists { get; set; } public virtual DbSet PimsCompReqPayeeHists { get; set; } @@ -324,6 +330,10 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsLeaseLeasePurposeHists { get; set; } + public virtual DbSet PimsLeaseLicenseTeams { get; set; } + + public virtual DbSet PimsLeaseLicenseTeamHists { get; set; } + public virtual DbSet PimsLeaseLicenseTypes { get; set; } public virtual DbSet PimsLeaseNotes { get; set; } @@ -362,10 +372,6 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsLeaseStakeholders { get; set; } - public virtual DbSet PimsLeaseStakeholderCompReqs { get; set; } - - public virtual DbSet PimsLeaseStakeholderCompReqHists { get; set; } - public virtual DbSet PimsLeaseStakeholderHists { get; set; } public virtual DbSet PimsLeaseStakeholderTypes { get; set; } @@ -376,6 +382,8 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsLetterTypes { get; set; } + public virtual DbSet PimsLlTeamProfileTypes { get; set; } + public virtual DbSet PimsNotes { get; set; } public virtual DbSet PimsNoteHists { get; set; } @@ -1966,6 +1974,79 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CompReqAcqPayeeId).HasName("CRACQP_PK"); + + entity.ToTable("PIMS_COMP_REQ_ACQ_PAYEE", tb => + { + tb.HasComment("Table to support multiple payees on a compensation requisition."); + tb.HasTrigger("PIMS_CRACQP_A_S_IUD_TR"); + tb.HasTrigger("PIMS_CRACQP_I_S_I_TR"); + tb.HasTrigger("PIMS_CRACQP_I_S_U_TR"); + }); + + entity.Property(e => e.CompReqAcqPayeeId) + .HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMP_REQ_ACQ_PAYEE_ID_SEQ])") + .HasComment("Generated surrogate primary key."); + entity.Property(e => e.AcquisitionFileTeamId).HasComment("Foreign key reference to the PIMS_ACQUISITION_FILE_TEAM table."); + entity.Property(e => e.AcquisitionOwnerId).HasComment("Foreign key reference to the PIMS_ACQUISITION_OWNER table."); + entity.Property(e => e.AppCreateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the user created the record."); + entity.Property(e => e.AppCreateUserDirectory) + .HasDefaultValueSql("(user_name())") + .HasComment("The directory of the user account that created the record."); + entity.Property(e => e.AppCreateUserGuid).HasComment("The GUID of the user account that created the record."); + entity.Property(e => e.AppCreateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user account that created the record."); + entity.Property(e => e.AppLastUpdateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the user updated the record."); + entity.Property(e => e.AppLastUpdateUserDirectory) + .HasDefaultValueSql("(user_name())") + .HasComment("The directory of the user account that updated the record."); + entity.Property(e => e.AppLastUpdateUserGuid).HasComment("The GUID of the user account that updated the record."); + entity.Property(e => e.AppLastUpdateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user account that updated the record."); + entity.Property(e => e.CompensationRequisitionId).HasComment("Foreign key reference to the PIMS_COMPENSATION_REQUISITION table."); + entity.Property(e => e.ConcurrencyControlNumber) + .HasDefaultValue(1L) + .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o"); + entity.Property(e => e.DbCreateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the record was created."); + entity.Property(e => e.DbCreateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user or proxy account that created the record."); + entity.Property(e => e.DbLastUpdateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the record was created or last updated."); + entity.Property(e => e.DbLastUpdateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user or proxy account that created or last updated the record."); + entity.Property(e => e.InterestHolderId).HasComment("Foreign key reference to the PIMS_INTEREST_HOLDER table."); + entity.Property(e => e.LegacyPayee).HasComment("Payee where only the name is known from the PAIMS system,"); + + entity.HasOne(d => d.AcquisitionFileTeam).WithMany(p => p.PimsCompReqAcqPayees).HasConstraintName("PIM_ACQNTM_PIM_CRACQP_FK"); + + entity.HasOne(d => d.AcquisitionOwner).WithMany(p => p.PimsCompReqAcqPayees).HasConstraintName("PIM_ACQOWN_PIM_CRACQP_FK"); + + entity.HasOne(d => d.CompensationRequisition).WithMany(p => p.PimsCompReqAcqPayees).HasConstraintName("PIM_CMPREQ_PIM_CRACQP_FK"); + + entity.HasOne(d => d.InterestHolder).WithMany(p => p.PimsCompReqAcqPayees).HasConstraintName("PIM_INTHLD_PIM_CRACQP_FK"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CompReqAcqPayeeHistId).HasName("PIMS_CRACQP_H_PK"); + + entity.Property(e => e.CompReqAcqPayeeHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMP_REQ_ACQ_PAYEE_H_ID_SEQ])"); + entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.CompReqFinancialId).HasName("CRQFIN_PK"); @@ -2017,47 +2098,45 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { - entity.HasKey(e => e.CompReqPayeeId).HasName("CMPRQP_PK"); + entity.HasKey(e => e.CompReqLeasePayeeId).HasName("CRLESP_PK"); - entity.ToTable("PIMS_COMP_REQ_PAYEE", tb => + entity.ToTable("PIMS_COMP_REQ_LEASE_PAYEE", tb => { - tb.HasComment("Table to support multiple payees on a compensation requisition."); - tb.HasTrigger("PIMS_CMPRQP_A_S_IUD_TR"); - tb.HasTrigger("PIMS_CMPRQP_I_S_I_TR"); - tb.HasTrigger("PIMS_CMPRQP_I_S_U_TR"); + tb.HasComment("Desribes the relationship between a lease stakeholder and a compensation requisition."); + tb.HasTrigger("PIMS_CRLESP_A_S_IUD_TR"); + tb.HasTrigger("PIMS_CRLESP_I_S_I_TR"); + tb.HasTrigger("PIMS_CRLESP_I_S_U_TR"); }); - entity.Property(e => e.CompReqPayeeId) - .HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMP_REQ_PAYEE_ID_SEQ])") + entity.Property(e => e.CompReqLeasePayeeId) + .HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMP_REQ_LEASE_PAYEE_ID_SEQ])") .HasComment("Generated surrogate primary key."); - entity.Property(e => e.AcquisitionFileTeamId).HasComment("Foreign key reference to the PIMS_ACQUISITION_FILE_TEAM table."); - entity.Property(e => e.AcquisitionOwnerId).HasComment("Foreign key reference to the PIMS_ACQUISITION_OWNER table."); entity.Property(e => e.AppCreateTimestamp) .HasDefaultValueSql("(getutcdate())") - .HasComment("The date and time the user created the record."); + .HasComment("The date and time the record was created by the user."); entity.Property(e => e.AppCreateUserDirectory) .HasDefaultValueSql("(user_name())") - .HasComment("The directory of the user account that created the record."); - entity.Property(e => e.AppCreateUserGuid).HasComment("The GUID of the user account that created the record."); + .HasComment("User directory of the user that created the record."); + entity.Property(e => e.AppCreateUserGuid).HasComment("GUID of the user that created the record."); entity.Property(e => e.AppCreateUserid) .HasDefaultValueSql("(user_name())") - .HasComment("The user account that created the record."); + .HasComment("The user that created the record."); entity.Property(e => e.AppLastUpdateTimestamp) .HasDefaultValueSql("(getutcdate())") - .HasComment("The date and time the user updated the record."); + .HasComment("The date and time the record was updated by the user."); entity.Property(e => e.AppLastUpdateUserDirectory) .HasDefaultValueSql("(user_name())") - .HasComment("The directory of the user account that updated the record."); - entity.Property(e => e.AppLastUpdateUserGuid).HasComment("The GUID of the user account that updated the record."); + .HasComment("User directory of the user that updated the record."); + entity.Property(e => e.AppLastUpdateUserGuid).HasComment("GUID of the user that updated the record."); entity.Property(e => e.AppLastUpdateUserid) .HasDefaultValueSql("(user_name())") - .HasComment("The user account that updated the record."); - entity.Property(e => e.CompensationRequisitionId).HasComment("Foreign key reference to the PIMS_COMPENSATION_REQUISITION table."); + .HasComment("The user that updated the record."); + entity.Property(e => e.CompensationRequisitionId).HasComment("Foreign key to the PIMS_COMPENSATION_REQUISITION table."); entity.Property(e => e.ConcurrencyControlNumber) .HasDefaultValue(1L) - .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o"); + .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any"); entity.Property(e => e.DbCreateTimestamp) .HasDefaultValueSql("(getutcdate())") .HasComment("The date and time the record was created."); @@ -2070,16 +2149,24 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.DbLastUpdateUserid) .HasDefaultValueSql("(user_name())") .HasComment("The user or proxy account that created or last updated the record."); - entity.Property(e => e.InterestHolderId).HasComment("Foreign key reference to the PIMS_INTEREST_HOLDER table."); - entity.Property(e => e.LegacyPayee).HasComment("Payee where only the name is known from the PAIMS system,"); + entity.Property(e => e.LeaseLicenseTeamId).HasComment("Foreign key to the PIMS_LEASE_LICENSE_TEAM table."); + entity.Property(e => e.LeaseStakeholderId).HasComment("Foreign key to the LEASE_STAKEHOLDER table."); + + entity.HasOne(d => d.CompensationRequisition).WithMany(p => p.PimsCompReqLeasePayees) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("PIM_CMPREQ_PIM_CRLESP_FK"); - entity.HasOne(d => d.AcquisitionFileTeam).WithMany(p => p.PimsCompReqPayees).HasConstraintName("PIM_ACQNTM_PIM_CMPRQP_FK"); + entity.HasOne(d => d.LeaseLicenseTeam).WithMany(p => p.PimsCompReqLeasePayees).HasConstraintName("PIM_LSLITM_PIM_CRLESP_FK"); - entity.HasOne(d => d.AcquisitionOwner).WithMany(p => p.PimsCompReqPayees).HasConstraintName("PIM_ACQOWN_PIM_CMPRQP_FK"); + entity.HasOne(d => d.LeaseStakeholder).WithMany(p => p.PimsCompReqLeasePayees).HasConstraintName("PIM_LSTKHL_PIM_CRLESP_FK"); + }); - entity.HasOne(d => d.CompensationRequisition).WithMany(p => p.PimsCompReqPayees).HasConstraintName("PIM_CMPREQ_PIM_CMPRQP_FK"); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.CompReqLeasePayeeHistId).HasName("PIMS_CRLESP_H_PK"); - entity.HasOne(d => d.InterestHolder).WithMany(p => p.PimsCompReqPayees).HasConstraintName("PIM_INTHLD_PIM_CMPRQP_FK"); + entity.Property(e => e.CompReqLeasePayeeHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMP_REQ_LEASE_PAYEE_H_ID_SEQ])"); + entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); modelBuilder.Entity(entity => @@ -5342,6 +5429,85 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.LeaseLicenseTeamId).HasName("LSLITM_PK"); + + entity.ToTable("PIMS_LEASE_LICENSE_TEAM", tb => + { + tb.HasComment("Table containing lease and license team members."); + tb.HasTrigger("PIMS_LSLITM_A_S_IUD_TR"); + tb.HasTrigger("PIMS_LSLITM_I_S_I_TR"); + tb.HasTrigger("PIMS_LSLITM_I_S_U_TR"); + }); + + entity.Property(e => e.LeaseLicenseTeamId) + .HasDefaultValueSql("(NEXT VALUE FOR [PIMS_LEASE_LICENSE_TEAM_ID_SEQ])") + .HasComment("Generated surrogate primary key"); + entity.Property(e => e.AppCreateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the user created the record."); + entity.Property(e => e.AppCreateUserDirectory) + .HasDefaultValueSql("(user_name())") + .HasComment("The directory of the user account that created the record."); + entity.Property(e => e.AppCreateUserGuid).HasComment("The GUID of the user account that created the record."); + entity.Property(e => e.AppCreateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user account that created the record."); + entity.Property(e => e.AppLastUpdateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the user updated the record."); + entity.Property(e => e.AppLastUpdateUserDirectory) + .HasDefaultValueSql("(user_name())") + .HasComment("The directory of the user account that updated the record."); + entity.Property(e => e.AppLastUpdateUserGuid).HasComment("The GUID of the user account that updated the record."); + entity.Property(e => e.AppLastUpdateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user account that updated the record."); + entity.Property(e => e.ConcurrencyControlNumber) + .HasDefaultValue(1L) + .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o"); + entity.Property(e => e.DbCreateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the record was created."); + entity.Property(e => e.DbCreateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user or proxy account that created the record."); + entity.Property(e => e.DbLastUpdateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the record was created or last updated."); + entity.Property(e => e.DbLastUpdateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user or proxy account that created or last updated the record."); + entity.Property(e => e.LeaseId).HasComment("Foreign key to the PIMS_LEASE table."); + entity.Property(e => e.LlTeamProfileTypeCode).HasComment("Foreign key to the PIMS_LL_TEAM_PROFILE_TYPE table."); + entity.Property(e => e.OrganizationId).HasComment("Foreign key to the team member's organization (PIMS_ORGANIZATION)."); + entity.Property(e => e.PersonId).HasComment("Foreign key to the team member (PIMS_PERSON)."); + entity.Property(e => e.PrimaryContactId).HasComment("Foreign key to the primary contact for the organization (PIMS_PERSON)."); + + entity.HasOne(d => d.Lease).WithMany(p => p.PimsLeaseLicenseTeams) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("PIM_LEASE_PIM_LSLITM_FK"); + + entity.HasOne(d => d.LlTeamProfileTypeCodeNavigation).WithMany(p => p.PimsLeaseLicenseTeams) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("PIM_LLPRTY_PIM_LSLITM_FK"); + + entity.HasOne(d => d.Organization).WithMany(p => p.PimsLeaseLicenseTeams).HasConstraintName("PIM_ORG_PIM_LSLITM_FK"); + + entity.HasOne(d => d.Person).WithMany(p => p.PimsLeaseLicenseTeamPeople).HasConstraintName("PIM_PERSON_PIM_LSLITM_FK"); + + entity.HasOne(d => d.PrimaryContact).WithMany(p => p.PimsLeaseLicenseTeamPrimaryContacts).HasConstraintName("PIM_PERSON_PIM_LSLITM_PRIMARY_FK"); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.LeaseLicenseTeamHistId).HasName("PIMS_LSLITM_H_PK"); + + entity.Property(e => e.LeaseLicenseTeamHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_LEASE_LICENSE_TEAM_H_ID_SEQ])"); + entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.LeaseLicenseTypeCode).HasName("LELIST_PK"); @@ -5909,76 +6075,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.HasOne(d => d.PrimaryContact).WithMany(p => p.PimsLeaseStakeholderPrimaryContacts).HasConstraintName("PIM_PERSON_PIM_PRIMARY_CONTACT_FK"); }); - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.LeaseStakeholderCompReqId).HasName("LSKCRQ_PK"); - - entity.ToTable("PIMS_LEASE_STAKEHOLDER_COMP_REQ", tb => - { - tb.HasComment("Desribes the relationship between a lease stakeholder and a compensation requisition."); - tb.HasTrigger("PIMS_LSKCRQ_A_S_IUD_TR"); - tb.HasTrigger("PIMS_LSKCRQ_I_S_I_TR"); - tb.HasTrigger("PIMS_LSKCRQ_I_S_U_TR"); - }); - - entity.Property(e => e.LeaseStakeholderCompReqId) - .HasDefaultValueSql("(NEXT VALUE FOR [PIMS_LEASE_STAKEHOLDER_COMP_REQ_ID_SEQ])") - .HasComment("Generated surrogate primary key."); - entity.Property(e => e.AppCreateTimestamp) - .HasDefaultValueSql("(getutcdate())") - .HasComment("The date and time the record was created by the user."); - entity.Property(e => e.AppCreateUserDirectory) - .HasDefaultValueSql("(user_name())") - .HasComment("User directory of the user that created the record."); - entity.Property(e => e.AppCreateUserGuid).HasComment("GUID of the user that created the record."); - entity.Property(e => e.AppCreateUserid) - .HasDefaultValueSql("(user_name())") - .HasComment("The user that created the record."); - entity.Property(e => e.AppLastUpdateTimestamp) - .HasDefaultValueSql("(getutcdate())") - .HasComment("The date and time the record was updated by the user."); - entity.Property(e => e.AppLastUpdateUserDirectory) - .HasDefaultValueSql("(user_name())") - .HasComment("User directory of the user that updated the record."); - entity.Property(e => e.AppLastUpdateUserGuid).HasComment("GUID of the user that updated the record."); - entity.Property(e => e.AppLastUpdateUserid) - .HasDefaultValueSql("(user_name())") - .HasComment("The user that updated the record."); - entity.Property(e => e.CompensationRequisitionId).HasComment("Foreign key to the PIMS_COMPENSATION_REQUISITION table."); - entity.Property(e => e.ConcurrencyControlNumber) - .HasDefaultValue(1L) - .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any"); - entity.Property(e => e.DbCreateTimestamp) - .HasDefaultValueSql("(getutcdate())") - .HasComment("The date and time the record was created."); - entity.Property(e => e.DbCreateUserid) - .HasDefaultValueSql("(user_name())") - .HasComment("The user or proxy account that created the record."); - entity.Property(e => e.DbLastUpdateTimestamp) - .HasDefaultValueSql("(getutcdate())") - .HasComment("The date and time the record was created or last updated."); - entity.Property(e => e.DbLastUpdateUserid) - .HasDefaultValueSql("(user_name())") - .HasComment("The user or proxy account that created or last updated the record."); - entity.Property(e => e.LeaseStakeholderId).HasComment("Foreign key to the LEASE_STAKEHOLDER table."); - - entity.HasOne(d => d.CompensationRequisition).WithMany(p => p.PimsLeaseStakeholderCompReqs) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_CMPREQ_PIM_LSKCRQ_FK"); - - entity.HasOne(d => d.LeaseStakeholder).WithMany(p => p.PimsLeaseStakeholderCompReqs) - .OnDelete(DeleteBehavior.ClientSetNull) - .HasConstraintName("PIM_LSTKHL_PIM_LSKCRQ_FK"); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.LeaseStakeholderCompReqHistId).HasName("PIMS_LSKCRQ_H_PK"); - - entity.Property(e => e.LeaseStakeholderCompReqHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_LEASE_STAKEHOLDER_COMP_REQ_H_ID_SEQ])"); - entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); - }); - modelBuilder.Entity(entity => { entity.HasKey(e => e.LeaseStakeholderHistId).HasName("PIMS_LSTKHL_H_PK"); @@ -6094,6 +6190,38 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.IsDisabled).HasComment("Indicates if the code value is inactive."); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.LlTeamProfileTypeCode).HasName("LLPRTY_PK"); + + entity.ToTable("PIMS_LL_TEAM_PROFILE_TYPE", tb => + { + tb.HasComment("Codified values for the lease and license team profiles (roles)."); + tb.HasTrigger("PIMS_LLPRTY_I_S_I_TR"); + tb.HasTrigger("PIMS_LLPRTY_I_S_U_TR"); + }); + + entity.Property(e => e.LlTeamProfileTypeCode).HasComment("Code value of the lease and license profile (role)."); + entity.Property(e => e.ConcurrencyControlNumber) + .HasDefaultValue(1L) + .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o"); + entity.Property(e => e.DbCreateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the record was created."); + entity.Property(e => e.DbCreateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user or proxy account that created the record."); + entity.Property(e => e.DbLastUpdateTimestamp) + .HasDefaultValueSql("(getutcdate())") + .HasComment("The date and time the record was created or last updated."); + entity.Property(e => e.DbLastUpdateUserid) + .HasDefaultValueSql("(user_name())") + .HasComment("The user or proxy account that created or last updated the record."); + entity.Property(e => e.Description).HasComment("Description of the lease and license profile (role)."); + entity.Property(e => e.DisplayOrder).HasComment("Designates a preferred presentation order of the code descriptions."); + entity.Property(e => e.IsDisabled).HasComment("Indicates if the code value is inactive."); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.NoteId).HasName("NOTE_PK"); @@ -9543,16 +9671,25 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.HasSequence("PIMS_CLAIM_ID_SEQ") .HasMin(1L) .HasMax(2147483647L); + modelBuilder.HasSequence("PIMS_COMP_REQ_ACQ_PAYEE_H_ID_SEQ") + .HasMin(1L) + .HasMax(2147483647L); + modelBuilder.HasSequence("PIMS_COMP_REQ_ACQ_PAYEE_ID_SEQ") + .HasMin(1L) + .HasMax(2147483647L); modelBuilder.HasSequence("PIMS_COMP_REQ_FINANCIAL_H_ID_SEQ") .HasMin(1L) .HasMax(2147483647L); modelBuilder.HasSequence("PIMS_COMP_REQ_FINANCIAL_ID_SEQ") .HasMin(1L) .HasMax(2147483647L); - modelBuilder.HasSequence("PIMS_COMP_REQ_PAYEE_H_ID_SEQ") + modelBuilder.HasSequence("PIMS_COMP_REQ_LEASE_PAYEE_H_ID_SEQ") .HasMin(1L) .HasMax(2147483647L); - modelBuilder.HasSequence("PIMS_COMP_REQ_PAYEE_ID_SEQ") + modelBuilder.HasSequence("PIMS_COMP_REQ_LEASE_PAYEE_ID_SEQ") + .HasMin(1L) + .HasMax(2147483647L); + modelBuilder.HasSequence("PIMS_COMP_REQ_PAYEE_H_ID_SEQ") .HasMin(1L) .HasMax(2147483647L); modelBuilder.HasSequence("PIMS_COMPENSATION_REQUISITION_H_ID_SEQ") @@ -9786,6 +9923,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.HasSequence("PIMS_LEASE_LEASE_PURPOSE_ID_SEQ") .HasMin(1L) .HasMax(2147483647L); + modelBuilder.HasSequence("PIMS_LEASE_LICENSE_TEAM_H_ID_SEQ") + .HasMin(1L) + .HasMax(2147483647L); modelBuilder.HasSequence("PIMS_LEASE_LICENSE_TEAM_ID_SEQ") .HasMin(1L) .HasMax(2147483647L); diff --git a/source/backend/entities/ef/PimsAcquisitionFileTeam.cs b/source/backend/entities/ef/PimsAcquisitionFileTeam.cs index 0cab12f8ef..5dfa424cf1 100644 --- a/source/backend/entities/ef/PimsAcquisitionFileTeam.cs +++ b/source/backend/entities/ef/PimsAcquisitionFileTeam.cs @@ -115,7 +115,7 @@ public partial class PimsAcquisitionFileTeam public virtual PimsPerson Person { get; set; } [InverseProperty("AcquisitionFileTeam")] - public virtual ICollection PimsCompReqPayees { get; set; } = new List(); + public virtual ICollection PimsCompReqAcqPayees { get; set; } = new List(); [ForeignKey("PrimaryContactId")] [InverseProperty("PimsAcquisitionFileTeamPrimaryContacts")] diff --git a/source/backend/entities/ef/PimsAcquisitionOwner.cs b/source/backend/entities/ef/PimsAcquisitionOwner.cs index e75b4a012f..eace627931 100644 --- a/source/backend/entities/ef/PimsAcquisitionOwner.cs +++ b/source/backend/entities/ef/PimsAcquisitionOwner.cs @@ -158,7 +158,7 @@ public partial class PimsAcquisitionOwner public virtual PimsAddress Address { get; set; } [InverseProperty("AcquisitionOwner")] - public virtual ICollection PimsCompReqPayees { get; set; } = new List(); + public virtual ICollection PimsCompReqAcqPayees { get; set; } = new List(); [InverseProperty("AcquisitionOwner")] public virtual ICollection PimsExpropriationNotices { get; set; } = new List(); diff --git a/source/backend/entities/ef/PimsCompReqPayee.cs b/source/backend/entities/ef/PimsCompReqAcqPayee.cs similarity index 89% rename from source/backend/entities/ef/PimsCompReqPayee.cs rename to source/backend/entities/ef/PimsCompReqAcqPayee.cs index d0be1d7965..4fe1c75f70 100644 --- a/source/backend/entities/ef/PimsCompReqPayee.cs +++ b/source/backend/entities/ef/PimsCompReqAcqPayee.cs @@ -9,19 +9,19 @@ namespace Pims.Dal.Entities; /// /// Table to support multiple payees on a compensation requisition. /// -[Table("PIMS_COMP_REQ_PAYEE")] -[Index("AcquisitionFileTeamId", Name = "CMPRQP_ACQUISITION_FILE_TEAM_ID_IDX")] -[Index("AcquisitionOwnerId", Name = "CMPRQP_ACQUISITION_OWNER_ID_IDX")] -[Index("CompensationRequisitionId", Name = "CMPRQP_COMPENSATION_REQUISITION_ID_IDX")] -[Index("InterestHolderId", Name = "CMPRQP_INTEREST_HOLDER_ID_IDX")] -public partial class PimsCompReqPayee +[Table("PIMS_COMP_REQ_ACQ_PAYEE")] +[Index("AcquisitionFileTeamId", Name = "CRACQP_ACQUISITION_FILE_TEAM_ID_IDX")] +[Index("AcquisitionOwnerId", Name = "CRACQP_ACQUISITION_OWNER_ID_IDX")] +[Index("CompensationRequisitionId", Name = "CRACQP_COMPENSATION_REQUISITION_ID_IDX")] +[Index("InterestHolderId", Name = "CRACQP_INTEREST_HOLDER_ID_IDX")] +public partial class PimsCompReqAcqPayee { /// /// Generated surrogate primary key. /// [Key] - [Column("COMP_REQ_PAYEE_ID")] - public long CompReqPayeeId { get; set; } + [Column("COMP_REQ_ACQ_PAYEE_ID")] + public long CompReqAcqPayeeId { get; set; } /// /// Foreign key reference to the PIMS_COMPENSATION_REQUISITION table. @@ -145,18 +145,18 @@ public partial class PimsCompReqPayee public string DbLastUpdateUserid { get; set; } [ForeignKey("AcquisitionFileTeamId")] - [InverseProperty("PimsCompReqPayees")] + [InverseProperty("PimsCompReqAcqPayees")] public virtual PimsAcquisitionFileTeam AcquisitionFileTeam { get; set; } [ForeignKey("AcquisitionOwnerId")] - [InverseProperty("PimsCompReqPayees")] + [InverseProperty("PimsCompReqAcqPayees")] public virtual PimsAcquisitionOwner AcquisitionOwner { get; set; } [ForeignKey("CompensationRequisitionId")] - [InverseProperty("PimsCompReqPayees")] + [InverseProperty("PimsCompReqAcqPayees")] public virtual PimsCompensationRequisition CompensationRequisition { get; set; } [ForeignKey("InterestHolderId")] - [InverseProperty("PimsCompReqPayees")] + [InverseProperty("PimsCompReqAcqPayees")] public virtual PimsInterestHolder InterestHolder { get; set; } } diff --git a/source/backend/entities/ef/PimsCompReqAcqPayeeHist.cs b/source/backend/entities/ef/PimsCompReqAcqPayeeHist.cs new file mode 100644 index 0000000000..5aa7ddaeec --- /dev/null +++ b/source/backend/entities/ef/PimsCompReqAcqPayeeHist.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Pims.Dal.Entities; + +[Table("PIMS_COMP_REQ_ACQ_PAYEE_HIST")] +[Index("CompReqAcqPayeeHistId", "EndDateHist", Name = "PIMS_CRACQP_H_UK", IsUnique = true)] +public partial class PimsCompReqAcqPayeeHist +{ + [Key] + [Column("_COMP_REQ_ACQ_PAYEE_HIST_ID")] + public long CompReqAcqPayeeHistId { get; set; } + + [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] + public DateTime EffectiveDateHist { get; set; } + + [Column("END_DATE_HIST", TypeName = "datetime")] + public DateTime? EndDateHist { get; set; } + + [Column("COMP_REQ_ACQ_PAYEE_ID")] + public long CompReqAcqPayeeId { get; set; } + + [Column("COMPENSATION_REQUISITION_ID")] + public long? CompensationRequisitionId { get; set; } + + [Column("ACQUISITION_OWNER_ID")] + public long? AcquisitionOwnerId { get; set; } + + [Column("INTEREST_HOLDER_ID")] + public long? InterestHolderId { get; set; } + + [Column("ACQUISITION_FILE_TEAM_ID")] + public long? AcquisitionFileTeamId { get; set; } + + [Column("LEGACY_PAYEE")] + [StringLength(1000)] + public string LegacyPayee { get; set; } + + [Column("CONCURRENCY_CONTROL_NUMBER")] + public long ConcurrencyControlNumber { get; set; } + + [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime AppCreateTimestamp { get; set; } + + [Required] + [Column("APP_CREATE_USERID")] + [StringLength(30)] + public string AppCreateUserid { get; set; } + + [Column("APP_CREATE_USER_GUID")] + public Guid? AppCreateUserGuid { get; set; } + + [Required] + [Column("APP_CREATE_USER_DIRECTORY")] + [StringLength(30)] + public string AppCreateUserDirectory { get; set; } + + [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime AppLastUpdateTimestamp { get; set; } + + [Required] + [Column("APP_LAST_UPDATE_USERID")] + [StringLength(30)] + public string AppLastUpdateUserid { get; set; } + + [Column("APP_LAST_UPDATE_USER_GUID")] + public Guid? AppLastUpdateUserGuid { get; set; } + + [Required] + [Column("APP_LAST_UPDATE_USER_DIRECTORY")] + [StringLength(30)] + public string AppLastUpdateUserDirectory { get; set; } + + [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbCreateTimestamp { get; set; } + + [Required] + [Column("DB_CREATE_USERID")] + [StringLength(30)] + public string DbCreateUserid { get; set; } + + [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbLastUpdateTimestamp { get; set; } + + [Required] + [Column("DB_LAST_UPDATE_USERID")] + [StringLength(30)] + public string DbLastUpdateUserid { get; set; } +} diff --git a/source/backend/entities/ef/PimsLeaseStakeholderCompReq.cs b/source/backend/entities/ef/PimsCompReqLeasePayee.cs similarity index 82% rename from source/backend/entities/ef/PimsLeaseStakeholderCompReq.cs rename to source/backend/entities/ef/PimsCompReqLeasePayee.cs index 7083e498ae..fd5758f5a2 100644 --- a/source/backend/entities/ef/PimsLeaseStakeholderCompReq.cs +++ b/source/backend/entities/ef/PimsCompReqLeasePayee.cs @@ -9,30 +9,36 @@ namespace Pims.Dal.Entities; /// /// Desribes the relationship between a lease stakeholder and a compensation requisition. /// -[Table("PIMS_LEASE_STAKEHOLDER_COMP_REQ")] -[Index("CompensationRequisitionId", Name = "LSKCRQ_COMPENSATION_REQUISITION_ID_IDX")] -[Index("LeaseStakeholderId", Name = "LSKCRQ_LEASE_STAKEHOLDER_ID_IDX")] -[Index("LeaseStakeholderId", "CompensationRequisitionId", Name = "LSKCRQ_LS_TNT_COMP_REQ_IDX", IsUnique = true)] -public partial class PimsLeaseStakeholderCompReq +[Table("PIMS_COMP_REQ_LEASE_PAYEE")] +[Index("CompensationRequisitionId", Name = "CRLESP_COMPENSATION_REQUISITION_ID_IDX")] +[Index("LeaseLicenseTeamId", Name = "CRLESP_LEASE_LICENSE_TEAM_ID_IDX")] +[Index("LeaseStakeholderId", Name = "CRLESP_LEASE_STAKEHOLDER_ID_IDX")] +public partial class PimsCompReqLeasePayee { /// /// Generated surrogate primary key. /// [Key] - [Column("LEASE_STAKEHOLDER_COMP_REQ_ID")] - public long LeaseStakeholderCompReqId { get; set; } + [Column("COMP_REQ_LEASE_PAYEE_ID")] + public long CompReqLeasePayeeId { get; set; } + + /// + /// Foreign key to the PIMS_COMPENSATION_REQUISITION table. + /// + [Column("COMPENSATION_REQUISITION_ID")] + public long CompensationRequisitionId { get; set; } /// /// Foreign key to the LEASE_STAKEHOLDER table. /// [Column("LEASE_STAKEHOLDER_ID")] - public long LeaseStakeholderId { get; set; } + public long? LeaseStakeholderId { get; set; } /// - /// Foreign key to the PIMS_COMPENSATION_REQUISITION table. + /// Foreign key to the PIMS_LEASE_LICENSE_TEAM table. /// - [Column("COMPENSATION_REQUISITION_ID")] - public long CompensationRequisitionId { get; set; } + [Column("LEASE_LICENSE_TEAM_ID")] + public long? LeaseLicenseTeamId { get; set; } /// /// Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any @@ -125,10 +131,14 @@ public partial class PimsLeaseStakeholderCompReq public string DbLastUpdateUserid { get; set; } [ForeignKey("CompensationRequisitionId")] - [InverseProperty("PimsLeaseStakeholderCompReqs")] + [InverseProperty("PimsCompReqLeasePayees")] public virtual PimsCompensationRequisition CompensationRequisition { get; set; } + [ForeignKey("LeaseLicenseTeamId")] + [InverseProperty("PimsCompReqLeasePayees")] + public virtual PimsLeaseLicenseTeam LeaseLicenseTeam { get; set; } + [ForeignKey("LeaseStakeholderId")] - [InverseProperty("PimsLeaseStakeholderCompReqs")] + [InverseProperty("PimsCompReqLeasePayees")] public virtual PimsLeaseStakeholder LeaseStakeholder { get; set; } } diff --git a/source/backend/entities/ef/PimsLeaseStakeholderCompReqHist.cs b/source/backend/entities/ef/PimsCompReqLeasePayeeHist.cs similarity index 80% rename from source/backend/entities/ef/PimsLeaseStakeholderCompReqHist.cs rename to source/backend/entities/ef/PimsCompReqLeasePayeeHist.cs index 0244b79186..66e7571b4c 100644 --- a/source/backend/entities/ef/PimsLeaseStakeholderCompReqHist.cs +++ b/source/backend/entities/ef/PimsCompReqLeasePayeeHist.cs @@ -6,13 +6,13 @@ namespace Pims.Dal.Entities; -[Table("PIMS_LEASE_STAKEHOLDER_COMP_REQ_HIST")] -[Index("LeaseStakeholderCompReqHistId", "EndDateHist", Name = "PIMS_LSKCRQ_H_UK", IsUnique = true)] -public partial class PimsLeaseStakeholderCompReqHist +[Table("PIMS_COMP_REQ_LEASE_PAYEE_HIST")] +[Index("CompReqLeasePayeeHistId", "EndDateHist", Name = "PIMS_CRLESP_H_UK", IsUnique = true)] +public partial class PimsCompReqLeasePayeeHist { [Key] - [Column("_LEASE_STAKEHOLDER_COMP_REQ_HIST_ID")] - public long LeaseStakeholderCompReqHistId { get; set; } + [Column("_COMP_REQ_LEASE_PAYEE_HIST_ID")] + public long CompReqLeasePayeeHistId { get; set; } [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] public DateTime EffectiveDateHist { get; set; } @@ -20,15 +20,18 @@ public partial class PimsLeaseStakeholderCompReqHist [Column("END_DATE_HIST", TypeName = "datetime")] public DateTime? EndDateHist { get; set; } - [Column("LEASE_STAKEHOLDER_COMP_REQ_ID")] - public long LeaseStakeholderCompReqId { get; set; } - - [Column("LEASE_STAKEHOLDER_ID")] - public long LeaseStakeholderId { get; set; } + [Column("COMP_REQ_LEASE_PAYEE_ID")] + public long CompReqLeasePayeeId { get; set; } [Column("COMPENSATION_REQUISITION_ID")] public long CompensationRequisitionId { get; set; } + [Column("LEASE_STAKEHOLDER_ID")] + public long? LeaseStakeholderId { get; set; } + + [Column("LEASE_LICENSE_TEAM_ID")] + public long? LeaseLicenseTeamId { get; set; } + [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } diff --git a/source/backend/entities/ef/PimsCompReqPayeeHist.cs b/source/backend/entities/ef/PimsCompReqPayeeHist.cs index 4c67dc9916..1a3190a4d8 100644 --- a/source/backend/entities/ef/PimsCompReqPayeeHist.cs +++ b/source/backend/entities/ef/PimsCompReqPayeeHist.cs @@ -7,7 +7,6 @@ namespace Pims.Dal.Entities; [Table("PIMS_COMP_REQ_PAYEE_HIST")] -[Index("CompReqPayeeHistId", "EndDateHist", Name = "PIMS_CMPRQP_H_UK", IsUnique = true)] public partial class PimsCompReqPayeeHist { [Key] diff --git a/source/backend/entities/ef/PimsCompensationRequisition.cs b/source/backend/entities/ef/PimsCompensationRequisition.cs index a6a7a4ae2b..89a41e8002 100644 --- a/source/backend/entities/ef/PimsCompensationRequisition.cs +++ b/source/backend/entities/ef/PimsCompensationRequisition.cs @@ -232,13 +232,13 @@ public partial class PimsCompensationRequisition public virtual PimsLease Lease { get; set; } [InverseProperty("CompensationRequisition")] - public virtual ICollection PimsCompReqFinancials { get; set; } = new List(); + public virtual ICollection PimsCompReqAcqPayees { get; set; } = new List(); [InverseProperty("CompensationRequisition")] - public virtual ICollection PimsCompReqPayees { get; set; } = new List(); + public virtual ICollection PimsCompReqFinancials { get; set; } = new List(); [InverseProperty("CompensationRequisition")] - public virtual ICollection PimsLeaseStakeholderCompReqs { get; set; } = new List(); + public virtual ICollection PimsCompReqLeasePayees { get; set; } = new List(); [InverseProperty("CompensationRequisition")] public virtual ICollection PimsPropAcqFlCompReqs { get; set; } = new List(); diff --git a/source/backend/entities/ef/PimsInterestHolder.cs b/source/backend/entities/ef/PimsInterestHolder.cs index 85973becf4..1f07f2472e 100644 --- a/source/backend/entities/ef/PimsInterestHolder.cs +++ b/source/backend/entities/ef/PimsInterestHolder.cs @@ -122,7 +122,7 @@ public partial class PimsInterestHolder public virtual PimsPerson Person { get; set; } [InverseProperty("InterestHolder")] - public virtual ICollection PimsCompReqPayees { get; set; } = new List(); + public virtual ICollection PimsCompReqAcqPayees { get; set; } = new List(); [InverseProperty("InterestHolder")] public virtual ICollection PimsExpropriationNotices { get; set; } = new List(); diff --git a/source/backend/entities/ef/PimsLease.cs b/source/backend/entities/ef/PimsLease.cs index d4dcfdd61f..75196bc01f 100644 --- a/source/backend/entities/ef/PimsLease.cs +++ b/source/backend/entities/ef/PimsLease.cs @@ -441,6 +441,9 @@ public partial class PimsLease [InverseProperty("Lease")] public virtual ICollection PimsLeaseLeasePurposes { get; set; } = new List(); + [InverseProperty("Lease")] + public virtual ICollection PimsLeaseLicenseTeams { get; set; } = new List(); + [InverseProperty("Lease")] public virtual ICollection PimsLeaseNotes { get; set; } = new List(); diff --git a/source/backend/entities/ef/PimsLeaseLicenseTeam.cs b/source/backend/entities/ef/PimsLeaseLicenseTeam.cs new file mode 100644 index 0000000000..1e54409cf4 --- /dev/null +++ b/source/backend/entities/ef/PimsLeaseLicenseTeam.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Pims.Dal.Entities; + +/// +/// Table containing lease and license team members. +/// +[Table("PIMS_LEASE_LICENSE_TEAM")] +[Index("LeaseId", Name = "LSLITM_LEASE_ID_IDX")] +[Index("LeaseId", "LlTeamProfileTypeCode", Name = "LSLITM_LEASE_TEAM_PROFILE_TUC", IsUnique = true)] +[Index("OrganizationId", Name = "LSLITM_ORGANIZATION_ID_IDX")] +[Index("PersonId", Name = "LSLITM_PERSON_ID_IDX")] +[Index("PrimaryContactId", Name = "LSLITM_PRIMARY_CONTACT_ID_IDX")] +public partial class PimsLeaseLicenseTeam +{ + /// + /// Generated surrogate primary key + /// + [Key] + [Column("LEASE_LICENSE_TEAM_ID")] + public long LeaseLicenseTeamId { get; set; } + + /// + /// Foreign key to the PIMS_LEASE table. + /// + [Column("LEASE_ID")] + public long LeaseId { get; set; } + + /// + /// Foreign key to the team member (PIMS_PERSON). + /// + [Column("PERSON_ID")] + public long? PersonId { get; set; } + + /// + /// Foreign key to the team member's organization (PIMS_ORGANIZATION). + /// + [Column("ORGANIZATION_ID")] + public long? OrganizationId { get; set; } + + /// + /// Foreign key to the primary contact for the organization (PIMS_PERSON). + /// + [Column("PRIMARY_CONTACT_ID")] + public long? PrimaryContactId { get; set; } + + /// + /// Foreign key to the PIMS_LL_TEAM_PROFILE_TYPE table. + /// + [Required] + [Column("LL_TEAM_PROFILE_TYPE_CODE")] + [StringLength(20)] + public string LlTeamProfileTypeCode { get; set; } + + /// + /// Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o + /// + [Column("CONCURRENCY_CONTROL_NUMBER")] + public long ConcurrencyControlNumber { get; set; } + + /// + /// The date and time the user created the record. + /// + [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime AppCreateTimestamp { get; set; } + + /// + /// The user account that created the record. + /// + [Required] + [Column("APP_CREATE_USERID")] + [StringLength(30)] + public string AppCreateUserid { get; set; } + + /// + /// The GUID of the user account that created the record. + /// + [Column("APP_CREATE_USER_GUID")] + public Guid? AppCreateUserGuid { get; set; } + + /// + /// The directory of the user account that created the record. + /// + [Required] + [Column("APP_CREATE_USER_DIRECTORY")] + [StringLength(30)] + public string AppCreateUserDirectory { get; set; } + + /// + /// The date and time the user updated the record. + /// + [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime AppLastUpdateTimestamp { get; set; } + + /// + /// The user account that updated the record. + /// + [Required] + [Column("APP_LAST_UPDATE_USERID")] + [StringLength(30)] + public string AppLastUpdateUserid { get; set; } + + /// + /// The GUID of the user account that updated the record. + /// + [Column("APP_LAST_UPDATE_USER_GUID")] + public Guid? AppLastUpdateUserGuid { get; set; } + + /// + /// The directory of the user account that updated the record. + /// + [Required] + [Column("APP_LAST_UPDATE_USER_DIRECTORY")] + [StringLength(30)] + public string AppLastUpdateUserDirectory { get; set; } + + /// + /// The date and time the record was created. + /// + [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbCreateTimestamp { get; set; } + + /// + /// The user or proxy account that created the record. + /// + [Required] + [Column("DB_CREATE_USERID")] + [StringLength(30)] + public string DbCreateUserid { get; set; } + + /// + /// The date and time the record was created or last updated. + /// + [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbLastUpdateTimestamp { get; set; } + + /// + /// The user or proxy account that created or last updated the record. + /// + [Required] + [Column("DB_LAST_UPDATE_USERID")] + [StringLength(30)] + public string DbLastUpdateUserid { get; set; } + + [ForeignKey("LeaseId")] + [InverseProperty("PimsLeaseLicenseTeams")] + public virtual PimsLease Lease { get; set; } + + [ForeignKey("LlTeamProfileTypeCode")] + [InverseProperty("PimsLeaseLicenseTeams")] + public virtual PimsLlTeamProfileType LlTeamProfileTypeCodeNavigation { get; set; } + + [ForeignKey("OrganizationId")] + [InverseProperty("PimsLeaseLicenseTeams")] + public virtual PimsOrganization Organization { get; set; } + + [ForeignKey("PersonId")] + [InverseProperty("PimsLeaseLicenseTeamPeople")] + public virtual PimsPerson Person { get; set; } + + [InverseProperty("LeaseLicenseTeam")] + public virtual ICollection PimsCompReqLeasePayees { get; set; } = new List(); + + [ForeignKey("PrimaryContactId")] + [InverseProperty("PimsLeaseLicenseTeamPrimaryContacts")] + public virtual PimsPerson PrimaryContact { get; set; } +} diff --git a/source/backend/entities/ef/PimsLeaseLicenseTeamHist.cs b/source/backend/entities/ef/PimsLeaseLicenseTeamHist.cs new file mode 100644 index 0000000000..bd18e1b639 --- /dev/null +++ b/source/backend/entities/ef/PimsLeaseLicenseTeamHist.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Pims.Dal.Entities; + +[Table("PIMS_LEASE_LICENSE_TEAM_HIST")] +[Index("LeaseLicenseTeamHistId", "EndDateHist", Name = "PIMS_LSLITM_H_UK", IsUnique = true)] +public partial class PimsLeaseLicenseTeamHist +{ + [Key] + [Column("_LEASE_LICENSE_TEAM_HIST_ID")] + public long LeaseLicenseTeamHistId { get; set; } + + [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")] + public DateTime EffectiveDateHist { get; set; } + + [Column("END_DATE_HIST", TypeName = "datetime")] + public DateTime? EndDateHist { get; set; } + + [Column("LEASE_LICENSE_TEAM_ID")] + public long LeaseLicenseTeamId { get; set; } + + [Column("LEASE_ID")] + public long LeaseId { get; set; } + + [Column("PERSON_ID")] + public long? PersonId { get; set; } + + [Column("ORGANIZATION_ID")] + public long? OrganizationId { get; set; } + + [Column("PRIMARY_CONTACT_ID")] + public long? PrimaryContactId { get; set; } + + [Required] + [Column("LL_TEAM_PROFILE_TYPE_CODE")] + [StringLength(20)] + public string LlTeamProfileTypeCode { get; set; } + + [Column("CONCURRENCY_CONTROL_NUMBER")] + public long ConcurrencyControlNumber { get; set; } + + [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime AppCreateTimestamp { get; set; } + + [Required] + [Column("APP_CREATE_USERID")] + [StringLength(30)] + public string AppCreateUserid { get; set; } + + [Column("APP_CREATE_USER_GUID")] + public Guid? AppCreateUserGuid { get; set; } + + [Required] + [Column("APP_CREATE_USER_DIRECTORY")] + [StringLength(30)] + public string AppCreateUserDirectory { get; set; } + + [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime AppLastUpdateTimestamp { get; set; } + + [Required] + [Column("APP_LAST_UPDATE_USERID")] + [StringLength(30)] + public string AppLastUpdateUserid { get; set; } + + [Column("APP_LAST_UPDATE_USER_GUID")] + public Guid? AppLastUpdateUserGuid { get; set; } + + [Required] + [Column("APP_LAST_UPDATE_USER_DIRECTORY")] + [StringLength(30)] + public string AppLastUpdateUserDirectory { get; set; } + + [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbCreateTimestamp { get; set; } + + [Required] + [Column("DB_CREATE_USERID")] + [StringLength(30)] + public string DbCreateUserid { get; set; } + + [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbLastUpdateTimestamp { get; set; } + + [Required] + [Column("DB_LAST_UPDATE_USERID")] + [StringLength(30)] + public string DbLastUpdateUserid { get; set; } +} diff --git a/source/backend/entities/ef/PimsLeaseStakeholder.cs b/source/backend/entities/ef/PimsLeaseStakeholder.cs index 57039f9572..73848ce2c5 100644 --- a/source/backend/entities/ef/PimsLeaseStakeholder.cs +++ b/source/backend/entities/ef/PimsLeaseStakeholder.cs @@ -124,7 +124,7 @@ public partial class PimsLeaseStakeholder public virtual PimsPerson Person { get; set; } [InverseProperty("LeaseStakeholder")] - public virtual ICollection PimsLeaseStakeholderCompReqs { get; set; } = new List(); + public virtual ICollection PimsCompReqLeasePayees { get; set; } = new List(); [ForeignKey("PrimaryContactId")] [InverseProperty("PimsLeaseStakeholderPrimaryContacts")] diff --git a/source/backend/entities/ef/PimsLlTeamProfileType.cs b/source/backend/entities/ef/PimsLlTeamProfileType.cs new file mode 100644 index 0000000000..3044c68ac6 --- /dev/null +++ b/source/backend/entities/ef/PimsLlTeamProfileType.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Pims.Dal.Entities; + +/// +/// Codified values for the lease and license team profiles (roles). +/// +[Table("PIMS_LL_TEAM_PROFILE_TYPE")] +public partial class PimsLlTeamProfileType +{ + /// + /// Code value of the lease and license profile (role). + /// + [Key] + [Column("LL_TEAM_PROFILE_TYPE_CODE")] + [StringLength(20)] + public string LlTeamProfileTypeCode { get; set; } + + /// + /// Description of the lease and license profile (role). + /// + [Required] + [Column("DESCRIPTION")] + [StringLength(200)] + public string Description { get; set; } + + /// + /// Indicates if the code value is inactive. + /// + [Column("IS_DISABLED")] + public bool IsDisabled { get; set; } + + /// + /// Designates a preferred presentation order of the code descriptions. + /// + [Column("DISPLAY_ORDER")] + public int? DisplayOrder { get; set; } + + /// + /// Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o + /// + [Column("CONCURRENCY_CONTROL_NUMBER")] + public long ConcurrencyControlNumber { get; set; } + + /// + /// The date and time the record was created. + /// + [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbCreateTimestamp { get; set; } + + /// + /// The user or proxy account that created the record. + /// + [Required] + [Column("DB_CREATE_USERID")] + [StringLength(30)] + public string DbCreateUserid { get; set; } + + /// + /// The date and time the record was created or last updated. + /// + [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbLastUpdateTimestamp { get; set; } + + /// + /// The user or proxy account that created or last updated the record. + /// + [Required] + [Column("DB_LAST_UPDATE_USERID")] + [StringLength(30)] + public string DbLastUpdateUserid { get; set; } + + [InverseProperty("LlTeamProfileTypeCodeNavigation")] + public virtual ICollection PimsLeaseLicenseTeams { get; set; } = new List(); +} diff --git a/source/backend/entities/ef/PimsOrganization.cs b/source/backend/entities/ef/PimsOrganization.cs index d274254545..35bd577d5c 100644 --- a/source/backend/entities/ef/PimsOrganization.cs +++ b/source/backend/entities/ef/PimsOrganization.cs @@ -165,6 +165,9 @@ public partial class PimsOrganization [InverseProperty("Organization")] public virtual ICollection PimsLeaseConsultations { get; set; } = new List(); + [InverseProperty("Organization")] + public virtual ICollection PimsLeaseLicenseTeams { get; set; } = new List(); + [InverseProperty("Organization")] public virtual ICollection PimsLeaseStakeholders { get; set; } = new List(); diff --git a/source/backend/entities/ef/PimsPerson.cs b/source/backend/entities/ef/PimsPerson.cs index aaf7072146..8ed9cdbeaf 100644 --- a/source/backend/entities/ef/PimsPerson.cs +++ b/source/backend/entities/ef/PimsPerson.cs @@ -151,6 +151,12 @@ public partial class PimsPerson [InverseProperty("PrimaryContact")] public virtual ICollection PimsLeaseConsultationPrimaryContacts { get; set; } = new List(); + [InverseProperty("Person")] + public virtual ICollection PimsLeaseLicenseTeamPeople { get; set; } = new List(); + + [InverseProperty("PrimaryContact")] + public virtual ICollection PimsLeaseLicenseTeamPrimaryContacts { get; set; } = new List(); + [InverseProperty("Person")] public virtual ICollection PimsLeaseStakeholderPeople { get; set; } = new List(); diff --git a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs index 36bd312545..14b8932543 100644 --- a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs +++ b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs @@ -1074,9 +1074,9 @@ public void Update_Exception_Removed_AcqFileOwner() new PimsCompensationRequisition() { CompensationRequisitionId = 1, AcquisitionFileId = acqFile.Internal_Id, - PimsCompReqPayees = new List() + PimsCompReqAcqPayees = new List() { - new PimsCompReqPayee() + new PimsCompReqAcqPayee() { AcquisitionOwnerId = 100, }, @@ -1129,9 +1129,9 @@ public void Update_FKException_Removed_OwnerSolicitor() new PimsCompensationRequisition() { CompensationRequisitionId = 1, AcquisitionFileId = acqFile.Internal_Id, - PimsCompReqPayees = new List() + PimsCompReqAcqPayees = new List() { - new PimsCompReqPayee() + new PimsCompReqAcqPayee() { InterestHolderId = 100, }, @@ -1184,9 +1184,9 @@ public void Update_FKException_Removed_OwnerRepresentative() new PimsCompensationRequisition() { CompensationRequisitionId = 1, AcquisitionFileId = acqFile.Internal_Id, - PimsCompReqPayees = new List() + PimsCompReqAcqPayees = new List() { - new PimsCompReqPayee() + new PimsCompReqAcqPayee() { InterestHolderId = 100, }, @@ -1238,9 +1238,9 @@ public void Update_FKException_Removed_PersonOfInterest() new PimsCompensationRequisition() { CompensationRequisitionId = 1, AcquisitionFileId = acqFile.Internal_Id, - PimsCompReqPayees = new List() + PimsCompReqAcqPayees = new List() { - new PimsCompReqPayee() + new PimsCompReqAcqPayee() { AcquisitionFileTeamId = 100, }, @@ -2659,9 +2659,9 @@ public void UpdateInterestHolders_FKExeption_Removed_InterestHolder() new PimsCompensationRequisition() { CompensationRequisitionId = 1, AcquisitionFileId = acqFile.Internal_Id, - PimsCompReqPayees = new List() + PimsCompReqAcqPayees = new List() { - new PimsCompReqPayee() + new PimsCompReqAcqPayee() { InterestHolderId = 100, }, diff --git a/source/backend/tests/unit/dal/Repositories/CompensationRequisitionRepositoryTest.cs b/source/backend/tests/unit/dal/Repositories/CompensationRequisitionRepositoryTest.cs index a60634b24f..8e71dc5809 100644 --- a/source/backend/tests/unit/dal/Repositories/CompensationRequisitionRepositoryTest.cs +++ b/source/backend/tests/unit/dal/Repositories/CompensationRequisitionRepositoryTest.cs @@ -240,7 +240,7 @@ public void DeleteCompensationRequisition_CascadeDelete_SubEntities_ACQUISITION( } }); - compReq.PimsCompReqPayees.Add( + compReq.PimsCompReqAcqPayees.Add( new() { Internal_Id = 1, @@ -261,7 +261,7 @@ public void DeleteCompensationRequisition_CascadeDelete_SubEntities_ACQUISITION( context.PimsCompensationRequisitions.Should().BeEmpty(); context.PimsCompReqFinancials.Should().BeEmpty(); context.PimsPropAcqFlCompReqs.Should().BeEmpty(); - context.PimsCompReqPayees.Should().BeEmpty(); + context.PimsCompReqAcqPayees.Should().BeEmpty(); } [Fact] @@ -297,7 +297,7 @@ public void DeleteCompensationRequisition_CascadeDelete_SubEntities_LEASE() } }); - compReq.PimsLeaseStakeholderCompReqs.Add( + compReq.PimsCompReqLeasePayees.Add( new() { Internal_Id = 1, @@ -318,7 +318,7 @@ public void DeleteCompensationRequisition_CascadeDelete_SubEntities_LEASE() context.PimsCompensationRequisitions.Should().BeEmpty(); context.PimsCompReqFinancials.Should().BeEmpty(); context.PimsPropLeaseCompReqs.Should().BeEmpty(); - context.PimsLeaseStakeholderCompReqs.Should().BeEmpty(); + context.PimsCompReqLeasePayees.Should().BeEmpty(); } [Fact] @@ -427,7 +427,7 @@ public void GetCompensationRequisitionFinancials_Success() public void GetCompensationRequisitionPayees_Success() { // Arrange - PimsCompReqPayee[] payees = + PimsCompReqAcqPayee[] payees = { new () { @@ -442,14 +442,14 @@ public void GetCompensationRequisitionPayees_Success() }; var repository = CreateWithPermissions(Permissions.CompensationRequisitionView); - _helper.AddAndSaveChanges(payees); + _helper.AddAndSaveChanges(payees); // Act - var result = repository.GetCompensationRequisitionPayees(1); + var result = repository.GetCompensationRequisitionAcquisitionPayees(1); // Assert result.Should().NotBeNull(); - result.Should().BeAssignableTo>(); + result.Should().BeAssignableTo>(); result.Should().HaveCount(2); result.First().CompensationRequisitionId.Should().Be(1); }