mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 03:43:11 +00:00
- Reject duplicate site codes per client (case-insensitive); site code is immutable once set
- Delete tombstones the site and requires the DeleteSites permission (Admin, Scheduler)
- GET /api/locations/{id}/open-work-orders returns the open count and ids
- PATCH /api/locations/{id}/contact-info saves contacts and notes from the work-order Site dialog
- Add nullable Locations.Notes, used as the site-level POC notes fallback
121 lines
4.2 KiB
C#
121 lines
4.2 KiB
C#
namespace SeaHaven.Services.DTOs
|
|
{
|
|
public class LocationDTO
|
|
{
|
|
public int Id { get; set; }
|
|
public string? Name { get; set; }
|
|
public string? Title { get; set; }
|
|
public string? Address1 { get; set; }
|
|
public string? Address2 { get; set; }
|
|
public string? City { get; set; }
|
|
public string? State { get; set; }
|
|
public string? Zip { get; set; }
|
|
public string? PhoneNumber { get; set; }
|
|
public string? Email { get; set; }
|
|
public string? Status { get; set; }
|
|
public int? AccountId { get; set; }
|
|
public string? AccountName { get; set; }
|
|
public string? Notes { get; set; }
|
|
public DateTime? CreatedDate { get; set; }
|
|
public string? CreatedBy { get; set; }
|
|
|
|
/// <summary>SH-138: ordered site contacts; null when the site has none.</summary>
|
|
public IReadOnlyList<SiteContactResponseDTO>? Contacts { get; set; }
|
|
}
|
|
|
|
/// <summary>SH-138: additive site-contact write row. Id is optional on writes.</summary>
|
|
public class SiteContactRequestDTO
|
|
{
|
|
public int? Id { get; set; }
|
|
public string? Name { get; set; }
|
|
public string? Phone { get; set; }
|
|
}
|
|
|
|
/// <summary>SH-138: site-contact read row, ordered by SiteContactOrder then Id.</summary>
|
|
public class SiteContactResponseDTO
|
|
{
|
|
public int Id { get; set; }
|
|
public string? Name { get; set; }
|
|
public string? Phone { get; set; }
|
|
}
|
|
|
|
public class CreateLocationDTO
|
|
{
|
|
public required string LocationName { get; set; }
|
|
public string? Address { get; set; }
|
|
public string? City { get; set; }
|
|
public string? State { get; set; }
|
|
public string? Zipcode { get; set; }
|
|
public int? AccountId { get; set; }
|
|
}
|
|
|
|
public class UpdateLocationDTO
|
|
{
|
|
public string? LocationName { get; set; }
|
|
public string? Address { get; set; }
|
|
public string? City { get; set; }
|
|
public string? State { get; set; }
|
|
public string? Zipcode { get; set; }
|
|
public int? AccountId { get; set; }
|
|
}
|
|
|
|
public class LocationCreateRequestDTO
|
|
{
|
|
public string? Name { get; set; }
|
|
public string? Title { get; set; }
|
|
public string? Address { get; set; }
|
|
public string? City { get; set; }
|
|
public string? State { get; set; }
|
|
public string? ZipCode { get; set; }
|
|
public string? Phone { get; set; }
|
|
public string? ContactEmail { get; set; }
|
|
public string? Status { get; set; }
|
|
public int? AccountId { get; set; }
|
|
public string? Notes { get; set; }
|
|
|
|
/// <summary>SH-138: null keeps legacy behavior; empty array is a validation error.</summary>
|
|
public List<SiteContactRequestDTO>? Contacts { get; set; }
|
|
}
|
|
|
|
public class LocationUpdateRequestDTO
|
|
{
|
|
public string? Name { get; set; }
|
|
public string? Title { get; set; }
|
|
public string? Address { get; set; }
|
|
public string? City { get; set; }
|
|
public string? State { get; set; }
|
|
public string? ZipCode { get; set; }
|
|
public string? Phone { get; set; }
|
|
public string? ContactEmail { get; set; }
|
|
public string? Status { get; set; }
|
|
public int? AccountId { get; set; }
|
|
|
|
/// <summary>Null keeps the stored notes.</summary>
|
|
public string? Notes { get; set; }
|
|
|
|
/// <summary>SH-138: null keeps legacy behavior and must not mutate contact rows.</summary>
|
|
public List<SiteContactRequestDTO>? Contacts { get; set; }
|
|
}
|
|
|
|
public class SiteOptionDTO
|
|
{
|
|
public int Id { get; set; }
|
|
public string? Code { get; set; }
|
|
public string? City { get; set; }
|
|
public string? State { get; set; }
|
|
}
|
|
|
|
/// <summary>Site contacts and notes edited from the work-order Site dialog.</summary>
|
|
public class SiteContactInfoRequestDTO
|
|
{
|
|
public List<SiteContactRequestDTO>? Contacts { get; set; }
|
|
public string? Notes { get; set; }
|
|
}
|
|
|
|
/// <summary>Open (not Completed or Canceled) work orders that reference a site.</summary>
|
|
public class SiteOpenWorkOrdersDTO
|
|
{
|
|
public int Count { get; set; }
|
|
public IReadOnlyList<int> WorkOrderIds { get; set; } = Array.Empty<int>();
|
|
}
|
|
}
|