shoc-backend/SeaHaven.Services/DTOs/ContactDTOs.cs
Arthur Bassi 620a36af54
feat(work-orders): enrich board search overdue filters and 0-based paging (#23)
* feat(work-orders): enrich board search overdue filters and 0-based paging

* fix(work-orders): align stacked services with CI build

* fix(tests): pass userDataService in comment service unit test

* fix(work-orders): use dedicated overdue query flag

Stop treating WorkOrderType.Other as an overdue sentinel. Board and advanced search now accept overdue=true while types=Other filters real Other rows; combining both uses OR.

* test(work-orders): cover overdue date/status boundary and Other type-filter

Lock the PR #23 overdue regression boundary through the public advanced
search service. Prove overdue filtering is driven by past-due date plus
non-terminal status, not by the WorkOrderType.Other sentinel:
- Other + future/not-completed excluded from overdue
- past-due + Scheduled included; past-due + Completed/Canceled excluded
- types=[PM, Other] keeps real Other rows and does not pull past-due rows
- assert 0-based paging (Page=0) is preserved alongside overdue/type filters

---------

Co-authored-by: Arthur Bassi <arthur.winiarski.ranger@outlook.com>
Co-authored-by: Alexandre Brandizzi <alex_brandizzi@hotmail.com>
2026-07-24 21:12:03 +00:00

64 lines
2.3 KiB
C#

namespace SeaHaven.Services.DTOs
{
public class ContactDTO
{
public int Id { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public string? Mobile { get; set; }
public string? Title { get; set; }
public string? Type { get; set; }
public int? AccountId { get; set; }
public string? AccountName { get; set; }
public DateTime? CreatedDate { get; set; }
public string? CreatedBy { get; set; }
public DateTime? ModifiedDate { get; set; }
public string? ModifiedBy { get; set; }
}
public class CreateContactDTO
{
public required string FirstName { get; set; }
public required string LastName { get; set; }
public required string Email { get; set; }
public string? Phone { get; set; }
public string? Mobile { get; set; }
public string? Title { get; set; }
public string? Type { get; set; }
public int? AccountId { get; set; }
}
public class UpdateContactDTO
{
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? Email { get; set; }
public string? Phone { get; set; }
public string? Mobile { get; set; }
public string? Title { get; set; }
public string? Type { get; set; }
public int? AccountId { get; set; }
}
public class PagedResult<T>
{
public IEnumerable<T> Items { get; set; } = new List<T>();
public int TotalCount { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
/// <summary>
/// Page numbering base for <see cref="HasPrevious"/> / <see cref="HasNext"/>.
/// Default <c>1</c> (classic APIs). Work-order advanced search sets <c>0</c>.
/// </summary>
public int PageBase { get; set; } = 1;
public int TotalPages => PageSize <= 0 ? 0 : (int)Math.Ceiling(TotalCount / (double)PageSize);
public bool HasPrevious => PageBase <= 0 ? Page > 0 : Page > 1;
public bool HasNext => PageBase <= 0 ? Page + 1 < TotalPages : Page < TotalPages;
}
}