diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/BffDataController.cs b/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/BffDataController.cs index 81884ebd..4c7b4b8a 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/BffDataController.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/BffDataController.cs @@ -54,6 +54,24 @@ public class BffDataController : ControllerBase return Ok(shop); } + [HttpGet("staff")] + public async Task GetStaff() + { + await using var conn = new NpgsqlConnection(ConnStr("merchant_service")); + var staff = await conn.QueryAsync( + @"SELECT ms.id, ms.user_id, ms.employee_code, ms.phone, ms.email, + ms.joined_at, ms.terminated_at, + sr.name as role, ss.name as status, + s.name as shop_name + FROM merchant_staff ms + JOIN staff_roles sr ON ms.role_id = sr.id + JOIN staff_statuses ss ON ms.status_id = ss.id + LEFT JOIN shop_members sm ON sm.staff_id = ms.id + LEFT JOIN shops s ON sm.shop_id = s.id + ORDER BY ms.joined_at DESC"); + return Ok(staff); + } + [HttpGet("shops/{shopId}/products")] public async Task GetProducts(Guid shopId) {