roles controller added
This commit is contained in:
@@ -55,7 +55,7 @@ public class GendersController : ControllerBase
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
[ProducesResponseType(typeof(GenderResponse), StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||
public async Task<ActionResult> DeleteGender([FromRoute]short id) => await _gendersControllerService.DeleteGender(id);
|
||||
|
||||
96
WatchIt.WebAPI/WatchIt.WebAPI.Controllers/RolesController.cs
Normal file
96
WatchIt.WebAPI/WatchIt.WebAPI.Controllers/RolesController.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WatchIt.Common.Model.Roles;
|
||||
using WatchIt.WebAPI.Services.Controllers.Roles;
|
||||
|
||||
namespace WatchIt.WebAPI.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("persons")]
|
||||
public class RolesController : ControllerBase
|
||||
{
|
||||
#region SERVICES
|
||||
|
||||
private readonly IRolesControllerService _rolesControllerService;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region CONSTRUCTORS
|
||||
|
||||
public RolesController(IRolesControllerService rolesControllerService)
|
||||
{
|
||||
_rolesControllerService = rolesControllerService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region METHODS
|
||||
|
||||
#region Actor
|
||||
|
||||
[HttpGet("actor")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(IEnumerable<RoleResponse>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult> GetAllActorRoles(RoleQueryParameters query) => await _rolesControllerService.GetAllActorRoles(query);
|
||||
|
||||
[HttpGet("actor/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(RoleResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult> GetActorRole([FromRoute]short id) => await _rolesControllerService.GetActorRole(id);
|
||||
|
||||
[HttpPost("actor")]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
[ProducesResponseType(typeof(RoleResponse), StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||
public async Task<ActionResult> PostActorRoles([FromBody]RoleRequest body) => await _rolesControllerService.PostActorRole(body);
|
||||
|
||||
[HttpDelete("actor/{id}")]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||
public async Task<ActionResult> DeleteActorRoles([FromRoute]short id) => await _rolesControllerService.DeleteActorRole(id);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Creator
|
||||
|
||||
[HttpGet("creator")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(IEnumerable<RoleResponse>), StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult> GetAllCreatorRoles(RoleQueryParameters query) => await _rolesControllerService.GetAllCreatorRoles(query);
|
||||
|
||||
[HttpGet("creator/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(typeof(RoleResponse), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult> GetCreatorRole([FromRoute]short id) => await _rolesControllerService.GetCreatorRole(id);
|
||||
|
||||
[HttpPost("creator")]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
[ProducesResponseType(typeof(RoleResponse), StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||
public async Task<ActionResult> PostCreatorRoles([FromBody]RoleRequest body) => await _rolesControllerService.PostCreatorRole(body);
|
||||
|
||||
[HttpDelete("creator/{id}")]
|
||||
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
|
||||
public async Task<ActionResult> DeleteCreatorRoles([FromRoute]short id) => await _rolesControllerService.DeleteCreatorRole(id);
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -20,6 +20,7 @@
|
||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Movies\WatchIt.WebAPI.Services.Controllers.Movies.csproj" />
|
||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Persons\WatchIt.WebAPI.Services.Controllers.Persons.csproj" />
|
||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Photos\WatchIt.WebAPI.Services.Controllers.Photos.csproj" />
|
||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Roles\WatchIt.WebAPI.Services.Controllers.Roles.csproj" />
|
||||
<ProjectReference Include="..\WatchIt.WebAPI.Services\WatchIt.WebAPI.Services.Controllers\WatchIt.WebAPI.Services.Controllers.Series\WatchIt.WebAPI.Services.Controllers.Series.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user