Compare commits

..

2 Commits
main ... dev

@ -10,7 +10,8 @@ using Shared.DTOs;
namespace CatalogService.Controllers; namespace CatalogService.Controllers;
[ApiController] [ApiController]
[Route("api/[controller]")] [Authorize]
[Route("api/catalog/[controller]")]
public class ExercicesController : ControllerBase public class ExercicesController : ControllerBase
{ {
private readonly CatalogDbContext _context; private readonly CatalogDbContext _context;
@ -24,6 +25,7 @@ public class ExercicesController : ControllerBase
[Authorize] [Authorize]
[HttpPost] [HttpPost]
[AllowAnonymous]
public async Task<IActionResult> Create([FromBody] CreateExerciceTemplateDto dto) public async Task<IActionResult> Create([FromBody] CreateExerciceTemplateDto dto)
{ {
if (User.Identity.Name != "admin") return Forbid(); if (User.Identity.Name != "admin") return Forbid();
@ -36,6 +38,7 @@ public class ExercicesController : ControllerBase
[Authorize] [Authorize]
[HttpPut("{id}")] [HttpPut("{id}")]
[AllowAnonymous]
public async Task<IActionResult> Update(string id, [FromBody] UpdateExerciceTemplateDto dto) public async Task<IActionResult> Update(string id, [FromBody] UpdateExerciceTemplateDto dto)
{ {
if (User.Identity.Name != "admin") return Forbid(); if (User.Identity.Name != "admin") return Forbid();
@ -51,6 +54,7 @@ public class ExercicesController : ControllerBase
[Authorize] [Authorize]
[HttpDelete("{id}")] [HttpDelete("{id}")]
[AllowAnonymous]
public async Task<IActionResult> Delete(string id) public async Task<IActionResult> Delete(string id)
{ {
if (User.Identity.Name != "admin") return Forbid(); if (User.Identity.Name != "admin") return Forbid();
@ -65,6 +69,7 @@ public class ExercicesController : ControllerBase
[Authorize] [Authorize]
[HttpGet("{id}")] [HttpGet("{id}")]
[AllowAnonymous]
public async Task<ActionResult<ExerciceTemplateDto>> GetById(string id) public async Task<ActionResult<ExerciceTemplateDto>> GetById(string id)
{ {
if (User.Identity.Name != "admin") return Forbid(); if (User.Identity.Name != "admin") return Forbid();

@ -5,9 +5,6 @@ namespace CatalogService.DTOs;
public class UpdateExerciceTemplateDto public class UpdateExerciceTemplateDto
{ {
[Required]
public required string Id { get; set; }
public string? Name { get; set; } public string? Name { get; set; }
public string? Description { get; set; } public string? Description { get; set; }

Loading…
Cancel
Save