api tests
Some checks failed
Some checks failed
This commit is contained in:
@@ -14,7 +14,11 @@ export function getActorFromRequestContext(): Actor {
|
||||
const ctx = getHttpRequestContext();
|
||||
const req = ctx.req as unknown as AuthenticatedRequest;
|
||||
|
||||
const userId = req.user?.userId;
|
||||
if (!req || !req.user) {
|
||||
throw new Error('Unauthorized');
|
||||
}
|
||||
|
||||
const userId = req.user.userId;
|
||||
if (!userId) {
|
||||
throw new Error('Unauthorized');
|
||||
}
|
||||
@@ -23,5 +27,5 @@ export function getActorFromRequestContext(): Actor {
|
||||
// - The authenticated session identity is `userId`.
|
||||
// - In the current system, that `userId` is also treated as the performer `driverId`.
|
||||
// - Include role from session if available
|
||||
return { userId, driverId: userId, role: req.user?.role };
|
||||
return { userId, driverId: userId, role: req.user.role };
|
||||
}
|
||||
Reference in New Issue
Block a user