forked from sanchezvem/PyroFetes
Compare commits
94 Commits
8f4171a045
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c0e7df9de | |||
| 5506eab8ff | |||
| 15545980af | |||
| dda2240e86 | |||
| a014c6c9f7 | |||
| 2112605cf3 | |||
| 90d685d42c | |||
| 2bcca6f856 | |||
| 6d564c89ff | |||
| bad259e9f5 | |||
| 32dee6eb18 | |||
| b3347fe163 | |||
| 0e74cb40f5 | |||
| 91b4aca2fa | |||
| 1734ec0219 | |||
| 7a8daa6ab8 | |||
| bb5dd63da2 | |||
| c5805d979b | |||
| 44da6ed371 | |||
| 08bf910437 | |||
| d1fa3aca68 | |||
| f155d03559 | |||
| f3ed82f4a4 | |||
| 22275b63f2 | |||
| 018f7c5c25 | |||
| 81ab26f765 | |||
| 75ab503dfc | |||
| 52f0e84323 | |||
| 9b9ec133aa | |||
| 4aa6db31b0 | |||
| 149cd9eb33 | |||
| d7bc054cb5 | |||
| abe508bd7c | |||
| 94ea571a42 | |||
| 93d259638a | |||
| e6030cacf2 | |||
| ccaaf25dbc | |||
| abc1c42b53 | |||
| 7e3eaa3b51 | |||
| 658d346dd0 | |||
| 997d7c64fb | |||
| 81854417d8 | |||
| 423f8f9645 | |||
| bd8495b79a | |||
| c729af3d32 | |||
| 04cb47802b | |||
| e4677b1aea | |||
| 268230daea | |||
| ad9c8aa42d | |||
| af208c152b | |||
| 0ddf5d380a | |||
| af92cdc524 | |||
| 856d8e2733 | |||
| 89be35ecb0 | |||
| 9a5c83161a | |||
| 41b0f1892e | |||
| 2bbb771635 | |||
| 1446fe7b95 | |||
| 5261446ddb | |||
| cfa2d59c0d | |||
| fa353446eb | |||
| f4da74e9e2 | |||
| df3b820dea | |||
| 2d73830c5a | |||
| 5419ca5aa9 | |||
| 03db82ed49 | |||
| 65725922f6 | |||
| c128cd453d | |||
| 52521908b7 | |||
| 3f1880b702 | |||
| df919bf943 | |||
| da0f5fb513 | |||
| 8be7169995 | |||
| 2781f1e80a | |||
| c4e8b0b2de | |||
| f163aa5feb | |||
| 4cb501fe04 | |||
| 87f92cf382 | |||
| 9da75d53b9 | |||
| da468f2853 | |||
| 6bb86c0ce9 | |||
| 788ad93327 | |||
| 2bbb6c6e78 | |||
| c0ee31f4a7 | |||
| bb02df6323 | |||
| 21d3480b19 | |||
|
|
964faa0b6b | ||
| 423f4c4a6c | |||
| 8416f5af82 | |||
| a8a6aa4094 | |||
| d3a8ae593e | |||
| 1078244eeb | |||
| cd0e4e6431 | |||
| 443663d6af |
810
.gitignore
vendored
Normal file
810
.gitignore
vendored
Normal file
@@ -0,0 +1,810 @@
|
|||||||
|
# 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
PyroFetes.sln
Normal file
16
PyroFetes.sln
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
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
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
namespace PyroFetes.DTO.Brand.Request;
|
namespace PyroFetes.DTO.Brand.Request
|
||||||
|
{
|
||||||
|
// DTO pour créer une nouvelle marque
|
||||||
public class CreateBrandDto
|
public class CreateBrandDto
|
||||||
{
|
{
|
||||||
|
// Nom de la marque
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
namespace PyroFetes.DTO.Brand.Request;
|
namespace PyroFetes.DTO.Brand.Request
|
||||||
|
{
|
||||||
|
// DTO pour mettre à jour une marque existante
|
||||||
public class UpdateBrandDto
|
public class UpdateBrandDto
|
||||||
{
|
{
|
||||||
|
// Identifiant de la marque à mettre à jour
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Name { get; set; }
|
|
||||||
|
|
||||||
|
// Nouveau nom de la marque
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
namespace PyroFetes.DTO.Brand.Response;
|
namespace API.DTO.Brand.Response
|
||||||
|
{
|
||||||
|
// DTO pour récupérer les informations d'une marque
|
||||||
public class GetBrandDto
|
public class GetBrandDto
|
||||||
{
|
{
|
||||||
|
// Identifiant de la marque
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Name { get; set; }
|
|
||||||
|
|
||||||
|
// Nom de la marque
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
namespace PyroFetes.DTO.Classification.Request;
|
// Définition de l'espace de noms pour les DTO liés à la création de classifications
|
||||||
|
namespace API.DTO.Classification.Request
|
||||||
|
{
|
||||||
|
// DTO (Data Transfer Object) utilisé pour créer une nouvelle classification
|
||||||
public class CreateClassificationDto
|
public class CreateClassificationDto
|
||||||
{
|
{
|
||||||
|
// Propriété représentant le nom ou le label de la classification
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
namespace PyroFetes.DTO.Classification.Request;
|
// Définition de l'espace de noms pour les DTO liés à la mise à jour de classifications
|
||||||
|
namespace API.DTO.Classification.Request
|
||||||
|
{
|
||||||
|
// DTO (Data Transfer Object) utilisé pour mettre à jour une classification existante
|
||||||
public class UpdateClassificationDto
|
public class UpdateClassificationDto
|
||||||
{
|
{
|
||||||
|
// Propriété représentant l'ID unique de la classification à mettre à jour
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Label { get; set; }
|
|
||||||
|
|
||||||
|
// Propriété représentant le nouveau nom ou label de la classification
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null
|
||||||
|
// Si null, le label ne sera pas modifié
|
||||||
|
public string? Label { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
namespace PyroFetes.DTO.Classification.Response;
|
// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux classifications
|
||||||
|
namespace API.DTO.Classification.Response
|
||||||
|
{
|
||||||
|
// DTO (Data Transfer Object) utilisé pour renvoyer les informations d'une classification
|
||||||
public class GetClassificationDto
|
public class GetClassificationDto
|
||||||
{
|
{
|
||||||
|
// Propriété représentant l'ID unique de la classification
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Label { get; set; }
|
|
||||||
|
|
||||||
|
// Propriété représentant le nom ou label de la classification
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si la classification n'a pas de label
|
||||||
|
public string? Label { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
namespace PyroFetes.DTO.Color.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux couleurs
|
||||||
|
namespace API.DTO.Color.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour créer une nouvelle couleur
|
||||||
public class CreateColorDto
|
public class CreateColorDto
|
||||||
{
|
{
|
||||||
|
// Propriété représentant le nom ou label de la couleur à créer
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si le label n'est pas fourni
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
namespace PyroFetes.DTO.Color.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux couleurs
|
||||||
|
namespace API.DTO.Color.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour mettre à jour une couleur existante
|
||||||
public class UpdateColorDto
|
public class UpdateColorDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique de la couleur à mettre à jour
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nouveau nom ou label de la couleur
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si aucun changement n'est fourni
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
namespace PyroFetes.DTO.Color.Response;
|
// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux couleurs
|
||||||
|
namespace API.DTO.Color.Response
|
||||||
|
{
|
||||||
|
// DTO utilisé pour renvoyer les informations d'une couleur
|
||||||
public class GetColorDto
|
public class GetColorDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique de la couleur
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nom ou label de la couleur
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si le label n'est pas défini
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
namespace PyroFetes.DTO.Effect.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux effets
|
||||||
|
namespace API.DTO.Effect.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour créer un nouvel effet
|
||||||
public class CreateEffectDto
|
public class CreateEffectDto
|
||||||
{
|
{
|
||||||
|
// Nom ou label de l'effet
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si aucun label n'est fourni
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
namespace PyroFetes.DTO.Effect.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux effets
|
||||||
|
namespace API.DTO.Effect.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour mettre à jour un effet existant
|
||||||
public class UpdateEffectDto
|
public class UpdateEffectDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique de l'effet à mettre à jour
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nouveau nom ou label de l'effet
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si aucun label n'est fourni
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
namespace PyroFetes.DTO.Effect.Response;
|
// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux effets
|
||||||
|
namespace API.DTO.Effect.Response
|
||||||
|
{
|
||||||
|
// DTO utilisé pour renvoyer les informations d'un effet
|
||||||
public class GetEffectDto
|
public class GetEffectDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique de l'effet
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nom ou label de l'effet
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est disponible
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
7
PyroFetes/DTO/Login/Request/ConnectLoginDto.cs
Normal file
7
PyroFetes/DTO/Login/Request/ConnectLoginDto.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.Login.Request;
|
||||||
|
|
||||||
|
public class ConnectLoginDto
|
||||||
|
{
|
||||||
|
public string? Username { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
|
}
|
||||||
8
PyroFetes/DTO/Login/Request/CreateLoginDto.cs
Normal file
8
PyroFetes/DTO/Login/Request/CreateLoginDto.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PyroFetes.DTO.Login.Request;
|
||||||
|
|
||||||
|
public class CreateLoginDto
|
||||||
|
{
|
||||||
|
public string? Username { get; set; }
|
||||||
|
public string? FullName { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
|
}
|
||||||
9
PyroFetes/DTO/Login/Request/UpdateLoginDto.cs
Normal file
9
PyroFetes/DTO/Login/Request/UpdateLoginDto.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PyroFetes.DTO.Login.Request;
|
||||||
|
|
||||||
|
public class UpdateLoginDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? Username { get; set; }
|
||||||
|
public string? FullName { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
|
}
|
||||||
6
PyroFetes/DTO/Login/Response/GetLoginConnectDto.cs
Normal file
6
PyroFetes/DTO/Login/Response/GetLoginConnectDto.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace PyroFetes.DTO.Login.Response;
|
||||||
|
|
||||||
|
public class GetLoginConnectDto
|
||||||
|
{
|
||||||
|
public string? Token { get; set; }
|
||||||
|
}
|
||||||
10
PyroFetes/DTO/Login/Response/GetLoginDto.cs
Normal file
10
PyroFetes/DTO/Login/Response/GetLoginDto.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PyroFetes.DTO.Login.Response;
|
||||||
|
|
||||||
|
public class GetLoginDto
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string? Username { get; set; }
|
||||||
|
public string? FullName { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
|
public string? Salt { get; set; }
|
||||||
|
}
|
||||||
@@ -1,9 +1,17 @@
|
|||||||
namespace PyroFetes.DTO.Material.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux matériaux
|
||||||
|
namespace API.DTO.Material.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour créer un nouveau matériau
|
||||||
public class CreateMaterialDto
|
public class CreateMaterialDto
|
||||||
{
|
{
|
||||||
|
// Nom ou label du matériau
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est fournie
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
public int Quantity { get; set; }
|
|
||||||
public int WarehouseId {get; set;}
|
|
||||||
|
|
||||||
|
// Quantité du matériau à créer
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de l'entrepôt dans lequel le matériau sera stocké
|
||||||
|
public int WarehouseId { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,20 @@
|
|||||||
namespace PyroFetes.DTO.Material.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux matériaux
|
||||||
|
namespace API.DTO.Material.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour mettre à jour un matériau existant
|
||||||
public class UpdateMaterialDto
|
public class UpdateMaterialDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique du matériau à mettre à jour
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Label { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
public int WarehouseId {get; set;}
|
|
||||||
|
|
||||||
|
// Nom ou label du matériau
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est fournie
|
||||||
|
public string? Label { get; set; }
|
||||||
|
|
||||||
|
// Quantité mise à jour du matériau
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de l'entrepôt associé au matériau
|
||||||
|
public int WarehouseId { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,20 @@
|
|||||||
namespace PyroFetes.DTO.Material.Response;
|
// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux matériaux
|
||||||
|
namespace API.DTO.Material.Response
|
||||||
|
{
|
||||||
|
// DTO utilisé pour renvoyer les informations d'un matériau
|
||||||
public class GetMaterialDto
|
public class GetMaterialDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique du matériau
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Label { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
public int WarehouseId {get; set;}
|
|
||||||
|
|
||||||
|
// Nom ou label du matériau
|
||||||
|
// Le type "string?" signifie que cette valeur peut être null si aucune valeur n'est définie
|
||||||
|
public string? Label { get; set; }
|
||||||
|
|
||||||
|
// Quantité disponible du matériau
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de l'entrepôt auquel le matériau est associé
|
||||||
|
public int WarehouseId { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,19 @@
|
|||||||
namespace API.DTO.Movement.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux mouvements
|
||||||
|
namespace API.DTO.Movement.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour créer un nouveau mouvement
|
||||||
public class CreateMovementDto
|
public class CreateMovementDto
|
||||||
{
|
{
|
||||||
|
// Date à laquelle le mouvement est enregistré
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public DateTime Start {get; set;}
|
|
||||||
public DateTime Arrival {get; set;}
|
|
||||||
public int Quantity {get; set;}
|
|
||||||
|
|
||||||
|
// Date et heure de début du mouvement
|
||||||
|
public DateTime Start { get; set; }
|
||||||
|
|
||||||
|
// Date et heure d'arrivée prévue du mouvement
|
||||||
|
public DateTime Arrival { get; set; }
|
||||||
|
|
||||||
|
// Quantité de matériaux ou objets impliqués dans le mouvement
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,22 @@
|
|||||||
namespace API.DTO.Movement.Request;
|
// Définition de l'espace de noms pour les DTO utilisés dans les requêtes liées aux mouvements
|
||||||
|
namespace API.DTO.Movement.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour mettre à jour un mouvement existant
|
||||||
public class UpdateMovementDto
|
public class UpdateMovementDto
|
||||||
{
|
{
|
||||||
|
// ID unique du mouvement à mettre à jour
|
||||||
public int Id { get; set; }
|
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;}
|
|
||||||
|
|
||||||
|
// Date à laquelle le mouvement est enregistré
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
// Date et heure de début du mouvement
|
||||||
|
public DateTime Start { get; set; }
|
||||||
|
|
||||||
|
// Date et heure d'arrivée prévue du mouvement
|
||||||
|
public DateTime Arrival { get; set; }
|
||||||
|
|
||||||
|
// Quantité de matériaux ou objets impliqués dans le mouvement
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,22 @@
|
|||||||
namespace API.DTO.Movement.Response;
|
// Définition de l'espace de noms pour les DTO utilisés dans les réponses liées aux mouvements
|
||||||
|
namespace API.DTO.Movement.Response
|
||||||
|
{
|
||||||
|
// DTO utilisé pour renvoyer les informations d'un mouvement
|
||||||
public class GetMovementDto
|
public class GetMovementDto
|
||||||
{
|
{
|
||||||
|
// ID unique du mouvement
|
||||||
public int Id { get; set; }
|
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;}
|
|
||||||
|
|
||||||
|
// Date à laquelle le mouvement est enregistré
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
|
||||||
|
// Date et heure de début du mouvement
|
||||||
|
public DateTime Start { get; set; }
|
||||||
|
|
||||||
|
// Date et heure d'arrivée prévue du mouvement
|
||||||
|
public DateTime Arrival { get; set; }
|
||||||
|
|
||||||
|
// Quantité de matériaux ou objets impliqués dans le mouvement
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,50 @@
|
|||||||
using PyroFetes.Models;
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
|
||||||
namespace PyroFetes.DTO.Product.Request;
|
|
||||||
|
|
||||||
|
namespace PyroFetes.DTO.Product.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé lors de la création d’un produit
|
||||||
public class CreateProductDto
|
public class CreateProductDto
|
||||||
{
|
{
|
||||||
|
// Référence interne du produit
|
||||||
public int References { get; set; }
|
public int References { get; set; }
|
||||||
|
|
||||||
|
// Nom du produit
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
// Durée de l’effet du produit
|
||||||
public decimal Duration { get; set; }
|
public decimal Duration { get; set; }
|
||||||
|
|
||||||
|
// Calibre du produit
|
||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
|
|
||||||
|
// Numéro d’homologation
|
||||||
public int ApprovalNumber { get; set; }
|
public int ApprovalNumber { get; set; }
|
||||||
|
|
||||||
|
// Poids du produit
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
|
|
||||||
|
// Matière active (NEC)
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
|
|
||||||
|
// Prix de vente du produit
|
||||||
public decimal SellingPrice { get; set; }
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
|
// Image associée au produit (URL ou chemin)
|
||||||
public string? Image { get; set; }
|
public string? Image { get; set; }
|
||||||
|
|
||||||
|
// Lien vers une ressource externe (vidéo, fiche, etc.)
|
||||||
public string? Link { get; set; }
|
public string? Link { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de la classification du produit
|
||||||
public int ClassificationId { get; set; }
|
public int ClassificationId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de la catégorie du produit
|
||||||
public int ProductCategoryId { get; set; }
|
public int ProductCategoryId { get; set; }
|
||||||
|
|
||||||
|
// Liste des fournisseurs liés au produit venant du DTO ProductSupplierPriceDto
|
||||||
|
public List<ProductSupplierPriceDto>? Suppliers { get; set; }
|
||||||
|
|
||||||
|
// Liste des entrepôts liés au produit venant du DTO CreateProductWarehouseDto
|
||||||
|
public List<CreateProductWarehouseDto>? Warehouses { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,53 @@
|
|||||||
using PyroFetes.Models;
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
|
||||||
namespace PyroFetes.DTO.Product.Request;
|
|
||||||
|
|
||||||
|
namespace PyroFetes.DTO.Product.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour la mise à jour d’un produit existant
|
||||||
public class UpdateProductDto
|
public class UpdateProductDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique du produit à modifier
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int Reference { get; set; }
|
|
||||||
|
// Référence interne du produit
|
||||||
|
public int References { get; set; }
|
||||||
|
|
||||||
|
// Nom du produit
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
// Durée de l’effet du produit
|
||||||
public decimal Duration { get; set; }
|
public decimal Duration { get; set; }
|
||||||
|
|
||||||
|
// Calibre du produit
|
||||||
public decimal Caliber { get; set; }
|
public decimal Caliber { get; set; }
|
||||||
|
|
||||||
|
// Numéro d’homologation
|
||||||
public int ApprovalNumber { get; set; }
|
public int ApprovalNumber { get; set; }
|
||||||
|
|
||||||
|
// Poids du produit
|
||||||
public decimal Weight { get; set; }
|
public decimal Weight { get; set; }
|
||||||
|
|
||||||
|
// Matière active (NEC)
|
||||||
public decimal Nec { get; set; }
|
public decimal Nec { get; set; }
|
||||||
|
|
||||||
|
// Prix de vente du produit
|
||||||
public decimal SellingPrice { get; set; }
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
|
// Image associée au produit (URL ou chemin)
|
||||||
public string? Image { get; set; }
|
public string? Image { get; set; }
|
||||||
|
|
||||||
|
// Lien vers une ressource externe (fiche, vidéo, etc.)
|
||||||
public string? Link { get; set; }
|
public string? Link { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de la classification du produit
|
||||||
public int ClassificationId { get; set; }
|
public int ClassificationId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de la catégorie du produit
|
||||||
public int ProductCategoryId { get; set; }
|
public int ProductCategoryId { get; set; }
|
||||||
|
|
||||||
|
// Liste des fournisseurs associés venant du DTO ProductSupplierPriceDto
|
||||||
|
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
|
||||||
|
|
||||||
|
// Liste des entrepôts associés venant du DTO UpdateProductWarehouseDto
|
||||||
|
public List<UpdateProductWarehouseDto> Warehouses { get; set; } = new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,54 @@
|
|||||||
using PyroFetes.Models;
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
using PyroFetes.DTO.Product.Response;
|
||||||
namespace PyroFetes.DTO.Product.Response;
|
|
||||||
|
|
||||||
|
namespace PyroFetes.DTO.Product.Response
|
||||||
|
{
|
||||||
|
// DTO utilisé pour renvoyer les informations complètes d’un produit
|
||||||
public class GetProductDto
|
public class GetProductDto
|
||||||
{
|
{
|
||||||
|
// Identifiant unique du produit
|
||||||
public int Id { get; set; }
|
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; }
|
|
||||||
|
|
||||||
|
// Référence interne du produit
|
||||||
|
public int Reference { get; set; }
|
||||||
|
|
||||||
|
// Nom du produit
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
// Durée de l’effet du produit
|
||||||
|
public decimal Duration { get; set; }
|
||||||
|
|
||||||
|
// Calibre du produit
|
||||||
|
public decimal Caliber { get; set; }
|
||||||
|
|
||||||
|
// Numéro d’homologation
|
||||||
|
public int ApprovalNumber { get; set; }
|
||||||
|
|
||||||
|
// Poids du produit
|
||||||
|
public decimal Weight { get; set; }
|
||||||
|
|
||||||
|
// Matière active (NEC)
|
||||||
|
public decimal Nec { get; set; }
|
||||||
|
|
||||||
|
// Prix de vente du produit
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
|
||||||
|
// Image du produit (URL ou chemin)
|
||||||
|
public string? Image { get; set; }
|
||||||
|
|
||||||
|
// Lien externe vers plus d’informations (fiche, vidéo, etc.)
|
||||||
|
public string? Link { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de la classification du produit
|
||||||
|
public int ClassificationId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de la catégorie du produit
|
||||||
|
public int ProductCategoryId { get; set; }
|
||||||
|
|
||||||
|
// Fournisseurs liés venant du DTO ProductSupplierPriceDto
|
||||||
|
public List<ProductSupplierPriceDto> Suppliers { get; set; } = new();
|
||||||
|
|
||||||
|
// Entrepôts liés venant du DTO ProductWarehouseDto
|
||||||
|
public List<GetProductWarehouseDto> Warehouses { get; set; } = new();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
namespace API.DTO.ProductCategory.Request;
|
namespace API.DTO.ProductCategory.Request
|
||||||
|
{
|
||||||
|
// DTO pour créer une catégorie de produit
|
||||||
public class CreateProductCategoryDto
|
public class CreateProductCategoryDto
|
||||||
{
|
{
|
||||||
|
// Nom de la catégorie
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
namespace API.DTO.ProductCategory.Request;
|
namespace API.DTO.ProductCategory.Request
|
||||||
|
{
|
||||||
|
// DTO pour mettre à jour une catégorie de produit
|
||||||
public class UpdateProductCategoryDto
|
public class UpdateProductCategoryDto
|
||||||
{
|
{
|
||||||
|
// Identifiant de la catégorie
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nom de la catégorie
|
||||||
public string? Label { get; set; }
|
public string? Label { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
namespace API.DTO.ProductCategory.Response;
|
namespace API.DTO.ProductCategory.Response
|
||||||
|
{
|
||||||
|
// DTO pour récupérer une catégorie de produit
|
||||||
public class GetProductCategoryDto
|
public class GetProductCategoryDto
|
||||||
{
|
{
|
||||||
|
// Identifiant de la catégorie
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string? Label { get; set; }
|
|
||||||
|
|
||||||
|
// Nom de la catégorie
|
||||||
|
public string? Label { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
7
PyroFetes/DTO/ProductColor/Request/ProductColorDto.cs
Normal file
7
PyroFetes/DTO/ProductColor/Request/ProductColorDto.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace PyroFetes.DTO.ProductColor.Request;
|
||||||
|
// DTO utilisé pour créer ou mettre à jour la relation Product <-> Color
|
||||||
|
public class ProductColorDto
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; } // Id du produit (pour update)
|
||||||
|
public int ColorId { get; set; } // Id de la couleur
|
||||||
|
}
|
||||||
11
PyroFetes/DTO/ProductColor/Response/GetProductColorDto.cs
Normal file
11
PyroFetes/DTO/ProductColor/Response/GetProductColorDto.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PyroFetes.DTO.ProductColor.Response;
|
||||||
|
// DTO utilisé pour renvoyer les informations d’un produit lié à une couleur
|
||||||
|
|
||||||
|
public class GetProductColorDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit concerné
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de la couleur
|
||||||
|
public int ColorId { get; set; }
|
||||||
|
}
|
||||||
8
PyroFetes/DTO/ProductEffect/Request/ProductEffectDto.cs
Normal file
8
PyroFetes/DTO/ProductEffect/Request/ProductEffectDto.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace PyroFetes.DTO.ProductEffect.Request;
|
||||||
|
|
||||||
|
// DTO utilisé pour créer ou mettre à jour la relation Product <-> Effect
|
||||||
|
public class ProductEffectDto
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; } // Id du produit (pour update)
|
||||||
|
public int EffectId { get; set; } // Id de l'effet
|
||||||
|
}
|
||||||
12
PyroFetes/DTO/ProductEffect/Response/GetProductEffectDto.cs
Normal file
12
PyroFetes/DTO/ProductEffect/Response/GetProductEffectDto.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace PyroFetes.DTO.ProductEffect.Response;
|
||||||
|
|
||||||
|
// DTO utilisé pour renvoyer les informations d’un produit lié à un effet
|
||||||
|
|
||||||
|
public class GetProductEffectDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit concerné
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant de l'effet
|
||||||
|
public int EffectId { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PyroFetes.DTO.Product.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé pour créer ou mettre à jour la relation Product <-> Supplier
|
||||||
|
public class ProductSupplierPriceDto
|
||||||
|
{
|
||||||
|
public int ProductId { get; set; } // Id du produit (pour update)
|
||||||
|
public int SupplierId { get; set; } // Id du fournisseur
|
||||||
|
public decimal SellingPrice { get; set; } // Prix de vente
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace PyroFetes.DTO.Product.Response
|
||||||
|
{
|
||||||
|
// DTO utilisé pour renvoyer les informations d’un fournisseur lié à un produit
|
||||||
|
public class GetProductSupplierDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit concerné
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant du fournisseur
|
||||||
|
public int SupplierId { get; set; }
|
||||||
|
|
||||||
|
// Nom du fournisseur
|
||||||
|
public string SupplierName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
// Prix de vente du produit fourni par ce fournisseur
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
namespace PyroFetes.DTO.Product.Request
|
||||||
|
{
|
||||||
|
// DTO utilisé lors de la création d’une relation entre un produit et un entrepôt
|
||||||
|
public class CreateProductWarehouseDto
|
||||||
|
{
|
||||||
|
// Identifiant de l'entrepôt concerné
|
||||||
|
public int WarehouseId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant du produit associé à cet entrepôt
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Quantité du produit disponible dans cet entrepôt
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// DTO utilisé lors de la mise à jour d’une relation entre un produit et un entrepôt
|
||||||
|
public class UpdateProductWarehouseDto
|
||||||
|
{
|
||||||
|
// Identifiant de l'entrepôt concerné
|
||||||
|
public int WarehouseId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant du produit associé à cet entrepôt
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Nouvelle quantité du produit dans cet entrepôt
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace PyroFetes.DTO.Product.Response
|
||||||
|
{
|
||||||
|
// DTO utilisé pour renvoyer les informations d’un entrepôt lié à un produit
|
||||||
|
public class GetProductWarehouseDto
|
||||||
|
{
|
||||||
|
// Identifiant de l'entrepôt
|
||||||
|
public int WarehouseId { get; set; }
|
||||||
|
|
||||||
|
// Identifiant du produit associé à cet entrepôt
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Nom de l'entrepôt (utile pour l’affichage)
|
||||||
|
public string WarehouseName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
// Quantité du produit stockée dans cet entrepôt
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,37 @@
|
|||||||
namespace API.DTO.Supplier.Request;
|
namespace PyroFetes.DTO.Supplier.Request
|
||||||
|
{
|
||||||
|
// DTO pour créer un nouveau fournisseur
|
||||||
public class CreateSupplierDto
|
public class CreateSupplierDto
|
||||||
{
|
{
|
||||||
|
// Nom du fournisseur
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
// Email du fournisseur
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
// Numéro de téléphone du fournisseur
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; set; }
|
||||||
|
|
||||||
|
// Adresse du fournisseur
|
||||||
public string Adress { get; set; }
|
public string Adress { get; set; }
|
||||||
|
|
||||||
|
// Code postal de l'adresse
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
|
|
||||||
|
// Ville de l'adresse
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
|
// Liste des produits fournis par ce fournisseur dans la classe SupplierProductPriceDto
|
||||||
|
public List<SupplierProductPriceDto>? Products { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// DTO pour relier un produit et son prix à un fournisseur
|
||||||
|
public class SupplierProductPriceDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit fourni
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Prix de vente du produit par ce fournisseur
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,30 @@
|
|||||||
namespace API.DTO.Supplier.Request;
|
namespace PyroFetes.DTO.Supplier.Request
|
||||||
|
{
|
||||||
|
// DTO pour mettre à jour un fournisseur existant
|
||||||
public class UpdateSupplierDto
|
public class UpdateSupplierDto
|
||||||
{
|
{
|
||||||
|
// Identifiant du fournisseur à mettre à jour
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nom du fournisseur
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
// Email du fournisseur
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
// Numéro de téléphone du fournisseur
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; set; }
|
||||||
|
|
||||||
|
// Adresse du fournisseur
|
||||||
public string Adress { get; set; }
|
public string Adress { get; set; }
|
||||||
|
|
||||||
|
// Code postal de l'adresse
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
|
|
||||||
|
// Ville de l'adresse
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
|
// Liste des produits fournis par ce fournisseur relié à la classe SupplierProductPriceDto
|
||||||
|
public List<SupplierProductPriceDto>? Products { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,45 @@
|
|||||||
namespace API.DTO.Supplier.Response;
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
|
|
||||||
|
namespace PyroFetes.DTO.Supplier.Response
|
||||||
|
{
|
||||||
|
// DTO pour récupérer les informations d'un fournisseur
|
||||||
public class GetSupplierDto
|
public class GetSupplierDto
|
||||||
{
|
{
|
||||||
|
// Identifiant du fournisseur
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nom du fournisseur
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
// Email du fournisseur
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
|
// Numéro de téléphone
|
||||||
public string PhoneNumber { get; set; }
|
public string PhoneNumber { get; set; }
|
||||||
|
|
||||||
|
// Adresse du fournisseur
|
||||||
public string Adress { get; set; }
|
public string Adress { get; set; }
|
||||||
|
|
||||||
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
|
|
||||||
|
// Ville
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
|
// Liste des produits fournis par la classe SupplierProductPriceDto
|
||||||
|
public List<SupplierProductPriceDto> Products { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
// DTO pour les détails d'un produit lié à un fournisseur
|
||||||
|
public class GetSupplierProductDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Nom du produit
|
||||||
|
public string ProductName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
// Prix de vente fourni par le fournisseur
|
||||||
|
public decimal SellingPrice { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,40 @@
|
|||||||
namespace API.DTO.Warehouse.Request;
|
namespace API.DTO.Warehouse.Request
|
||||||
|
{
|
||||||
|
// DTO pour créer un entrepôt
|
||||||
public class CreateWarehouseDto
|
public class CreateWarehouseDto
|
||||||
{
|
{
|
||||||
|
// Nom de l'entrepôt
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
// Poids maximal que l'entrepôt peut contenir
|
||||||
public int MaxWeight { get; set; }
|
public int MaxWeight { get; set; }
|
||||||
|
|
||||||
|
// Poids actuel stocké
|
||||||
public int Current { get; set; }
|
public int Current { get; set; }
|
||||||
|
|
||||||
|
// Poids minimal souhaité
|
||||||
public int MinWeight { get; set; }
|
public int MinWeight { get; set; }
|
||||||
|
|
||||||
|
// Adresse de l'entrepôt
|
||||||
public string Adress { get; set; }
|
public string Adress { get; set; }
|
||||||
|
|
||||||
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
|
|
||||||
|
// Ville
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
|
// Liste des produits à stocker dans cet entrepôt venant de la classe en dessous
|
||||||
|
public List<CreateWarehouseProductDto>? Products { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// DTO pour associer un produit à un entrepôt
|
||||||
|
public class CreateWarehouseProductDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Quantité du produit dans l'entrepôt
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,43 @@
|
|||||||
namespace API.DTO.Warehouse.Request;
|
namespace API.DTO.Warehouse.Request
|
||||||
|
{
|
||||||
|
// DTO pour mettre à jour un entrepôt
|
||||||
public class UpdateWarehouseDto
|
public class UpdateWarehouseDto
|
||||||
{
|
{
|
||||||
|
// Identifiant de l'entrepôt à mettre à jour
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nom de l'entrepôt
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
// Poids maximal que l'entrepôt peut contenir
|
||||||
public int MaxWeight { get; set; }
|
public int MaxWeight { get; set; }
|
||||||
|
|
||||||
|
// Poids actuel stocké
|
||||||
public int Current { get; set; }
|
public int Current { get; set; }
|
||||||
|
|
||||||
|
// Poids minimal souhaité
|
||||||
public int MinWeight { get; set; }
|
public int MinWeight { get; set; }
|
||||||
|
|
||||||
|
// Adresse de l'entrepôt
|
||||||
public string Adress { get; set; }
|
public string Adress { get; set; }
|
||||||
|
|
||||||
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
|
|
||||||
|
// Ville
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
|
// Liste des produits à mettre à jour dans cet entrepôt
|
||||||
|
public List<UpdateWarehouseProductDto>? Products { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// DTO pour mettre à jour la quantité d'un produit dans un entrepôt
|
||||||
|
public class UpdateWarehouseProductDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Nouvelle quantité du produit dans l'entrepôt
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,46 @@
|
|||||||
namespace API.DTO.Warehouse.Response;
|
namespace API.DTO.Warehouse.Response
|
||||||
|
{
|
||||||
|
// DTO pour la lecture d'un entrepôt
|
||||||
public class GetWarehouseDto
|
public class GetWarehouseDto
|
||||||
{
|
{
|
||||||
|
// Identifiant de l'entrepôt
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
// Nom de l'entrepôt
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
// Poids maximal que l'entrepôt peut contenir
|
||||||
public int MaxWeight { get; set; }
|
public int MaxWeight { get; set; }
|
||||||
|
|
||||||
|
// Poids actuellement stocké
|
||||||
public int Current { get; set; }
|
public int Current { get; set; }
|
||||||
|
|
||||||
|
// Poids minimal souhaité
|
||||||
public int MinWeight { get; set; }
|
public int MinWeight { get; set; }
|
||||||
|
|
||||||
|
// Adresse de l'entrepôt
|
||||||
public string Adress { get; set; }
|
public string Adress { get; set; }
|
||||||
|
|
||||||
|
// Code postal
|
||||||
public int ZipCode { get; set; }
|
public int ZipCode { get; set; }
|
||||||
|
|
||||||
|
// Ville
|
||||||
public string City { get; set; }
|
public string City { get; set; }
|
||||||
|
|
||||||
|
// Liste des produits stockés dans l'entrepôt
|
||||||
|
public List<WarehouseProductDto>? Products { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// DTO pour la lecture d'un produit dans un entrepôt
|
||||||
|
public class WarehouseProductDto
|
||||||
|
{
|
||||||
|
// Identifiant du produit
|
||||||
|
public int ProductId { get; set; }
|
||||||
|
|
||||||
|
// Nom du produit
|
||||||
|
public string? ProductName { get; set; }
|
||||||
|
|
||||||
|
// Quantité du produit dans l'entrepôt
|
||||||
|
public int Quantity { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using PyroFetes.DTO.Brand.Request;
|
using API.DTO.Brand.Response;
|
||||||
using PyroFetes.DTO.Brand.Response;
|
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Brand.Request;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Brand;
|
namespace PyroFetes.Endpoints.Brand;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using PyroFetes.DTO.Brand.Response;
|
using API.DTO.Brand.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using PyroFetes.DTO.Brand.Response;
|
using API.DTO.Brand.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using PyroFetes.DTO.Brand.Request;
|
using API.DTO.Brand.Response;
|
||||||
using PyroFetes.DTO.Brand.Response;
|
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
using PyroFetes.DTO.Brand.Request;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Brand;
|
namespace PyroFetes.Endpoints.Brand;
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ public class UpdateBrandEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/brands");
|
Put("/api/brands/{Id}");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using PyroFetes.DTO.Classification.Request;
|
using API.DTO.Classification.Request;
|
||||||
using PyroFetes.DTO.Classification.Response;
|
using API.DTO.Classification.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Classification;
|
namespace PyroFetes.Endpoints.Classification;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using PyroFetes.DTO.Classification.Response;
|
using API.DTO.Classification.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using PyroFetes.DTO.Classification.Response;
|
using API.DTO.Classification.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using PyroFetes.DTO.Classification.Request;
|
using API.DTO.Classification.Request;
|
||||||
using PyroFetes.DTO.Classification.Response;
|
using API.DTO.Classification.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Classification;
|
namespace PyroFetes.Endpoints.Classification;
|
||||||
@@ -8,7 +8,7 @@ public class UpdateClassificationEndpoint(PyroFetesDbContext pyrofetesdbcontext)
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/classifications");
|
Put("/api/classifications");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,27 @@
|
|||||||
using PyroFetes.DTO.Color.Request;
|
using API.DTO.Color.Request;
|
||||||
using PyroFetes.DTO.Color.Response;
|
using API.DTO.Color.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
using PyroFetes;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Color;
|
namespace API.Endpoints.Color;
|
||||||
|
|
||||||
public class CreateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<CreateColorDto, GetColorDto>
|
public class CreateColorEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateColorDto, GetColorDto> //Instanciation d'une connexion à la bdd dans un endpoint, utilise l'élément de requête CreateColorDto et l'élement de réponse GetColorDto
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure() //Configuration de l'endpoint
|
||||||
{
|
{
|
||||||
Post("/api/color/create");
|
Post("Api/colors"); //Création d'un endpoint pour créer une couleur avec les données de CreateColorDto
|
||||||
AllowAnonymous();
|
AllowAnonymous(); //Laisser passer les requêtes non authentifiées
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateColorDto req, CancellationToken ct)
|
public override async Task HandleAsync(CreateColorDto req, CancellationToken ct) //La méthode HandleAsync est appelée lorsqu'une requête est envoyée à l'endpoint
|
||||||
{
|
{
|
||||||
Models.Color color = new()
|
PyroFetes.Models.Color color = new()
|
||||||
{
|
{
|
||||||
Label = req.Label,
|
Label = req.Label,
|
||||||
};
|
};
|
||||||
|
|
||||||
appDbContext.Colors.Add(color);
|
pyroFetesDbContext.Colors.Add(color);
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyroFetesDbContext.SaveChangesAsync(ct);
|
||||||
Console.WriteLine("Added Color");
|
Console.WriteLine("Added Color");
|
||||||
|
|
||||||
GetColorDto responseDto = new()
|
GetColorDto responseDto = new()
|
||||||
|
|||||||
@@ -8,17 +8,17 @@ public class DeleteColorRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeleteColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<DeleteColorRequest>
|
public class DeleteColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteColorRequest>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/colors/{@id}", x => new { x.Id });
|
Delete("Api/colors/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteColorRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteColorRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Color? colorToDelete = await appDbContext
|
Models.Color? colorToDelete = await pyrofetesdbcontext
|
||||||
.Colors
|
.Colors
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
@@ -29,8 +29,8 @@ public class DeleteColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<Del
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
appDbContext.Colors.Remove(colorToDelete);
|
pyrofetesdbcontext.Colors.Remove(colorToDelete);
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
using PyroFetes.DTO.Color.Response;
|
using API.DTO.Color.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Color;
|
namespace PyroFetes.Endpoints.Color;
|
||||||
|
|
||||||
public class GetAllColorsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest<List<GetColorDto>>
|
public class GetAllColorsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetColorDto>>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/colors");
|
Get("Api/colors");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
List<GetColorDto> responseDto = await appDbContext.Colors
|
List<GetColorDto> responseDto = await pyrofetesdbcontext.Colors
|
||||||
.Select(a => new GetColorDto
|
.Select(a => new GetColorDto
|
||||||
{
|
{
|
||||||
Id = a.Id,
|
Id = a.Id,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using PyroFetes.DTO.Color.Response;
|
using API.DTO.Color.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Color;
|
namespace PyroFetes.Endpoints.Color;
|
||||||
@@ -10,23 +9,23 @@ public class GetColorRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<GetColorRequest, GetColorDto>
|
public class GetColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetColorRequest, GetColorDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/colors/{@id}", x => new { x.Id});
|
Get("Api/colors/{@id}", x => new { x.Id});
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(GetColorRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetColorRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Color? color = await appDbContext
|
Models.Color? color = await pyrofetesdbcontext
|
||||||
.Colors
|
.Colors
|
||||||
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (color == null)
|
if (color == null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucune couleur avec l'ID {req.Id} trouvé.");
|
Console.WriteLine("Aucune couleur avec l'ID {req.Id} trouvé.");
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,33 @@
|
|||||||
using PyroFetes.DTO.Color.Request;
|
using API.DTO.Color.Request;
|
||||||
using PyroFetes.DTO.Color.Response;
|
using API.DTO.Color.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Color;
|
namespace PyroFetes.Endpoints.Color;
|
||||||
|
|
||||||
public class UpdateColorEndpoint(PyroFetesDbContext appDbContext) : Endpoint<UpdateColorDto, GetColorDto>
|
public class UpdateColorEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateColorDto, GetColorDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/api/colors/{@id}", x => new { x.Id });
|
Put("Api/colors/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateColorDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateColorDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Color? colorToEdit = await appDbContext
|
Models.Color? colorToEdit = await pyrofetesdbcontext
|
||||||
.Colors
|
.Colors
|
||||||
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (colorToEdit == null)
|
if (colorToEdit == null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucune couleur avec l'id {req.Id} trouvé.");
|
Console.WriteLine("Aucune couleur avec l'id {req.Id} trouvé.");
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
colorToEdit.Label = req.Label;
|
colorToEdit.Label = req.Label;
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
GetColorDto responseDto = new()
|
GetColorDto responseDto = new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
using PyroFetes.DTO.Effect.Request;
|
using API.DTO.Effect.Request;
|
||||||
using PyroFetes.DTO.Effect.Response;
|
using API.DTO.Effect.Response;
|
||||||
|
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Effect;
|
namespace PyroFetes.Endpoints.Effect;
|
||||||
|
|
||||||
public class CreateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<CreateEffectDto, GetEffectDto>
|
public class CreateEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateEffectDto, GetEffectDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/effect/create");
|
Post("Api/effects");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@ public class CreateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<Cr
|
|||||||
Label = req.Label,
|
Label = req.Label,
|
||||||
};
|
};
|
||||||
|
|
||||||
appDbContext.Effects.Add(effect);
|
pyrofetesdbcontext.Effects.Add(effect);
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
Console.WriteLine("Effect added");
|
Console.WriteLine("Effect added");
|
||||||
|
|
||||||
GetEffectDto responseDto = new()
|
GetEffectDto responseDto = new()
|
||||||
|
|||||||
@@ -7,17 +7,17 @@ public class DeleteEffectRequest
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
public class DeleteEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<DeleteEffectRequest>
|
public class DeleteEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteEffectRequest>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/effects/{@id}", x => new { x.Id });
|
Delete("Api/effects/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteEffectRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteEffectRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Effect? effectToDelete = await appDbContext
|
Models.Effect? effectToDelete = await pyrofetesdbcontext
|
||||||
.Effects
|
.Effects
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
@@ -28,8 +28,8 @@ public class DeleteEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<De
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
appDbContext.Effects.Remove(effectToDelete);
|
pyrofetesdbcontext.Effects.Remove(effectToDelete);
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
using PyroFetes.DTO.Effect.Response;
|
using API.DTO.Effect.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Effect;
|
namespace PyroFetes.Endpoints.Effect;
|
||||||
|
|
||||||
public class GetAllEffectsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest<List<GetEffectDto>>
|
public class GetAllEffectsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetEffectDto>>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/effects");
|
Get("Api/effects");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
List<GetEffectDto> responseDto = await appDbContext.Effects
|
List<GetEffectDto> responseDto = await pyrofetesdbcontext.Effects
|
||||||
.Select(a => new GetEffectDto
|
.Select(a => new GetEffectDto
|
||||||
{
|
{
|
||||||
Id = a.Id,
|
Id = a.Id,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using PyroFetes.DTO.Effect.Response;
|
using API.DTO.Effect.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Effect;
|
namespace PyroFetes.Endpoints.Effect;
|
||||||
@@ -10,23 +9,23 @@ public class GetEffectRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<GetEffectRequest, GetEffectDto>
|
public class GetEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetEffectRequest, GetEffectDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/effect/{@id}", x => new { x.Id });
|
Get("Api/effects/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(GetEffectRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetEffectRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Effect? effect = await appDbContext
|
Models.Effect? effect = await pyrofetesdbcontext
|
||||||
.Effects
|
.Effects
|
||||||
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (effect == null)
|
if (effect == null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucun effet avec l'ID {req.Id} trouvé.");
|
Console.WriteLine("Aucun effet avec l'ID {req.Id} trouvé.");
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,33 @@
|
|||||||
using PyroFetes.DTO.Effect.Request;
|
using API.DTO.Effect.Request;
|
||||||
using PyroFetes.DTO.Effect.Response;
|
using API.DTO.Effect.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Effect;
|
namespace PyroFetes.Endpoints.Effect;
|
||||||
|
|
||||||
public class UpdateEffectEndpoint(PyroFetesDbContext appDbContext) : Endpoint<UpdateEffectDto, GetEffectDto>
|
public class UpdateEffectEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateEffectDto, GetEffectDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/api/effect/{@id}", x => new { x.Id });
|
Put("Api/effects/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateEffectDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateEffectDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Effect? effectToEdit = await appDbContext
|
Models.Effect? effectToEdit = await pyrofetesdbcontext
|
||||||
.Effects
|
.Effects
|
||||||
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (effectToEdit == null)
|
if (effectToEdit == null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucun effet avec l'id {req.Id} trouvé.");
|
Console.WriteLine("Aucun effet avec l'id {req.Id} trouvé.");
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
effectToEdit.Label = req.Label;
|
effectToEdit.Label = req.Label;
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
GetEffectDto responseDto = new()
|
GetEffectDto responseDto = new()
|
||||||
{
|
{
|
||||||
|
|||||||
44
PyroFetes/Endpoints/Login/CreateLoginEndpoint.cs
Normal file
44
PyroFetes/Endpoints/Login/CreateLoginEndpoint.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using PyroFetes.DTO.Login.Request;
|
||||||
|
using PyroFetes.DTO.Login.Response;
|
||||||
|
using PasswordGenerator;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Login;
|
||||||
|
using FastEndpoints;
|
||||||
|
|
||||||
|
public class CreateLoginEndpoint(PyroFetesDbContext database) : Endpoint<CreateLoginDto, GetLoginDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/api/logins");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CreateLoginDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
string? salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next();
|
||||||
|
|
||||||
|
var login = new Models.Login()
|
||||||
|
{
|
||||||
|
Username = req.Username,
|
||||||
|
FullName = req.FullName,
|
||||||
|
Password = BCrypt.Net.BCrypt.HashPassword(req.Password + salt),
|
||||||
|
Salt = salt
|
||||||
|
};
|
||||||
|
|
||||||
|
database.Logins.Add(login);
|
||||||
|
|
||||||
|
await database.SaveChangesAsync(ct);
|
||||||
|
// Pour renvoyer une erreur : Send.StringAsync("Le message d'erreur", 400);
|
||||||
|
|
||||||
|
GetLoginDto responseDto = new()
|
||||||
|
{
|
||||||
|
Id = login.Id,
|
||||||
|
Username = login.Username,
|
||||||
|
FullName = login.FullName,
|
||||||
|
Password = login.Password,
|
||||||
|
Salt = login.Salt
|
||||||
|
};
|
||||||
|
|
||||||
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
35
PyroFetes/Endpoints/Login/DeleteLoginEndpoint.cs
Normal file
35
PyroFetes/Endpoints/Login/DeleteLoginEndpoint.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using PyroFetes.DTO.Login.Request;
|
||||||
|
using PyroFetes.DTO.Login.Response;
|
||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Login;
|
||||||
|
|
||||||
|
public class DeleteLoginRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DeleteLoginEndpoint(PyroFetesDbContext database) : Endpoint<DeleteLoginRequest>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Delete("/api/logins/{@Id}", x => new {x.Id});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(DeleteLoginRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
var login = await database.Logins.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
||||||
|
|
||||||
|
if (login == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
database.Logins.Remove(login);
|
||||||
|
await database.SaveChangesAsync(ct);
|
||||||
|
|
||||||
|
await Send.NoContentAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
PyroFetes/Endpoints/Login/GetAllLoginEndpoint.cs
Normal file
30
PyroFetes/Endpoints/Login/GetAllLoginEndpoint.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using PyroFetes.DTO.Login.Response;
|
||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Login;
|
||||||
|
|
||||||
|
public class GetAllLoginEndpoint(PyroFetesDbContext database) : EndpointWithoutRequest<List<GetLoginDto>>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/api/logins");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
|
{
|
||||||
|
var logins = await database.Logins
|
||||||
|
.Select(login => new GetLoginDto()
|
||||||
|
{
|
||||||
|
Id = login.Id,
|
||||||
|
Username = login.Username,
|
||||||
|
FullName = login.FullName,
|
||||||
|
Password = login.Password,
|
||||||
|
Salt = login.Salt
|
||||||
|
})
|
||||||
|
.ToListAsync(ct);
|
||||||
|
|
||||||
|
await Send.OkAsync(logins, ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
41
PyroFetes/Endpoints/Login/GetLoginEndpoint.cs
Normal file
41
PyroFetes/Endpoints/Login/GetLoginEndpoint.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using PyroFetes.DTO.Login.Response;
|
||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Login;
|
||||||
|
|
||||||
|
public class GetLoginRequest
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetLoginEndpoint(PyroFetesDbContext database) : Endpoint<GetLoginRequest, GetLoginDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Get("/api/logins/{@Id}", x => new {x.Id});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(GetLoginRequest req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
var login = await database.Logins
|
||||||
|
.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
||||||
|
|
||||||
|
if (login == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetLoginDto responseDto = new()
|
||||||
|
{
|
||||||
|
Id = login.Id,
|
||||||
|
Username = login.Username,
|
||||||
|
FullName = login.FullName,
|
||||||
|
Password = login.Password,
|
||||||
|
Salt = login.Salt
|
||||||
|
};
|
||||||
|
|
||||||
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
45
PyroFetes/Endpoints/Login/UpdateLoginEndpoint.cs
Normal file
45
PyroFetes/Endpoints/Login/UpdateLoginEndpoint.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using PyroFetes.DTO.Login.Request;
|
||||||
|
using PyroFetes.DTO.Login.Response;
|
||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PasswordGenerator;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Login;
|
||||||
|
|
||||||
|
public class UpdateLoginEndpoint(PyroFetesDbContext database) : Endpoint<UpdateLoginDto, GetLoginDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Put("/api/logins/{@Id}", x => new {x.Id});
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(UpdateLoginDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
var login = await database.Logins.SingleOrDefaultAsync(x => x.Id == req.Id, ct);
|
||||||
|
|
||||||
|
if (login == null)
|
||||||
|
{
|
||||||
|
await Send.NotFoundAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string? salt = new Password().IncludeLowercase().IncludeUppercase().IncludeNumeric().LengthRequired(24).Next();
|
||||||
|
|
||||||
|
login.Username = req.Username;
|
||||||
|
login.FullName = req.FullName;
|
||||||
|
login.Password = BCrypt.Net.BCrypt.HashPassword(req.Password + salt);
|
||||||
|
login.Salt = salt;
|
||||||
|
await database.SaveChangesAsync(ct);
|
||||||
|
|
||||||
|
GetLoginDto responseDto = new()
|
||||||
|
{
|
||||||
|
Id = login.Id,
|
||||||
|
Username = login.Username,
|
||||||
|
FullName = login.FullName,
|
||||||
|
Password = login.Password,
|
||||||
|
Salt = login.Salt
|
||||||
|
};
|
||||||
|
|
||||||
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
50
PyroFetes/Endpoints/Login/UserLoginEndpoint.cs
Normal file
50
PyroFetes/Endpoints/Login/UserLoginEndpoint.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using PyroFetes.DTO.Login.Request;
|
||||||
|
using FastEndpoints.Security;
|
||||||
|
using PyroFetes.DTO.Login.Response;
|
||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes;
|
||||||
|
|
||||||
|
namespace PyroFetes.Endpoints.Login;
|
||||||
|
|
||||||
|
public class UserLoginEndpoint(PyroFetesDbContext database) : Endpoint<ConnectLoginDto, GetLoginConnectDto>
|
||||||
|
{
|
||||||
|
public override void Configure()
|
||||||
|
{
|
||||||
|
Post("/api/login");
|
||||||
|
AllowAnonymous();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task HandleAsync(ConnectLoginDto req, CancellationToken ct)
|
||||||
|
{
|
||||||
|
var login = await database.Logins.SingleOrDefaultAsync(x => x.Username == req.Username, ct);
|
||||||
|
|
||||||
|
if (login == null)
|
||||||
|
{
|
||||||
|
await Send.UnauthorizedAsync(ct);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BCrypt.Net.BCrypt.Verify(req.Password + login.Salt, login.Password))
|
||||||
|
{
|
||||||
|
var jwtToken = JwtBearer.CreateToken(
|
||||||
|
o =>
|
||||||
|
{
|
||||||
|
o.SigningKey = "ThisIsASuperSecretJwtKeyThatIsAtLeast32CharsLong";
|
||||||
|
o.ExpireAt = DateTime.UtcNow.AddMinutes(15);
|
||||||
|
if (login.Role != null) o.User.Roles.Add(login.Role);
|
||||||
|
o.User.Claims.Add(("Username", login.Username)!);
|
||||||
|
o.User.Claims.Add(("FullName", login.FullName)!);
|
||||||
|
o.User["UserId"] = "001";
|
||||||
|
});
|
||||||
|
|
||||||
|
GetLoginConnectDto responseDto = new()
|
||||||
|
{
|
||||||
|
Token = jwtToken
|
||||||
|
};
|
||||||
|
|
||||||
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
}
|
||||||
|
else await Send.UnauthorizedAsync(ct);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +1,34 @@
|
|||||||
using PyroFetes.DTO.Material.Request;
|
using API.DTO.Material.Request;
|
||||||
using PyroFetes.DTO.Material.Response;
|
using API.DTO.Material.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Material;
|
namespace PyroFetes.Endpoints.Material;
|
||||||
|
|
||||||
public class CreateMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<CreateMaterialDto, GetMaterialDto>
|
public class CreateMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateMaterialDto, GetMaterialDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/material/create");
|
Post("Api/materials");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateMaterialDto req, CancellationToken ct)
|
public override async Task HandleAsync(CreateMaterialDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Material material = new()
|
Models.Material quantity = new()
|
||||||
{
|
{
|
||||||
Label = req.Label,
|
Name = req.Label,
|
||||||
Quantity = req.Quantity,
|
Quantity = req.Quantity,
|
||||||
WarehouseId = req.WarehouseId,
|
WarehouseId = req.WarehouseId,
|
||||||
};
|
};
|
||||||
|
|
||||||
appDbContext.Materials.Add(material);
|
pyrofetesdbcontext.Materials.Add(quantity);
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
Console.WriteLine("Material added");
|
Console.WriteLine("Material added");
|
||||||
|
|
||||||
GetMaterialDto responseDto = new()
|
GetMaterialDto responseDto = new()
|
||||||
{
|
{
|
||||||
Id = material.Id,
|
Id = quantity.Id,
|
||||||
WarehouseId = material.WarehouseId,
|
WarehouseId = quantity.WarehouseId,
|
||||||
Label = req.Label,
|
Label = req.Label,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,17 +6,17 @@ public class DeleteMaterialRequest
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
public class DeleteMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<DeleteMaterialRequest>
|
public class DeleteMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteMaterialRequest>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/materials/{@id}", x => new { x.Id });
|
Delete("/materials/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteMaterialRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteMaterialRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Material? materialToDelete = await appDbContext
|
Models.Material? materialToDelete = await pyrofetesdbcontext
|
||||||
.Materials
|
.Materials
|
||||||
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(a => a.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
@@ -27,8 +27,8 @@ public class DeleteMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
appDbContext.Materials.Remove(materialToDelete);
|
pyrofetesdbcontext.Materials.Remove(materialToDelete);
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
using PyroFetes.DTO.Material.Response;
|
using API.DTO.Material.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Material;
|
namespace PyroFetes.Endpoints.Material;
|
||||||
|
|
||||||
public class GetAllMaterialsEndpoint(PyroFetesDbContext appDbContext) : EndpointWithoutRequest<List<GetMaterialDto>>
|
public class GetAllMaterialsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetMaterialDto>>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/material");
|
Get("Api/materials");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
List<GetMaterialDto> responseDto = await appDbContext.Materials
|
List<GetMaterialDto> responseDto = await pyrofetesdbcontext.Materials
|
||||||
.Select(a => new GetMaterialDto
|
.Select(a => new GetMaterialDto
|
||||||
{
|
{
|
||||||
Id = a.Id,
|
Id = a.Id,
|
||||||
Label = a.Label,
|
Label = a.Name,
|
||||||
Quantity = a.Quantity,
|
Quantity = a.Quantity,
|
||||||
WarehouseId = a.WarehouseId,
|
WarehouseId = a.WarehouseId,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using PyroFetes.DTO.Material.Response;
|
using API.DTO.Material.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.AspNetCore.Authentication;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Material;
|
namespace PyroFetes.Endpoints.Material;
|
||||||
@@ -10,17 +9,17 @@ public class GetMaterialRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<GetMaterialRequest, GetMaterialDto>
|
public class GetMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetMaterialRequest, GetMaterialDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/material/{@id}", x => new { x.Id });
|
Get("Api/materials/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(GetMaterialRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetMaterialRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Material? material = await appDbContext
|
Models.Material? material = await pyrofetesdbcontext
|
||||||
.Materials
|
.Materials
|
||||||
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ public class GetMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<Get
|
|||||||
GetMaterialDto responseDto = new()
|
GetMaterialDto responseDto = new()
|
||||||
{
|
{
|
||||||
Id = material.Id,
|
Id = material.Id,
|
||||||
Label = material.Label,
|
Label = material.Name,
|
||||||
WarehouseId = material.WarehouseId,
|
WarehouseId = material.WarehouseId,
|
||||||
};
|
};
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
|||||||
@@ -1,35 +1,34 @@
|
|||||||
using PyroFetes.DTO.Material.Request;
|
using API.DTO.Material.Request;
|
||||||
using PyroFetes.DTO.Material.Response;
|
using API.DTO.Material.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.AspNetCore.Server.Kestrel;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Material;
|
namespace PyroFetes.Endpoints.Material;
|
||||||
|
|
||||||
public class UpdateMaterialEndpoint(PyroFetesDbContext appDbContext) : Endpoint<UpdateMaterialDto, GetMaterialDto>
|
public class UpdateMaterialEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateMaterialDto, GetMaterialDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/api/material/{@id}", x => new { x.Id });
|
Put("Api/materials/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateMaterialDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateMaterialDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Material? materialToEdit = await appDbContext
|
Models.Material? materialToEdit = await pyrofetesdbcontext
|
||||||
.Materials
|
.Materials
|
||||||
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (materialToEdit == null)
|
if (materialToEdit == null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucun matériel avec l'id {req.Id} trouvé.");
|
Console.WriteLine("Aucun matériel avec l'id {req.Id} trouvé.");
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
materialToEdit.Label = req.Label;
|
materialToEdit.Name = req.Label;
|
||||||
materialToEdit.WarehouseId = req.WarehouseId;
|
materialToEdit.WarehouseId = req.WarehouseId;
|
||||||
await appDbContext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
GetMaterialDto responseDto = new()
|
GetMaterialDto responseDto = new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class UpdateMovementEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Post("/api/movements");
|
Put("/api/movements");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
using FastEndpoints;
|
using PyroFetes.DTO.Product.Request;
|
||||||
using PyroFetes.DTO.Product.Request;
|
|
||||||
using PyroFetes.DTO.Product.Response;
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
namespace PyroFetes.Endpoints.Product;
|
||||||
|
|
||||||
public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateProductDto, GetProductDto>
|
public class CreateProductEndpoint(PyroFetesDbContext db)
|
||||||
|
: Endpoint<CreateProductDto, GetProductDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -14,28 +17,62 @@ public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endp
|
|||||||
|
|
||||||
public override async Task HandleAsync(CreateProductDto req, CancellationToken ct)
|
public override async Task HandleAsync(CreateProductDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Product product = new ()
|
var product = new Models.Product
|
||||||
{
|
{
|
||||||
References = req.References,
|
Reference = req.References.ToString(),
|
||||||
Name = req.Name!,
|
Name = req.Name!,
|
||||||
Duration = req.Duration,
|
Duration = req.Duration,
|
||||||
Caliber = req.Caliber,
|
Caliber = req.Caliber,
|
||||||
ApprovalNumber = req.ApprovalNumber,
|
ApprovalNumber = req.ApprovalNumber,
|
||||||
Weight = req.Weight,
|
Weight = req.Weight,
|
||||||
Nec = req.Nec,
|
Nec = req.Nec,
|
||||||
SellingPrice = req.SellingPrice,
|
|
||||||
Image = req.Image!,
|
Image = req.Image!,
|
||||||
Link = req.Link!,
|
Link = req.Link!,
|
||||||
ProductCategoryId = req.ProductCategoryId,
|
ProductCategoryId = req.ProductCategoryId,
|
||||||
ClassificationId = req.ClassificationId
|
ClassificationId = req.ClassificationId
|
||||||
};
|
};
|
||||||
|
|
||||||
pyrofetesdbcontext.Products.Add(product);
|
db.Products.Add(product);
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
await db.SaveChangesAsync(ct);
|
||||||
|
|
||||||
Console.WriteLine("Product créé avec succès !");
|
// Ajout des fournisseurs liés
|
||||||
|
if (req.Suppliers is not null && req.Suppliers.Any())
|
||||||
|
{
|
||||||
|
foreach (var s in req.Suppliers)
|
||||||
|
{
|
||||||
|
var price = new Price
|
||||||
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
SupplierId = s.SupplierId,
|
||||||
|
SellingPrice = s.SellingPrice
|
||||||
|
};
|
||||||
|
db.Prices.Add(price);
|
||||||
|
}
|
||||||
|
await db.SaveChangesAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
GetProductDto responseDto = new ()
|
// Ajout des entrepôts liés
|
||||||
|
if (req.Warehouses is not null && req.Warehouses.Any())
|
||||||
|
{
|
||||||
|
foreach (var w in req.Warehouses)
|
||||||
|
{
|
||||||
|
var exists = await db.Warehouses.AnyAsync(x => x.Id == w.WarehouseId, ct);
|
||||||
|
if (!exists)
|
||||||
|
continue; // sécurité : on ignore les warehouses inexistants
|
||||||
|
|
||||||
|
var warehouseProduct = new WarehouseProduct
|
||||||
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
WarehouseId = w.WarehouseId,
|
||||||
|
Quantity = w.Quantity
|
||||||
|
};
|
||||||
|
db.WarehouseProducts.Add(warehouseProduct);
|
||||||
|
}
|
||||||
|
await db.SaveChangesAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construction de la réponse
|
||||||
|
var response = new GetProductDto
|
||||||
{
|
{
|
||||||
Id = product.Id,
|
Id = product.Id,
|
||||||
Reference = req.References,
|
Reference = req.References,
|
||||||
@@ -49,9 +86,20 @@ public class CreateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endp
|
|||||||
Image = req.Image,
|
Image = req.Image,
|
||||||
Link = req.Link,
|
Link = req.Link,
|
||||||
ProductCategoryId = req.ProductCategoryId,
|
ProductCategoryId = req.ProductCategoryId,
|
||||||
ClassificationId = req.ClassificationId
|
ClassificationId = req.ClassificationId,
|
||||||
|
Suppliers = req.Suppliers?.Select(s => new ProductSupplierPriceDto
|
||||||
|
{
|
||||||
|
SupplierId = s.SupplierId,
|
||||||
|
SellingPrice = s.SellingPrice
|
||||||
|
}).ToList() ?? new(),
|
||||||
|
Warehouses = req.Warehouses?.Select(w => new GetProductWarehouseDto
|
||||||
|
{
|
||||||
|
WarehouseId = w.WarehouseId,
|
||||||
|
Quantity = w.Quantity,
|
||||||
|
WarehouseName = db.Warehouses.FirstOrDefault(x => x.Id == w.WarehouseId)?.Name ?? string.Empty
|
||||||
|
}).ToList() ?? new()
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
namespace PyroFetes.Endpoints.Product;
|
||||||
|
|
||||||
@@ -8,7 +9,7 @@ public class DeleteProductRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeleteProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteProductRequest>
|
public class DeleteProductEndpoint(PyroFetesDbContext db) : Endpoint<DeleteProductRequest>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -18,19 +19,40 @@ public class DeleteProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endp
|
|||||||
|
|
||||||
public override async Task HandleAsync(DeleteProductRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteProductRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Product? productToDelete = await pyrofetesdbcontext
|
// Récupérer le produit
|
||||||
.Products
|
var productToDelete = await db.Products
|
||||||
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(p => p.Id == req.Id, ct);
|
||||||
|
|
||||||
if (productToDelete == null)
|
if (productToDelete is null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
|
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pyrofetesdbcontext.Products.Remove(productToDelete);
|
// Supprimer les liaisons Price
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
var relatedPrices = await db.Prices
|
||||||
|
.Where(p => p.ProductId == req.Id)
|
||||||
|
.ToListAsync(ct);
|
||||||
|
if (relatedPrices.Any())
|
||||||
|
{
|
||||||
|
db.Prices.RemoveRange(relatedPrices);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supprimer les liaisons WarehouseProduct
|
||||||
|
var relatedWarehouseProducts = await db.WarehouseProducts
|
||||||
|
.Where(wp => wp.ProductId == req.Id)
|
||||||
|
.ToListAsync(ct);
|
||||||
|
if (relatedWarehouseProducts.Any())
|
||||||
|
{
|
||||||
|
db.WarehouseProducts.RemoveRange(relatedWarehouseProducts);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supprimer le produit
|
||||||
|
db.Products.Remove(productToDelete);
|
||||||
|
|
||||||
|
await db.SaveChangesAsync(ct);
|
||||||
|
Console.WriteLine($"Produit {req.Id}, ses prix et ses entrepôts liés ont été supprimés avec succès.");
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
using FastEndpoints;
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PyroFetes.DTO.Product.Response;
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
namespace PyroFetes.Endpoints.Product;
|
||||||
|
|
||||||
public class GetAllProductsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetProductDto>>
|
public class GetAllProductsEndpoint(PyroFetesDbContext db)
|
||||||
|
: EndpointWithoutRequest<List<GetProductDto>>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -14,26 +17,46 @@ public class GetAllProductsEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
List<GetProductDto> responseDto = await pyrofetesdbcontext.Products
|
// Inclure toutes les relations nécessaires : Prices + WarehouseProducts + Warehouse
|
||||||
.Select(p => new GetProductDto()
|
var products = await db.Products
|
||||||
|
.Include(p => p.Prices)
|
||||||
|
.Include(p => p.WarehouseProducts)
|
||||||
|
.ThenInclude(wp => wp.Warehouse)
|
||||||
|
.ToListAsync(ct);
|
||||||
|
|
||||||
|
var responseDto = products.Select(p => new GetProductDto
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
Reference = p.References,
|
// Le modèle Product contient "Reference" (string) — pas "References" (int)
|
||||||
|
Reference = int.TryParse(p.Reference, out var refInt) ? refInt : 0,
|
||||||
Name = p.Name,
|
Name = p.Name,
|
||||||
Duration = p.Duration,
|
Duration = p.Duration,
|
||||||
Caliber = p.Caliber,
|
Caliber = p.Caliber,
|
||||||
ApprovalNumber = p.ApprovalNumber,
|
ApprovalNumber = p.ApprovalNumber,
|
||||||
Weight = p.Weight,
|
Weight = p.Weight,
|
||||||
Nec = p.Nec,
|
Nec = p.Nec,
|
||||||
SellingPrice = p.SellingPrice,
|
// Le prix de vente n’est pas dans Product, on le récupère via Prices
|
||||||
|
SellingPrice = p.Prices.FirstOrDefault()?.SellingPrice ?? 0,
|
||||||
Image = p.Image,
|
Image = p.Image,
|
||||||
Link = p.Link,
|
Link = p.Link,
|
||||||
ClassificationId = p.ClassificationId,
|
ClassificationId = p.ClassificationId,
|
||||||
ClassificationLabel = p.Classification!.Label,
|
|
||||||
ProductCategoryId = p.ProductCategoryId,
|
ProductCategoryId = p.ProductCategoryId,
|
||||||
ProductCategoryLabel = p.ProductCategory!.Label,
|
|
||||||
}
|
// Liste des fournisseurs liés via Price
|
||||||
).ToListAsync(ct);
|
Suppliers = p.Prices.Select(pr => new ProductSupplierPriceDto
|
||||||
|
{
|
||||||
|
SupplierId = pr.SupplierId,
|
||||||
|
SellingPrice = pr.SellingPrice
|
||||||
|
}).ToList(),
|
||||||
|
|
||||||
|
// Liste des entrepôts liés via WarehouseProduct
|
||||||
|
Warehouses = p.WarehouseProducts.Select(wp => new GetProductWarehouseDto
|
||||||
|
{
|
||||||
|
WarehouseId = wp.WarehouseId,
|
||||||
|
WarehouseName = wp.Warehouse?.Name ?? string.Empty,
|
||||||
|
Quantity = wp.Quantity
|
||||||
|
}).ToList()
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(responseDto, ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using FastEndpoints;
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PyroFetes.DTO.Product.Response;
|
using PyroFetes.DTO.Product.Request;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
namespace PyroFetes.Endpoints.Product;
|
||||||
|
|
||||||
@@ -9,20 +11,23 @@ public class GetProductRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GetProductEndpoint(PyroFetesDbContext db)
|
||||||
public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<GetProductRequest, GetProductDto>
|
: Endpoint<GetProductRequest, GetProductDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/product/{@id}", x => new { x.Id });
|
Get("/api/products/{@id}", x => new { x.Id });
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(GetProductRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetProductRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Product? product = await pyrofetesdbcontext
|
// Inclure toutes les relations : Prices + WarehouseProducts + Warehouse
|
||||||
.Products.Include(product => product.Classification).Include(product => product.ProductCategory)
|
var product = await db.Products
|
||||||
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
|
.Include(p => p.Prices)
|
||||||
|
.Include(p => p.WarehouseProducts)
|
||||||
|
.ThenInclude(wp => wp.Warehouse)
|
||||||
|
.SingleOrDefaultAsync(p => p.Id == req.Id, ct);
|
||||||
|
|
||||||
if (product == null)
|
if (product == null)
|
||||||
{
|
{
|
||||||
@@ -31,23 +36,42 @@ public class GetProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetProductDto responseDto = new()
|
var responseDto = new GetProductDto
|
||||||
{
|
{
|
||||||
Id = product.Id,
|
Id = product.Id,
|
||||||
Reference = product.References,
|
|
||||||
|
// Le modèle Product contient "Reference" (string), pas "References" (int)
|
||||||
|
Reference = int.TryParse(product.Reference, out var refInt) ? refInt : 0,
|
||||||
|
|
||||||
Name = product.Name,
|
Name = product.Name,
|
||||||
Duration = product.Duration,
|
Duration = product.Duration,
|
||||||
Caliber = product.Caliber,
|
Caliber = product.Caliber,
|
||||||
ApprovalNumber = product.ApprovalNumber,
|
ApprovalNumber = product.ApprovalNumber,
|
||||||
Weight = product.Weight,
|
Weight = product.Weight,
|
||||||
Nec = product.Nec,
|
Nec = product.Nec,
|
||||||
SellingPrice = product.SellingPrice,
|
|
||||||
|
// Le prix de vente n’est pas dans Product → récupéré via Price
|
||||||
|
SellingPrice = product.Prices.FirstOrDefault()?.SellingPrice ?? 0,
|
||||||
|
|
||||||
Image = product.Image,
|
Image = product.Image,
|
||||||
Link = product.Link,
|
Link = product.Link,
|
||||||
ClassificationId = product.ClassificationId,
|
ClassificationId = product.ClassificationId,
|
||||||
ClassificationLabel = product.Classification!.Label,
|
|
||||||
ProductCategoryId = product.ProductCategoryId,
|
ProductCategoryId = product.ProductCategoryId,
|
||||||
ProductCategoryLabel = product.ProductCategory!.Label,
|
|
||||||
|
// Fournisseurs liés via Price
|
||||||
|
Suppliers = product.Prices.Select(pr => new ProductSupplierPriceDto
|
||||||
|
{
|
||||||
|
SupplierId = pr.SupplierId,
|
||||||
|
SellingPrice = pr.SellingPrice
|
||||||
|
}).ToList(),
|
||||||
|
|
||||||
|
// Entrepôts liés via WarehouseProduct
|
||||||
|
Warehouses = product.WarehouseProducts.Select(wp => new GetProductWarehouseDto
|
||||||
|
{
|
||||||
|
WarehouseId = wp.WarehouseId,
|
||||||
|
WarehouseName = wp.Warehouse?.Name ?? string.Empty,
|
||||||
|
Quantity = wp.Quantity
|
||||||
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
|||||||
@@ -1,58 +1,111 @@
|
|||||||
using FastEndpoints;
|
using PyroFetes.DTO.Product.Request;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Product.Request;
|
|
||||||
using PyroFetes.DTO.Product.Response;
|
using PyroFetes.DTO.Product.Response;
|
||||||
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Product;
|
namespace PyroFetes.Endpoints.Product;
|
||||||
|
|
||||||
public class UpdateProductEndpoint(PyroFetesDbContext pyrofetesdbcontext) :Endpoint<UpdateProductDto, GetProductDto>
|
// Endpoint permettant de mettre à jour un produit existant
|
||||||
|
public class UpdateProductEndpoint(PyroFetesDbContext db)
|
||||||
|
: Endpoint<UpdateProductDto, GetProductDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
|
// Route HTTP PUT avec un paramètre d'identifiant dans l'URL
|
||||||
Put("/api/products/{@id}", x => new { x.Id });
|
Put("/api/products/{@id}", x => new { x.Id });
|
||||||
|
|
||||||
|
// Autorise les requêtes anonymes (sans authentification)
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateProductDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Product? productToEdit = await pyrofetesdbcontext
|
// Recherche du produit à mettre à jour, en incluant les relations Prices et WarehouseProducts
|
||||||
.Products
|
var product = await db.Products
|
||||||
.SingleOrDefaultAsync(p => p.Id == req.Id, cancellationToken: ct);
|
.Include(p => p.Prices)
|
||||||
|
.Include(p => p.WarehouseProducts)
|
||||||
|
.SingleOrDefaultAsync(p => p.Id == req.Id, ct);
|
||||||
|
|
||||||
if (productToEdit == null)
|
// Si le produit n'existe pas, on retourne une réponse 404
|
||||||
|
if (product is null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucun produit avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
productToEdit.References = req.Reference;
|
// Mise à jour des propriétés principales du produit
|
||||||
productToEdit.Name = req.Name;
|
product.Reference = req.References.ToString(); // Converti int → string
|
||||||
productToEdit.Duration = req.Duration;
|
product.Name = req.Name;
|
||||||
productToEdit.Caliber = req.Caliber;
|
product.Duration = req.Duration;
|
||||||
productToEdit.ApprovalNumber = req.ApprovalNumber;
|
product.Caliber = req.Caliber;
|
||||||
productToEdit.Weight = req.Weight;
|
product.ApprovalNumber = req.ApprovalNumber;
|
||||||
productToEdit.Nec = req.Nec;
|
product.Weight = req.Weight;
|
||||||
productToEdit.SellingPrice = req.SellingPrice;
|
product.Nec = req.Nec;
|
||||||
productToEdit.Image = req.Image;
|
product.Image = req.Image;
|
||||||
productToEdit.Link = req.Link;
|
product.Link = req.Link;
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
product.ClassificationId = req.ClassificationId;
|
||||||
|
product.ProductCategoryId = req.ProductCategoryId;
|
||||||
|
|
||||||
GetProductDto responseDto = new()
|
// Mise à jour des prix fournisseurs associés
|
||||||
|
db.Prices.RemoveRange(product.Prices);
|
||||||
|
foreach (var s in req.Suppliers)
|
||||||
{
|
{
|
||||||
Id = req.Id,
|
db.Prices.Add(new Price
|
||||||
Reference = req.Reference,
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
SupplierId = s.SupplierId,
|
||||||
|
SellingPrice = s.SellingPrice
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mise à jour des entrepôts associés
|
||||||
|
db.WarehouseProducts.RemoveRange(product.WarehouseProducts);
|
||||||
|
foreach (var w in req.Warehouses)
|
||||||
|
{
|
||||||
|
db.WarehouseProducts.Add(new WarehouseProduct
|
||||||
|
{
|
||||||
|
ProductId = product.Id,
|
||||||
|
WarehouseId = w.WarehouseId,
|
||||||
|
Quantity = w.Quantity
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.SaveChangesAsync(ct);
|
||||||
|
|
||||||
|
// Construction de la réponse renvoyée au client
|
||||||
|
var response = new GetProductDto
|
||||||
|
{
|
||||||
|
Id = product.Id,
|
||||||
|
Reference = req.References, // DTO garde int pour cohérence
|
||||||
Name = req.Name,
|
Name = req.Name,
|
||||||
Duration = req.Duration,
|
Duration = req.Duration,
|
||||||
Caliber = req.Caliber,
|
Caliber = req.Caliber,
|
||||||
ApprovalNumber = req.ApprovalNumber,
|
ApprovalNumber = req.ApprovalNumber,
|
||||||
Weight = req.Weight,
|
Weight = req.Weight,
|
||||||
Nec = req.Nec,
|
Nec = req.Nec,
|
||||||
SellingPrice = req.SellingPrice,
|
// Le prix de vente est pris depuis Prices
|
||||||
|
SellingPrice = req.Suppliers.FirstOrDefault()?.SellingPrice ?? 0,
|
||||||
Image = req.Image,
|
Image = req.Image,
|
||||||
Link = req.Link
|
Link = req.Link,
|
||||||
|
ClassificationId = req.ClassificationId,
|
||||||
|
ProductCategoryId = req.ProductCategoryId,
|
||||||
|
|
||||||
|
Suppliers = req.Suppliers.Select(s => new ProductSupplierPriceDto
|
||||||
|
{
|
||||||
|
SupplierId = s.SupplierId,
|
||||||
|
SellingPrice = s.SellingPrice
|
||||||
|
}).ToList(),
|
||||||
|
|
||||||
|
Warehouses = req.Warehouses.Select(w => new GetProductWarehouseDto
|
||||||
|
{
|
||||||
|
WarehouseId = w.WarehouseId,
|
||||||
|
Quantity = w.Quantity,
|
||||||
|
WarehouseName = db.Warehouses
|
||||||
|
.FirstOrDefault(x => x.Id == w.WarehouseId)?.Name ?? string.Empty
|
||||||
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
using API.DTO.Supplier.Request;
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
using API.DTO.Supplier.Response;
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
namespace PyroFetes.Endpoints.Supplier;
|
||||||
|
|
||||||
public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateSupplierDto, GetSupplierDto>
|
public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext)
|
||||||
|
: Endpoint<CreateSupplierDto, GetSupplierDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -14,8 +17,7 @@ public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
|
|
||||||
public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct)
|
public override async Task HandleAsync(CreateSupplierDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
// Création d'un nouvel objet Supplier
|
var supplier = new Models.Supplier
|
||||||
Models.Supplier supplier = new()
|
|
||||||
{
|
{
|
||||||
Name = req.Name,
|
Name = req.Name,
|
||||||
Email = req.Email,
|
Email = req.Email,
|
||||||
@@ -25,14 +27,26 @@ public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
City = req.City
|
City = req.City
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ajout à la base et sauvegarde
|
|
||||||
pyrofetesdbcontext.Suppliers.Add(supplier);
|
pyrofetesdbcontext.Suppliers.Add(supplier);
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
Console.WriteLine("Fournisseur créé avec succès !");
|
// Ajout des liaisons Price si produits renseignés
|
||||||
|
if (req.Products is not null && req.Products.Any())
|
||||||
|
{
|
||||||
|
foreach (var p in req.Products)
|
||||||
|
{
|
||||||
|
var price = new Price
|
||||||
|
{
|
||||||
|
SupplierId = supplier.Id,
|
||||||
|
ProductId = p.ProductId,
|
||||||
|
SellingPrice = p.SellingPrice
|
||||||
|
};
|
||||||
|
pyrofetesdbcontext.Prices.Add(price);
|
||||||
|
}
|
||||||
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
// Préparation de la réponse
|
var response = new GetSupplierDto
|
||||||
GetSupplierDto responseDto = new()
|
|
||||||
{
|
{
|
||||||
Id = supplier.Id,
|
Id = supplier.Id,
|
||||||
Name = supplier.Name,
|
Name = supplier.Name,
|
||||||
@@ -43,6 +57,6 @@ public class CreateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
City = supplier.City
|
City = supplier.City
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
namespace PyroFetes.Endpoints.Supplier;
|
||||||
|
|
||||||
@@ -18,19 +19,32 @@ public class DeleteSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
|
|
||||||
public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteSupplierRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Supplier? supplierToDelete = await pyrofetesdbcontext
|
var supplierToDelete = await pyrofetesdbcontext
|
||||||
.Suppliers
|
.Suppliers
|
||||||
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(s => s.Id == req.Id, ct);
|
||||||
|
|
||||||
if (supplierToDelete == null)
|
if (supplierToDelete is null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
|
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Supprimer les liaisons Price avant le fournisseur
|
||||||
|
var relatedPrices = await pyrofetesdbcontext.Prices
|
||||||
|
.Where(p => p.SupplierId == req.Id)
|
||||||
|
.ToListAsync(ct);
|
||||||
|
|
||||||
|
if (relatedPrices.Any())
|
||||||
|
{
|
||||||
|
pyrofetesdbcontext.Prices.RemoveRange(relatedPrices);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supprimer le fournisseur
|
||||||
pyrofetesdbcontext.Suppliers.Remove(supplierToDelete);
|
pyrofetesdbcontext.Suppliers.Remove(supplierToDelete);
|
||||||
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
Console.WriteLine($"Fournisseur {req.Id} et ses prix liés supprimés avec succès.");
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
using API.DTO.Supplier.Response;
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
namespace PyroFetes.Endpoints.Supplier;
|
||||||
|
|
||||||
public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetSupplierDto>>
|
public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext)
|
||||||
|
: EndpointWithoutRequest<List<GetSupplierDto>>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -14,8 +17,11 @@ public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
List<GetSupplierDto> responseDto = await pyrofetesdbcontext.Suppliers
|
var suppliers = await pyrofetesdbcontext.Suppliers
|
||||||
.Select(s => new GetSupplierDto
|
.Include(s => s.Prices)
|
||||||
|
.ToListAsync(ct);
|
||||||
|
|
||||||
|
var responseDto = suppliers.Select(s => new GetSupplierDto
|
||||||
{
|
{
|
||||||
Id = s.Id,
|
Id = s.Id,
|
||||||
Name = s.Name!,
|
Name = s.Name!,
|
||||||
@@ -23,9 +29,15 @@ public class GetAllSuppliersEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
PhoneNumber = s.Phone!,
|
PhoneNumber = s.Phone!,
|
||||||
Adress = s.Address!,
|
Adress = s.Address!,
|
||||||
ZipCode = s.ZipCode,
|
ZipCode = s.ZipCode,
|
||||||
City = s.City!
|
City = s.City!,
|
||||||
})
|
|
||||||
.ToListAsync(ct);
|
// 🔹 Liste des produits liés via Price
|
||||||
|
Products = s.Prices.Select(pr => new SupplierProductPriceDto
|
||||||
|
{
|
||||||
|
ProductId = pr.ProductId,
|
||||||
|
SellingPrice = pr.SellingPrice
|
||||||
|
}).ToList()
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(responseDto, ct);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using API.DTO.Supplier.Response;
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
@@ -9,7 +10,8 @@ public class GetSupplierRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetSupplierRequest, GetSupplierDto>
|
public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext)
|
||||||
|
: Endpoint<GetSupplierRequest, GetSupplierDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -19,9 +21,9 @@ public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi
|
|||||||
|
|
||||||
public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetSupplierRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Supplier? supplier = await pyrofetesdbcontext
|
var supplier = await pyrofetesdbcontext.Suppliers
|
||||||
.Suppliers
|
.Include(s => s.Prices)
|
||||||
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(s => s.Id == req.Id, ct);
|
||||||
|
|
||||||
if (supplier == null)
|
if (supplier == null)
|
||||||
{
|
{
|
||||||
@@ -30,7 +32,7 @@ public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetSupplierDto responseDto = new()
|
var responseDto = new GetSupplierDto
|
||||||
{
|
{
|
||||||
Id = supplier.Id,
|
Id = supplier.Id,
|
||||||
Name = supplier.Name!,
|
Name = supplier.Name!,
|
||||||
@@ -38,7 +40,14 @@ public class GetSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoi
|
|||||||
PhoneNumber = supplier.Phone!,
|
PhoneNumber = supplier.Phone!,
|
||||||
Adress = supplier.Address!,
|
Adress = supplier.Address!,
|
||||||
ZipCode = supplier.ZipCode,
|
ZipCode = supplier.ZipCode,
|
||||||
City = supplier.City!
|
City = supplier.City!,
|
||||||
|
|
||||||
|
// Produits liés
|
||||||
|
Products = supplier.Prices.Select(p => new SupplierProductPriceDto
|
||||||
|
{
|
||||||
|
ProductId = p.ProductId,
|
||||||
|
SellingPrice = p.SellingPrice
|
||||||
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(responseDto, ct);
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using API.DTO.Supplier.Request;
|
using PyroFetes.DTO.Supplier.Request;
|
||||||
using API.DTO.Supplier.Response;
|
using PyroFetes.DTO.Supplier.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Supplier;
|
namespace PyroFetes.Endpoints.Supplier;
|
||||||
|
|
||||||
@@ -15,18 +16,16 @@ public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
|
|
||||||
public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateSupplierDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Supplier? supplierToEdit = await pyrofetesdbcontext
|
var supplierToEdit = await pyrofetesdbcontext
|
||||||
.Suppliers
|
.Suppliers
|
||||||
.SingleOrDefaultAsync(s => s.Id == req.Id, cancellationToken: ct);
|
.Include(s => s.Prices)
|
||||||
|
.SingleOrDefaultAsync(s => s.Id == req.Id, ct);
|
||||||
|
|
||||||
if (supplierToEdit == null)
|
if (supplierToEdit is null)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Aucun fournisseur avec l'ID {req.Id} trouvé.");
|
|
||||||
await Send.NotFoundAsync(ct);
|
await Send.NotFoundAsync(ct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise à jour des propriétés
|
|
||||||
supplierToEdit.Name = req.Name;
|
supplierToEdit.Name = req.Name;
|
||||||
supplierToEdit.Email = req.Email;
|
supplierToEdit.Email = req.Email;
|
||||||
supplierToEdit.Phone = req.PhoneNumber;
|
supplierToEdit.Phone = req.PhoneNumber;
|
||||||
@@ -34,9 +33,28 @@ public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
supplierToEdit.ZipCode = req.ZipCode;
|
supplierToEdit.ZipCode = req.ZipCode;
|
||||||
supplierToEdit.City = req.City;
|
supplierToEdit.City = req.City;
|
||||||
|
|
||||||
|
if (req.Products is not null)
|
||||||
|
{
|
||||||
|
// Supprimer les anciennes liaisons
|
||||||
|
var existingPrices = pyrofetesdbcontext.Prices
|
||||||
|
.Where(p => p.SupplierId == supplierToEdit.Id);
|
||||||
|
pyrofetesdbcontext.Prices.RemoveRange(existingPrices);
|
||||||
|
|
||||||
|
// Ajouter les nouvelles liaisons
|
||||||
|
foreach (var p in req.Products)
|
||||||
|
{
|
||||||
|
pyrofetesdbcontext.Prices.Add(new Price
|
||||||
|
{
|
||||||
|
SupplierId = supplierToEdit.Id,
|
||||||
|
ProductId = p.ProductId,
|
||||||
|
SellingPrice = p.SellingPrice
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
||||||
|
|
||||||
GetSupplierDto responseDto = new()
|
var response = new GetSupplierDto
|
||||||
{
|
{
|
||||||
Id = supplierToEdit.Id,
|
Id = supplierToEdit.Id,
|
||||||
Name = supplierToEdit.Name,
|
Name = supplierToEdit.Name,
|
||||||
@@ -47,6 +65,6 @@ public class UpdateSupplierEndpoint(PyroFetesDbContext pyrofetesdbcontext) : End
|
|||||||
City = supplierToEdit.City
|
City = supplierToEdit.City
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
using API.DTO.Warehouse.Request;
|
using API.DTO.Warehouse.Request;
|
||||||
using API.DTO.Warehouse.Response;
|
using API.DTO.Warehouse.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
namespace PyroFetes.Endpoints.Warehouse;
|
||||||
|
|
||||||
public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<CreateWarehouseDto, GetWarehouseDto>
|
public class CreateWarehouseEndpoint(PyroFetesDbContext db)
|
||||||
|
: Endpoint<CreateWarehouseDto, GetWarehouseDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -14,7 +16,7 @@ public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
|
|
||||||
public override async Task HandleAsync(CreateWarehouseDto req, CancellationToken ct)
|
public override async Task HandleAsync(CreateWarehouseDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Warehouse warehouse = new()
|
var warehouse = new Models.Warehouse
|
||||||
{
|
{
|
||||||
Name = req.Name,
|
Name = req.Name,
|
||||||
MaxWeight = req.MaxWeight,
|
MaxWeight = req.MaxWeight,
|
||||||
@@ -25,12 +27,26 @@ public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
City = req.City
|
City = req.City
|
||||||
};
|
};
|
||||||
|
|
||||||
pyrofetesdbcontext.Warehouses.Add(warehouse);
|
db.Warehouses.Add(warehouse);
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
await db.SaveChangesAsync(ct);
|
||||||
|
|
||||||
Console.WriteLine("Entrepôt créé avec succès !");
|
// 🔹 Ajout des produits liés à cet entrepôt
|
||||||
|
if (req.Products is not null && req.Products.Any())
|
||||||
|
{
|
||||||
|
foreach (var p in req.Products)
|
||||||
|
{
|
||||||
|
var warehouseProduct = new WarehouseProduct
|
||||||
|
{
|
||||||
|
WarehouseId = warehouse.Id,
|
||||||
|
ProductId = p.ProductId,
|
||||||
|
Quantity = p.Quantity
|
||||||
|
};
|
||||||
|
db.WarehouseProducts.Add(warehouseProduct);
|
||||||
|
}
|
||||||
|
await db.SaveChangesAsync(ct);
|
||||||
|
}
|
||||||
|
|
||||||
GetWarehouseDto responseDto = new()
|
var response = new GetWarehouseDto
|
||||||
{
|
{
|
||||||
Id = warehouse.Id,
|
Id = warehouse.Id,
|
||||||
Name = warehouse.Name,
|
Name = warehouse.Name,
|
||||||
@@ -42,6 +58,6 @@ public class CreateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
City = warehouse.City
|
City = warehouse.City
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
namespace PyroFetes.Endpoints.Warehouse;
|
||||||
|
|
||||||
@@ -8,18 +9,18 @@ public class DeleteWarehouseRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DeleteWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<DeleteWarehouseRequest>
|
public class DeleteWarehouseEndpoint(PyroFetesDbContext db) : Endpoint<DeleteWarehouseRequest>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Delete("/api/warehouse/{@id}", x => new { x.Id });
|
Delete("/api/warehouse/{id}");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(DeleteWarehouseRequest req, CancellationToken ct)
|
public override async Task HandleAsync(DeleteWarehouseRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Warehouse? warehouseToDelete = await pyrofetesdbcontext
|
// On charge aussi les WarehouseProducts liés pour les supprimer proprement
|
||||||
.Warehouses
|
var warehouseToDelete = await db.Warehouses
|
||||||
|
.Include(w => w.WarehouseProducts)
|
||||||
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (warehouseToDelete == null)
|
if (warehouseToDelete == null)
|
||||||
@@ -29,9 +30,21 @@ public class DeleteWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pyrofetesdbcontext.Warehouses.Remove(warehouseToDelete);
|
// 🔹 Suppression des relations WarehouseProduct avant l'entrepôt
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
var relatedWarehouseProducts = await db.WarehouseProducts
|
||||||
|
.Where(wp => wp.WarehouseId == req.Id)
|
||||||
|
.ToListAsync(ct);
|
||||||
|
|
||||||
|
if (relatedWarehouseProducts.Any())
|
||||||
|
{
|
||||||
|
db.WarehouseProducts.RemoveRange(relatedWarehouseProducts);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 🔹 Suppression de l’entrepôt
|
||||||
|
db.Warehouses.Remove(warehouseToDelete);
|
||||||
|
await db.SaveChangesAsync(ct);
|
||||||
|
|
||||||
|
Console.WriteLine($"Entrepôt {warehouseToDelete.Name} (ID {req.Id}) supprimé avec succès.");
|
||||||
await Send.NoContentAsync(ct);
|
await Send.NoContentAsync(ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
using API.DTO.Warehouse.Response;
|
using API.DTO.Warehouse.Response;
|
||||||
|
using API.DTO.Warehouse.Request;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
namespace PyroFetes.Endpoints.Warehouse;
|
||||||
|
|
||||||
public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : EndpointWithoutRequest<List<GetWarehouseDto>>
|
public class GetAllWarehouseEndpoint(PyroFetesDbContext db)
|
||||||
|
: EndpointWithoutRequest<List<GetWarehouseDto>>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -14,8 +17,13 @@ public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
public override async Task HandleAsync(CancellationToken ct)
|
||||||
{
|
{
|
||||||
List<GetWarehouseDto> responseDto = await pyrofetesdbcontext.Warehouses
|
// 🔹 On inclut les relations avec WarehouseProducts et Product
|
||||||
.Select(w => new GetWarehouseDto
|
var warehouses = await db.Warehouses
|
||||||
|
.Include(w => w.WarehouseProducts)
|
||||||
|
.ThenInclude(wp => wp.Product)
|
||||||
|
.ToListAsync(ct);
|
||||||
|
|
||||||
|
var response = warehouses.Select(w => new GetWarehouseDto
|
||||||
{
|
{
|
||||||
Id = w.Id,
|
Id = w.Id,
|
||||||
Name = w.Name,
|
Name = w.Name,
|
||||||
@@ -24,10 +32,15 @@ public class GetAllWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
MinWeight = w.MinWeight,
|
MinWeight = w.MinWeight,
|
||||||
Adress = w.Address,
|
Adress = w.Address,
|
||||||
ZipCode = w.ZipCode,
|
ZipCode = w.ZipCode,
|
||||||
City = w.City
|
City = w.City,
|
||||||
})
|
Products = w.WarehouseProducts.Select(wp => new WarehouseProductDto
|
||||||
.ToListAsync(ct);
|
{
|
||||||
|
ProductId = wp.ProductId,
|
||||||
|
ProductName = wp.Product?.Name,
|
||||||
|
Quantity = wp.Quantity
|
||||||
|
}).ToList()
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using API.DTO.Warehouse.Response;
|
using API.DTO.Warehouse.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
namespace PyroFetes.Endpoints.Warehouse;
|
||||||
|
|
||||||
@@ -9,18 +10,22 @@ public class GetWarehouseRequest
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<GetWarehouseRequest, GetWarehouseDto>
|
public class GetWarehouseEndpoint(PyroFetesDbContext db)
|
||||||
|
: Endpoint<GetWarehouseRequest, GetWarehouseDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Get("/api/warehouses/{@id}", x => new { x.Id });
|
// Pas de "@id" ici, juste {id}
|
||||||
|
Get("/api/warehouses/{Id}");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(GetWarehouseRequest req, CancellationToken ct)
|
public override async Task HandleAsync(GetWarehouseRequest req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Warehouse? warehouse = await pyrofetesdbcontext
|
// 🔹 Inclut les produits associés à cet entrepôt
|
||||||
.Warehouses
|
var warehouse = await db.Warehouses
|
||||||
|
.Include(w => w.WarehouseProducts)
|
||||||
|
.ThenInclude(wp => wp.Product)
|
||||||
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (warehouse == null)
|
if (warehouse == null)
|
||||||
@@ -30,7 +35,7 @@ public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetWarehouseDto responseDto = new()
|
var response = new GetWarehouseDto
|
||||||
{
|
{
|
||||||
Id = warehouse.Id,
|
Id = warehouse.Id,
|
||||||
Name = warehouse.Name!,
|
Name = warehouse.Name!,
|
||||||
@@ -39,9 +44,15 @@ public class GetWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpo
|
|||||||
MinWeight = warehouse.MinWeight,
|
MinWeight = warehouse.MinWeight,
|
||||||
Adress = warehouse.Address!,
|
Adress = warehouse.Address!,
|
||||||
ZipCode = warehouse.ZipCode,
|
ZipCode = warehouse.ZipCode,
|
||||||
City = warehouse.City!
|
City = warehouse.City!,
|
||||||
|
Products = warehouse.WarehouseProducts.Select(wp => new WarehouseProductDto
|
||||||
|
{
|
||||||
|
ProductId = wp.ProductId,
|
||||||
|
ProductName = wp.Product?.Name,
|
||||||
|
Quantity = wp.Quantity
|
||||||
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,21 +2,25 @@
|
|||||||
using API.DTO.Warehouse.Response;
|
using API.DTO.Warehouse.Response;
|
||||||
using FastEndpoints;
|
using FastEndpoints;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using PyroFetes.Models;
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Warehouse;
|
namespace PyroFetes.Endpoints.Warehouse;
|
||||||
|
|
||||||
public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : Endpoint<UpdateWarehouseDto, GetWarehouseDto>
|
public class UpdateWarehouseEndpoint(PyroFetesDbContext db)
|
||||||
|
: Endpoint<UpdateWarehouseDto, GetWarehouseDto>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
Put("/api/warehouses/{@id}", x => new { x.Id });
|
// Utilise {id} plutôt que {@id}
|
||||||
|
Put("/api/warehouses/{Id}");
|
||||||
AllowAnonymous();
|
AllowAnonymous();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateWarehouseDto req, CancellationToken ct)
|
public override async Task HandleAsync(UpdateWarehouseDto req, CancellationToken ct)
|
||||||
{
|
{
|
||||||
Models.Warehouse? warehouseToEdit = await pyrofetesdbcontext
|
// 🔹 On inclut les produits existants pour pouvoir les modifier
|
||||||
.Warehouses
|
var warehouseToEdit = await db.Warehouses
|
||||||
|
.Include(w => w.WarehouseProducts)
|
||||||
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
.SingleOrDefaultAsync(w => w.Id == req.Id, cancellationToken: ct);
|
||||||
|
|
||||||
if (warehouseToEdit == null)
|
if (warehouseToEdit == null)
|
||||||
@@ -26,7 +30,7 @@ public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise à jour des champs
|
// 🔹 Mise à jour des champs de base
|
||||||
warehouseToEdit.Name = req.Name;
|
warehouseToEdit.Name = req.Name;
|
||||||
warehouseToEdit.MaxWeight = req.MaxWeight;
|
warehouseToEdit.MaxWeight = req.MaxWeight;
|
||||||
warehouseToEdit.Current = req.Current;
|
warehouseToEdit.Current = req.Current;
|
||||||
@@ -35,9 +39,30 @@ public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
warehouseToEdit.ZipCode = req.ZipCode;
|
warehouseToEdit.ZipCode = req.ZipCode;
|
||||||
warehouseToEdit.City = req.City;
|
warehouseToEdit.City = req.City;
|
||||||
|
|
||||||
await pyrofetesdbcontext.SaveChangesAsync(ct);
|
// 🔹 Gestion des produits associés
|
||||||
|
if (req.Products is not null)
|
||||||
|
{
|
||||||
|
// On supprime les anciens liens pour recréer proprement
|
||||||
|
var existingLinks = warehouseToEdit.WarehouseProducts.ToList();
|
||||||
|
if (existingLinks.Any())
|
||||||
|
db.WarehouseProducts.RemoveRange(existingLinks);
|
||||||
|
|
||||||
GetWarehouseDto responseDto = new()
|
foreach (var p in req.Products)
|
||||||
|
{
|
||||||
|
var newLink = new WarehouseProduct
|
||||||
|
{
|
||||||
|
WarehouseId = warehouseToEdit.Id,
|
||||||
|
ProductId = p.ProductId,
|
||||||
|
Quantity = p.Quantity
|
||||||
|
};
|
||||||
|
db.WarehouseProducts.Add(newLink);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.SaveChangesAsync(ct);
|
||||||
|
|
||||||
|
// 🔹 On renvoie la version mise à jour
|
||||||
|
var response = new GetWarehouseDto
|
||||||
{
|
{
|
||||||
Id = warehouseToEdit.Id,
|
Id = warehouseToEdit.Id,
|
||||||
Name = warehouseToEdit.Name,
|
Name = warehouseToEdit.Name,
|
||||||
@@ -46,9 +71,16 @@ public class UpdateWarehouseEndpoint(PyroFetesDbContext pyrofetesdbcontext) : En
|
|||||||
MinWeight = warehouseToEdit.MinWeight,
|
MinWeight = warehouseToEdit.MinWeight,
|
||||||
Adress = warehouseToEdit.Address,
|
Adress = warehouseToEdit.Address,
|
||||||
ZipCode = warehouseToEdit.ZipCode,
|
ZipCode = warehouseToEdit.ZipCode,
|
||||||
City = warehouseToEdit.City
|
City = warehouseToEdit.City,
|
||||||
|
Products = warehouseToEdit.WarehouseProducts.Select(wp => new WarehouseProductDto
|
||||||
|
{
|
||||||
|
ProductId = wp.ProductId,
|
||||||
|
ProductName = wp.Product?.Name,
|
||||||
|
Quantity = wp.Quantity
|
||||||
|
}).ToList()
|
||||||
};
|
};
|
||||||
|
|
||||||
await Send.OkAsync(responseDto, ct);
|
Console.WriteLine($"Entrepôt {warehouseToEdit.Name} mis à jour avec succès.");
|
||||||
|
await Send.OkAsync(response, ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1951
PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs
generated
Normal file
1951
PyroFetes/Migrations/20251008103414_InitialDatabase.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
1392
PyroFetes/Migrations/20251008103414_InitialDatabase.cs
Normal file
1392
PyroFetes/Migrations/20251008103414_InitialDatabase.cs
Normal file
File diff suppressed because it is too large
Load Diff
13
PyroFetes/Models/.idea/.gitignore
generated
vendored
Normal file
13
PyroFetes/Models/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# 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
PyroFetes/Models/.idea/encodings.xml
generated
Normal file
4
PyroFetes/Models/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
||||||
8
PyroFetes/Models/.idea/indexLayout.xml
generated
Normal file
8
PyroFetes/Models/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -4,13 +4,11 @@ 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; }
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,9 @@ 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; }
|
|
||||||
|
|
||||||
//Relations
|
[Required] public int ProductId { get; set; }
|
||||||
[Required] public Product? Product { get; set; }
|
[Required] public Product? Product { get; set; }
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,9 @@ 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; }
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,8 @@ 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; }
|
||||||
}
|
}
|
||||||
@@ -4,10 +4,8 @@ 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; }
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user