66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
// using System;
|
|
// using System.Collections.Generic;
|
|
// using System.Linq;
|
|
// using System.Threading.Tasks;
|
|
// using Contracts.DTOs.Generic;
|
|
// using Contracts.DTOs.Requests;
|
|
// using Core.Services.Requests;
|
|
// using Microsoft.AspNetCore.Mvc;
|
|
|
|
// namespace Auth.API.Endpoints.v1.RequestEndpoints;
|
|
|
|
// public static class RequestMap
|
|
// {
|
|
// public static RouteGroupBuilder RequestEndpoints(this RouteGroupBuilder group)
|
|
// {
|
|
// group.MapGet(
|
|
// "requests",
|
|
// async ([AsParameters] RequestFilter filter, [AsParameters] Pagination pagination, RequestService requestService, HttpContext httpContext) =>
|
|
// {
|
|
// var result = await requestService.GetRequests(filter, pagination);
|
|
|
|
// return result;
|
|
// }
|
|
// );
|
|
|
|
// group.MapGet(
|
|
// "requests/user",
|
|
// async ([AsParameters] RequestFilter requestFilter, RequestService requestService, HttpContext httpContext) =>
|
|
// {
|
|
// var userId = httpContext.User.Claims.FirstOrDefault(x => x.Type == "uid").Value;
|
|
// return await requestService.GetRequestsAsUser(requestFilter, userId);
|
|
// }
|
|
// );
|
|
|
|
|
|
// group.MapPost(
|
|
// "request",
|
|
// async ([FromBody] RequestVM requestVM, RequestService requestService, HttpContext httpContext) =>
|
|
// {
|
|
// var userId = httpContext.User.Claims.FirstOrDefault(x => x.Type == "uid").Value;
|
|
// await requestService.CreateRequest(requestVM, userId);
|
|
// }
|
|
// );
|
|
|
|
|
|
// //should be only auhtoized by Admins
|
|
// group.MapPut(
|
|
// "request",
|
|
// async ([FromBody] RequestVM requestVM, RequestService requestService, HttpContext httpContext) =>
|
|
// {
|
|
// var userId = httpContext.User.Claims.FirstOrDefault(x => x.Type == "uid").Value;
|
|
// await requestService.TreatRequest(requestVM, userId);
|
|
// }
|
|
// );
|
|
|
|
|
|
|
|
|
|
// return group;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|