shoc-backend/SeaHaven.Services/DTOs/VendorCompanyRosterDTOs.cs
Alexandre Brandizzi 11a355bb7a feat(vendor-roster): additive PATCH endpoint for technician adds (SH-250, SH-246)
PATCH /api/vendor-company-roster/{companyId} inserts the submitted
technicians and optionally updates company fields. Technicians absent
from the payload are never removed or deactivated, so the Add Vendor
flow can no longer soft-delete an existing roster via the full-snapshot
PUT. Stale rowVersion still 409s; unknown company 404s. POST (create)
and PUT (reconcile) behaviour is unchanged.
2026-08-18 12:14:12 -03:00

93 lines
3.5 KiB
C#

namespace SeaHaven.Services.DTOs
{
public class VendorRosterDTO
{
public int CompanyId { get; set; }
public string Name { get; set; } = string.Empty;
public string? CompanyPhone { get; set; }
public string? Email { get; set; }
public string? Address { get; set; }
public string? City { get; set; }
public string? State { get; set; }
public string? Zip { get; set; }
public string? GoogleMapsUrl { get; set; }
public string? Notes { get; set; }
public string? RowVersion { get; set; }
public List<VendorRosterTechnicianDTO> Technicians { get; set; } = new();
}
public class VendorRosterTechnicianDTO
{
public int? Id { get; set; }
public string? ContactName { get; set; }
public string? Phone { get; set; }
public string? Email { get; set; }
public string? PreferredContact { get; set; }
public string? TradeSpecialties { get; set; }
public bool IsActive { get; set; }
public int TotalJobs { get; set; }
}
public class RosterTechnicianInputDTO
{
public int? Id { get; set; }
public string? ContactName { get; set; }
public string? Phone { get; set; }
public string? Email { get; set; }
public string? PreferredContact { get; set; }
public string? TradeSpecialties { get; set; }
public bool? IsActive { get; set; }
}
public class CreateVendorRosterDTO
{
public required string Name { get; set; }
public string? CompanyPhone { get; set; }
public string? Email { get; set; }
public string? Address { get; set; }
public string? City { get; set; }
public string? State { get; set; }
public string? Zip { get; set; }
public string? GoogleMapsUrl { get; set; }
public string? Notes { get; set; }
public List<RosterTechnicianInputDTO> Technicians { get; set; } = new();
}
public class ReconcileVendorRosterDTO
{
public required string RowVersion { get; set; }
public required string Name { get; set; }
public string? CompanyPhone { get; set; }
public string? Email { get; set; }
public string? Address { get; set; }
public string? City { get; set; }
public string? State { get; set; }
public string? Zip { get; set; }
public string? GoogleMapsUrl { get; set; }
public string? Notes { get; set; }
public List<RosterTechnicianInputDTO> Technicians { get; set; } = new();
}
// Partial, purely additive roster update (SH-250): technicians listed here are
// inserted; any technician absent from the payload is never removed, soft-deleted
// or deactivated. Company fields are optional; a null field means "unchanged".
public class AddTechniciansVendorRosterDTO
{
public required string RowVersion { get; set; }
public List<RosterTechnicianInputDTO> AddTechnicians { get; set; } = new();
public VendorRosterCompanyFieldsDTO? CompanyFields { get; set; }
}
public class VendorRosterCompanyFieldsDTO
{
public string? Name { get; set; }
public string? CompanyPhone { get; set; }
public string? Email { get; set; }
public string? Address { get; set; }
public string? City { get; set; }
public string? State { get; set; }
public string? Zip { get; set; }
public string? GoogleMapsUrl { get; set; }
public string? Notes { get; set; }
}
}