2026-01-30 15:34:23 +00:00
|
|
|
using DoliMiddlewareApi.Dtos.Dolibarr;
|
|
|
|
|
using DoliMiddlewareApi.Dtos.query;
|
|
|
|
|
|
|
|
|
|
namespace DoliMiddlewareApi.Mappers;
|
|
|
|
|
|
feat: add DTOs, Dolibarr response types and mappers for Contacts, Clients, Setup and invoice lines
- New command DTOs: CreateClientDto, UpdateClientDto, CreateContactDto,
UpdateContactDto, UpdateInvoiceLineDto
- New query DTOs: ClientDetailDto, ContactDetailDto, Setup dictionaries
(PaymentTypeDto, CountryDto, CivilityDto, ContactTypeDto,
PaymentTermDto, CompanyDto)
- New Dolibarr response types for setup endpoints
- SetupMapper for all dictionary transforms
- Extended ClientResponse and ContactResponse with additional fields
(address, town, zip, country_code, note_public, note_private, etc.)
- ClientMapper: added MapToClientDetailDto for GET /Clients/{id}
- ContactMapper: added MapToContactDetailDto for GET /Contacts/{id}
2026-05-15 16:58:26 +00:00
|
|
|
public static class ContactMapper
|
2026-01-30 15:34:23 +00:00
|
|
|
{
|
|
|
|
|
public static ContactDto MapToContactDto(ContactResponse contactResponse)
|
|
|
|
|
{
|
|
|
|
|
return new ContactDto
|
|
|
|
|
{
|
|
|
|
|
Id = int.TryParse(contactResponse.id, out int id) ? id : 0,
|
|
|
|
|
Lastname = contactResponse.lastname,
|
|
|
|
|
Firstname = contactResponse.firstname,
|
|
|
|
|
Email = contactResponse.email,
|
|
|
|
|
PhonePro = contactResponse.phone_pro,
|
|
|
|
|
PhonePerso = contactResponse.phone_perso,
|
|
|
|
|
PhoneMobile = contactResponse.phone_mobile,
|
|
|
|
|
ClientId = int.TryParse(contactResponse.fk_soc, out int clientId) ? clientId : 0
|
|
|
|
|
};
|
|
|
|
|
}
|
feat: add DTOs, Dolibarr response types and mappers for Contacts, Clients, Setup and invoice lines
- New command DTOs: CreateClientDto, UpdateClientDto, CreateContactDto,
UpdateContactDto, UpdateInvoiceLineDto
- New query DTOs: ClientDetailDto, ContactDetailDto, Setup dictionaries
(PaymentTypeDto, CountryDto, CivilityDto, ContactTypeDto,
PaymentTermDto, CompanyDto)
- New Dolibarr response types for setup endpoints
- SetupMapper for all dictionary transforms
- Extended ClientResponse and ContactResponse with additional fields
(address, town, zip, country_code, note_public, note_private, etc.)
- ClientMapper: added MapToClientDetailDto for GET /Clients/{id}
- ContactMapper: added MapToContactDetailDto for GET /Contacts/{id}
2026-05-15 16:58:26 +00:00
|
|
|
|
|
|
|
|
public static ContactDetailDto MapToContactDetailDto(ContactResponse r)
|
|
|
|
|
{
|
|
|
|
|
return new ContactDetailDto
|
|
|
|
|
{
|
|
|
|
|
Id = int.TryParse(r.id, out int id) ? id : 0,
|
|
|
|
|
Lastname = r.lastname,
|
|
|
|
|
Firstname = r.firstname,
|
|
|
|
|
Email = r.email,
|
|
|
|
|
PhonePro = r.phone_pro,
|
|
|
|
|
PhonePerso = r.phone_perso,
|
|
|
|
|
PhoneMobile = r.phone_mobile,
|
|
|
|
|
ClientId = int.TryParse(r.fk_soc, out int clientId) ? clientId : 0,
|
|
|
|
|
Address = r.address,
|
|
|
|
|
Town = r.town,
|
|
|
|
|
Zip = r.zip,
|
|
|
|
|
CivilityCode = r.civility_code,
|
|
|
|
|
Status = r.statut switch
|
|
|
|
|
{
|
|
|
|
|
"0" => "inactive",
|
|
|
|
|
"1" => "active",
|
|
|
|
|
_ => r.statut
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2026-01-30 15:34:23 +00:00
|
|
|
}
|