refactor: simplify token retrieval by using findById method

This commit is contained in:
Piyush Gupta
2025-11-12 23:00:58 +05:30
parent 8d9775c42a
commit 4091dc53a5
@@ -535,10 +535,7 @@ export const identityTokenAuthServiceFactory = ({
}); });
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity);
const token = await identityAccessTokenDAL.findOne({ const token = await identityAccessTokenDAL.findById(tokenId);
[`${TableName.IdentityAccessToken}.id` as "id"]: tokenId,
[`${TableName.IdentityAccessToken}.authMethod` as "authMethod"]: IdentityAuthMethod.TOKEN_AUTH
});
if (!token) throw new NotFoundError({ message: `Token with ID ${tokenId} not found` }); if (!token) throw new NotFoundError({ message: `Token with ID ${tokenId} not found` });