diff --git a/PyroFetes/DTO/Show/Request/CreateShowDto.cs b/PyroFetes/DTO/Show/Request/CreateShowDto.cs index 5230f53..5dcb292 100644 --- a/PyroFetes/DTO/Show/Request/CreateShowDto.cs +++ b/PyroFetes/DTO/Show/Request/CreateShowDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Show.Request; +namespace PyroFetes.DTO.Show.Request; public class CreateShowDto { diff --git a/PyroFetes/DTO/Show/Request/IdShowDto.cs b/PyroFetes/DTO/Show/Request/IdShowDto.cs index ebf5e37..7932d80 100644 --- a/PyroFetes/DTO/Show/Request/IdShowDto.cs +++ b/PyroFetes/DTO/Show/Request/IdShowDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Show.Request; +namespace PyroFetes.DTO.Show.Request; public class IdShowDto { diff --git a/PyroFetes/DTO/Show/Request/UpdateShowDto.cs b/PyroFetes/DTO/Show/Request/UpdateShowDto.cs index ac3c132..25b68e3 100644 --- a/PyroFetes/DTO/Show/Request/UpdateShowDto.cs +++ b/PyroFetes/DTO/Show/Request/UpdateShowDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Show.Request; +namespace PyroFetes.DTO.Show.Request; public class UpdateShowDto { diff --git a/PyroFetes/DTO/Show/Response/ReadShowDto.cs b/PyroFetes/DTO/Show/Response/ReadShowDto.cs index 4e91893..41ceec4 100644 --- a/PyroFetes/DTO/Show/Response/ReadShowDto.cs +++ b/PyroFetes/DTO/Show/Response/ReadShowDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Show.Response; +namespace PyroFetes.DTO.Show.Response; public class ReadShowDto { diff --git a/PyroFetes/DTO/Sound/Request/CreateSoundDto.cs b/PyroFetes/DTO/Sound/Request/CreateSoundDto.cs index e1775ae..b6f4318 100644 --- a/PyroFetes/DTO/Sound/Request/CreateSoundDto.cs +++ b/PyroFetes/DTO/Sound/Request/CreateSoundDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Request; +namespace PyroFetes.DTO.Sound.Request; public class CreateSoundDto { diff --git a/PyroFetes/DTO/Sound/Request/IdSoundto.cs b/PyroFetes/DTO/Sound/Request/IdSoundto.cs index 41bad0b..1a94c5a 100644 --- a/PyroFetes/DTO/Sound/Request/IdSoundto.cs +++ b/PyroFetes/DTO/Sound/Request/IdSoundto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Request; +namespace PyroFetes.DTO.Sound.Request; public class IdSoundto { diff --git a/PyroFetes/DTO/Sound/Request/UpdateSoundDto.cs b/PyroFetes/DTO/Sound/Request/UpdateSoundDto.cs index 2382b13..7951796 100644 --- a/PyroFetes/DTO/Sound/Request/UpdateSoundDto.cs +++ b/PyroFetes/DTO/Sound/Request/UpdateSoundDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Request; +namespace PyroFetes.DTO.Sound.Request; public class UpdateSoundDto { diff --git a/PyroFetes/DTO/Sound/Response/ReadSoundDto.cs b/PyroFetes/DTO/Sound/Response/ReadSoundDto.cs index 0ee013d..aa2e514 100644 --- a/PyroFetes/DTO/Sound/Response/ReadSoundDto.cs +++ b/PyroFetes/DTO/Sound/Response/ReadSoundDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Response; +namespace PyroFetes.DTO.Sound.Response; public class ReadSoundDto { diff --git a/PyroFetes/DTO/SoundCategory/Request/CreateSoundCategoryDto.cs b/PyroFetes/DTO/SoundCategory/Request/CreateSoundCategoryDto.cs index 743d458..7f4065d 100644 --- a/PyroFetes/DTO/SoundCategory/Request/CreateSoundCategoryDto.cs +++ b/PyroFetes/DTO/SoundCategory/Request/CreateSoundCategoryDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Request; +namespace PyroFetes.DTO.SoundCategory.Request; public class CreateSoundCategoryDto { diff --git a/PyroFetes/DTO/SoundCategory/Request/IdSoundCategoryDto.cs b/PyroFetes/DTO/SoundCategory/Request/IdSoundCategoryDto.cs index d2aad4f..7cc1173 100644 --- a/PyroFetes/DTO/SoundCategory/Request/IdSoundCategoryDto.cs +++ b/PyroFetes/DTO/SoundCategory/Request/IdSoundCategoryDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Request; +namespace PyroFetes.DTO.SoundCategory.Request; public class IdSoundCategoryDto { diff --git a/PyroFetes/DTO/SoundCategory/Request/UpdateSoundCategoryDto.cs b/PyroFetes/DTO/SoundCategory/Request/UpdateSoundCategoryDto.cs index 43e7e1f..3f9d965 100644 --- a/PyroFetes/DTO/SoundCategory/Request/UpdateSoundCategoryDto.cs +++ b/PyroFetes/DTO/SoundCategory/Request/UpdateSoundCategoryDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Request; +namespace PyroFetes.DTO.SoundCategory.Request; public class UpdateSoundCategoryDto { diff --git a/PyroFetes/DTO/SoundCategory/Response/ReadSoundCategoryDto.cs b/PyroFetes/DTO/SoundCategory/Response/ReadSoundCategoryDto.cs index c113b6f..f2ed116 100644 --- a/PyroFetes/DTO/SoundCategory/Response/ReadSoundCategoryDto.cs +++ b/PyroFetes/DTO/SoundCategory/Response/ReadSoundCategoryDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundCategory.Response; +namespace PyroFetes.DTO.SoundCategory.Response; public class ReadSoundCategoryDto { diff --git a/PyroFetes/DTO/SoundTimecode/Request/CreateSoundTimecodeDto.cs b/PyroFetes/DTO/SoundTimecode/Request/CreateSoundTimecodeDto.cs index 54093b2..9169a0e 100644 --- a/PyroFetes/DTO/SoundTimecode/Request/CreateSoundTimecodeDto.cs +++ b/PyroFetes/DTO/SoundTimecode/Request/CreateSoundTimecodeDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundTimecode.Request; +namespace PyroFetes.DTO.SoundTimecode.Request; public class CreateSoundTimecodeDto { diff --git a/PyroFetes/DTO/SoundTimecode/Request/IdSoundTimecodeDto.cs b/PyroFetes/DTO/SoundTimecode/Request/IdSoundTimecodeDto.cs index 3f86699..3b89679 100644 --- a/PyroFetes/DTO/SoundTimecode/Request/IdSoundTimecodeDto.cs +++ b/PyroFetes/DTO/SoundTimecode/Request/IdSoundTimecodeDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundTimecode.Request; +namespace PyroFetes.DTO.SoundTimecode.Request; public class IdSoundTimecodeDto { diff --git a/PyroFetes/DTO/SoundTimecode/Request/UpdateSoundTimecodeDto.cs b/PyroFetes/DTO/SoundTimecode/Request/UpdateSoundTimecodeDto.cs index 9352795..0a29b72 100644 --- a/PyroFetes/DTO/SoundTimecode/Request/UpdateSoundTimecodeDto.cs +++ b/PyroFetes/DTO/SoundTimecode/Request/UpdateSoundTimecodeDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundTimecode.Request; +namespace PyroFetes.DTO.SoundTimecode.Request; public class UpdateSoundTimecodeDto { diff --git a/PyroFetes/DTO/SoundTimecode/Response/ReadSoundTimecodeDto.cs b/PyroFetes/DTO/SoundTimecode/Response/ReadSoundTimecodeDto.cs index cf32366..76f9c25 100644 --- a/PyroFetes/DTO/SoundTimecode/Response/ReadSoundTimecodeDto.cs +++ b/PyroFetes/DTO/SoundTimecode/Response/ReadSoundTimecodeDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.SoundTimecode.Response; +namespace PyroFetes.DTO.SoundTimecode.Response; public class ReadSoundTimecodeDto { diff --git a/PyroFetes/DTO/Staff/Request/CreateStaffDto.cs b/PyroFetes/DTO/Staff/Request/CreateStaffDto.cs index c68747d..4189bcd 100644 --- a/PyroFetes/DTO/Staff/Request/CreateStaffDto.cs +++ b/PyroFetes/DTO/Staff/Request/CreateStaffDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Staff.Request; +namespace PyroFetes.DTO.Staff.Request; public class CreateStaffDto { diff --git a/PyroFetes/DTO/Staff/Request/IdStaffDto.cs b/PyroFetes/DTO/Staff/Request/IdStaffDto.cs index 8f8ae83..e301d35 100644 --- a/PyroFetes/DTO/Staff/Request/IdStaffDto.cs +++ b/PyroFetes/DTO/Staff/Request/IdStaffDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Staff.Request; +namespace PyroFetes.DTO.Staff.Request; public class IdStaffDto { diff --git a/PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs b/PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs index 31fa354..549b146 100644 --- a/PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs +++ b/PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Staff.Request; +namespace PyroFetes.DTO.Staff.Request; public class UpdateStaffDto { diff --git a/PyroFetes/DTO/Staff/Response/ReadStaffDto.cs b/PyroFetes/DTO/Staff/Response/ReadStaffDto.cs index c11a6ab..383be4a 100644 --- a/PyroFetes/DTO/Staff/Response/ReadStaffDto.cs +++ b/PyroFetes/DTO/Staff/Response/ReadStaffDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Staff.Response; +namespace PyroFetes.DTO.Staff.Response; public class ReadStaffDto { diff --git a/PyroFetes/DTO/Truck/Request/CreateTruckDto.cs b/PyroFetes/DTO/Truck/Request/CreateTruckDto.cs index c71313d..7e44a42 100644 --- a/PyroFetes/DTO/Truck/Request/CreateTruckDto.cs +++ b/PyroFetes/DTO/Truck/Request/CreateTruckDto.cs @@ -1,10 +1,10 @@ -namespace PF3.DTO.Truck.Request; +namespace PyroFetes.DTO.Truck.Request; public class CreateTruckDto { public string? Type { get; set; } - public string? MaxExplosiveCapacity { get; set; } + public double? MaxExplosiveCapacity { get; set; } public string? Sizes { get; set; } - public string? Statut { get; set; } + public string? Status { get; set; } public int? ShowId { get; set; } } \ No newline at end of file diff --git a/PyroFetes/DTO/Truck/Request/IdTruckDto.cs b/PyroFetes/DTO/Truck/Request/IdTruckDto.cs index 4ce547b..b34012b 100644 --- a/PyroFetes/DTO/Truck/Request/IdTruckDto.cs +++ b/PyroFetes/DTO/Truck/Request/IdTruckDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Truck.Request; +namespace PyroFetes.DTO.Truck.Request; public class IdTruckDto { diff --git a/PyroFetes/DTO/Truck/Request/UpdateTruckDto.cs b/PyroFetes/DTO/Truck/Request/UpdateTruckDto.cs index 4ddf924..3141e83 100644 --- a/PyroFetes/DTO/Truck/Request/UpdateTruckDto.cs +++ b/PyroFetes/DTO/Truck/Request/UpdateTruckDto.cs @@ -1,4 +1,4 @@ -namespace PF3.DTO.Truck.Request; +namespace PyroFetes.DTO.Truck.Request; public class UpdateTruckDto { diff --git a/PyroFetes/DTO/Truck/Response/ReadTruckDto.cs b/PyroFetes/DTO/Truck/Response/ReadTruckDto.cs index 110208a..5fb73e5 100644 --- a/PyroFetes/DTO/Truck/Response/ReadTruckDto.cs +++ b/PyroFetes/DTO/Truck/Response/ReadTruckDto.cs @@ -1,10 +1,10 @@ -namespace PF3.DTO.Truck.Response; +namespace PyroFetes.DTO.Truck.Response; public class ReadTruckDto { public int? Id { get; set; } public string? Type { get; set; } - public string? MaxExplosiveCapacity { get; set; } + public double? MaxExplosiveCapacity { get; set; } public string? Sizes { get; set; } public string? Statut { get; set; } public int? ShowId { get; set; } diff --git a/PyroFetes/Endpoints/SoundCategory/CreateSoundCategoryEndpoint.cs b/PyroFetes/Endpoints/SoundCategory/CreateSoundCategoryEndpoint.cs index 0bc516c..bf2be25 100644 --- a/PyroFetes/Endpoints/SoundCategory/CreateSoundCategoryEndpoint.cs +++ b/PyroFetes/Endpoints/SoundCategory/CreateSoundCategoryEndpoint.cs @@ -1,11 +1,10 @@ using FastEndpoints; -using PF3.DTO.SoundCategory.Request; -using PF3.DTO.SoundCategory.Response; -using PF3.Models; +using PyroFetes.DTO.SoundCategory.Request; +using PyroFetes.DTO.SoundCategory.Response; -namespace PF3.Endpoints.SoundCategory; +namespace PyroFetes.Endpoints.SoundCategory; -public class CreateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint +public class CreateSoundCategoryEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint { public override void Configure() { @@ -15,13 +14,13 @@ public class CreateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint +public class DeleteSoundCategoryEndpoint(PyroFetesDbContext pf3DbContext) : Endpoint { public override void Configure() { @@ -14,14 +14,14 @@ public class DeleteSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint st.Id == req.Id, ct); + var soundCategory = await pf3DbContext.SoundCategories.FirstOrDefaultAsync(st => st.Id == req.Id, ct); if (soundCategory is null) { await Send.NotFoundAsync(ct); return; } - pf3DbContext.SoundsCategorys.Remove(soundCategory); + pf3DbContext.SoundCategories.Remove(soundCategory); await pf3DbContext.SaveChangesAsync(ct); await Send.OkAsync(ct); diff --git a/PyroFetes/Endpoints/SoundCategory/GetAllSoundCategoryEndpoint.cs b/PyroFetes/Endpoints/SoundCategory/GetAllSoundCategoryEndpoint.cs index 4dd534d..75766d2 100644 --- a/PyroFetes/Endpoints/SoundCategory/GetAllSoundCategoryEndpoint.cs +++ b/PyroFetes/Endpoints/SoundCategory/GetAllSoundCategoryEndpoint.cs @@ -1,10 +1,10 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; -using PF3.DTO.SoundCategory.Response; +using PyroFetes.DTO.SoundCategory.Response; -namespace PF3.Endpoints.SoundCategory; +namespace PyroFetes.Endpoints.SoundCategory; -public class GetAllSoundCategorysEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest> +public class GetAllSoundCategorysEndpoint(PyroFetesDbContext pf3DbContext) : EndpointWithoutRequest> { public override void Configure() { @@ -14,7 +14,7 @@ public class GetAllSoundCategorysEndpoint(PF3DbContext pf3DbContext) : EndpointW public override async Task HandleAsync(CancellationToken ct) { - var soundCategorys = await pf3DbContext.SoundsCategorys.ToListAsync(ct); + var soundCategorys = await pf3DbContext.SoundCategories.ToListAsync(ct); var result = soundCategorys.Select(sC => new ReadSoundCategoryDto { diff --git a/PyroFetes/Endpoints/SoundCategory/GetSoundCategoryEndpoint.cs b/PyroFetes/Endpoints/SoundCategory/GetSoundCategoryEndpoint.cs index b4d2e69..465d052 100644 --- a/PyroFetes/Endpoints/SoundCategory/GetSoundCategoryEndpoint.cs +++ b/PyroFetes/Endpoints/SoundCategory/GetSoundCategoryEndpoint.cs @@ -1,11 +1,11 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; -using PF3.DTO.SoundCategory.Request; -using PF3.DTO.SoundCategory.Response; +using PyroFetes.DTO.SoundCategory.Request; +using PyroFetes.DTO.SoundCategory.Response; -namespace PF3.Endpoints.SoundCategory; +namespace PyroFetes.Endpoints.SoundCategory; -public class GetSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint +public class GetSoundCategoryEndpoint(PyroFetesDbContext pf3DbContext) : Endpoint { public override void Configure() { @@ -15,7 +15,7 @@ public class GetSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint sc.Id == req.Id) .Select(sc => new ReadSoundCategoryDto { diff --git a/PyroFetes/Endpoints/SoundCategory/UpdateSoundCategoryEndpoint.cs b/PyroFetes/Endpoints/SoundCategory/UpdateSoundCategoryEndpoint.cs index 83ff0c0..ad95f0b 100644 --- a/PyroFetes/Endpoints/SoundCategory/UpdateSoundCategoryEndpoint.cs +++ b/PyroFetes/Endpoints/SoundCategory/UpdateSoundCategoryEndpoint.cs @@ -1,11 +1,11 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; -using PF3.DTO.SoundCategory.Request; -using PF3.DTO.SoundCategory.Response; +using PyroFetes.DTO.SoundCategory.Request; +using PyroFetes.DTO.SoundCategory.Response; -namespace PF3.Endpoints.SoundCategory; +namespace PyroFetes.Endpoints.SoundCategory; -public class UpdateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint +public class UpdateSoundCategoryEndpoint(PyroFetesDbContext pf3DbContext) : Endpoint { public override void Configure() { @@ -15,7 +15,7 @@ public class UpdateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint st.Id == req.Id, ct); + var soundCategory = await pf3DbContext.SoundCategories.FirstOrDefaultAsync(st => st.Id == req.Id, ct); if (soundCategory is null) { await Send.NotFoundAsync(ct); diff --git a/PyroFetes/Endpoints/Staff/CreateStaffEndpoint.cs b/PyroFetes/Endpoints/Staff/CreateStaffEndpoint.cs index 08fee1c..74e8238 100644 --- a/PyroFetes/Endpoints/Staff/CreateStaffEndpoint.cs +++ b/PyroFetes/Endpoints/Staff/CreateStaffEndpoint.cs @@ -1,10 +1,10 @@ using FastEndpoints; -using PF3.DTO.Staff.Request; -using PF3.DTO.Staff.Response; +using PyroFetes.DTO.Staff.Request; +using PyroFetes.DTO.Staff.Response; -namespace PF3.Endpoints.Staff; +namespace PyroFetes.Endpoints.Staff; -public class CreateStaffEndpoint(PF3DbContext pf3DbContext):Endpoint +public class CreateStaffEndpoint(PyroFetesDbContext pf3DbContext):Endpoint { public override void Configure() { @@ -14,7 +14,7 @@ public class CreateStaffEndpoint(PF3DbContext pf3DbContext):Endpoint +public class DeleteStaffEndpoint(PyroFetesDbContext pf3DbContext) : Endpoint { public override void Configure() { diff --git a/PyroFetes/Endpoints/Staff/GetAllStaffEndpoint.cs b/PyroFetes/Endpoints/Staff/GetAllStaffEndpoint.cs index b8c85d7..a2db600 100644 --- a/PyroFetes/Endpoints/Staff/GetAllStaffEndpoint.cs +++ b/PyroFetes/Endpoints/Staff/GetAllStaffEndpoint.cs @@ -1,10 +1,10 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; -using PF3.DTO.Staff.Response; +using PyroFetes.DTO.Staff.Response; -namespace PF3.Endpoints.Staff; +namespace PyroFetes.Endpoints.Staff; -public class GetAllStaffEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest> +public class GetAllStaffEndpoint(PyroFetesDbContext pf3DbContext) : EndpointWithoutRequest> { public override void Configure() { diff --git a/PyroFetes/Endpoints/Staff/GetStaffEndpoint.cs b/PyroFetes/Endpoints/Staff/GetStaffEndpoint.cs index 67624c8..7d9a7b9 100644 --- a/PyroFetes/Endpoints/Staff/GetStaffEndpoint.cs +++ b/PyroFetes/Endpoints/Staff/GetStaffEndpoint.cs @@ -1,11 +1,11 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; -using PF3.DTO.Staff.Request; -using PF3.DTO.Staff.Response; +using PyroFetes.DTO.Staff.Request; +using PyroFetes.DTO.Staff.Response; -namespace PF3.Endpoints.Staff; +namespace PyroFetes.Endpoints.Staff; -public class GetStaffEndpoint(PF3DbContext pf3DbContext) : Endpoint +public class GetStaffEndpoint(PyroFetesDbContext pf3DbContext) : Endpoint { public override void Configure() { diff --git a/PyroFetes/Endpoints/Staff/UpdateStaffEndpoint.cs b/PyroFetes/Endpoints/Staff/UpdateStaffEndpoint.cs index 3af1977..48cac68 100644 --- a/PyroFetes/Endpoints/Staff/UpdateStaffEndpoint.cs +++ b/PyroFetes/Endpoints/Staff/UpdateStaffEndpoint.cs @@ -1,11 +1,11 @@ using FastEndpoints; using Microsoft.EntityFrameworkCore; -using PF3.DTO.Staff.Request; -using PF3.DTO.Staff.Response; +using PyroFetes.DTO.Staff.Request; +using PyroFetes.DTO.Staff.Response; -namespace PF3.Endpoints.Staff; +namespace PyroFetes.Endpoints.Staff; -public class UpdateStaffEndpoint(PF3DbContext pf3DbContext) : Endpoint +public class UpdateStaffEndpoint(PyroFetesDbContext pf3DbContext) : Endpoint { public override void Configure() { diff --git a/PyroFetes/Endpoints/Truck/CreateTruckEndpoint.cs b/PyroFetes/Endpoints/Truck/CreateTruckEndpoint.cs deleted file mode 100644 index d12b66b..0000000 --- a/PyroFetes/Endpoints/Truck/CreateTruckEndpoint.cs +++ /dev/null @@ -1,41 +0,0 @@ -using FastEndpoints; -using PF3.DTO.Truck.Request; -using PF3.DTO.Truck.Response; -using PyroFetes; - -namespace PF3.Endpoints.Truck; - -public class CreateTruckEndpoint(PF3DbContext pf3DbContext):Endpoint -{ - public override void Configure() - { - Post("/api/truck"); - AllowAnonymous(); - } - - public override async Task HandleAsync(CreateTruckDto req, CancellationToken ct) - { - var truck = new Models.Truck - { - Type = req.Type, - MaxExplosiveCapacity = req.MaxExplosiveCapacity, - Sizes = req.Sizes, - Statut = req.Statut - }; - - pf3DbContext.Trucks.Add(truck); - await pf3DbContext.SaveChangesAsync(ct); - - var result = new ReadTruckDto() - { - Id = truck.Id, - Type = truck.Type, - MaxExplosiveCapacity = truck.MaxExplosiveCapacity, - Sizes = truck.Sizes, - Statut = truck.Statut - }; - - await Send.OkAsync(result, ct); - - } -} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Truck/DeleteTruckEndpoint.cs b/PyroFetes/Endpoints/Truck/DeleteTruckEndpoint.cs deleted file mode 100644 index 90cba0e..0000000 --- a/PyroFetes/Endpoints/Truck/DeleteTruckEndpoint.cs +++ /dev/null @@ -1,24 +0,0 @@ -using PF3.DTO.Truck.Request; -using FastEndpoints; -using Microsoft.EntityFrameworkCore; -using PF3; - -namespace ApiLibrary.Endpoints.Truck; - -public class DeleteTruckEndpoint(PF3DbContext pf3DbContext) : Endpoint -{ - public override void Configure() - { - Delete("/api/trucks/{@Id}", x => new { x.Id }); - } - - public override async Task HandleAsync(IdTruckDto req, CancellationToken ct) - { - var truck = await pf3DbContext.Trucks.FirstOrDefaultAsync(a => a.Id == req.Id, ct); - - pf3DbContext.Trucks.Remove(truck); - await pf3DbContext.SaveChangesAsync(ct); - - await Send.OkAsync(ct); - } -} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Truck/GetAllTruckEndpoint.cs b/PyroFetes/Endpoints/Truck/GetAllTruckEndpoint.cs deleted file mode 100644 index a6d2e65..0000000 --- a/PyroFetes/Endpoints/Truck/GetAllTruckEndpoint.cs +++ /dev/null @@ -1,33 +0,0 @@ -using PF3.DTO.Truck.Response; -using FastEndpoints; -using Microsoft.EntityFrameworkCore; -using PF3; - -namespace PF3.Endpoints.Truck; - -public class GetAllTrucksEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest> -{ - public override void Configure() - { - Get("/api/trucks"); - } - - public override async Task HandleAsync(CancellationToken ct) - { - var trucks = await pf3DbContext.Trucks.ToListAsync(ct); - - var result = trucks - .Select(truck => new ReadTruckDto - { - Id = truck.Id, - Type = truck.Type, - MaxExplosiveCapacity = truck.MaxExplosiveCapacity, - Sizes = truck.Sizes, - Statut = truck.Statut, - ShowId = truck.ShowId - }) - .ToList(); - - await Send.OkAsync(result, ct); - } -} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Truck/GetTruckEndpoint.cs b/PyroFetes/Endpoints/Truck/GetTruckEndpoint.cs deleted file mode 100644 index b228ea5..0000000 --- a/PyroFetes/Endpoints/Truck/GetTruckEndpoint.cs +++ /dev/null @@ -1,39 +0,0 @@ -using PF3.DTO.Truck.Request; -using PF3.DTO.Truck.Response; -using FastEndpoints; -using Microsoft.EntityFrameworkCore; -using PF3; - -namespace PF3.Endpoints.Truck; - -public class GetTruckEndpoint(PF3DbContext pf3DbContext) : Endpoint -{ - public override void Configure() - { - Get("/api/trucks/{@Id}"); - } - - public override async Task HandleAsync(IdTruckDto req, CancellationToken ct) - { - var truck = await pf3DbContext.Trucks - .Where(t => t.Id == req.Id) - .Select(t => new ReadTruckDto - { - Id = t.Id, - Type = t.Type, - MaxExplosiveCapacity = t.MaxExplosiveCapacity, - Sizes = t.Sizes, - Statut = t.Statut, - ShowId = t.ShowId - }) - .FirstOrDefaultAsync(ct); - - if (truck is null) - { - await Send.NotFoundAsync(ct); - return; - } - - await Send.OkAsync(truck, ct); - } -} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Truck/UpdateTruckEndpoint.cs b/PyroFetes/Endpoints/Truck/UpdateTruckEndpoint.cs deleted file mode 100644 index 3a6fce9..0000000 --- a/PyroFetes/Endpoints/Truck/UpdateTruckEndpoint.cs +++ /dev/null @@ -1,48 +0,0 @@ -using PF3.DTO.Truck.Request; -using PF3.DTO.Truck.Response; -using FastEndpoints; -using Microsoft.EntityFrameworkCore; -using PF3; - -namespace PF3.Endpoints.Truck; - -public class UpdateTruckEndpoint(PF3DbContext pf3DbContext) : Endpoint -{ - public override void Configure() - { - Put("/api/trucks/{id}"); - } - - public override async Task HandleAsync(UpdateTruckDto req, CancellationToken ct) - { - var id = Route("id"); - - var truck = await pf3DbContext.Trucks.FirstOrDefaultAsync(t => t.Id == id, ct); - - if (truck is null) - { - await Send.NotFoundAsync(ct); - return; - } - - truck.Type = req.Type; - truck.MaxExplosiveCapacity = req.MaxExplosiveCapacity; - truck.Sizes = req.Sizes; - truck.Statut = req.Statut; - truck.ShowId = req.ShowId; - - await pf3DbContext.SaveChangesAsync(ct); - - var result = new ReadTruckDto - { - Id = truck.Id, - Type = truck.Type, - MaxExplosiveCapacity = truck.MaxExplosiveCapacity, - Sizes = truck.Sizes, - Statut = truck.Statut, - ShowId = truck.ShowId - }; - - await Send.OkAsync(result, ct); - } -} \ No newline at end of file diff --git a/PyroFetes/PyroFetes.csproj b/PyroFetes/PyroFetes.csproj index e90efe4..5ac37e4 100644 --- a/PyroFetes/PyroFetes.csproj +++ b/PyroFetes/PyroFetes.csproj @@ -7,6 +7,8 @@ + + @@ -21,6 +23,7 @@ + diff --git a/PyroFetes/PyroFetesDbContext.cs b/PyroFetes/PyroFetesDbContext.cs index b5ce8c7..996befa 100644 --- a/PyroFetes/PyroFetesDbContext.cs +++ b/PyroFetes/PyroFetesDbContext.cs @@ -37,6 +37,10 @@ public class PyroFetesDbContext : DbContext public DbSet QuotationProducts { get; set; } public DbSet Settings { get; set; } public DbSet Shows { get; set; } + + // AJOUTE CETTE LIGNE ICI ⬇️ + public DbSet ShowTrucks { get; set; } + public DbSet Sounds { get; set; } public DbSet SoundCategories { get; set; } public DbSet SoundTimecodes { get; set; }