diff --git a/src/CatalogService/Controllers/ExercicesController.cs b/src/CatalogService/Controllers/ExercicesController.cs index deb6456..5370499 100644 --- a/src/CatalogService/Controllers/ExercicesController.cs +++ b/src/CatalogService/Controllers/ExercicesController.cs @@ -2,6 +2,7 @@ using AutoMapper; using CatalogService.Data; using CatalogService.DTOs; using CatalogService.Entities; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Shared.DTOs; @@ -9,7 +10,8 @@ using Shared.DTOs; namespace CatalogService.Controllers; [ApiController] -[Route("api/[controller]")] +[Authorize] +[Route("api/catalog/[controller]")] public class ExercicesController : ControllerBase { private readonly CatalogDbContext _context; @@ -22,6 +24,7 @@ public class ExercicesController : ControllerBase } [HttpPost] + [AllowAnonymous] public async Task Create([FromBody] CreateExerciceTemplateDto dto) { var exercice = _mapper.Map(dto); @@ -31,6 +34,7 @@ public class ExercicesController : ControllerBase } [HttpPut("{id}")] + [AllowAnonymous] public async Task Update(string id, [FromBody] UpdateExerciceTemplateDto dto) { var exercice = await _context.Exercices.FindAsync(id); @@ -43,6 +47,7 @@ public class ExercicesController : ControllerBase } [HttpDelete("{id}")] + [AllowAnonymous] public async Task Delete(string id) { var exercice = await _context.Exercices.FindAsync(id); @@ -54,6 +59,7 @@ public class ExercicesController : ControllerBase } [HttpGet("{id}")] + [AllowAnonymous] public async Task> GetById(string id) { var exercice = await _context.Exercices.FindAsync(id); diff --git a/src/CatalogService/DTOs/UpdateExerciceTemplateDto.cs b/src/CatalogService/DTOs/UpdateExerciceTemplateDto.cs index e19a600..0031442 100644 --- a/src/CatalogService/DTOs/UpdateExerciceTemplateDto.cs +++ b/src/CatalogService/DTOs/UpdateExerciceTemplateDto.cs @@ -5,9 +5,6 @@ namespace CatalogService.DTOs; public class UpdateExerciceTemplateDto { - [Required] - public required string Id { get; set; } - public string? Name { get; set; } public string? Description { get; set; }