création CreateShowEndpoint.cs et rectification quelque chemin

This commit is contained in:
2025-10-09 15:55:00 +02:00
parent c6ce3c658f
commit 139e849e41
62 changed files with 193 additions and 69 deletions

1
AP-WEB-PF3 Submodule

Submodule AP-WEB-PF3 added at 4a0d74b34d

View File

@@ -8,5 +8,5 @@ public class CreateShowDto
public string? Place { get; set; }
public string? Description { get; set; }
public string? PyrotechnicImplementationPlan { get; set; }
public DateTime? Date { get; set; }
public DateOnly? Date { get; set; }
}

View File

@@ -1,6 +1,4 @@
using System;
namespace PF3.DTO.SoundCategory.Request;
namespace PF3.DTO.Sound.Request;
public class CreateSoundDto
{

View File

@@ -1,4 +1,4 @@
namespace PF3.DTO.SoundCategory.Request;
namespace PF3.DTO.Sound.Request;
public class IdSoundto
{

View File

@@ -1,6 +1,4 @@
using System;
namespace PF3.DTO.SoundCategory.Request;
namespace PF3.DTO.Sound.Request;
public class UpdateSoundDto
{

View File

@@ -1,6 +1,4 @@
using System;
namespace PF3.DTO.SoundCategory.Response;
namespace PF3.DTO.Sound.Response;
public class ReadSoundDto
{

View File

@@ -1,10 +1,12 @@
using FastEndpoints;
using PF3.DTO.Show.Request;
using PF3.DTO.Show.Response;
using PF3.Migrations;
using PyroFetes;
namespace PF3.Endpoint.Show;
public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<CreateShowEndpoint, ReadShowDto>
public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<CreateShowDto, ReadShowDto>
{
public override void Configure()
{
@@ -12,8 +14,29 @@ public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<
AllowAnonymous();
}
public override Task HandleAsync(CreateShowEndpoint req, CancellationToken ct)
public override async Task HandleAsync(CreateShowDto req, CancellationToken ct)
{
var show = new Models.Show
{
Name = req.Name,
Place = req.Place,
Description = req.Description,
Date = req.Date,
PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan
};
pyroFetesDbContext.Shows.Add(show);
await pyroFetesDbContext.SaveChangesAsync(ct);
ReadShowDto readShowDto = new ReadShowDto()
{
Id = show.Id,
Name = show.Name,
Place = show.Place,
Description = show.Description,
PyrotechnicImplementationPlan = show.PyrotechnicImplementationPlan
};
await Send.OkAsync(readShowDto, ct);
}
}

View File

@@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PF3.Migrations;
using PyroFetes;
#nullable disable

View File

@@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore;
using PyroFetes.Models;
using ServiceProvider = PyroFetes.Models.ServiceProvider;
using PF3.Models;
using ServiceProvider = PF3.Models.ServiceProvider;
namespace PyroFetes;
namespace PF3.Migrations;
public class PyroFetesDbContext : DbContext
{

View File

@@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using PF3.Migrations;
using PyroFetes;
#nullable disable

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Availability
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Brand
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class City
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Classification
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Color
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Communication
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Contact
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ContactId), nameof(ServiceProviderId))]
public class ContactServiceProvider

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(ServiceProviderId))]
public class Contract

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Customer
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class CustomerType
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Deliverer
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class DeliveryNote
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Effect
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class ExperienceLevel
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class HistoryOfApproval
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Material
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(MaterialId), nameof(WarehouseId))]
public class MaterialWarehouse

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Movement
{

View File

@@ -1,8 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(SupplierId))]
public class Price

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models
namespace PF3.Models
{
public class Product
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class ProductCategory
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(ColorId))]
public class ProductColor

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(DeliveryNoteId))]
public class ProductDelivery

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(EffectId))]
public class ProductEffect

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(ShowId))]
public class ProductTimecode

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ContactId), nameof(ProviderId))]
public class ProviderContact

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class ProviderType
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class PurchaseOrder
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(PurchaseOrderId))]
public class PurchaseProduct

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Quotation
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(QuotationId))]
public class QuotationProduct

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class ServiceProvider
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Setting
{

25
PF3/Models/Show.cs Normal file
View File

@@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Show
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required, MaxLength(120)] public string? Place { get; set; }
[MaxLength(500)] public string? Description { get; set; }
public DateOnly? Date { get; set; }
// Link (path/URL/file name) to the pyrotechnic implementation plan
[Required, MaxLength(500)] public string? PyrotechnicImplementationPlan { get; set; }
[Required] public int CityId { get; set; }
public City? City { get; set; }
public List<ShowStaff>? ShowStaffs { get; set; }
public List<ShowTruck>? ShowTrucks { get; set; }
public List<SoundTimecode>? SoundTimecodes { get; set; }
public List<ProductTimecode>? ProductTimecodes { get; set; }
public List<Contract>? Contracts { get; set; }
public List<ShowMaterial>? ShowMaterials { get; set; }
}

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(MaterialId))]
public class ShowMaterial

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class ShowServiceProvider
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(StaffId), nameof(ShowId))]
public class ShowStaff

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(TruckId))]
public class ShowTruck

20
PF3/Models/Sound.cs Normal file
View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Sound
{
[Key] public int Id { get; set; }
[Required, MaxLength(120)] public string Name { get; set; } = null!;
[Required, MaxLength(60)] public string? Type { get; set; }
[Required, MaxLength(120)] public string? Artist { get; set; }
[Required, Range(0, int.MaxValue)] public int? Duration { get; set; }
[Required, MaxLength(40)] public string? Kind { get; set; }
[Required, MaxLength(40)] public string? Format { get; set; }
public DateTime? CreationDate { get; set; }
[Required] public int SoundCategoryId { get; set; }
public SoundCategory? SoundCategory { get; set; }
public List<SoundTimecode>? SoundTimecodes { get; set; }
}

View File

@@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class SoundCategory
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string Name { get; set; } = null!;
public List<Sound>? Sounds { get; set; }
}

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(SoundId))]
public class SoundTimecode
{
[Required] public int ShowId { get; set; }
public Show? Show { get; set; }
[Required] public int SoundId { get; set; }
public Sound? Sound { get; set; }
[Required] public decimal Start { get; set; }
[Required] public decimal End { get; set; }
}

20
PF3/Models/Staff.cs Normal file
View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Staff
{
[Key] public int Id { get; set; }
[Required, MaxLength(60)] public string FirstName { get; set; } = null!;
[Required, MaxLength(60)] public string LastName { get; set; } = null!;
[Required, MaxLength(100)] public string? Profession { get; set; }
[Required, MaxLength(120)] public string? Email { get; set; }
[Required, MaxLength(100)] public string? F4T2NumberApproval { get; set; }
[Required] public DateOnly F4T2ExpirationDate { get; set; }
public List<ShowStaff>? ShowStaffs { get; set; }
public List<ExperienceLevel>? ExperienceLevels { get; set; }
public List<StaffAvailability>? StaffAvailabilities { get; set; }
public List<StaffHistoryOfApproval>? StaffHistoryOfApprovals { get; set; }
public List<StaffContact>? StaffContacts { get; set; }
}

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(AvailabilityId), nameof(StaffId))]
public class StaffAvailability

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ContactId), nameof(StaffId))]
public class StaffContact

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(HistoryOfApprovalId), nameof(StaffId))]
public class StaffHistoryOfApproval

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Supplier
{

14
PF3/Models/Truck.cs Normal file
View File

@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Truck
{
[Key] public int Id { get; set; }
[Required, MaxLength(40)] public string Type { get; set; } = null!;
[Required] public double? MaxExplosiveCapacity { get; set; }
[Required, MaxLength(80)] public string? Sizes { get; set; }
[Required, MaxLength(40)] public string? Status { get; set; }
public List<ShowTruck>? ShowTrucks { get; set; }
}

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class User
{

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace PyroFetes.Models;
namespace PF3.Models;
public class Warehouse
{

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Models;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(WarehouseId))]
public class WarehouseProduct

View File

@@ -1,8 +1,4 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using PF3;
var builder = WebApplication.CreateBuilder(args);
@@ -44,7 +40,10 @@ app.MapGet("/weatherforecast", () =>
app.Run();
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
namespace PF3
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}