add client relation btw user and client

This commit is contained in:
faris Aljohari
2025-03-27 01:55:26 +03:00
parent cbd3f5028b
commit cf8cf08bdc
5 changed files with 27 additions and 13 deletions
+3 -9
View File
@@ -20,6 +20,8 @@ export class ClientGuard extends AuthGuard('jwt') {
if (!this.validateToken(decoded)) {
throw new UnauthorizedException('Invalid token');
}
request.client = (decoded as jwt.JwtPayload).client;
} catch (err) {
throw new UnauthorizedException('Invalid token');
}
@@ -36,14 +38,6 @@ export class ClientGuard extends AuthGuard('jwt') {
}
private validateToken(decoded: any): boolean {
if (
decoded &&
decoded.client &&
decoded.client.clientId &&
decoded.client.uuid
) {
return true;
}
return false;
return decoded?.client?.clientId && decoded?.client?.uuid;
}
}