Bladeren bron

Set base root for UserController

Feature
Safet Purkovic 4 jaren geleden
bovenliggende
commit
d6ed83a8fd

BIN
.vs/BlackRock/v17/.suo Bestand weergeven


BIN
BlackRock.Reporting.API/BlackRock.db-shm Bestand weergeven


BIN
BlackRock.Reporting.API/BlackRock.db-wal Bestand weergeven


+ 5
- 9
BlackRock.Reporting.API/Controllers/UsersController.cs Bestand weergeven

using BlackRock.Reporting.API.Controllers.Model; using BlackRock.Reporting.API.Controllers.Model;
using BlackRock.Reporting.API.Jwt.Filters;
using BlackRock.Reporting.API.Mediator.UserMediator.Commands; using BlackRock.Reporting.API.Mediator.UserMediator.Commands;
using BlackRock.Reporting.API.Mediator.UserMediator.Queries; using BlackRock.Reporting.API.Mediator.UserMediator.Queries;
using MediatR; using MediatR;


namespace BlackRock.Reporting.API.Controllers namespace BlackRock.Reporting.API.Controllers
{ {
//[Route("api/users")]
[Authorize] [Authorize]
//[JwtAuthentication]
[Route("api/users")]
public class UsersController : Controller public class UsersController : Controller
{ {
private readonly IMediator mediator; private readonly IMediator mediator;


// GET: api/users/1 // GET: api/users/1
[HttpGet] [HttpGet]
[Route("api/users/{id}")]
[Route("{id}")]
public async Task<IActionResult> GetUser(int id) public async Task<IActionResult> GetUser(int id)
{ {
var result = await mediator.Send(new GetUserQuery { Id = id }); var result = await mediator.Send(new GetUserQuery { Id = id });
} }
// GET: api/users?Page=2&PageSize=25 // GET: api/users?Page=2&PageSize=25
[HttpGet] [HttpGet]
[Route("api/users")]
public async Task<IActionResult> GetAllUsers(GetAllUsersQuery query) public async Task<IActionResult> GetAllUsers(GetAllUsersQuery query)
{ {
var result = await mediator.Send(query); var result = await mediator.Send(query);
} }
// POST: api/users // POST: api/users
[HttpPost] [HttpPost]
[Route("api/users")]
public async Task<IActionResult> CreateUser([FromBody] CreateUserCommand user) public async Task<IActionResult> CreateUser([FromBody] CreateUserCommand user)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
} }
// PUT: api/users/1 // PUT: api/users/1
[HttpPut] [HttpPut]
[Route("api/users/{id}")]
[Route("{id}")]
public async Task<IActionResult> UpdateUser(int id, [FromBody] UpdateUserCommand user) public async Task<IActionResult> UpdateUser(int id, [FromBody] UpdateUserCommand user)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
} }
// PATCH: api/users/1/email // PATCH: api/users/1/email
[HttpPatch] [HttpPatch]
[Route("api/users/{id}/email")]
[Route("{id}/email")]
public async Task<IActionResult> UpdateUserEmail(int id, [FromBody] UpdateUserEmailCommand user) public async Task<IActionResult> UpdateUserEmail(int id, [FromBody] UpdateUserEmailCommand user)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)
} }
// DELETE: api/users/1 // DELETE: api/users/1
[HttpDelete] [HttpDelete]
[Route("api/users/{id}")]
[Route("{id}")]
public async Task<IActionResult> DeleteUser(int id) public async Task<IActionResult> DeleteUser(int id)
{ {
if (!ModelState.IsValid) if (!ModelState.IsValid)

+ 0
- 1
BlackRock.Reporting.API/Program.cs Bestand weergeven

builder.Services.AddScoped<IUnitOfWork, UnitOfWork>(); builder.Services.AddScoped<IUnitOfWork, UnitOfWork>();
builder.Services.AddScoped<IJwtManager, JwtManager>(); builder.Services.AddScoped<IJwtManager, JwtManager>();
builder.Services.AddScoped<IRefreshTokenManager, RefreshTokenManager>(); builder.Services.AddScoped<IRefreshTokenManager, RefreshTokenManager>();
builder.Services.AddScoped<IAuthenticationMediator, AuthenticationMediator>();
builder.Services.AddCors(); builder.Services.AddCors();
builder.Services.AddControllers(); builder.Services.AddControllers();
builder.Services.AddAutoMapper(typeof(Program)); builder.Services.AddAutoMapper(typeof(Program));

+ 5
- 0
BlackRock.Reporting.API/obj/staticwebassets.pack.sentinel Bestand weergeven

2.0 2.0
2.0 2.0
2.0 2.0
2.0
2.0
2.0
2.0
2.0

Laden…
Annuleren
Opslaan