Application complète de saisie et de suivi des trajets kilométriques avec calcul de distance routière (OpenRouteService), barème kilométrique, résumés et régularisation annuelle. Backend (ASP.NET Core .NET 8, EF Core, SQLite) : - Trajets (CRUD, réordonnancement, insertion), calcul de distance ORS avec fallback Haversine, géométrie d'itinéraire stockée par trajet, recalcul en masse. - Profil, véhicules (avec dénomination), carnet d'adresses nommées, cache d'adresses. - Barème kilométrique : tranches multiples par puissance fiscale, borne max exclusive avec 'illimité' (KmMax nullable), coefficient à 3 décimales, recopie du dernier barème connu. - Résumés mensuel/annuel, montants réglés, régularisation, export PDF. Frontend (Angular 22, zoneless + signals) : - Consultation par jour, navigation temporelle synchronisée, carte Leaflet, formulaire de trajet (adresses nommées, domicile, autocomplétion BAN). - Détection de changement zoneless (indépendante de zone.js). Hébergement : Docker Compose (nginx + backend), scripts run-dev.sh / run-docker.sh.
54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using TrajetKmTracker.Api.Models.DTOs;
|
|
using TrajetKmTracker.Api.Services;
|
|
|
|
namespace TrajetKmTracker.Api.Controllers;
|
|
|
|
/// <summary>
|
|
/// Endpoints de gestion du profil utilisateur (singleton) et de son état de configuration.
|
|
/// </summary>
|
|
[ApiController]
|
|
[Route("api/profil")]
|
|
public class ProfilController : ControllerBase
|
|
{
|
|
private readonly IProfilService _profilService;
|
|
|
|
public ProfilController(IProfilService profilService)
|
|
{
|
|
_profilService = profilService;
|
|
}
|
|
|
|
/// <summary>Récupère le profil (créé à la volée s'il est absent).</summary>
|
|
[HttpGet]
|
|
[ProducesResponseType(typeof(ProfilDto), StatusCodes.Status200OK)]
|
|
public async Task<ActionResult<ProfilDto>> GetProfil(CancellationToken cancellationToken)
|
|
{
|
|
var profil = await _profilService.GetProfilAsync(cancellationToken);
|
|
return Ok(profil);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sauvegarde le profil. La validation du matricule (≤ 8 car.) est assurée par FluentValidation.
|
|
/// Le géocodage de l'Adresse_Domicile est effectué au mieux : un échec BAN n'empêche pas la sauvegarde.
|
|
/// </summary>
|
|
[HttpPut]
|
|
[ProducesResponseType(typeof(ProfilDto), StatusCodes.Status200OK)]
|
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
public async Task<ActionResult<ProfilDto>> SaveProfil(
|
|
[FromBody] SaveProfilDto dto,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
var profil = await _profilService.SaveProfilAsync(dto, cancellationToken);
|
|
return Ok(profil);
|
|
}
|
|
|
|
/// <summary>État de configuration du profil (onboarding).</summary>
|
|
[HttpGet("etat")]
|
|
[ProducesResponseType(typeof(EtatProfilDto), StatusCodes.Status200OK)]
|
|
public async Task<ActionResult<EtatProfilDto>> GetEtat(CancellationToken cancellationToken)
|
|
{
|
|
var etat = await _profilService.GetEtatAsync(cancellationToken);
|
|
return Ok(etat);
|
|
}
|
|
}
|