feat(web-client-tpos): add BFF staff endpoint for admin staff directory
This commit is contained in:
@@ -54,6 +54,24 @@ public class BffDataController : ControllerBase
|
||||
return Ok(shop);
|
||||
}
|
||||
|
||||
[HttpGet("staff")]
|
||||
public async Task<IActionResult> GetStaff()
|
||||
{
|
||||
await using var conn = new NpgsqlConnection(ConnStr("merchant_service"));
|
||||
var staff = await conn.QueryAsync<dynamic>(
|
||||
@"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<IActionResult> GetProducts(Guid shopId)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user