Compare commits

2 Commits

Author SHA1 Message Date
ec5149b6da Endopoint presque fini 2025-10-16 17:00:36 +02:00
8d0c2aa3f6 dbcontext et endpoint begin 2025-10-02 17:52:40 +02:00
108 changed files with 6090 additions and 6264 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,2 @@
*.log
*.tmp
PF3/obj/

Submodule AP-WEB-PF3 deleted from 4a0d74b34d

View File

@@ -1,6 +1,4 @@
using System;
namespace PF3.DTO.Show.Request;
namespace PF3.DTO.Show.Request;
public class CreateShowDto
{
@@ -8,5 +6,5 @@ public class CreateShowDto
public string? Place { get; set; }
public string? Description { get; set; }
public string? PyrotechnicImplementationPlan { get; set; }
public DateOnly? Date { get; set; }
public DateTime? Date { get; set; }
}

View File

@@ -1,6 +1,4 @@
using System;
namespace PF3.DTO.Show.Request;
namespace PF3.DTO.Show.Request;
public class UpdateShowDto
{

View File

@@ -1,7 +1,4 @@
using System;
using PF3.Models;
namespace PF3.DTO.Show.Response;
namespace PF3.DTO.Show.Response;
public class ReadShowDto
{
@@ -11,14 +8,4 @@ public class ReadShowDto
public string? Description { get; set; }
public string? PyrotechnicImplementationPlan { get; set; }
public DateTime? Date { get; set; }
public int CityId { get; set; }
public string? City { get; set; }
public List<ShowStaff>? ShowStaffs { get; set; }
public List<ShowTruck>? ShowTrucks { get; set; }
public List<Models.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,4 +1,4 @@
namespace PF3.DTO.Sound.Request;
namespace PF3.DTO.SoundCategory.Request;
public class CreateSoundDto
{

View File

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

View File

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

View File

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

View File

@@ -2,8 +2,8 @@
public class CreateSoundTimecodeDto
{
public int? ShowId { get; set; }
public int? SoundId { get; set; }
public string? Start { get; set; }
public string? End { get; set; }
public int ShowId { get; set; }
public int SoundId { get; set; }
public int Start { get; set; }
public int End { get; set; }
}

View File

@@ -3,8 +3,8 @@
public class UpdateSoundTimecodeDto
{
public int? Id { get; set; }
public int? ShowId { get; set; }
public int? SoundId { get; set; }
public string? Start { get; set; }
public string? End { get; set; }
public int ShowId { get; set; }
public int SoundId { get; set; }
public int Start { get; set; }
public int End { get; set; }
}

View File

@@ -5,6 +5,6 @@ public class ReadSoundTimecodeDto
public int? Id { get; set; }
public int? ShowId { get; set; }
public int? SoundId { get; set; }
public string? Start { get; set; }
public string? End { get; set; }
public int Start { get; set; }
public int End { get; set; }
}

View File

@@ -3,8 +3,8 @@
public class CreateTruckDto
{
public string? Type { get; set; }
public double? MaxExplosiveCapacity { get; set; }
public string? MaxExplosiveCapacity { get; set; }
public string? Sizes { get; set; }
public bool? Statut { get; set; }
public string? Statut { get; set; }
public int? ShowId { get; set; }
}

View File

@@ -6,6 +6,6 @@ public class UpdateTruckDto
public string? Type { get; set; }
public string? MaxExplosiveCapacity { get; set; }
public string? Sizes { get; set; }
public bool? Statut { get; set; }
public string? Statut { get; set; }
public int? ShowId { get; set; }
}

View File

@@ -6,6 +6,6 @@ public class ReadTruckDto
public string? Type { get; set; }
public string? MaxExplosiveCapacity { get; set; }
public string? Sizes { get; set; }
public bool? Statut { get; set; }
public string? Statut { get; set; }
public int? ShowId { get; set; }
}

View File

@@ -1,42 +0,0 @@
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<CreateShowDto, ReadShowDto>
{
public override void Configure()
{
Post("/api/shows");
AllowAnonymous();
}
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

@@ -1,46 +0,0 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.Show.Response;
using PF3.Migrations;
namespace PF3.Endpoint.Show;
public class GetShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint<ReadShowDto>
{
public override void Configure()
{
Get("/api/shows/{Id}", a=> a.Id!);
AllowAnonymous();
}
public override async Task HandleAsync(ReadShowDto req, CancellationToken ct)
{
var show = await pyroFetesDbContext.Shows
.Include(s => s.City)
.Include(s => s.ShowStaffs)
.Include(s => s.ShowTrucks)
.Include(s => s.SoundTimecodes)
.Include(s => s.ProductTimecodes)
.Include(s => s.Contracts)
.Include(s => s.ShowMaterials)
.Where(a => a.Id == req.Id)
.Select(a => new ReadShowDto
{
Id = req.Id,
Name = req.Name,
Place = req.Place,
Description = req.Description,
PyrotechnicImplementationPlan = req.PyrotechnicImplementationPlan,
CityId = a.CityId,
City = a.City!.Name,
ShowStaffs = a.ShowStaffs,
ShowTrucks = a.ShowTrucks,
SoundTimecodes = a.SoundTimecodes,
ProductTimecodes = a.ProductTimecodes,
Contracts = a.Contracts,
ShowMaterials = a.ShowMaterials,
})
.FirstOrDefaultAsync(ct);
await Send.OkAsync(show, ct);
}
}

View File

@@ -0,0 +1,34 @@
using FastEndpoints;
using PF3.DTO.SoundCategory.Request;
using PF3.DTO.SoundCategory.Response;
using PF3.Models;
namespace PF3.Endpoints.SoundCategory;
public class CreateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint<CreateSoundCategoryDto, ReadSoundCategoryDto>
{
public override void Configure()
{
Post("/api/soundcategorys");
AllowAnonymous();
}
public override async Task HandleAsync(CreateSoundCategoryDto req, CancellationToken ct)
{
var soundCategory = new Models.SoundCategory
{
Name = req.Name,
};
pf3DbContext.SoundsCategorys.Add(soundCategory);
await pf3DbContext.SaveChangesAsync(ct);
var result = new ReadSoundCategoryDto
{
Id = soundCategory.Id,
Name = soundCategory.Name
};
await Send.OkAsync(result, ct);
}
}

View File

@@ -0,0 +1,29 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.SoundCategory.Request;
namespace PF3.Endpoints.SoundCategory;
public class DeleteSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint<IdSoundCategoryDto>
{
public override void Configure()
{
Delete("/api/soundcategorys/{Id}");
AllowAnonymous();
}
public override async Task HandleAsync(IdSoundCategoryDto req, CancellationToken ct)
{
var soundCategory = await pf3DbContext.SoundsCategorys.FirstOrDefaultAsync(st => st.Id == req.Id, ct);
if (soundCategory is null)
{
await Send.NotFoundAsync(ct);
return;
}
pf3DbContext.SoundsCategorys.Remove(soundCategory);
await pf3DbContext.SaveChangesAsync(ct);
await Send.OkAsync(ct);
}
}

View File

@@ -0,0 +1,27 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.SoundCategory.Response;
namespace PF3.Endpoints.SoundCategory;
public class GetAllSoundCategorysEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest<List<ReadSoundCategoryDto>>
{
public override void Configure()
{
Get("/api/soundcategorys");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
var soundCategorys = await pf3DbContext.SoundsCategorys.ToListAsync(ct);
var result = soundCategorys.Select(sC => new ReadSoundCategoryDto
{
Id = sC.Id,
Name = sC.Name
}).ToList();
await Send.OkAsync(result, ct);
}
}

View File

@@ -0,0 +1,35 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.SoundCategory.Request;
using PF3.DTO.SoundCategory.Response;
namespace PF3.Endpoints.SoundCategory;
public class GetSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint<IdSoundCategoryDto, ReadSoundCategoryDto>
{
public override void Configure()
{
Get("/api/soundcategorys/{Id}");
AllowAnonymous();
}
public override async Task HandleAsync(IdSoundCategoryDto req, CancellationToken ct)
{
var soundCategory = await pf3DbContext.SoundsCategorys
.Where(sc => sc.Id == req.Id)
.Select(sc => new ReadSoundCategoryDto
{
Id = sc.Id,
Name = sc.Name,
})
.FirstOrDefaultAsync(ct);
if (soundCategory is null)
{
await Send.NotFoundAsync(ct);
return;
}
await Send.OkAsync(soundCategory, ct);
}
}

View File

@@ -0,0 +1,37 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.SoundCategory.Request;
using PF3.DTO.SoundCategory.Response;
namespace PF3.Endpoints.SoundCategory;
public class UpdateSoundCategoryEndpoint(PF3DbContext pf3DbContext) : Endpoint<UpdateSoundCategoryDto, ReadSoundCategoryDto>
{
public override void Configure()
{
Patch("/api/soundcategorys/{Id}/name");
AllowAnonymous();
}
public override async Task HandleAsync(UpdateSoundCategoryDto req, CancellationToken ct)
{
var soundCategory = await pf3DbContext.SoundsCategorys.FirstOrDefaultAsync(st => st.Id == req.Id, ct);
if (soundCategory is null)
{
await Send.NotFoundAsync(ct);
return;
}
soundCategory.Name = req.Name;
await pf3DbContext.SaveChangesAsync(ct);
var result = new ReadSoundCategoryDto
{
Id = soundCategory.Id,
Name = soundCategory.Name
};
await Send.OkAsync(result, ct);
}
}

View File

@@ -0,0 +1,40 @@
using FastEndpoints;
using PF3.DTO.Staff.Request;
using PF3.DTO.Staff.Response;
namespace PF3.Endpoints.Staff;
public class CreateStaffEndpoint(PF3DbContext pf3DbContext):Endpoint<CreateStaffDto, ReadStaffDto>
{
public override void Configure()
{
Post("/api/staff");
AllowAnonymous();
}
public override async Task HandleAsync(CreateStaffDto req, CancellationToken ct)
{
var staff = new Models.Staff
{
FirstName = req.FirstName,
LastName = req.LastName,
Profession = req.Profession,
Email = req.Email
};
pf3DbContext.Staffs.Add(staff);
await pf3DbContext.SaveChangesAsync(ct);
var result = new ReadStaffDto()
{
Id = staff.Id,
FirstName = req.FirstName,
LastName = req.LastName,
Profession = req.Profession,
Email = req.Email
};
await Send.OkAsync(result, ct);
}
}

View File

@@ -0,0 +1,29 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.Staff.Request;
namespace PF3.Endpoints.Staff;
public class DeleteStaffEndpoint(PF3DbContext pf3DbContext) : Endpoint<IdStaffDto>
{
public override void Configure()
{
Delete("/api/staff/{Id}");
AllowAnonymous();
}
public override async Task HandleAsync(IdStaffDto req, CancellationToken ct)
{
var staff = await pf3DbContext.Staffs.FirstOrDefaultAsync(s => s.Id == req.Id, ct);
if (staff is null)
{
await Send.NotFoundAsync(ct);
return;
}
pf3DbContext.Staffs.Remove(staff);
await pf3DbContext.SaveChangesAsync(ct);
await Send.OkAsync(ct);
}
}

View File

@@ -0,0 +1,30 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.Staff.Response;
namespace PF3.Endpoints.Staff;
public class GetAllStaffEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest<List<ReadStaffDto>>
{
public override void Configure()
{
Get("/api/staff");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
var staffs = await pf3DbContext.Staffs.ToListAsync(ct);
var result = staffs.Select(s => new ReadStaffDto
{
Id = s.Id,
FirstName = s.FirstName,
LastName = s.LastName,
Profession = s.Profession,
Email = s.Email
}).ToList();
await Send.OkAsync(result, ct);
}
}

View File

@@ -0,0 +1,38 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.Staff.Request;
using PF3.DTO.Staff.Response;
namespace PF3.Endpoints.Staff;
public class GetStaffEndpoint(PF3DbContext pf3DbContext) : Endpoint<IdStaffDto, ReadStaffDto>
{
public override void Configure()
{
Get("/api/staff/{Id}");
AllowAnonymous();
}
public override async Task HandleAsync(IdStaffDto req, CancellationToken ct)
{
var staff = await pf3DbContext.Staffs
.Where(s => s.Id == req.Id)
.Select(s => new ReadStaffDto
{
Id = s.Id,
FirstName = s.FirstName,
LastName = s.LastName,
Profession = s.Profession,
Email = s.Email
})
.FirstOrDefaultAsync(ct);
if (staff is null)
{
await Send.NotFoundAsync(ct);
return;
}
await Send.OkAsync(staff, ct);
}
}

View File

@@ -0,0 +1,43 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.Staff.Request;
using PF3.DTO.Staff.Response;
namespace PF3.Endpoints.Staff;
public class UpdateStaffEndpoint(PF3DbContext pf3DbContext) : Endpoint<UpdateStaffDto, ReadStaffDto>
{
public override void Configure()
{
Put("/api/staff/{Id}");
AllowAnonymous();
}
public override async Task HandleAsync(UpdateStaffDto req, CancellationToken ct)
{
var staff = await pf3DbContext.Staffs.FirstOrDefaultAsync(s => s.Id == req.Id, ct);
if (staff is null)
{
await Send.NotFoundAsync(ct);
return;
}
staff.FirstName = req.FirstName;
staff.LastName = req.LastName;
staff.Profession = req.Profession;
staff.Email = req.Email;
await pf3DbContext.SaveChangesAsync(ct);
var result = new ReadStaffDto
{
Id = staff.Id,
FirstName = staff.FirstName,
LastName = staff.LastName,
Profession = staff.Profession,
Email = staff.Email
};
await Send.OkAsync(result, ct);
}
}

View File

@@ -0,0 +1,40 @@
using FastEndpoints;
using PF3.DTO.Truck.Request;
using PF3.DTO.Truck.Response;
namespace PF3.Endpoints.Truck;
public class CreateTruckEndpoint(PF3DbContext pf3DbContext):Endpoint<CreateTruckDto, ReadTruckDto>
{
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);
}
}

View File

@@ -0,0 +1,24 @@
using PF3.DTO.Truck.Request;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3;
namespace ApiLibrary.Endpoints.Truck;
public class DeleteTruckEndpoint(PF3DbContext pf3DbContext) : Endpoint<IdTruckDto>
{
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);
}
}

View File

@@ -0,0 +1,33 @@
using PF3.DTO.Truck.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3;
namespace PF3.Endpoints.Truck;
public class GetAllTrucksEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest<List<ReadTruckDto>>
{
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);
}
}

View File

@@ -0,0 +1,39 @@
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<IdTruckDto, ReadTruckDto>
{
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);
}
}

View File

@@ -0,0 +1,48 @@
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<UpdateTruckDto, ReadTruckDto>
{
public override void Configure()
{
Put("/api/trucks/{id}");
}
public override async Task HandleAsync(UpdateTruckDto req, CancellationToken ct)
{
var id = Route<int>("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);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,93 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PF3.Models;
using ServiceProvider = PF3.Models.ServiceProvider;
namespace PF3.Migrations;
public class PyroFetesDbContext : DbContext
{
// Entities
public DbSet<Availability> Availabilities { get; set; }
public DbSet<Brand> Brands { get; set; }
public DbSet<Classification> Classifications { get; set; }
public DbSet<Color> Colors { get; set; }
public DbSet<Communication> Communications { get; set; }
public DbSet<Contact> Contacts { get; set; }
public DbSet<Customer> Customers { get; set; }
public DbSet<CustomerType> CustomerTypes { get; set; }
public DbSet<Deliverer> Deliverers { get; set; }
public DbSet<DeliveryNote> DeliveryNotes { get; set; }
public DbSet<Effect> Effects { get; set; }
public DbSet<ExperienceLevel> ExperienceLevels { get; set; }
public DbSet<HistoryOfApproval> HistoryOfApprovals { get; set; }
public DbSet<Material> Materials { get; set; }
public DbSet<Movement> Movements { get; set; }
public DbSet<Price> Prices { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<ProductCategory> ProductCategories { get; set; }
public DbSet<ProductColor> ProductColors { get; set; }
public DbSet<ProductDelivery> ProductDeliveries { get; set; }
public DbSet<ProductEffect> ProductEffects { get; set; }
public DbSet<ServiceProvider> Providers { get; set; }
public DbSet<ProviderContact> ProviderContacts { get; set; }
public DbSet<ProviderType> ProviderTypes { get; set; }
public DbSet<PurchaseOrder> PurchaseOrders { get; set; }
public DbSet<PurchaseProduct> PurchaseProducts { get; set; }
public DbSet<Quotation> Quotations { get; set; }
public DbSet<QuotationProduct> QuotationProducts { get; set; }
public DbSet<Setting> Settings { get; set; }
public DbSet<Show> Shows { get; set; }
public DbSet<Sound> Sounds { get; set; }
public DbSet<SoundCategory> SoundCategories { get; set; }
public DbSet<SoundTimecode> SoundTimecodes { get; set; }
public DbSet<Staff> Staffs { get; set; }
public DbSet<StaffAvailability> StaffAvailabilities { get; set; }
public DbSet<StaffContact> StaffContacts { get; set; }
public DbSet<StaffHistoryOfApproval> StaffHistoryOfApprovals { get; set; }
public DbSet<Supplier> Suppliers { get; set; }
public DbSet<Truck> Trucks { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<Warehouse> Warehouses { get; set; }
public DbSet<WarehouseProduct> WarehouseProducts { get; set; }
// Database configuration
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
string connectionString =
"Server=romaric-thibault.fr;" +
"Database=PyroFetes;" +
"User Id=pyrofetes;" +
"Password=Crablike8-Fringe-Swimmable;" +
"TrustServerCertificate=true;";
optionsBuilder.UseSqlServer(connectionString);
}
// Models customization
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Movement>()
.HasOne(m => m.SourceWarehouse)
.WithMany(w => w.MovementsSource)
.HasForeignKey(m => m.SourceWarehouseId)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Movement>()
.HasOne(m => m.DestinationWarehouse)
.WithMany(w => w.MovementsDestination)
.HasForeignKey(m => m.DestinationWarehouseId)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<MaterialWarehouse>()
.HasOne(mw => mw.Material)
.WithMany(m => m.MaterialWarehouses)
.HasForeignKey(mw => mw.MaterialId)
.OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<MaterialWarehouse>()
.HasOne(mw => mw.Warehouse)
.WithMany(w => w.MaterialWarehouses)
.HasForeignKey(mw => mw.WarehouseId)
.OnDelete(DeleteBehavior.Restrict);
}
}

File diff suppressed because it is too large Load Diff

13
PF3/Models/.idea/.gitignore generated vendored
View File

@@ -1,13 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.Models.iml
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Availability
{
[Key] public int Id { get; set; }
[Required] public DateOnly AvailabilityDate { get; set; }
[Required] public DateOnly DeliveryDate { get; set; }
[Required] public DateOnly ExpirationDate { get; set; }
[Required] public DateOnly RenewallDate { get; set; }
public List<StaffAvailability>? StaffAvailabilities { get; set; }
}

View File

@@ -1,12 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Brand
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int ProductId { get; set; }
[Required] public Product? Product { get; set; }
}

View File

@@ -1,12 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class City
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int ZipCode { get; set; }
public List<Show>? Shows { get; set; }
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Classification
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<Product>? Products { get; set; }
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Color
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<ProductColor>? ProductColors { get; set; }
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Communication
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Calling { get; set; }
[Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(300)] public string? Meeting { get; set; }
[Required] public int ContactId { get; set; }
public Contact? Contact { get; set; }
}

View File

@@ -1,23 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Contact
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? LastName { get; set; }
[Required, MaxLength(100)] public string? FirstName { get; set; }
[Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(30)] public string? PhoneNumber { get; set; }
[Required, MaxLength(100)] public string? Address { get; set; }
[Required] public int ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
[Required, MaxLength(100)] public string? Role { get; set; }
public Customer? Customer { get; set; }
[Required] public int CustomerId { get; set; }
public List<Communication>? Communications { get; set; }
public List<StaffContact>? StaffContacts { get; set; }
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ContactId), nameof(ServiceProviderId))]
public class ContactServiceProvider
{
[Required] public int ContactId { get; set; }
[Required] public int ServiceProviderId { get; set; }
public Contact? Contact { get; set; }
public ServiceProvider? ServiceProvider { get; set; }
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(ServiceProviderId))]
public class Contract
{
[Required] public int ShowId { get; set; }
[Required] public int ServiceProviderId { get; set; }
[Required] public string? TermsAndConditions { get; set; }
public Show? Show { get; set; }
public ServiceProvider? ServiceProvider { get; set; }
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Customer
{
[Key] public int Id { get; set; }
[Required, MaxLength(200)] public string? Note { get; set; }
//Relations
[Required] public int CustomerTypeId { get; set; }
public CustomerType? CustomerType { get; set; }
public List<Contact>? Contacts { get; set; }
public List<Quotation>? Quotations { get; set; }
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class CustomerType
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<Customer>? Customers { get; set; }
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Deliverer
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Transporter { get; set; }
public List<DeliveryNote>? DeliveryNotes { get; set; }
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class DeliveryNote
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? TrackingNumber { get; set; }
public int DelivererId { get; set; }
[Required] public DateOnly EstimateDeliveryDate { get; set; }
[Required] public DateOnly ExpeditionDate { get; set; }
[Required] public DateOnly RealDeliveryDate { get; set; }
public Deliverer? Deliverer { get; set; }
public List<ProductDelivery>? ProductDeliveries { get; set; }
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Effect
{
[Key] public int Id { get; set; }
[Required, MaxLength(200)] public string? Label { get; set; }
public List<ProductEffect>? ProductEffects { get; set; }
}

View File

@@ -1,12 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class ExperienceLevel
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public Staff? Staff { get; set; }
[Required] public int StaffId { get; set; }
}

View File

@@ -1,12 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class HistoryOfApproval
{
[Key] public int Id { get; set; }
[Required] public DateOnly DeliveryDate { get; set; }
[Required] public DateOnly ExpirationDate { get; set; }
public List<StaffHistoryOfApproval>? StaffHistoryOfApprovals { get; set; }
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Material
{
[Key] public int Id {get; set;}
[Required, MaxLength(100)] public string? Name {get; set;}
[Required] public int Quantity {get; set;}
[Required] public int WarehouseId {get; set;}
public Warehouse? Warehouse {get; set;}
public List<ShowMaterial>? ShowMaterials {get; set;}
public List<MaterialWarehouse>? MaterialWarehouses {get; set;}
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(MaterialId), nameof(WarehouseId))]
public class MaterialWarehouse
{
[Required] public int MaterialId { get; set; }
[Required] public int WarehouseId { get; set; }
public Material? Material { get; set; }
public Warehouse? Warehouse { get; set; }
}

View File

@@ -1,19 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Movement
{
[Key] public int Id { get; set; }
[Required] public DateTime Date { get; set; }
[Required] public DateTime Start {get; set;}
[Required] public DateTime Arrival {get; set;}
[Required] public int Quantity {get; set;}
public List<Product>? Products { get; set; }
public int? SourceWarehouseId {get; set;}
public Warehouse? SourceWarehouse {get; set;}
public int? DestinationWarehouseId {get; set;}
public Warehouse? DestinationWarehouse {get; set;}
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(SupplierId))]
public class Price
{
[Required] public int ProductId { get; set; }
[Required] public int SupplierId { get; set; }
[Required] public decimal SellingPrice { get; set; }
public Product? Product { get; set; }
public Supplier? Supplier { get; set; }
}

View File

@@ -1,42 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models
{
public class Product
{
[Key] public int Id { get; set; }
[Required] public int References { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required] public decimal Duration {get; set;}
[Required] public decimal Caliber { get; set; }
[Required] public int ApprovalNumber { get; set; }
[Required] public decimal Weight { get; set; }
[Required] public decimal Nec { get; set; }
[Required] public decimal SellingPrice { get; set; }
[Required] public string? Image { get; set; }
[Required, MaxLength(200)] public string? Link { get; set; }
[Required] public int MinimalQuantity { get; set; }
// Relations
[Required] public int ClassificationId { get; set; }
public Classification? Classification { get; set; }
[Required] public int ProductCategoryId { get; set; }
public ProductCategory? ProductCategory { get; set; }
[Required] public int MovementId {get; set;}
public Movement? Movement {get; set;}
public List<ProductDelivery>? ProductDeliveries { get; set; }
public List<Brand>? Brands { get; set; }
public List<ProductEffect>? ProductEffects { get; set; }
public List<ProductColor>? ProductColors { get; set; }
public List<PurchaseProduct>? PurchaseProducts { get; set; }
public List<Price>? Prices { get; set; }
public List<QuotationProduct>? QuotationProducts { get; set; }
public List<WarehouseProduct>? WarehouseProducts { get; set; }
public List<ProductTimecode>? ProductTimecodes { get; set; }
}
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class ProductCategory
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<Product>? Products { get; set; }
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(ColorId))]
public class ProductColor
{
public Product? Product { get; set; }
[Required] public int ProductId { get; set; }
public Color? Color { get; set; }
[Required] public int ColorId { get; set; }
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(DeliveryNoteId))]
public class ProductDelivery
{
[Required] public int ProductId { get; set; }
[Required] public int DeliveryNoteId { get; set; }
[Required] public int Quantity { get; set; }
public Product? Product { get; set; }
public DeliveryNote? DeliveryNote { get; set; }
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(EffectId))]
public class ProductEffect
{
[Required] public Product? Product { get; set; }
[Required] public int ProductId { get; set; }
public Effect? Effect { get; set; }
[Required] public int EffectId { get; set; }
}

View File

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

View File

@@ -1,12 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ContactId), nameof(ProviderId))]
public class ProviderContact
{
public int ProviderId { get; set; }
public ServiceProvider? Provider { get; set; }
public int ContactId { get; set; }
public Contact? Contact { get; set; }
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class ProviderType
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; }
public List<ServiceProvider>? ServiceProviders { get; set; }
}

View File

@@ -1,11 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class PurchaseOrder
{
[Key] public int Id { get; set; }
[Required, MaxLength(300)] public string? PurchaseConditions { get; set; }
public List<PurchaseProduct>? PurchaseProducts { get; set; }
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(PurchaseOrderId))]
public class PurchaseProduct
{
public Product? Product { get; set; }
[Required] public int ProductId { get; set; }
public PurchaseOrder? PurchaseOrder { get; set; }
[Required] public int PurchaseOrderId { get; set; }
[Required] public int Quantity { get; set; }
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Quotation
{
[Key] public int Id { get; set; }
[Required, MaxLength(200)] public string? Message { get; set; }
[Required, MaxLength(300)] public string? ConditionsSale { get; set; }
[Required] public int CustomerId { get; set; }
public Customer? Customer { get; set; }
public List<QuotationProduct>? QuotationProducts { get; set; }
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(QuotationId))]
public class QuotationProduct
{
[Required] public int ProductId { get; set; }
[Required] public int QuotationId { get; set; }
[Required] public int Quantity { get; set; }
public Product? Product { get; set; }
public Quotation? Quotation { get; set; }
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class ServiceProvider
{
[Key] public int Id { get; set; }
[Required] public decimal Price { get; set; }
//Relations
[Required] public int ProviderTypeId { get; set; }
public ProviderType? ProviderType { get; set; }
public List<Contract>? Contracts { get; set; }
public List<ContactServiceProvider>? ContactServiceProviders { get; set; }
}

View File

@@ -1,10 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Setting
{
[Key] public int Id { get; set; }
[Required] public string? Logo { get; set; }
[Required] public string? ElectronicSignature { get; set; }
}

View File

@@ -5,21 +5,23 @@ 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 string? Name { get; set; }
[Required] public int CityId { get; set; }
public City? City { get; set; }
[Required, MaxLength(120)]
public string? Place { 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; }
[MaxLength(500)]
public string? Description { get; set; }
// Lien (chemin/URL/nom de fichier) vers le plan dimplémentation pyrotechnique
[Required, MaxLength(500)]
public string? PyrotechnicImplementationPlan { get; set; }
public DateTime? Date { get; set; }
public ICollection<Staff> Staff { get; set; } = new List<Staff>();
public ICollection<Truck> Trucks { get; set; } = new List<Truck>();
public ICollection<SoundTimecode> SoundCues { get; set; } = new List<SoundTimecode>();
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(MaterialId))]
public class ShowMaterial
{
[Required] public Show? Show { get; set; }
[Required] public int ShowId { get; set; }
public Material? Material { get; set; }
[Required] public int MaterialId { get; set; }
}

View File

@@ -1,9 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class ShowServiceProvider
{
[Key] public int Id { get; set; }
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(StaffId), nameof(ShowId))]
public class ShowStaff
{
public Staff? Staff { get; set; }
[Required] public int StaffId { get; set; }
public Show? Show { get; set; }
[Required] public int ShowId { get; set; }
}

View File

@@ -1,14 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(TruckId))]
public class ShowTruck
{
public Show? Show { get; set; }
[Required] public int ShowId { get; set; }
public Truck? Truck { get; set; }
[Required] public int TruckId { get; set; }
}

View File

@@ -1,20 +1,35 @@
using System.ComponentModel.DataAnnotations;
using PF3.Models;
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; }
[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; }
[Required]
public int SoundCategoryId { get; set; }
public SoundCategory? Category { get; set; }
public List<SoundTimecode>? SoundTimecodes { get; set; }
public ICollection<SoundTimecode> ShowPlacements { get; set; } = new List<SoundTimecode>();
}

View File

@@ -5,7 +5,9 @@ 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; }
[Required, MaxLength(60)]
public string Name { get; set; } = null!;
public ICollection<Sound> Sounds { get; set; } = new List<Sound>();
}

View File

@@ -1,16 +1,22 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ShowId), nameof(SoundId))]
public class SoundTimecode
{
[Required] public int ShowId { get; set; }
[Key] public int Id { get; set; }
[Required]
public int ShowId { get; set; }
public Show? Show { get; set; }
[Required] public int SoundId { 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; }
[Required, Range(0, int.MaxValue)]
public int Start { get; set; }
[Required, Range(0, int.MaxValue)]
public int End { get; set; }
}

View File

@@ -5,16 +5,18 @@ 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; }
[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; }
public ICollection<Show> Shows { get; set; } = new List<Show>();
}

View File

@@ -1,12 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(AvailabilityId), nameof(StaffId))]
public class StaffAvailability
{
public int StaffId { get; set; }
public Staff? Staff { get; set; }
public int AvailabilityId { get; set; }
public Availability? Availability { get; set; }
}

View File

@@ -1,13 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ContactId), nameof(StaffId))]
public class StaffContact
{
[Required] public int StaffId { get; set; }
public Staff? Staff { get; set; }
[Required] public int ContactId { get; set; }
public Contact? Contact { get; set; }
}

View File

@@ -1,12 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(HistoryOfApprovalId), nameof(StaffId))]
public class StaffHistoryOfApproval
{
public int StaffId { get; set; }
public Staff? Staff { get; set; }
public int HistoryOfApprovalId { get; set; }
public HistoryOfApproval? HistoryOfApproval { get; set; }
}

View File

@@ -1,17 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Supplier
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(30)] public string? Phone { get; set; }
[Required, MaxLength(100)] public string? Address { get; set; }
[Required] public int ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
[Required] public int DeliveryDelay { get; set; }
public List<Price>? Prices { get; set; }
}

View File

@@ -5,10 +5,20 @@ 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; }
[Required, MaxLength(40)]
public string? Type { get; set; } = null!;
[Range(0, double.MaxValue)]
public string? MaxExplosiveCapacity { get; set; }
[Required, MaxLength(80)]
public string? Sizes { get; set; }
[Required, MaxLength(40)]
public string? Statut { get; set; }
[Required]
public int? ShowId { get; set; }
public Show? Show { get; set; }
}

View File

@@ -1,13 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class User
{
[Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; }
[Required, MinLength(12), MaxLength(50)] public string? Password { get; set; }
[Required, MaxLength(100)] public string? Salt { get; set; }
[Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(100)] public string? Fonction { get; set; }
}

View File

@@ -1,22 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace PF3.Models;
public class Warehouse
{
[Key] public int Id {get; set;}
[Required, MaxLength(100)] public string? Name {get; set;}
[Required] public int MaxWeight {get; set;}
[Required] public int Current {get; set;}
[Required] public int MinWeight {get; set;}
[Required, MaxLength(100)] public string? Address { get; set; }
[Required] public int ZipCode { get; set; }
[Required, MaxLength(100)] public string? City { get; set; }
public List<WarehouseProduct>? WarehouseProducts { get; set; }
public List<MaterialWarehouse>? MaterialWarehouses {get; set;}
public List<Movement>? MovementsSource { get; set; }
public List<Movement>? MovementsDestination { get; set; }
}

View File

@@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;
namespace PF3.Models;
[PrimaryKey(nameof(ProductId), nameof(WarehouseId))]
public class WarehouseProduct
{
[Required] public int ProductId { get; set; }
public Product? Product { get; set; }
[Required] public int WarehouseId { get; set; }
public Warehouse? Warehouse { get; set; }
[Required] public int Quantity { get; set; }
}

View File

@@ -23,12 +23,9 @@
<Folder Include="DTO\Show\" />
<Folder Include="DTO\SoundCategory\" />
<Folder Include="DTO\SoundTimecode\" />
</ItemGroup>
<ItemGroup>
<Content Include="Models\.idea\.gitignore" />
<Content Include="Models\.idea\encodings.xml" />
<Content Include="Models\.idea\indexLayout.xml" />
<Folder Include="Endpoints\Show\" />
<Folder Include="Endpoints\SoundTimecode\" />
<Folder Include="Endpoints\Sound\" />
</ItemGroup>
</Project>

33
PF3/PF3DbContext.cs Normal file
View File

@@ -0,0 +1,33 @@
using PF3.Models;
using Microsoft.EntityFrameworkCore;
namespace PF3;
public class PF3DbContext : DbContext
{
public DbSet<Show> Shows { get; set; }
public DbSet<Sound> Sounds { get; set; }
public DbSet<SoundCategory> SoundsCategorys { get; set; }
public DbSet<SoundTimecode> SoundsTimecodes { get; set; }
public DbSet<Staff> Staffs { get; set; }
public DbSet<Truck> Trucks { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)//Configuration de la connexion à la BDD
{
/*
string connectionString =
"Server=romaric-thibault.fr;" +
"Database=timothe_EfCoreLibrary;" +
"User Id=timothe;" +
"Password=Onto9-Cage-Afflicted;" +
"TrustServerCertificate=true;";
optionsBuilder.UseSqlServer(connectionString);
*/
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
//Vide pour le moment
}
}

View File

@@ -1,5 +1,3 @@
using PF3;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@@ -40,10 +38,7 @@ app.MapGet("/weatherforecast", () =>
app.Run();
namespace PF3
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("PF3")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8d0c2aa3f65ecf346de689fc5cf245d03bdfa389")]
[assembly: System.Reflection.AssemblyProductAttribute("PF3")]
[assembly: System.Reflection.AssemblyTitleAttribute("PF3")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Généré par la classe MSBuild WriteCodeFragment.

View File

@@ -0,0 +1 @@
ee982ef4ec9c48c98f177c2b539dc42b46b252a39b493b307728df084d0fdc9e

View File

@@ -0,0 +1,19 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb = true
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = PF3
build_property.RootNamespace = PF3
build_property.ProjectDir = C:\Users\timot\RiderProjects\PF3\AP-WEB-PF3\PF3\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 8.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\Users\timot\RiderProjects\PF3\AP-WEB-PF3\PF3
build_property._RazorSourceGeneratorDebug =

View File

@@ -0,0 +1,17 @@
// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;
global using global::System.Threading;
global using global::System.Threading.Tasks;

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More