feat: enhance agent settlement features and improve data access controls
- Added new section in AGENTS.md detailing learned workspace facts for better understanding of settlement processes. - Updated AgentNodeDestroyController to remove unnecessary checks for admin users. - Enhanced AgentSettlement controllers to assert permissions for finance adjustments and bill operations. - Improved query scopes in AgentSettlement services to ensure proper data access based on admin roles. - Refactored methods in SettlementPartyEnrichment for better bill row enrichment and data handling. - Introduced new methods in AdminAgentSettlementScope for managing agent node visibility and finance adjustments.
This commit is contained in:
@@ -29,6 +29,7 @@ final class AdminAuthProfile
|
||||
* agent: ?array{
|
||||
* id: int,
|
||||
* admin_site_id: int,
|
||||
* admin_site_name: string,
|
||||
* site_code: string,
|
||||
* path: string,
|
||||
* code: string,
|
||||
@@ -73,6 +74,7 @@ final class AdminAuthProfile
|
||||
* @return array{
|
||||
* id: int,
|
||||
* admin_site_id: int,
|
||||
* admin_site_name: string,
|
||||
* site_code: string,
|
||||
* path: string,
|
||||
* code: string,
|
||||
@@ -93,13 +95,18 @@ final class AdminAuthProfile
|
||||
return null;
|
||||
}
|
||||
|
||||
$siteCode = AdminSite::query()->where('id', (int) $node->admin_site_id)->value('code');
|
||||
$site = AdminSite::query()
|
||||
->where('id', (int) $node->admin_site_id)
|
||||
->first(['code', 'name']);
|
||||
$siteCode = is_string($site?->code) ? $site->code : '';
|
||||
$siteName = is_string($site?->name) ? $site->name : '';
|
||||
$profile = AgentProfile::query()->where('agent_node_id', $node->id)->first();
|
||||
|
||||
return [
|
||||
'id' => (int) $node->id,
|
||||
'admin_site_id' => (int) $node->admin_site_id,
|
||||
'site_code' => is_string($siteCode) && $siteCode !== '' ? $siteCode : '',
|
||||
'admin_site_name' => $siteName,
|
||||
'site_code' => $siteCode !== '' ? $siteCode : '',
|
||||
'path' => (string) $node->path,
|
||||
'code' => (string) $node->code,
|
||||
'name' => (string) $node->name,
|
||||
|
||||
Reference in New Issue
Block a user