Skip to content

Commit

Permalink
made bus and passengers controllers refactoring and extending
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriyBorkovich committed Apr 9, 2024
1 parent 329265f commit 413d46a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/BSMS.API/Controllers/BusController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public async Task<ActionResult<MessageResponse>> Delete(int id)
/// <param name="query">Filtering fields</param>
/// <returns>List with bus data, driver and company name</returns>
[HttpGet("GetAll")]
public async Task<ActionResult<GetAllBusesResponse>> GetAll(GetAllBusesQuery query)
public async Task<ActionResult<List<GetAllBusesResponse>>> GetAll(
[FromQuery] GetAllBusesQuery query)
{
var result = await sender.Send(query);

Expand Down
15 changes: 15 additions & 0 deletions src/BSMS.API/Controllers/PassengerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BSMS.Application.Features.Common;
using BSMS.Application.Features.Passenger.Commands.Create;
using BSMS.Application.Features.Passenger.Commands.Delete;
using BSMS.Application.Features.Passenger.Queries.GetAll;
using MediatR;
using Microsoft.AspNetCore.Mvc;

Expand Down Expand Up @@ -37,4 +38,18 @@ public async Task<ActionResult<MessageResponse>> Delete(int id)

return result.DecideWhatToReturn();
}

/// <summary>
/// Get all passengers
/// </summary>
/// <param name="query">Filtering fields</param>
/// <returns>List with passengers' data: full name, phone, email</returns>
[HttpGet("GetAll")]
public async Task<ActionResult<List<GetAllPassengersResponse>>> GetAll(
[FromQuery] GetAllPassengersQuery query)
{
var result = await sender.Send(query);

return result.DecideWhatToReturn();
}
}

0 comments on commit 413d46a

Please sign in to comment.