HSB-462 feat: infra token module and sh apis (#4191)
* feat: infra token module added * feat: infra token guard added * feat: token prefix removed * feat: get pending invites api added * docs: swagger doc added for get user invites api * feat: delete user invitation api added * feat: get users api added * feat: update user api added * feat: update admin status api added * feat: create invitation api added * chore: swagger doc update for create user invite * feat: interceptor added to track last used on * feat: change db schema * chore: readonly tag added * feat: get user by id api added * fix: return type of a function * feat: controller name change * chore: improve token extractino * chore: added email validation logic --------- Co-authored-by: Balu Babu <balub997@gmail.com>
This commit is contained in:
@@ -286,3 +286,14 @@ export function escapeSqlLikeString(str: string) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the expiration date of the token
|
||||
*
|
||||
* @param expiresOn Number of days the token is valid for
|
||||
* @returns Date object of the expiration date
|
||||
*/
|
||||
export function calculateExpirationDate(expiresOn: null | number) {
|
||||
if (expiresOn === null) return null;
|
||||
return new Date(Date.now() + expiresOn * 24 * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user