Skip to content

Commit

Permalink
Merge branch 'dev' into features/psp-7598
Browse files Browse the repository at this point in the history
  • Loading branch information
FuriousLlama authored Feb 9, 2024
2 parents 9887e22 + b19f2f8 commit 58d9274
Show file tree
Hide file tree
Showing 30 changed files with 704 additions and 236 deletions.
4 changes: 2 additions & 2 deletions source/backend/api/Pims.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<UserSecretsId>0ef6255f-9ea0-49ec-8c65-c172304b4926</UserSecretsId>
<Version>5.0.0-73.19</Version>
<Version>5.0.0-73.19</Version>
<Version>5.0.0-73.22</Version>
<Version>5.0.0-73.22</Version>
<AssemblyVersion>5.0.0.73</AssemblyVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ProjectGuid>16BC0468-78F6-4C91-87DA-7403C919E646</ProjectGuid>
Expand Down
180 changes: 180 additions & 0 deletions source/backend/dal/Repositories/DispositionFileRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,186 @@ public LastUpdatedByModel GetLastUpdateBy(long id)
.ToList();
lastUpdatedByAggregate.AddRange(propertiesHistoryLastUpdatedBy);

// Disposition Sales
var salesLastUpdatedBy = this.Context.PimsDispositionSales.AsNoTracking()
.Where(dp => dp.DispositionFileId == id)
.Select(dp => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dp.AppLastUpdateUserid,
AppLastUpdateUserGuid = dp.AppLastUpdateUserGuid,
AppLastUpdateTimestamp = dp.AppLastUpdateTimestamp,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(salesLastUpdatedBy);

// Disposition Deleted Sales
var salesHistoryLastUpdatedBy = Context.PimsDispositionSaleHists.AsNoTracking()
.Where(dph => dph.DispositionFileId == id)
.Select(dph => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dph.AppLastUpdateUserid, // TODO: Update this once the DB tracks the user
AppLastUpdateUserGuid = dph.AppLastUpdateUserGuid, // TODO: Update this once the DB tracks the user
AppLastUpdateTimestamp = dph.EndDateHist ?? DateTime.UnixEpoch,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(salesHistoryLastUpdatedBy);

// Disposition Offers
var offerLastUpdatedBy = this.Context.PimsDispositionOffers.AsNoTracking()
.Where(dp => dp.DispositionFileId == id)
.Select(dp => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dp.AppLastUpdateUserid,
AppLastUpdateUserGuid = dp.AppLastUpdateUserGuid,
AppLastUpdateTimestamp = dp.AppLastUpdateTimestamp,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(offerLastUpdatedBy);

// Disposition Deleted Offers
var offerHistoryLastUpdatedBy = Context.PimsDispositionOfferHists.AsNoTracking()
.Where(dph => dph.DispositionFileId == id)
.Select(dph => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dph.AppLastUpdateUserid, // TODO: Update this once the DB tracks the user
AppLastUpdateUserGuid = dph.AppLastUpdateUserGuid, // TODO: Update this once the DB tracks the user
AppLastUpdateTimestamp = dph.EndDateHist ?? DateTime.UnixEpoch,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(offerHistoryLastUpdatedBy);

// Disposition Values
var valueLastUpdatedBy = this.Context.PimsDispositionAppraisals.AsNoTracking()
.Where(dp => dp.DispositionFileId == id)
.Select(dp => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dp.AppLastUpdateUserid,
AppLastUpdateUserGuid = dp.AppLastUpdateUserGuid,
AppLastUpdateTimestamp = dp.AppLastUpdateTimestamp,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(valueLastUpdatedBy);

// Disposition Deleted Values
var valueHistoryLastUpdatedBy = Context.PimsDispositionAppraisalHists.AsNoTracking()
.Where(dph => dph.DispositionFileId == id)
.Select(dph => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dph.AppLastUpdateUserid, // TODO: Update this once the DB tracks the user
AppLastUpdateUserGuid = dph.AppLastUpdateUserGuid, // TODO: Update this once the DB tracks the user
AppLastUpdateTimestamp = dph.EndDateHist ?? DateTime.UnixEpoch,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(valueHistoryLastUpdatedBy);

// Disposition Checklist
var checklistLastUpdatedBy = this.Context.PimsDispositionChecklistItems.AsNoTracking()
.Where(dp => dp.DispositionFileId == id)
.Select(dp => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dp.AppLastUpdateUserid,
AppLastUpdateUserGuid = dp.AppLastUpdateUserGuid,
AppLastUpdateTimestamp = dp.AppLastUpdateTimestamp,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(checklistLastUpdatedBy);

// Disposition Deleted Checklists
var checklistHistoryLastUpdatedBy = Context.PimsDispositionChecklistItemHists.AsNoTracking()
.Where(dph => dph.DispositionFileId == id)
.Select(dph => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dph.AppLastUpdateUserid, // TODO: Update this once the DB tracks the user
AppLastUpdateUserGuid = dph.AppLastUpdateUserGuid, // TODO: Update this once the DB tracks the user
AppLastUpdateTimestamp = dph.EndDateHist ?? DateTime.UnixEpoch,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(checklistHistoryLastUpdatedBy);

// Disposition Document
var documentLastUpdatedBy = this.Context.PimsDispositionFileDocuments.AsNoTracking()
.Where(dp => dp.DispositionFileId == id)
.Select(dp => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dp.AppLastUpdateUserid,
AppLastUpdateUserGuid = dp.AppLastUpdateUserGuid,
AppLastUpdateTimestamp = dp.AppLastUpdateTimestamp,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(documentLastUpdatedBy);

// Disposition Deleted Documents
var documentHistoryLastUpdatedBy = Context.PimsDispositionFileDocumentHists.AsNoTracking()
.Where(dph => dph.DispositionFileId == id)
.Select(dph => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dph.AppLastUpdateUserid, // TODO: Update this once the DB tracks the user
AppLastUpdateUserGuid = dph.AppLastUpdateUserGuid, // TODO: Update this once the DB tracks the user
AppLastUpdateTimestamp = dph.EndDateHist ?? DateTime.UnixEpoch,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(documentHistoryLastUpdatedBy);

// Disposition Notes
var notesLastUpdatedBy = this.Context.PimsDispositionFileNotes.AsNoTracking()
.Where(dp => dp.DispositionFileId == id)
.Select(dp => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dp.AppLastUpdateUserid,
AppLastUpdateUserGuid = dp.AppLastUpdateUserGuid,
AppLastUpdateTimestamp = dp.AppLastUpdateTimestamp,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(notesLastUpdatedBy);

// Disposition Deleted Notes
var notesHistoryLastUpdatedBy = Context.PimsDispositionFileNoteHists.AsNoTracking()
.Where(dph => dph.DispositionFileId == id)
.Select(dph => new LastUpdatedByModel()
{
ParentId = id,
AppLastUpdateUserid = dph.AppLastUpdateUserid, // TODO: Update this once the DB tracks the user
AppLastUpdateUserGuid = dph.AppLastUpdateUserGuid, // TODO: Update this once the DB tracks the user
AppLastUpdateTimestamp = dph.EndDateHist ?? DateTime.UnixEpoch,
})
.OrderByDescending(lu => lu.AppLastUpdateTimestamp)
.Take(1)
.ToList();
lastUpdatedByAggregate.AddRange(notesHistoryLastUpdatedBy);

return lastUpdatedByAggregate.OrderByDescending(x => x.AppLastUpdateTimestamp).FirstOrDefault();
}

Expand Down
2 changes: 1 addition & 1 deletion source/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "5.0.0-73.19",
"version": "5.0.0-73.22",
"private": true,
"dependencies": {
"@bcgov/bc-sans": "1.0.1",
Expand Down
Loading

0 comments on commit 58d9274

Please sign in to comment.