style(backend): format changed architecture files

This commit is contained in:
Alexandre Brandizzi 2026-07-24 12:13:51 -03:00
parent f6e71edd00
commit ce7d612ac9
5 changed files with 75 additions and 75 deletions

View file

@ -55,9 +55,9 @@ namespace SeaHaven.DataServices.Implementation
} }
public async Task<(IEnumerable<Dispatch> Items, int TotalCount)> GetPagedAsync( public async Task<(IEnumerable<Dispatch> Items, int TotalCount)> GetPagedAsync(
int page, int page,
int pageSize, int pageSize,
string? search = null, string? search = null,
string? status = null) string? status = null)
{ {
var query = _context.Dispatches.AsQueryable(); var query = _context.Dispatches.AsQueryable();
@ -414,22 +414,22 @@ namespace SeaHaven.DataServices.Implementation
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
var rawComments = await (from c in _context.Comments var rawComments = await (from c in _context.Comments
where c.DispatchId == id && (c.IsDeleted == null || c.IsDeleted == false) where c.DispatchId == id && (c.IsDeleted == null || c.IsDeleted == false)
join u in _context.Users on c.UserId equals u.Id into users join u in _context.Users on c.UserId equals u.Id into users
from u in users.DefaultIfEmpty() from u in users.DefaultIfEmpty()
orderby c.CreatedDate orderby c.CreatedDate
select new select new
{ {
c.Id, c.Id,
c.Commenttext, c.Commenttext,
c.Commenter, c.Commenter,
c.CommentType, c.CommentType,
c.RecordType, c.RecordType,
c.CreatedDate, c.CreatedDate,
c.UserId, c.UserId,
UserFirstName = u != null ? u.FirstName : null, UserFirstName = u != null ? u.FirstName : null,
UserLastName = u != null ? u.LastName : null UserLastName = u != null ? u.LastName : null
}) })
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
var comments = rawComments.Select(c => new DispatchCommentDTO var comments = rawComments.Select(c => new DispatchCommentDTO
@ -446,25 +446,25 @@ namespace SeaHaven.DataServices.Implementation
}).ToList(); }).ToList();
var rawUplifts = await (from u in _context.DispatchUpliftRequests var rawUplifts = await (from u in _context.DispatchUpliftRequests
where u.DispatchId == id && (u.IsDeleted == null || u.IsDeleted == false) where u.DispatchId == id && (u.IsDeleted == null || u.IsDeleted == false)
join dec in _context.Users on u.DecidedByUserId equals dec.Id into decs join dec in _context.Users on u.DecidedByUserId equals dec.Id into decs
from dec in decs.DefaultIfEmpty() from dec in decs.DefaultIfEmpty()
orderby u.CreatedDate descending orderby u.CreatedDate descending
select new select new
{ {
u.Id, u.Id,
u.CurrentNTE, u.CurrentNTE,
u.RequestedNTE, u.RequestedNTE,
u.VendorReason, u.VendorReason,
u.Status, u.Status,
u.RequiredTier, u.RequiredTier,
u.RequestedByVendorName, u.RequestedByVendorName,
RequestedAt = u.CreatedDate, RequestedAt = u.CreatedDate,
u.DecidedAt, u.DecidedAt,
u.DecisionNote, u.DecisionNote,
DecidedByFirstName = dec != null ? dec.FirstName : null, DecidedByFirstName = dec != null ? dec.FirstName : null,
DecidedByLastName = dec != null ? dec.LastName : null DecidedByLastName = dec != null ? dec.LastName : null
}) })
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
var upliftRequests = rawUplifts.Select(u => new DispatchUpliftRequestDTO var upliftRequests = rawUplifts.Select(u => new DispatchUpliftRequestDTO
@ -488,24 +488,24 @@ namespace SeaHaven.DataServices.Implementation
var workOrderIds = linkedWOs.Select(l => l.WorkOrderId).Where(wid => wid > 0).ToList(); var workOrderIds = linkedWOs.Select(l => l.WorkOrderId).Where(wid => wid > 0).ToList();
var rawAudit = await (from a in _context.WorkOrderAuditLogs var rawAudit = await (from a in _context.WorkOrderAuditLogs
where workOrderIds.Contains(a.WorkOrderId) where workOrderIds.Contains(a.WorkOrderId)
&& a.FieldName != null && a.FieldName != null
&& a.FieldName.Contains(dispatchNumber) && a.FieldName.Contains(dispatchNumber)
join u in _context.Users on a.UserId equals u.Id into users join u in _context.Users on a.UserId equals u.Id into users
from u in users.DefaultIfEmpty() from u in users.DefaultIfEmpty()
orderby a.CreatedAt descending orderby a.CreatedAt descending
select new select new
{ {
a.Id, a.Id,
a.Action, a.Action,
a.FieldName, a.FieldName,
a.OldValue, a.OldValue,
a.NewValue, a.NewValue,
a.CreatedAt, a.CreatedAt,
a.UserId, a.UserId,
UserFirstName = u != null ? u.FirstName : null, UserFirstName = u != null ? u.FirstName : null,
UserLastName = u != null ? u.LastName : null UserLastName = u != null ? u.LastName : null
}) })
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
var auditLog = rawAudit.Select(a => new DispatchAuditLogDTO var auditLog = rawAudit.Select(a => new DispatchAuditLogDTO

View file

@ -37,16 +37,16 @@ namespace SeaHaven.DataServices.Implementation
} }
public async Task<(IEnumerable<Locations> Items, int TotalCount)> GetPagedAsync( public async Task<(IEnumerable<Locations> Items, int TotalCount)> GetPagedAsync(
int page, int page,
int pageSize, int pageSize,
string? search = null) string? search = null)
{ {
var query = _context.Locations.AsQueryable(); var query = _context.Locations.AsQueryable();
if (!string.IsNullOrWhiteSpace(search)) if (!string.IsNullOrWhiteSpace(search))
{ {
query = query.Where(l => query = query.Where(l =>
l.Name!.Contains(search) || l.Name!.Contains(search) ||
l.City!.Contains(search)); l.City!.Contains(search));
} }

View file

@ -106,11 +106,11 @@ namespace SeaHaven.DataServices.Implementation
ContactId = s.ContactId, ContactId = s.ContactId,
Date = s.Date, Date = s.Date,
Lineitems = s.LineItems!.Select(q => new QuoteLineItemReadModel Lineitems = s.LineItems!.Select(q => new QuoteLineItemReadModel
{ {
Descriptions = q.Descriptions, Descriptions = q.Descriptions,
Lineitem = q.Lineitem, Lineitem = q.Lineitem,
LineitemNumber = q.LineitemNumber LineitemNumber = q.LineitemNumber
}).ToList(), }).ToList(),
}) })
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
@ -137,10 +137,10 @@ namespace SeaHaven.DataServices.Implementation
BillingAddress = s.BillingAddress, BillingAddress = s.BillingAddress,
ShippingAddress = s.ShippingAddress, ShippingAddress = s.ShippingAddress,
Lineitems = s.LineItems!.Select(q => new QuoteLineItemReadModel Lineitems = s.LineItems!.Select(q => new QuoteLineItemReadModel
{ {
Descriptions = q.Descriptions, Descriptions = q.Descriptions,
Lineitem = q.Lineitem Lineitem = q.Lineitem
}).ToList(), }).ToList(),
TotalAmount = s.LineItems!.Sum(l => l.Lineitem ?? 0) TotalAmount = s.LineItems!.Sum(l => l.Lineitem ?? 0)
}) })
.FirstOrDefaultAsync(cancellationToken); .FirstOrDefaultAsync(cancellationToken);

View file

@ -54,7 +54,7 @@ namespace SeaHaven.Services.Implementation
public async Task<PagedResult<FollowUpDTO>> GetFollowUpsPagedAsync(int page, int pageSize, string? search = null, string? status = null) public async Task<PagedResult<FollowUpDTO>> GetFollowUpsPagedAsync(int page, int pageSize, string? search = null, string? status = null)
{ {
var (items, totalCount) = await _followUpDataService.GetPagedAsync(page, pageSize, search); var (items, totalCount) = await _followUpDataService.GetPagedAsync(page, pageSize, search);
var filteredItems = items.AsEnumerable(); var filteredItems = items.AsEnumerable();
if (!string.IsNullOrWhiteSpace(status)) if (!string.IsNullOrWhiteSpace(status))
{ {

View file

@ -180,11 +180,11 @@ namespace SeaHaven.Services.Implementation
private static QuoteLineItemDTO MapLineItem( private static QuoteLineItemDTO MapLineItem(
SeaHaven.DataServices.Models.QuoteLineItemReadModel item) => new() SeaHaven.DataServices.Models.QuoteLineItemReadModel item) => new()
{ {
Descriptions = item.Descriptions, Descriptions = item.Descriptions,
Lineitem = item.Lineitem, Lineitem = item.Lineitem,
LineitemNumber = item.LineitemNumber LineitemNumber = item.LineitemNumber
}; };
private static string FormatAmount(decimal amount) => $"${amount}"; private static string FormatAmount(decimal amount) => $"${amount}";
} }