This commit is contained in:
@@ -252,6 +252,41 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GET ANCESTOR
|
||||
//
|
||||
internal static async Task<AyaTypeId> GetAncestor(AyaType ayType, long id, AyContext ct)
|
||||
{
|
||||
//Note: there could be rules checking here in future, i.e. can only get own workorder or something
|
||||
//if so, then need to implement AddError and in route handle Null return with Error check just like PUT route does now
|
||||
|
||||
//https://docs.microsoft.com/en-us/ef/core/querying/related-data
|
||||
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
|
||||
var ret =
|
||||
await ct.WorkOrder
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.Expenses)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.Labors)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.Loans)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.Parts)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.PartRequests)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.ScheduledUsers)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.Tasks)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.Travels)
|
||||
.Include(w => w.Items)
|
||||
.ThenInclude(wi => wi.Units)
|
||||
.SingleOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async Task WorkOrderSearchIndexAsync(WorkOrder obj, bool isNew)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user