Ignore:
Timestamp:
05/12/22 16:36:14 (2 years ago)
Author:
Danilo <danilo.najkov@…>
Branches:
master
Children:
cc4db18
Parents:
7a983b0
Message:

prototype final

Location:
resTools_backend/backend/Controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • resTools_backend/backend/Controllers/ReservationsController.cs

    r7a983b0 rd76b7ee  
    2020    }
    2121
     22    [Authorize]
     23    [HttpGet()]
     24    public async Task<List<ReservationResponse>> GetReservations([FromQuery] DateTime from, [FromQuery] DateTime to)
     25    {
     26        return await _reservationService.GetReservatins(from, to);
     27    }
     28
    2229    [HttpPost()]
    2330    public async Task<IActionResult> CreateReservation([FromBody] CreateReservationRequest req)
  • resTools_backend/backend/Controllers/UsersController.cs

    r7a983b0 rd76b7ee  
    22
    33using backend.DTOs;
     4using backend.Entities;
    45using backend.Helpers;
    56using backend.Models;
     
    2930    }
    3031
     32    [HttpGet("authed")]
     33    public async Task<AuthenticateResponse> IsAuthed()
     34    {
     35        int userId = 0;
     36        try
     37        {
     38            userId = (int)this.HttpContext.Items["User"];
     39        }catch (Exception ex){ return null; }
     40        User user = await _userService.GetById(userId);
     41        return new AuthenticateResponse() { Email=user.Email, Id = user.Id};
     42    }
     43
    3144    [HttpPost("register")]
    3245    public async Task<AuthenticateResponse> Register(CreateUserRequest req)
Note: See TracChangeset for help on using the changeset viewer.