Add SetActiveStatusAsync, and update DTOs for active status management.

This commit is contained in:
2026-09-04 11:48:53 +05:30
parent d0bf5581c5
commit 1645eae694
5 changed files with 78 additions and 15 deletions
+16 -3
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Distribution.Models;
using Microsoft.AspNetCore.Mvc;
namespace Distribution.Features.Store;
@@ -7,8 +8,13 @@ namespace Distribution.Features.Store;
public class StoreController(StoreService service) : ControllerBase
{
[HttpGet]
public async Task<IActionResult> GetAll() =>
Ok(await service.GetAllAsync());
public async Task<IActionResult> GetAll(
[FromQuery] Guid? routeId,
[FromQuery] KycStatus? kycStatus,
[FromQuery] string? search,
[FromQuery] int page = 1,
[FromQuery] int pageSize = 20) =>
Ok(await service.GetAllAsync(routeId, kycStatus, search, page, pageSize));
[HttpGet("{id:guid}")]
public async Task<IActionResult> GetById(Guid id)
@@ -100,4 +106,11 @@ public class StoreController(StoreService service) : ControllerBase
var result = await service.VerifyKycAsync(id, new VerifyKycRequest(request.KycStatus, null), ct);
return result is null ? NotFound() : Ok(result);
}
[HttpPatch("{id:guid}/status")]
public async Task<IActionResult> PatchStatus(Guid id, PatchStoreStatusRequest request, CancellationToken ct)
{
var result = await service.SetActiveStatusAsync(id, request.IsActive, ct);
return result is null ? NotFound() : Ok(result);
}
}