Renommage : TrajetKmTracker -> SchotzIadKmTracker (backend, specs, frontend)
- Backend : projets, solution, namespaces et références TrajetKmTracker.Api/.Tests -> SchotzIadKmTracker.Api/.Tests (dossiers, .csproj, .sln, .http, namespaces C#). GUID UserSecretsId préservé. - Specs : dossier .kiro/specs/trajet-km-tracker -> schotziad-km-tracker et mise à jour des références internes (chemins, tags de propriétés). - Frontend : projet Angular trajet-km-tracker -> schotziad-km-tracker (package.json, angular.json, chemin dist, Dockerfile), titre applicatif 'SchotzIAD KM Tracker'. - Docker et scripts (backend/Dockerfile, frontend/Dockerfile, run-dev.sh) mis à jour. - Suppression du fichier résiduel package.json.bak. Backend (solution) et frontend (build production) compilent sans erreur.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SchotzIadKmTracker.Api.Data;
|
||||
using SchotzIadKmTracker.Api.Models.Entities;
|
||||
|
||||
namespace SchotzIadKmTracker.Api.Repositories;
|
||||
|
||||
/// <inheritdoc />
|
||||
public class VehiculeRepository : IVehiculeRepository
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
|
||||
public VehiculeRepository(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<Vehicule>> GetHistoriqueAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await _context.Vehicules
|
||||
.OrderByDescending(v => v.DateEffet)
|
||||
.ThenByDescending(v => v.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Vehicule?> GetByIdAsync(int id, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await _context.Vehicules
|
||||
.FirstOrDefaultAsync(v => v.Id == id, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Vehicule?> GetVehiculeCourantAsync(DateOnly date, CancellationToken cancellationToken = default)
|
||||
{
|
||||
// Design SQL : SELECT * FROM Vehicules WHERE DateEffet <= date ORDER BY DateEffet DESC, Id DESC LIMIT 1
|
||||
return await _context.Vehicules
|
||||
.Where(v => v.DateEffet <= date)
|
||||
.OrderByDescending(v => v.DateEffet)
|
||||
.ThenByDescending(v => v.Id)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task AddAsync(Vehicule vehicule, CancellationToken cancellationToken = default)
|
||||
{
|
||||
_context.Vehicules.Add(vehicule);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<Trajet>> GetTrajetsAReaffecterAsync(
|
||||
DateOnly dateEffet,
|
||||
int puissanceFiscale,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await _context.Trajets
|
||||
.Where(t => t.Date >= dateEffet && t.PuissanceFiscale != puissanceFiscale)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user