diff --git a/Marechai.Server/Controllers/CurrencyInflationController.cs b/Marechai.Server/Controllers/CurrencyInflationController.cs index 3b7e8926..5d27a7d5 100644 --- a/Marechai.Server/Controllers/CurrencyInflationController.cs +++ b/Marechai.Server/Controllers/CurrencyInflationController.cs @@ -83,7 +83,7 @@ public class CurrencyInflationController(MarechaiContext context) : ControllerBa if(userId is null) return Unauthorized(); - CurrencyInflation model = await context.CurrenciesInflation.FindAsync(dto.Id); + CurrencyInflation model = await context.CurrenciesInflation.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/CurrencyPeggingController.cs b/Marechai.Server/Controllers/CurrencyPeggingController.cs index 046430e0..a354c608 100644 --- a/Marechai.Server/Controllers/CurrencyPeggingController.cs +++ b/Marechai.Server/Controllers/CurrencyPeggingController.cs @@ -91,7 +91,7 @@ public class CurrencyPeggingController(MarechaiContext context) : ControllerBase if(userId is null) return Unauthorized(); - CurrencyPegging model = await context.CurrenciesPegging.FindAsync(dto.Id); + CurrencyPegging model = await context.CurrenciesPegging.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/DocumentCompaniesController.cs b/Marechai.Server/Controllers/DocumentCompaniesController.cs index a015b4a6..38fd6ace 100644 --- a/Marechai.Server/Controllers/DocumentCompaniesController.cs +++ b/Marechai.Server/Controllers/DocumentCompaniesController.cs @@ -36,7 +36,7 @@ using Microsoft.EntityFrameworkCore; namespace Marechai.Server.Controllers; -[Route("/document-companies")] +[Route("/documents/companies")] [ApiController] public class DocumentCompaniesController(MarechaiContext context) : ControllerBase { @@ -67,18 +67,18 @@ public class DocumentCompaniesController(MarechaiContext context) : ControllerBa }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] DocumentCompanyDto dto) + public async Task UpdateAsync(int id, [FromBody] DocumentCompanyDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - DocumentCompany model = await context.DocumentCompanies.FindAsync(dto.Id); + DocumentCompany model = await context.DocumentCompanies.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/DocumentPeopleController.cs b/Marechai.Server/Controllers/DocumentPeopleController.cs index d846ea4c..4e14295e 100644 --- a/Marechai.Server/Controllers/DocumentPeopleController.cs +++ b/Marechai.Server/Controllers/DocumentPeopleController.cs @@ -73,18 +73,18 @@ public class DocumentPeopleController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] DocumentPersonDto dto) + public async Task UpdateAsync(int id, [FromBody] DocumentPersonDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - DocumentPerson model = await context.DocumentPeople.FindAsync(dto.Id); + DocumentPerson model = await context.DocumentPeople.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/DocumentScansController.cs b/Marechai.Server/Controllers/DocumentScansController.cs index 2318af78..46d3915f 100644 --- a/Marechai.Server/Controllers/DocumentScansController.cs +++ b/Marechai.Server/Controllers/DocumentScansController.cs @@ -76,18 +76,18 @@ public class DocumentScansController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:Guid}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] DocumentScanDto dto) + public async Task UpdateAsync(Guid id, [FromBody] DocumentScanDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - DocumentScan model = await context.DocumentScans.FindAsync(dto.Id); + DocumentScan model = await context.DocumentScans.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/DocumentsController.cs b/Marechai.Server/Controllers/DocumentsController.cs index 6412e8b3..e9db9176 100644 --- a/Marechai.Server/Controllers/DocumentsController.cs +++ b/Marechai.Server/Controllers/DocumentsController.cs @@ -76,18 +76,18 @@ public class DocumentsController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:long}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] DocumentDto dto) + public async Task UpdateAsync(long id, [FromBody] DocumentDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Document model = await context.Documents.FindAsync(dto.Id); + Document model = await context.Documents.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/DumpsController.cs b/Marechai.Server/Controllers/DumpsController.cs index 718626de..d865978a 100644 --- a/Marechai.Server/Controllers/DumpsController.cs +++ b/Marechai.Server/Controllers/DumpsController.cs @@ -81,18 +81,18 @@ public class DumpsController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:ulong}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] DumpDto dto) + public async Task UpdateAsync(ulong id, [FromBody] DumpDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Dump model = await context.Dumps.FindAsync(dto.Id); + Dump model = await context.Dumps.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/GpusController.cs b/Marechai.Server/Controllers/GpusController.cs index c9353e19..d014393d 100644 --- a/Marechai.Server/Controllers/GpusController.cs +++ b/Marechai.Server/Controllers/GpusController.cs @@ -102,18 +102,18 @@ public class GpusController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] GpuDto dto) + public async Task UpdateAsync(int id, [FromBody] GpuDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Gpu model = await context.Gpus.FindAsync(dto.Id); + Gpu model = await context.Gpus.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/InstructionSetExtensionsController.cs b/Marechai.Server/Controllers/InstructionSetExtensionsController.cs index a0fe991f..9bf93979 100644 --- a/Marechai.Server/Controllers/InstructionSetExtensionsController.cs +++ b/Marechai.Server/Controllers/InstructionSetExtensionsController.cs @@ -64,13 +64,13 @@ public class InstructionSetExtensionsController(MarechaiContext context) : Contr }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] InstructionSetExtension viewModel) + public async Task UpdateAsync(int id, [FromBody] InstructionSetExtension viewModel) { string userId = User.FindFirstValue(ClaimTypes.Sid); diff --git a/Marechai.Server/Controllers/InstructionSetsController.cs b/Marechai.Server/Controllers/InstructionSetsController.cs index 49fb437e..0318800a 100644 --- a/Marechai.Server/Controllers/InstructionSetsController.cs +++ b/Marechai.Server/Controllers/InstructionSetsController.cs @@ -64,13 +64,13 @@ public class InstructionSetsController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] InstructionSet viewModel) + public async Task UpdateAsync(int id, [FromBody] InstructionSet viewModel) { string userId = User.FindFirstValue(ClaimTypes.Sid); diff --git a/Marechai.Server/Controllers/LicensesController.cs b/Marechai.Server/Controllers/LicensesController.cs index 6fb918bb..b889f751 100644 --- a/Marechai.Server/Controllers/LicensesController.cs +++ b/Marechai.Server/Controllers/LicensesController.cs @@ -72,13 +72,13 @@ public class LicensesController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] License viewModel) + public async Task UpdateAsync(int id, [FromBody] License viewModel) { string userId = User.FindFirstValue(ClaimTypes.Sid); diff --git a/Marechai.Server/Controllers/MachineFamiliesController.cs b/Marechai.Server/Controllers/MachineFamiliesController.cs index 7c4172d6..8167feae 100644 --- a/Marechai.Server/Controllers/MachineFamiliesController.cs +++ b/Marechai.Server/Controllers/MachineFamiliesController.cs @@ -68,18 +68,18 @@ public class MachineFamiliesController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] MachineFamilyDto dto) + public async Task UpdateAsync(int id, [FromBody] MachineFamilyDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - MachineFamily model = await context.MachineFamilies.FindAsync(dto.Id); + MachineFamily model = await context.MachineFamilies.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/MachinePhotosController.cs b/Marechai.Server/Controllers/MachinePhotosController.cs index a933766e..6919739f 100644 --- a/Marechai.Server/Controllers/MachinePhotosController.cs +++ b/Marechai.Server/Controllers/MachinePhotosController.cs @@ -100,18 +100,18 @@ public class MachinePhotosController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:Guid}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] MachinePhotoDto dto) + public async Task UpdateAsync(Guid id, [FromBody] MachinePhotoDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - MachinePhoto model = await context.MachinePhotos.FindAsync(dto.Id); + MachinePhoto model = await context.MachinePhotos.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/MachinesController.cs b/Marechai.Server/Controllers/MachinesController.cs index 2ae7f22e..b9b1c3cb 100644 --- a/Marechai.Server/Controllers/MachinesController.cs +++ b/Marechai.Server/Controllers/MachinesController.cs @@ -87,18 +87,18 @@ public class MachinesController }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] MachineDto dto) + public async Task UpdateAsync(int id, [FromBody] MachineDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Machine model = await context.Machines.FindAsync(dto.Id); + Machine model = await context.Machines.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/MagazineIssuesController.cs b/Marechai.Server/Controllers/MagazineIssuesController.cs index 4c2ca62c..a5aa3668 100644 --- a/Marechai.Server/Controllers/MagazineIssuesController.cs +++ b/Marechai.Server/Controllers/MagazineIssuesController.cs @@ -80,18 +80,18 @@ public class MagazineIssuesController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:long}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] MagazineIssueDto dto) + public async Task UpdateAsync(long id, [FromBody] MagazineIssueDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - MagazineIssue model = await context.MagazineIssues.FindAsync(dto.Id); + MagazineIssue model = await context.MagazineIssues.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/MagazineScansController.cs b/Marechai.Server/Controllers/MagazineScansController.cs index 8ebb1a14..cb0f603e 100644 --- a/Marechai.Server/Controllers/MagazineScansController.cs +++ b/Marechai.Server/Controllers/MagazineScansController.cs @@ -76,18 +76,18 @@ public class MagazineScansController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:Guid}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] MagazineScanDto dto) + public async Task UpdateAsync(Guid id, [FromBody] MagazineScanDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - MagazineScan model = await context.MagazineScans.FindAsync(dto.Id); + MagazineScan model = await context.MagazineScans.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/MagazinesController.cs b/Marechai.Server/Controllers/MagazinesController.cs index 567c7257..0db21d00 100644 --- a/Marechai.Server/Controllers/MagazinesController.cs +++ b/Marechai.Server/Controllers/MagazinesController.cs @@ -91,18 +91,18 @@ public class MagazinesController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:long}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] MagazineDto dto) + public async Task UpdateAsync(long id, [FromBody] MagazineDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Magazine model = await context.Magazines.FindAsync(dto.Id); + Magazine model = await context.Magazines.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/MediaController.cs b/Marechai.Server/Controllers/MediaController.cs index d6ca6035..b8ab1130 100644 --- a/Marechai.Server/Controllers/MediaController.cs +++ b/Marechai.Server/Controllers/MediaController.cs @@ -124,18 +124,18 @@ public class MediaController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:ulong}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] MediaDto dto) + public async Task UpdateAsync(ulong id, [FromBody] MediaDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Media model = await context.Media.FindAsync(dto.Id); + Media model = await context.Media.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/PeopleController.cs b/Marechai.Server/Controllers/PeopleController.cs index 179c0aaa..d5679260 100644 --- a/Marechai.Server/Controllers/PeopleController.cs +++ b/Marechai.Server/Controllers/PeopleController.cs @@ -87,18 +87,18 @@ public class PeopleController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] PersonDto dto) + public async Task UpdateAsync(int id, [FromBody] PersonDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Person model = await context.People.FindAsync(dto.Id); + Person model = await context.People.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/ProcessorsController.cs b/Marechai.Server/Controllers/ProcessorsController.cs index 93244e77..bac450b0 100644 --- a/Marechai.Server/Controllers/ProcessorsController.cs +++ b/Marechai.Server/Controllers/ProcessorsController.cs @@ -159,18 +159,18 @@ public class ProcessorsController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] ProcessorDto dto) + public async Task UpdateAsync(int id, [FromBody] ProcessorDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Processor model = await context.Processors.FindAsync(dto.Id); + Processor model = await context.Processors.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/ResolutionsController.cs b/Marechai.Server/Controllers/ResolutionsController.cs index a761c84f..563b4419 100644 --- a/Marechai.Server/Controllers/ResolutionsController.cs +++ b/Marechai.Server/Controllers/ResolutionsController.cs @@ -79,18 +79,18 @@ public class ResolutionsController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] ResolutionDto dto) + public async Task UpdateAsync(int id, [FromBody] ResolutionDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Resolution model = await context.Resolutions.FindAsync(dto.Id); + Resolution model = await context.Resolutions.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/ScreensController.cs b/Marechai.Server/Controllers/ScreensController.cs index fae6a2d8..6e844af4 100644 --- a/Marechai.Server/Controllers/ScreensController.cs +++ b/Marechai.Server/Controllers/ScreensController.cs @@ -98,18 +98,18 @@ public class ScreensController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] ScreenDto dto) + public async Task UpdateAsync(int id, [FromBody] ScreenDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - Screen model = await context.Screens.FindAsync(dto.Id); + Screen model = await context.Screens.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/SoftwareFamiliesController.cs b/Marechai.Server/Controllers/SoftwareFamiliesController.cs index 14fde7a4..0616f12c 100644 --- a/Marechai.Server/Controllers/SoftwareFamiliesController.cs +++ b/Marechai.Server/Controllers/SoftwareFamiliesController.cs @@ -70,18 +70,18 @@ public class SoftwareFamiliesController(MarechaiContext context) : ControllerBas }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:ulong}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] SoftwareFamilyDto dto) + public async Task UpdateAsync(ulong id, [FromBody] SoftwareFamilyDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - SoftwareFamily model = await context.SoftwareFamilies.FindAsync(dto.Id); + SoftwareFamily model = await context.SoftwareFamilies.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/SoftwareVariantsController.cs b/Marechai.Server/Controllers/SoftwareVariantsController.cs index 5112dfac..fca36993 100644 --- a/Marechai.Server/Controllers/SoftwareVariantsController.cs +++ b/Marechai.Server/Controllers/SoftwareVariantsController.cs @@ -101,18 +101,18 @@ public class SoftwareVariantsController(MarechaiContext context) : ControllerBas }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:ulong}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] SoftwareVariantDto dto) + public async Task UpdateAsync(ulong id, [FromBody] SoftwareVariantDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - SoftwareVariant model = await context.SoftwareVariants.FindAsync(dto.Id); + SoftwareVariant model = await context.SoftwareVariants.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/SoftwareVersionsController.cs b/Marechai.Server/Controllers/SoftwareVersionsController.cs index de4cc753..13fe00c3 100644 --- a/Marechai.Server/Controllers/SoftwareVersionsController.cs +++ b/Marechai.Server/Controllers/SoftwareVersionsController.cs @@ -84,18 +84,18 @@ public class SoftwareVersionsController(MarechaiContext context) : ControllerBas }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:ulong}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] SoftwareVersionDto dto) + public async Task UpdateAsync(ulong id, [FromBody] SoftwareVersionDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - SoftwareVersion model = await context.SoftwareVersions.FindAsync(dto.Id); + SoftwareVersion model = await context.SoftwareVersions.FindAsync(id); if(model is null) return NotFound(); diff --git a/Marechai.Server/Controllers/SoundSynthsController.cs b/Marechai.Server/Controllers/SoundSynthsController.cs index d4bc4aef..5bde8c27 100644 --- a/Marechai.Server/Controllers/SoundSynthsController.cs +++ b/Marechai.Server/Controllers/SoundSynthsController.cs @@ -113,18 +113,18 @@ public class SoundSynthsController(MarechaiContext context) : ControllerBase }) .FirstOrDefaultAsync(); - [HttpPost] + [HttpPut("{id:int}")] [Authorize(Roles = "Admin,UberAdmin")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] - public async Task UpdateAsync([FromBody] SoundSynthDto dto) + public async Task UpdateAsync(int id, [FromBody] SoundSynthDto dto) { string userId = User.FindFirstValue(ClaimTypes.Sid); if(userId is null) return Unauthorized(); - SoundSynth model = await context.SoundSynths.FindAsync(dto.Id); + SoundSynth model = await context.SoundSynths.FindAsync(id); if(model is null) return NotFound();