2 Commits

Author SHA1 Message Date
oistig 8f4171a045 09/10 2025-10-09 16:55:29 +02:00
oistig 8a8a47c99c Initial commit 2025-10-09 16:52:35 +02:00
101 changed files with 2293 additions and 4336 deletions
-810
View File
@@ -1,810 +0,0 @@
# Created by https://www.toptal.com/developers/gitignore/api/dotnetcore,csharp,visualstudio,rider,jetbrains+all,windows,macos,linux,sonarqube
# Edit at https://www.toptal.com/developers/gitignore?templates=dotnetcore,csharp,visualstudio,rider,jetbrains+all,windows,macos,linux,sonarqube
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
### DotnetCore ###
# .NET Core build folders
bin/
obj/
# Common node modules locations
/node_modules
/wwwroot/node_modules
### JetBrains+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### JetBrains+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Linux ###
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
# AWS User-specific
# Generated files
# Sensitive or high-churn files
# Gradle
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
# Mongo Explorer plugin
# File-based project format
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
# SonarLint plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client
# Android studio 3.1+ serialized cache file
### SonarQube ###
# SonarQube ignore files.
#
# https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
# Sonar Scanner working directories
.sonar/
.sonarqube/
.scannerwork/
# http://www.sonarlint.org/commandline/
# SonarLint working directories, configuration files (including credentials)
.sonarlint/
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
# Windows shortcuts
*.lnk
### VisualStudio ###
# User-specific files
# User-specific files (MonoDevelop/Xamarin Studio)
# Mono auto generated files
# Build results
# Visual Studio 2015/2017 cache/options directory
# Uncomment if you have tasks that create the project's static files in wwwroot
# Visual Studio 2017 auto generated files
# MSTest test Results
# NUnit
# Build Results of an ATL Project
# Benchmark Results
# .NET Core
# ASP.NET Scaffolding
# StyleCop
# Files built by Visual Studio
# Chutzpah Test files
# Visual C++ cache files
# Visual Studio profiler
# Visual Studio Trace Files
# TFS 2012 Local Workspace
# Guidance Automation Toolkit
# ReSharper is a .NET coding add-in
# TeamCity is a build add-in
# DotCover is a Code Coverage Tool
# AxoCover is a Code Coverage Tool
# Coverlet is a free, cross platform Code Coverage Tool
# Visual Studio code coverage results
# NCrunch
# MightyMoose
# Web workbench (sass)
# Installshield output folder
# DocProject is a documentation generator add-in
# Click-Once directory
# Publish Web Output
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
# NuGet Packages
# NuGet Symbol Packages
# The packages folder can be ignored because of Package Restore
# except build/, which is used as an MSBuild target.
# Uncomment if necessary however generally it will be regenerated when needed
# NuGet v3's project.json files produces more ignorable files
# Microsoft Azure Build Output
# Microsoft Azure Emulator
# Windows Store app package directories and files
# Visual Studio cache files
# files ending in .cache can be ignored
# but keep track of directories ending in .cache
# Others
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
# RIA/Silverlight projects
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
# SQL Server files
# Business Intelligence projects
# Microsoft Fakes
# GhostDoc plugin setting file
# Node.js Tools for Visual Studio
# Visual Studio 6 build log
# Visual Studio 6 workspace options file
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
# Visual Studio 6 technical files
# Visual Studio LightSwitch build output
# Paket dependency manager
# FAKE - F# Make
# CodeRush personal settings
# Python Tools for Visual Studio (PTVS)
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
# Telerik's JustMock configuration file
# BizTalk build output
# OpenCover UI analysis results
# Azure Stream Analytics local run output
# MSBuild Binary and Structured Log
# NVidia Nsight GPU debugger configuration file
# MFractors (Xamarin productivity tool) working folder
# Local History for Visual Studio
# Visual Studio History (VSHistory) files
# BeatPulse healthcheck temp database
# Backup folder for Package Reference Convert tool in Visual Studio 2017
# Ionide (cross platform F# VS Code tools) working folder
# Fody - auto-generated XML schema
# VS Code files for those working on multiple tools
# Local History for Visual Studio Code
# Windows Installer files from build outputs
# JetBrains Rider
### VisualStudio Patch ###
# Additional files built by Visual Studio
# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,csharp,visualstudio,rider,jetbrains+all,windows,macos,linux,sonarqube
-16
View File
@@ -1,16 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PyroFetes", "PyroFetes\PyroFetes.csproj", "{23E11090-EC39-414E-B2A7-FEF96FE729E3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{23E11090-EC39-414E-B2A7-FEF96FE729E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23E11090-EC39-414E-B2A7-FEF96FE729E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23E11090-EC39-414E-B2A7-FEF96FE729E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23E11090-EC39-414E-B2A7-FEF96FE729E3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
@@ -0,0 +1,7 @@
namespace PyroFetes.DTO.Brand.Request;
public class CreateBrandDto
{
public string? Name { get; set; }
}
@@ -0,0 +1,8 @@
namespace PyroFetes.DTO.Brand.Request;
public class UpdateBrandDto
{
public int Id { get; set; }
public string? Name { get; set; }
}
@@ -0,0 +1,8 @@
namespace PyroFetes.DTO.Brand.Response;
public class GetBrandDto
{
public int Id { get; set; }
public string? Name { get; set; }
}
@@ -0,0 +1,7 @@
namespace PyroFetes.DTO.Classification.Request;
public class CreateClassificationDto
{
public string? Label { get; set; }
}
@@ -0,0 +1,8 @@
namespace PyroFetes.DTO.Classification.Request;
public class UpdateClassificationDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,8 @@
namespace PyroFetes.DTO.Classification.Response;
public class GetClassificationDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,6 @@
namespace PyroFetes.DTO.Color.Request;
public class CreateColorDto
{
public string? Label { get; set; }
}
@@ -0,0 +1,7 @@
namespace PyroFetes.DTO.Color.Request;
public class UpdateColorDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,7 @@
namespace PyroFetes.DTO.Color.Response;
public class GetColorDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,6 @@
namespace PyroFetes.DTO.Effect.Request;
public class CreateEffectDto
{
public string? Label { get; set; }
}
@@ -0,0 +1,7 @@
namespace PyroFetes.DTO.Effect.Request;
public class UpdateEffectDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,7 @@
namespace PyroFetes.DTO.Effect.Response;
public class GetEffectDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,9 @@
namespace PyroFetes.DTO.Material.Request;
public class CreateMaterialDto
{
public string? Label { get; set; }
public int Quantity { get; set; }
public int WarehouseId {get; set;}
}
@@ -0,0 +1,10 @@
namespace PyroFetes.DTO.Material.Request;
public class UpdateMaterialDto
{
public int Id { get; set; }
public string? Label { get; set; }
public int Quantity { get; set; }
public int WarehouseId {get; set;}
}
@@ -0,0 +1,10 @@
namespace PyroFetes.DTO.Material.Response;
public class GetMaterialDto
{
public int Id { get; set; }
public string? Label { get; set; }
public int Quantity { get; set; }
public int WarehouseId {get; set;}
}
@@ -0,0 +1,10 @@
namespace API.DTO.Movement.Request;
public class CreateMovementDto
{
public DateTime Date { get; set; }
public DateTime Start {get; set;}
public DateTime Arrival {get; set;}
public int Quantity {get; set;}
}
@@ -0,0 +1,11 @@
namespace API.DTO.Movement.Request;
public class UpdateMovementDto
{
public int Id { get; set; }
public DateTime Date { get; set; }
public DateTime Start {get; set;}
public DateTime Arrival {get; set;}
public int Quantity {get; set;}
}
@@ -0,0 +1,11 @@
namespace API.DTO.Movement.Response;
public class GetMovementDto
{
public int Id { get; set; }
public DateTime Date { get; set; }
public DateTime Start {get; set;}
public DateTime Arrival {get; set;}
public int Quantity {get; set;}
}
@@ -0,0 +1,21 @@
using PyroFetes.Models;
namespace PyroFetes.DTO.Product.Request;
public class CreateProductDto
{
public int References { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
public decimal SellingPrice {get; set;}
public string? Image { get; set; }
public string? Link { get; set; }
public int ClassificationId { get; set;}
public int ProductCategoryId { get; set; }
}
@@ -0,0 +1,20 @@
using PyroFetes.Models;
namespace PyroFetes.DTO.Product.Request;
public class UpdateProductDto
{
public int Id { get; set; }
public int Reference { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
public decimal SellingPrice {get; set;}
public string? Image { get; set; }
public string? Link { get; set; }
public int ClassificationId { get; set;}
public int ProductCategoryId { get; set; }
}
@@ -0,0 +1,23 @@
using PyroFetes.Models;
namespace PyroFetes.DTO.Product.Response;
public class GetProductDto
{
public int Id { get; set; }
public int Reference { get; set; }
public string? Name { get; set; }
public decimal Duration { get; set; }
public decimal Caliber { get; set; }
public int ApprovalNumber { get; set; }
public decimal Weight { get; set; }
public decimal Nec { get; set; }
public decimal SellingPrice {get; set;}
public string? Image { get; set; }
public string? Link { get; set; }
public int ClassificationId { get; set;}
public string? ClassificationLabel { get; set; }
public int ProductCategoryId { get; set; }
public string? ProductCategoryLabel { get; set; }
}
@@ -0,0 +1,6 @@
namespace API.DTO.ProductCategory.Request;
public class CreateProductCategoryDto
{
public string? Label { get; set; }
}
@@ -0,0 +1,7 @@
namespace API.DTO.ProductCategory.Request;
public class UpdateProductCategoryDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,8 @@
namespace API.DTO.ProductCategory.Response;
public class GetProductCategoryDto
{
public int Id { get; set; }
public string? Label { get; set; }
}
@@ -0,0 +1,11 @@
namespace API.DTO.Supplier.Request;
public class CreateSupplierDto
{
public string Name { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}
@@ -0,0 +1,12 @@
namespace API.DTO.Supplier.Request;
public class UpdateSupplierDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}
@@ -0,0 +1,12 @@
namespace API.DTO.Supplier.Response;
public class GetSupplierDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string PhoneNumber { get; set; }
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}
@@ -0,0 +1,12 @@
namespace API.DTO.Warehouse.Request;
public class CreateWarehouseDto
{
public string Name {get; set;}
public int MaxWeight {get; set;}
public int Current {get; set;}
public int MinWeight {get; set;}
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}
@@ -0,0 +1,13 @@
namespace API.DTO.Warehouse.Request;
public class UpdateWarehouseDto
{
public int Id {get; set;}
public string Name {get; set;}
public int MaxWeight {get; set;}
public int Current {get; set;}
public int MinWeight {get; set;}
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}
@@ -0,0 +1,13 @@
namespace API.DTO.Warehouse.Response;
public class GetWarehouseDto
{
public int Id {get; set;}
public string Name {get; set;}
public int MaxWeight {get; set;}
public int Current {get; set;}
public int MinWeight {get; set;}
public string Adress { get; set; }
public int ZipCode { get; set; }
public string City { get; set; }
}
@@ -0,0 +1,35 @@
using PyroFetes.DTO.Brand.Request;
using PyroFetes.DTO.Brand.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Brand;
public class CreateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateBrandDto, GetBrandDto>
{
public override void Configure()
{
Post("/api/brands");
AllowAnonymous();
}
public override async Task HandleAsync(CreateBrandDto req, CancellationToken ct)
{
Models.Brand brand = new ()
{
Name = req.Name
};
pyrofetesdbcontext.Brands.Add(brand);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Marque créé avec succès !");
GetBrandDto responseDto = new ()
{
Name = req.Name
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,38 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Brand;
public class DeleteBrandRequest
{
public int Id { get; set; }
}
public class DeleteBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteBrandRequest>
{
public override void Configure()
{
Delete("/api/brands/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteBrandRequest req, CancellationToken ct)
{
Models.Brand? brandToDelete = await pyrofetesdbcontext
.Brands
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (brandToDelete == null)
{
Console.WriteLine($"Aucune marque avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.Brands.Remove(brandToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,28 @@
using PyroFetes.DTO.Brand.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Brand;
public class GetAllBrandsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetBrandDto>>
{
public override void Configure()
{
Get("/api/brands");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetBrandDto> responseDto = await pyrofetesdbcontext.Brands
.Select(a => new GetBrandDto
{
Id = a.Id,
Name = a.Name,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,42 @@
using PyroFetes.DTO.Brand.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Brand;
public class GetBrandRequest
{
public int Id { get; set; }
}
public class GetBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetBrandRequest, GetBrandDto>
{
public override void Configure()
{
Get("/api/brands/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetBrandRequest req, CancellationToken ct)
{
Models.Brand? brand = await pyrofetesdbcontext
.Brands
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (brand == null)
{
Console.WriteLine($"Aucune marque avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetBrandDto responseDto = new()
{
Id = req.Id,
Name = brand.Name
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,34 @@
using PyroFetes.DTO.Brand.Request;
using PyroFetes.DTO.Brand.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Brand;
public class UpdateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateBrandDto, GetBrandDto>
{
public override void Configure()
{
Post("/api/brands");
AllowAnonymous();
}
public override async Task HandleAsync(UpdateBrandDto req, CancellationToken ct)
{
Models.Brand brand = new()
{
Name = req.Name
};
pyrofetesdbcontext.Add(brand);
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetBrandDto response = new()
{
Id = req.Id,
Name = req.Name
};
await Send.OkAsync(response, ct);
}
}
@@ -0,0 +1,35 @@
using PyroFetes.DTO.Classification.Request;
using PyroFetes.DTO.Classification.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Classification;
public class CreateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateClassificationDto, GetClassificationDto>
{
public override void Configure()
{
Post("/api/classifications");
AllowAnonymous();
}
public override async Task HandleAsync(CreateClassificationDto req, CancellationToken ct)
{
Models.Classification classification = new ()
{
Label = req.Label
};
pyrofetesdbcontext.Classifications.Add(classification);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Classification créée avec succès !");
GetClassificationDto responseDto = new ()
{
Label = req.Label
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,38 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Classification;
public class DeleteClassificationRequest
{
public int Id { get; set; }
}
public class DeleteClassificationEndpoint(PyroFetesDbContext libraryDbContext) : Endpoint<DeleteClassificationRequest>
{
public override void Configure()
{
Delete("/api/classifications/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteClassificationRequest req, CancellationToken ct)
{
Models.Classification? classificationToDelete = await libraryDbContext
.Classifications
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (classificationToDelete == null)
{
Console.WriteLine($"Aucune classification avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
libraryDbContext.Classifications.Remove(classificationToDelete);
await libraryDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,28 @@
using PyroFetes.DTO.Classification.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Classification;
public class GetAllClassificationsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetClassificationDto>>
{
public override void Configure()
{
Get("/api/classifications");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetClassificationDto> responseDto = await pyrofetesdbcontext.Classifications
.Select(a => new GetClassificationDto
{
Id = a.Id,
Label = a.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,42 @@
using PyroFetes.DTO.Classification.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Classification;
public class GetClassificationRequest
{
public int Id { get; set; }
}
public class GetClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetClassificationRequest, GetClassificationDto>
{
public override void Configure()
{
Get("/api/classifications/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetClassificationRequest req, CancellationToken ct)
{
Models.Classification? classification = await pyrofetesdbcontext
.Classifications
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (classification == null)
{
Console.WriteLine($"Aucune classification avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetClassificationDto responseDto = new()
{
Id = req.Id,
Label = classification.Label
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,34 @@
using PyroFetes.DTO.Classification.Request;
using PyroFetes.DTO.Classification.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Classification;
public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateClassificationDto, GetClassificationDto>
{
public override void Configure()
{
Post("/api/classifications");
AllowAnonymous();
}
public override async Task HandleAsync(UpdateClassificationDto req, CancellationToken ct)
{
Models.Classification classification = new()
{
Label = req.Label
};
pyrofetesdbcontext.Add(classification);
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetClassificationDto response = new()
{
Id = req.Id,
Label = req.Label
};
await Send.OkAsync(response, ct);
}
}
@@ -0,0 +1,35 @@
using PyroFetes.DTO.Color.Request;
using PyroFetes.DTO.Color.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Color;
public class CreateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<CreateColorDto, GetColorDto>
{
public override void Configure()
{
Post("/api/color/create");
AllowAnonymous();
}
public override async Task HandleAsync(CreateColorDto req, CancellationToken ct)
{
Models.Color color = new()
{
Label = req.Label,
};
appDbContext.Colors.Add(color);
await appDbContext.SaveChangesAsync(ct);
Console.WriteLine("Added Color");
GetColorDto responseDto = new()
{
Id = color.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,37 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Color;
public class DeleteColorRequest
{
public int Id { get; set; }
}
public class DeleteColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<DeleteColorRequest>
{
public override void Configure()
{
Delete("/api/colors/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteColorRequest req, CancellationToken ct)
{
Models.Color? colorToDelete = await appDbContext
.Colors
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (colorToDelete == null)
{
Console.WriteLine($"Aucune couleur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
appDbContext.Colors.Remove(colorToDelete);
await appDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,26 @@
using PyroFetes.DTO.Color.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Color;
public class GetAllColorsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest<List<GetColorDto>>
{
public override void Configure()
{
Get("/api/colors");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetColorDto> responseDto = await appDbContext.Colors
.Select(a => new GetColorDto
{
Id = a.Id,
Label = a.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,42 @@
using PyroFetes.DTO.Color.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Color;
public class GetColorRequest
{
public int Id { get; set; }
}
public class GetColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<GetColorRequest, GetColorDto>
{
public override void Configure()
{
Get("/api/colors/{@id}", x => new { x.Id});
AllowAnonymous();
}
public override async Task HandleAsync(GetColorRequest req, CancellationToken ct)
{
Models.Color? color = await appDbContext
.Colors
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (color == null)
{
Console.WriteLine($"Aucune couleur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetColorDto responseDto = new()
{
Id = color.Id,
Label = color.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,42 @@
using PyroFetes.DTO.Color.Request;
using PyroFetes.DTO.Color.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Color;
public class UpdateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<UpdateColorDto, GetColorDto>
{
public override void Configure()
{
Put("/api/colors/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateColorDto req, CancellationToken ct)
{
Models.Color? colorToEdit = await appDbContext
.Colors
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (colorToEdit == null)
{
Console.WriteLine($"Aucune couleur avec l'id {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
colorToEdit.Label = req.Label;
await appDbContext.SaveChangesAsync(ct);
GetColorDto responseDto = new()
{
Id = req.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,34 @@
using PyroFetes.DTO.Effect.Request;
using PyroFetes.DTO.Effect.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Effect;
public class CreateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<CreateEffectDto, GetEffectDto>
{
public override void Configure()
{
Post("/api/effect/create");
AllowAnonymous();
}
public override async Task HandleAsync(CreateEffectDto req, CancellationToken ct)
{
Models.Effect effect = new()
{
Label = req.Label,
};
appDbContext.Effects.Add(effect);
await appDbContext.SaveChangesAsync(ct);
Console.WriteLine("Effect added");
GetEffectDto responseDto = new()
{
Id = effect.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,36 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Effect;
public class DeleteEffectRequest
{
public int Id { get; set; }
}
public class DeleteEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<DeleteEffectRequest>
{
public override void Configure()
{
Delete("/api/effects/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteEffectRequest req, CancellationToken ct)
{
Models.Effect? effectToDelete = await appDbContext
.Effects
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (effectToDelete == null)
{
Console.WriteLine($"Aucun effet avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
appDbContext.Effects.Remove(effectToDelete);
await appDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,27 @@
using PyroFetes.DTO.Effect.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Effect;
public class GetAllEffectsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest<List<GetEffectDto>>
{
public override void Configure()
{
Get("/api/effects");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetEffectDto> responseDto = await appDbContext.Effects
.Select(a => new GetEffectDto
{
Id = a.Id,
Label = a.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,42 @@
using PyroFetes.DTO.Effect.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Effect;
public class GetEffectRequest
{
public int Id { get; set; }
}
public class GetEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<GetEffectRequest, GetEffectDto>
{
public override void Configure()
{
Get("/api/effect/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetEffectRequest req, CancellationToken ct)
{
Models.Effect? effect = await appDbContext
.Effects
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (effect == null)
{
Console.WriteLine($"Aucun effet avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetEffectDto responseDto = new()
{
Id = effect.Id,
Label = effect.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,42 @@
using PyroFetes.DTO.Effect.Request;
using PyroFetes.DTO.Effect.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Effect;
public class UpdateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<UpdateEffectDto, GetEffectDto>
{
public override void Configure()
{
Put("/api/effect/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateEffectDto req, CancellationToken ct)
{
Models.Effect? effectToEdit = await appDbContext
.Effects
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (effectToEdit == null)
{
Console.WriteLine($"Aucun effet avec l'id {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
effectToEdit.Label = req.Label;
await appDbContext.SaveChangesAsync(ct);
GetEffectDto responseDto = new()
{
Id = req.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,36 @@
using PyroFetes.DTO.Material.Request;
using PyroFetes.DTO.Material.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Material;
public class CreateMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<CreateMaterialDto, GetMaterialDto>
{
public override void Configure()
{
Post("/api/material/create");
AllowAnonymous();
}
public override async Task HandleAsync(CreateMaterialDto req, CancellationToken ct)
{
Models.Material material = new()
{
Label = req.Label,
Quantity = req.Quantity,
WarehouseId = req.WarehouseId,
};
appDbContext.Materials.Add(material);
await appDbContext.SaveChangesAsync(ct);
Console.WriteLine("Material added");
GetMaterialDto responseDto = new()
{
Id = material.Id,
WarehouseId = material.WarehouseId,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,35 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Material;
public class DeleteMaterialRequest
{
public int Id { get; set; }
}
public class DeleteMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<DeleteMaterialRequest>
{
public override void Configure()
{
Delete("/api/materials/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteMaterialRequest req, CancellationToken ct)
{
Models.Material? materialToDelete = await appDbContext
.Materials
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (materialToDelete == null)
{
Console.WriteLine($"Aucun matériel avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
appDbContext.Materials.Remove(materialToDelete);
await appDbContext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,28 @@
using PyroFetes.DTO.Material.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Material;
public class GetAllMaterialsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest<List<GetMaterialDto>>
{
public override void Configure()
{
Get("/api/material");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetMaterialDto> responseDto = await appDbContext.Materials
.Select(a => new GetMaterialDto
{
Id = a.Id,
Label = a.Label,
Quantity = a.Quantity,
WarehouseId = a.WarehouseId,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,43 @@
using PyroFetes.DTO.Material.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Authentication;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Material;
public class GetMaterialRequest
{
public int Id { get; set; }
}
public class GetMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<GetMaterialRequest, GetMaterialDto>
{
public override void Configure()
{
Get("/api/material/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetMaterialRequest req, CancellationToken ct)
{
Models.Material? material = await appDbContext
.Materials
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (material == null)
{
Console.WriteLine("Aucun matériel avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetMaterialDto responseDto = new()
{
Id = material.Id,
Label = material.Label,
WarehouseId = material.WarehouseId,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,43 @@
using PyroFetes.DTO.Material.Request;
using PyroFetes.DTO.Material.Response;
using FastEndpoints;
using Microsoft.AspNetCore.Server.Kestrel;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Material;
public class UpdateMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<UpdateMaterialDto, GetMaterialDto>
{
public override void Configure()
{
Put("/api/material/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateMaterialDto req, CancellationToken ct)
{
Models.Material? materialToEdit = await appDbContext
.Materials
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
if (materialToEdit == null)
{
Console.WriteLine($"Aucun matériel avec l'id {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
materialToEdit.Label = req.Label;
materialToEdit.WarehouseId = req.WarehouseId;
await appDbContext.SaveChangesAsync(ct);
GetMaterialDto responseDto = new()
{
Id = req.Id,
Label = req.Label,
WarehouseId = req.WarehouseId,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,41 @@
using API.DTO.Movement.Request;
using API.DTO.Movement.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Movement;
public class CreateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateMovementDto, GetMovementDto>
{
public override void Configure()
{
Post("/api/movements");
AllowAnonymous();
}
public override async Task HandleAsync(CreateMovementDto req, CancellationToken ct)
{
Models.Movement movement = new ()
{
Date = req.Date,
Start = req.Start,
Arrival = req.Arrival,
Quantity = req.Quantity
};
pyrofetesdbcontext.Movements.Add(movement);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Movement créée avec succès !");
GetMovementDto responseDto = new ()
{
Date = req.Date,
Start = req.Start,
Arrival = req.Arrival,
Quantity = req.Quantity
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,38 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Movement;
public class DeleteMovementRequest
{
public int Id { get; set; }
}
public class DeleteMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteMovementRequest>
{
public override void Configure()
{
Delete("/api/Movements/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteMovementRequest req, CancellationToken ct)
{
Models.Movement? movementToDelete = await pyrofetesdbcontext
.Movements
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (movementToDelete == null)
{
Console.WriteLine($"Aucune mouvement avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.Movements.Remove(movementToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,31 @@
using API.DTO.Movement.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Movement;
public class GetAllMovementsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetMovementDto>>
{
public override void Configure()
{
Get("/api/movements");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetMovementDto> responseDto = await pyrofetesdbcontext.Movements
.Select(a => new GetMovementDto
{
Id = a.Id,
Date = a.Date,
Start = a.Start,
Arrival = a.Arrival,
Quantity = a.Quantity
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,45 @@
using API.DTO.Movement.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Movement;
public class GetMovementRequest
{
public int Id { get; set; }
}
public class GetMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetMovementRequest, GetMovementDto>
{
public override void Configure()
{
Get("/api/movements/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetMovementRequest req, CancellationToken ct)
{
Models.Movement? movement = await pyrofetesdbcontext
.Movements
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
if (movement == null)
{
Console.WriteLine($"Aucun mouvement avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetMovementDto responseDto = new()
{
Id = req.Id,
Date = movement.Date,
Start = movement.Start,
Arrival = movement.Arrival,
Quantity = movement.Quantity
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,40 @@
using API.DTO.Movement.Request;
using API.DTO.Movement.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Movement;
public class UpdateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateMovementDto, GetMovementDto>
{
public override void Configure()
{
Post("/api/movements");
AllowAnonymous();
}
public override async Task HandleAsync(UpdateMovementDto req, CancellationToken ct)
{
Models.Movement movement = new()
{
Date = req.Date,
Start = req.Start,
Arrival = req.Arrival,
Quantity = req.Quantity
};
pyrofetesdbcontext.Add(movement);
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetMovementDto response = new()
{
Id = req.Id,
Date = req.Date,
Start = req.Start,
Arrival = req.Arrival,
Quantity = req.Quantity
};
await Send.OkAsync(response, ct);
}
}
@@ -0,0 +1,57 @@
using FastEndpoints;
using PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Response;
namespace PyroFetes.Endpoints.Product;
public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateProductDto, GetProductDto>
{
public override void Configure()
{
Post("/api/products");
AllowAnonymous();
}
public override async Task HandleAsync(CreateProductDto req, CancellationToken ct)
{
Models.Product product = new ()
{
References = req.References,
Name = req.Name!,
Duration = req.Duration,
Caliber = req.Caliber,
ApprovalNumber = req.ApprovalNumber,
Weight = req.Weight,
Nec = req.Nec,
SellingPrice = req.SellingPrice,
Image = req.Image!,
Link = req.Link!,
ProductCategoryId = req.ProductCategoryId,
ClassificationId = req.ClassificationId
};
pyrofetesdbcontext.Products.Add(product);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Product créé avec succès !");
GetProductDto responseDto = new ()
{
Id = product.Id,
Reference = req.References,
Name = req.Name,
Duration = req.Duration,
Caliber = req.Caliber,
ApprovalNumber = req.ApprovalNumber,
Weight = req.Weight,
Nec = req.Nec,
SellingPrice = req.SellingPrice,
Image = req.Image,
Link = req.Link,
ProductCategoryId = req.ProductCategoryId,
ClassificationId = req.ClassificationId
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,37 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Product;
public class DeleteProductRequest
{
public int Id { get; set; }
}
public class DeleteProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteProductRequest>
{
public override void Configure()
{
Delete("/api/products/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteProductRequest req, CancellationToken ct)
{
Models.Product? productToDelete = await pyrofetesdbcontext
.Products
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
if (productToDelete == null)
{
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.Products.Remove(productToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,40 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Product.Response;
namespace PyroFetes.Endpoints.Product;
public class GetAllProductsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetProductDto>>
{
public override void Configure()
{
Get("/api/products");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetProductDto> responseDto = await pyrofetesdbcontext.Products
.Select(p => new GetProductDto()
{
Id = p.Id,
Reference = p.References,
Name = p.Name,
Duration = p.Duration,
Caliber = p.Caliber,
ApprovalNumber = p.ApprovalNumber,
Weight = p.Weight,
Nec = p.Nec,
SellingPrice = p.SellingPrice,
Image = p.Image,
Link = p.Link,
ClassificationId = p.ClassificationId,
ClassificationLabel = p.Classification!.Label,
ProductCategoryId = p.ProductCategoryId,
ProductCategoryLabel = p.ProductCategory!.Label,
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,55 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Product.Response;
namespace PyroFetes.Endpoints.Product;
public class GetProductRequest
{
public int Id { get; set; }
}
public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetProductRequest, GetProductDto>
{
public override void Configure()
{
Get("/api/product/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetProductRequest req, CancellationToken ct)
{
Models.Product? product = await pyrofetesdbcontext
.Products.Include(product => product.Classification).Include(product => product.ProductCategory)
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
if (product == null)
{
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetProductDto responseDto = new()
{
Id = product.Id,
Reference = product.References,
Name = product.Name,
Duration = product.Duration,
Caliber = product.Caliber,
ApprovalNumber = product.ApprovalNumber,
Weight = product.Weight,
Nec = product.Nec,
SellingPrice = product.SellingPrice,
Image = product.Image,
Link = product.Link,
ClassificationId = product.ClassificationId,
ClassificationLabel = product.Classification!.Label,
ProductCategoryId = product.ProductCategoryId,
ProductCategoryLabel = product.ProductCategory!.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,58 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.Product.Request;
using PyroFetes.DTO.Product.Response;
namespace PyroFetes.Endpoints.Product;
public class UpdateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<UpdateProductDto, GetProductDto>
{
public override void Configure()
{
Put("/api/products/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct)
{
Models.Product? productToEdit = await pyrofetesdbcontext
.Products
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
if (productToEdit == null)
{
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
productToEdit.References = req.Reference;
productToEdit.Name = req.Name;
productToEdit.Duration = req.Duration;
productToEdit.Caliber = req.Caliber;
productToEdit.ApprovalNumber = req.ApprovalNumber;
productToEdit.Weight = req.Weight;
productToEdit.Nec = req.Nec;
productToEdit.SellingPrice = req.SellingPrice;
productToEdit.Image = req.Image;
productToEdit.Link = req.Link;
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetProductDto responseDto = new()
{
Id = req.Id,
Reference = req.Reference,
Name = req.Name,
Duration = req.Duration,
Caliber = req.Caliber,
ApprovalNumber = req.ApprovalNumber,
Weight = req.Weight,
Nec = req.Nec,
SellingPrice = req.SellingPrice,
Image = req.Image,
Link = req.Link
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,37 @@
using API.DTO.ProductCategory.Request;
using API.DTO.ProductCategory.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.ProductCategory;
public class CreateProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateProductCategoryDto, GetProductCategoryDto>
{
public override void Configure()
{
Post("/api/productcategories");
AllowAnonymous();
}
public override async Task HandleAsync(CreateProductCategoryDto req, CancellationToken ct)
{
Models.ProductCategory productCategory = new ()
{
Label = req.Label,
};
pyrofetesdbcontext.ProductCategories.Add(productCategory);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Category créé avec succès !");
GetProductCategoryDto responseDto = new ()
{
Id = productCategory.Id,
Label = productCategory.Label
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,36 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.ProductCategory;
public class DeleteProductCategoryRequest
{
public int Id { get; set; }
}
public class DeleteProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteProductCategoryRequest>
{
public override void Configure()
{
Delete("/api/productcategories/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteProductCategoryRequest req, CancellationToken ct)
{
Models.ProductCategory? productCategoryToDelete = await pyrofetesdbcontext
.ProductCategories
.SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct);
if (productCategoryToDelete == null)
{
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.ProductCategories.Remove(productCategoryToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,27 @@
using API.DTO.ProductCategory.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.ProductCategory;
public class GetAllProductCategoriesEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetProductCategoryDto>>
{
public override void Configure()
{
Get("/api/productcategories");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetProductCategoryDto> responseDto = await pyrofetesdbcontext.ProductCategories
.Select(pc => new GetProductCategoryDto()
{
Id = pc.Id,
Label = pc.Label
}
).ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,42 @@
using API.DTO.ProductCategory.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.ProductCategory;
public class GetProductCategoryRequest
{
public int Id { get; set; }
}
public class GetProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetProductCategoryRequest, GetProductCategoryDto>
{
public override void Configure()
{
Get("/api/productcategory/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetProductCategoryRequest req, CancellationToken ct)
{
Models.ProductCategory? productCategory = await pyrofetesdbcontext
.ProductCategories
.SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct);
if (productCategory == null)
{
await Send.NotFoundAsync(ct);
return;
}
GetProductCategoryDto responseDto = new()
{
Id = productCategory.Id,
Label = productCategory.Label
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,39 @@
using API.DTO.ProductCategory.Request;
using API.DTO.ProductCategory.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.ProductCategory;
public class UpdateProductCategoryEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<UpdateProductCategoryDto, GetProductCategoryDto>
{
public override void Configure()
{
Put("/api/productcategory/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateProductCategoryDto req, CancellationToken ct)
{
Models.ProductCategory? productCategoryToEdit = await pyrofetesdbcontext
.ProductCategories
.SingleOrDefaultAsync(pc => pc.Id == req.Id, cancellationToken: ct);
if (productCategoryToEdit == null)
{
await Send.NotFoundAsync(ct);
return;
}
productCategoryToEdit.Label = req.Label;
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetProductCategoryDto responseDto = new()
{
Id = req.Id,
Label = req.Label,
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,48 @@
using API.DTO.Supplier.Request;
using API.DTO.Supplier.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Supplier;
public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateSupplierDto, GetSupplierDto>
{
public override void Configure()
{
Post("/api/suppliers");
AllowAnonymous();
}
public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct)
{
// Création d'un nouvel objet Supplier
Models.Supplier supplier = new()
{
Name = req.Name,
Email = req.Email,
Phone = req.PhoneNumber,
Address = req.Adress,
ZipCode = req.ZipCode,
City = req.City
};
// Ajout à la base et sauvegarde
pyrofetesdbcontext.Suppliers.Add(supplier);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Fournisseur créé avec succès !");
// Préparation de la réponse
GetSupplierDto responseDto = new()
{
Id = supplier.Id,
Name = supplier.Name,
Email = supplier.Email,
PhoneNumber = supplier.Phone,
Adress = supplier.Address,
ZipCode = supplier.ZipCode,
City = supplier.City
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,37 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Supplier;
public class DeleteSupplierRequest
{
public int Id { get; set; }
}
public class DeleteSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteSupplierRequest>
{
public override void Configure()
{
Delete("/api/suppliers/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct)
{
Models.Supplier? supplierToDelete = await pyrofetesdbcontext
.Suppliers
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
if (supplierToDelete == null)
{
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.Suppliers.Remove(supplierToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,32 @@
using API.DTO.Supplier.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Supplier;
public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetSupplierDto>>
{
public override void Configure()
{
Get("/api/suppliers");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetSupplierDto> responseDto = await pyrofetesdbcontext.Suppliers
.Select(s => new GetSupplierDto
{
Id = s.Id,
Name = s.Name!,
Email = s.Email!,
PhoneNumber = s.Phone!,
Adress = s.Address!,
ZipCode = s.ZipCode,
City = s.City!
})
.ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,46 @@
using API.DTO.Supplier.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Supplier;
public class GetSupplierRequest
{
public int Id { get; set; }
}
public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetSupplierRequest, GetSupplierDto>
{
public override void Configure()
{
Get("/api/suppliers/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct)
{
Models.Supplier? supplier = await pyrofetesdbcontext
.Suppliers
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
if (supplier == null)
{
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetSupplierDto responseDto = new()
{
Id = supplier.Id,
Name = supplier.Name!,
Email = supplier.Email!,
PhoneNumber = supplier.Phone!,
Adress = supplier.Address!,
ZipCode = supplier.ZipCode,
City = supplier.City!
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,52 @@
using API.DTO.Supplier.Request;
using API.DTO.Supplier.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Supplier;
public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateSupplierDto, GetSupplierDto>
{
public override void Configure()
{
Put("/api/suppliers/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct)
{
Models.Supplier? supplierToEdit = await pyrofetesdbcontext
.Suppliers
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
if (supplierToEdit == null)
{
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
// Mise à jour des propriétés
supplierToEdit.Name = req.Name;
supplierToEdit.Email = req.Email;
supplierToEdit.Phone = req.PhoneNumber;
supplierToEdit.Address = req.Adress;
supplierToEdit.ZipCode = req.ZipCode;
supplierToEdit.City = req.City;
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetSupplierDto responseDto = new()
{
Id = supplierToEdit.Id,
Name = supplierToEdit.Name,
Email = supplierToEdit.Email,
PhoneNumber = supplierToEdit.Phone,
Adress = supplierToEdit.Address,
ZipCode = supplierToEdit.ZipCode,
City = supplierToEdit.City
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,47 @@
using API.DTO.Warehouse.Request;
using API.DTO.Warehouse.Response;
using FastEndpoints;
namespace PyroFetes.Endpoints.Warehouse;
public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateWarehouseDto, GetWarehouseDto>
{
public override void Configure()
{
Post("/api/warehouse");
AllowAnonymous();
}
public override async Task HandleAsync(CreateWarehouseDto req, CancellationToken ct)
{
Models.Warehouse warehouse = new()
{
Name = req.Name,
MaxWeight = req.MaxWeight,
Current = req.Current,
MinWeight = req.MinWeight,
Address = req.Adress,
ZipCode = req.ZipCode,
City = req.City
};
pyrofetesdbcontext.Warehouses.Add(warehouse);
await pyrofetesdbcontext.SaveChangesAsync(ct);
Console.WriteLine("Entrepôt créé avec succès !");
GetWarehouseDto responseDto = new()
{
Id = warehouse.Id,
Name = warehouse.Name,
MaxWeight = warehouse.MaxWeight,
Current = warehouse.Current,
MinWeight = warehouse.MinWeight,
Adress = warehouse.Address,
ZipCode = warehouse.ZipCode,
City = warehouse.City
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,37 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Warehouse;
public class DeleteWarehouseRequest
{
public int Id { get; set; }
}
public class DeleteWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteWarehouseRequest>
{
public override void Configure()
{
Delete("/api/warehouse/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(DeleteWarehouseRequest req, CancellationToken ct)
{
Models.Warehouse? warehouseToDelete = await pyrofetesdbcontext
.Warehouses
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
if (warehouseToDelete == null)
{
Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
pyrofetesdbcontext.Warehouses.Remove(warehouseToDelete);
await pyrofetesdbcontext.SaveChangesAsync(ct);
await Send.NoContentAsync(ct);
}
}
@@ -0,0 +1,33 @@
using API.DTO.Warehouse.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Warehouse;
public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetWarehouseDto>>
{
public override void Configure()
{
Get("/api/warehouses");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetWarehouseDto> responseDto = await pyrofetesdbcontext.Warehouses
.Select(w => new GetWarehouseDto
{
Id = w.Id,
Name = w.Name,
MaxWeight = w.MaxWeight,
Current = w.Current,
MinWeight = w.MinWeight,
Adress = w.Address,
ZipCode = w.ZipCode,
City = w.City
})
.ToListAsync(ct);
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,47 @@
using API.DTO.Warehouse.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Warehouse;
public class GetWarehouseRequest
{
public int Id { get; set; }
}
public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetWarehouseRequest, GetWarehouseDto>
{
public override void Configure()
{
Get("/api/warehouses/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(GetWarehouseRequest req, CancellationToken ct)
{
Models.Warehouse? warehouse = await pyrofetesdbcontext
.Warehouses
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
if (warehouse == null)
{
Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
GetWarehouseDto responseDto = new()
{
Id = warehouse.Id,
Name = warehouse.Name!,
MaxWeight = warehouse.MaxWeight,
Current = warehouse.Current,
MinWeight = warehouse.MinWeight,
Adress = warehouse.Address!,
ZipCode = warehouse.ZipCode,
City = warehouse.City!
};
await Send.OkAsync(responseDto, ct);
}
}
@@ -0,0 +1,54 @@
using API.DTO.Warehouse.Request;
using API.DTO.Warehouse.Response;
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
namespace PyroFetes.Endpoints.Warehouse;
public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateWarehouseDto, GetWarehouseDto>
{
public override void Configure()
{
Put("/api/warehouses/{@id}", x => new { x.Id });
AllowAnonymous();
}
public override async Task HandleAsync(UpdateWarehouseDto req, CancellationToken ct)
{
Models.Warehouse? warehouseToEdit = await pyrofetesdbcontext
.Warehouses
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
if (warehouseToEdit == null)
{
Console.WriteLine($"Aucun entrepôt avec l'ID {req.Id} trouvé.");
await Send.NotFoundAsync(ct);
return;
}
// Mise à jour des champs
warehouseToEdit.Name = req.Name;
warehouseToEdit.MaxWeight = req.MaxWeight;
warehouseToEdit.Current = req.Current;
warehouseToEdit.MinWeight = req.MinWeight;
warehouseToEdit.Address = req.Adress;
warehouseToEdit.ZipCode = req.ZipCode;
warehouseToEdit.City = req.City;
await pyrofetesdbcontext.SaveChangesAsync(ct);
GetWarehouseDto responseDto = new()
{
Id = warehouseToEdit.Id,
Name = warehouseToEdit.Name,
MaxWeight = warehouseToEdit.MaxWeight,
Current = warehouseToEdit.Current,
MinWeight = warehouseToEdit.MinWeight,
Adress = warehouseToEdit.Address,
ZipCode = warehouseToEdit.ZipCode,
City = warehouseToEdit.City
};
await Send.OkAsync(responseDto, ct);
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-13
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
-4
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>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
+2
View File
@@ -4,11 +4,13 @@ namespace PyroFetes.Models;
public class Availability public class Availability
{ {
//Champs
[Key] public int Id { get; set; } [Key] public int Id { get; set; }
[Required] public DateOnly AvailabilityDate { get; set; } [Required] public DateOnly AvailabilityDate { get; set; }
[Required] public DateOnly DeliveryDate { get; set; } [Required] public DateOnly DeliveryDate { get; set; }
[Required] public DateOnly ExpirationDate { get; set; } [Required] public DateOnly ExpirationDate { get; set; }
[Required] public DateOnly RenewallDate { get; set; } [Required] public DateOnly RenewallDate { get; set; }
//Relations
public List<StaffAvailability>? StaffAvailabilities { get; set; } public List<StaffAvailability>? StaffAvailabilities { get; set; }
} }
+3 -1
View File
@@ -4,9 +4,11 @@ namespace PyroFetes.Models;
public class Brand public class Brand
{ {
//Champs
[Key] public int Id { get; set; } [Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; } [Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int ProductId { get; set; } [Required] public int ProductId { get; set; }
//Relations
[Required] public Product? Product { get; set; } [Required] public Product? Product { get; set; }
} }
+2
View File
@@ -4,9 +4,11 @@ namespace PyroFetes.Models;
public class City public class City
{ {
//Champs
[Key] public int Id { get; set; } [Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Name { get; set; } [Required, MaxLength(100)] public string? Name { get; set; }
[Required] public int ZipCode { get; set; } [Required] public int ZipCode { get; set; }
//Relations
public List<Show>? Shows { get; set; } public List<Show>? Shows { get; set; }
} }
+2
View File
@@ -4,8 +4,10 @@ namespace PyroFetes.Models;
public class Classification public class Classification
{ {
//Champs
[Key] public int Id { get; set; } [Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; } [Required, MaxLength(100)] public string? Label { get; set; }
//Relations
public List<Product>? Products { get; set; } public List<Product>? Products { get; set; }
} }
+2
View File
@@ -4,8 +4,10 @@ namespace PyroFetes.Models;
public class Color public class Color
{ {
//Champs
[Key] public int Id { get; set; } [Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Label { get; set; } [Required, MaxLength(100)] public string? Label { get; set; }
//Relations
public List<ProductColor>? ProductColors { get; set; } public List<ProductColor>? ProductColors { get; set; }
} }
+2
View File
@@ -4,11 +4,13 @@ namespace PyroFetes.Models;
public class Communication public class Communication
{ {
//Champs
[Key] public int Id { get; set; } [Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? Calling { get; set; } [Required, MaxLength(100)] public string? Calling { get; set; }
[Required, MaxLength(100)] public string? Email { get; set; } [Required, MaxLength(100)] public string? Email { get; set; }
[Required, MaxLength(300)] public string? Meeting { get; set; } [Required, MaxLength(300)] public string? Meeting { get; set; }
//Relations
[Required] public int ContactId { get; set; } [Required] public int ContactId { get; set; }
public Contact? Contact { get; set; } public Contact? Contact { get; set; }
} }
+3
View File
@@ -4,6 +4,7 @@ namespace PyroFetes.Models;
public class Contact public class Contact
{ {
//Champs
[Key] public int Id { get; set; } [Key] public int Id { get; set; }
[Required, MaxLength(100)] public string? LastName { get; set; } [Required, MaxLength(100)] public string? LastName { get; set; }
[Required, MaxLength(100)] public string? FirstName { get; set; } [Required, MaxLength(100)] public string? FirstName { get; set; }
@@ -14,6 +15,8 @@ public class Contact
[Required, MaxLength(100)] public string? City { get; set; } [Required, MaxLength(100)] public string? City { get; set; }
[Required, MaxLength(100)] public string? Role { get; set; } [Required, MaxLength(100)] public string? Role { get; set; }
//Relations
public Customer? Customer { get; set; } public Customer? Customer { get; set; }
[Required] public int CustomerId { get; set; } [Required] public int CustomerId { get; set; }
+1 -1
View File
@@ -5,7 +5,7 @@ namespace PyroFetes.Models;
public class Material public class Material
{ {
[Key] public int Id {get; set;} [Key] public int Id {get; set;}
[Required, MaxLength(100)] public string? Name {get; set;} [Required, MaxLength(100)] public string? Label {get; set;}
[Required] public int Quantity {get; set;} [Required] public int Quantity {get; set;}
[Required] public int WarehouseId {get; set;} [Required] public int WarehouseId {get; set;}
+13 -12
View File
@@ -1,18 +1,19 @@
var builder = WebApplication.CreateBuilder(args); using API;
using FastEndpoints;
using FastEndpoints.Swagger;
using PyroFetes;
// Add services to the container. WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build(); // On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet
builder.Services.AddFastEndpoints().SwaggerDocument();
// Configure the HTTP request pipeline. // On ajoute ici la configuration de la base de données
if (app.Environment.IsDevelopment()) builder.Services.AddDbContext<PyroFetesDbContext>();
{
app.UseSwagger(); // On construit l'application en lui donnant vie
app.UseSwaggerUI(); WebApplication app = builder.Build();
} app.UseFastEndpoints().UseSwaggerGen();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
-41
View File
@@ -1,41 +0,0 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:60777",
"sslPort": 44379
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5298",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7219;http://localhost:5298",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
-20
View File
@@ -1,20 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.19"/>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.20" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.20">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.20" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2"/>
</ItemGroup>
</Project>
-8
View File
@@ -1,8 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
-9
View File
@@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

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