mirror of
https://github.com/azaion/missions.git
synced 2026-06-21 09:21:07 +00:00
2840ccb9b6
ci/woodpecker/push/build-arm Pipeline was successful
This commit transitions the project from Azaion.Flights to Azaion.Missions, updating namespaces, DTOs, services, and database entities accordingly. The Docker configuration and entry points have been modified to reflect the new project structure. Additionally, the README and documentation have been updated to clarify the ongoing renaming process and its implications. All references to flights have been replaced with missions, ensuring consistency across the codebase.
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Azaion.Missions.DTOs;
|
|
using Azaion.Missions.Services;
|
|
|
|
namespace Azaion.Missions.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("vehicles")]
|
|
[Authorize(Policy = "FL")]
|
|
public class VehiclesController(VehicleService vehicleService) : ControllerBase
|
|
{
|
|
[HttpPost]
|
|
public async Task<IActionResult> Create([FromBody] CreateVehicleRequest request)
|
|
{
|
|
var vehicle = await vehicleService.CreateVehicle(request);
|
|
return Created($"/vehicles/{vehicle.Id}", vehicle);
|
|
}
|
|
|
|
[HttpPut("{id:guid}")]
|
|
public async Task<IActionResult> Update(Guid id, [FromBody] UpdateVehicleRequest request)
|
|
{
|
|
var vehicle = await vehicleService.UpdateVehicle(id, request);
|
|
return Ok(vehicle);
|
|
}
|
|
|
|
[HttpDelete("{id:guid}")]
|
|
public async Task<IActionResult> Delete(Guid id)
|
|
{
|
|
await vehicleService.DeleteVehicle(id);
|
|
return NoContent();
|
|
}
|
|
|
|
[HttpGet]
|
|
public async Task<IActionResult> GetAll([FromQuery] GetVehiclesQuery query)
|
|
{
|
|
var vehicles = await vehicleService.GetVehicles(query);
|
|
return Ok(vehicles);
|
|
}
|
|
|
|
[HttpGet("{id:guid}")]
|
|
public async Task<IActionResult> Get(Guid id)
|
|
{
|
|
var vehicle = await vehicleService.GetVehicle(id);
|
|
return Ok(vehicle);
|
|
}
|
|
|
|
[HttpPatch("{id:guid}/default")]
|
|
public async Task<IActionResult> SetDefault(Guid id, [FromBody] SetDefaultRequest request)
|
|
{
|
|
await vehicleService.SetDefault(id, request);
|
|
return NoContent();
|
|
}
|
|
}
|