impl fix for user role

This commit is contained in:
2026-03-19 09:13:20 +08:00
parent 770f26afb1
commit e4fd8ca380
3 changed files with 14 additions and 1 deletions
@@ -189,6 +189,7 @@ class AuthController extends AbstractController
new OA\Property(property: 'id', type: 'integer'),
new OA\Property(property: 'username', type: 'string'),
new OA\Property(property: 'email', type: 'string'),
new OA\Property(property: 'role', type: 'string', example: 'administrator'),
], type: 'object'),
], type: 'object'),
])
@@ -254,6 +255,8 @@ class AuthController extends AbstractController
$user->refresh_token_expires_at = Carbon::now()->addDays(30);
$user->save();
$user->load('role');
OperationLogService::log(
user_id: $user->id,
action: 'auth.login',
@@ -275,6 +278,7 @@ class AuthController extends AbstractController
'id' => $user->id,
'username' => $user->username,
'email' => $user->email,
'role' => $user->role?->name ?? 'accessor',
],
],
];