Skip to content

Commit

Permalink
Resolving change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
jvedrson committed Jul 5, 2024
1 parent 610fd8b commit 982099e
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/app/routes/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ class BridgeController {

async getUsage(req: Request, res: Response) {
let user = (req as AuthorizedRequest).user;
const { workspaceUserId } = req.query;
const workspaceUserId = req.query.workspaceUserId;

if (workspaceUserId) {
user = await this.service.User.FindUserByUuid(workspaceUserId).catch(() => {
throw createHttpError(404, 'WorkspaceUser not found');
});
user = await this.service.User.FindUserByUuid(workspaceUserId);

if(!user) {
throw createHttpError(404, 'Workspace user not found');
}
}

const usage = await this.service.User.getUsage(user);
Expand All @@ -36,17 +38,19 @@ class BridgeController {
uuid
} = (req as AuthorizedRequest).user;

const { workspaceUserId } = req.query;
const workspaceUserId = req.query.workspaceUserId;

if (workspaceUserId) {
const workspaceUser = await this.service.User.FindUserByUuid(workspaceUserId).catch(() => {
throw createHttpError(404, 'WorkspaceUser not found');
});

bridgeUser = workspaceUser.username;
bridgePass = workspaceUser.userId;
uuid = workspaceUser.uuid;
updatedAt = workspaceUser.updatedAt;
const user = await this.service.User.FindUserByUuid(workspaceUserId);

if(!user) {
throw createHttpError(404, 'Workspace user not found');
}

bridgeUser = user.username;
bridgePass = user.userId;
uuid = user.uuid;
updatedAt = user.updatedAt;
}

const limit = await this.service.Limit.getLimit(
Expand Down

0 comments on commit 982099e

Please sign in to comment.