@chopkola/common 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/types/global.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
export declare const ACCESS_TOKEN_EXPIRATION_DURATION = "15m";
|
|
2
|
+
export declare const REFRESH_TOKEN_EXPIRATION_DURATION = "1d";
|
|
1
3
|
export interface JwtPayload {
|
|
4
|
+
first_name: string;
|
|
5
|
+
last_name: string;
|
|
6
|
+
accountType: string;
|
|
2
7
|
email: string;
|
|
3
8
|
userId: string;
|
|
4
9
|
}
|
package/build/types/global.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REFRESH_TOKEN_EXPIRATION_DURATION = exports.ACCESS_TOKEN_EXPIRATION_DURATION = void 0;
|
|
4
|
+
exports.ACCESS_TOKEN_EXPIRATION_DURATION = '15m';
|
|
5
|
+
exports.REFRESH_TOKEN_EXPIRATION_DURATION = '1d';
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { AdministratorI, CustomerI, VendorI } from "../types/user";
|
|
1
2
|
export declare const checkIsEmailValid: (email: string) => boolean;
|
|
2
3
|
export declare const checkIsPhoneNumberValid: (phoneNumber: string) => boolean;
|
|
3
4
|
export declare const checkIsEmailOrPhoneValid: (account_ref: string) => 'phone_number' | 'email' | false;
|
|
5
|
+
export declare const handleAdministratorValidation: (user: AdministratorI) => boolean;
|
|
6
|
+
export declare const handleVendorValidation: (user: VendorI) => boolean;
|
|
7
|
+
export declare const handleCustomerValidation: (user: CustomerI) => boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkIsEmailOrPhoneValid = exports.checkIsPhoneNumberValid = exports.checkIsEmailValid = void 0;
|
|
3
|
+
exports.handleCustomerValidation = exports.handleVendorValidation = exports.handleAdministratorValidation = exports.checkIsEmailOrPhoneValid = exports.checkIsPhoneNumberValid = exports.checkIsEmailValid = void 0;
|
|
4
|
+
const user_1 = require("../types/enum/user");
|
|
4
5
|
const regex_1 = require("./regex");
|
|
5
6
|
const checkIsEmailValid = (email) => {
|
|
6
7
|
return regex_1.emailRegex.test(email);
|
|
@@ -22,3 +23,15 @@ const checkIsEmailOrPhoneValid = (account_ref) => {
|
|
|
22
23
|
return false;
|
|
23
24
|
};
|
|
24
25
|
exports.checkIsEmailOrPhoneValid = checkIsEmailOrPhoneValid;
|
|
26
|
+
const handleAdministratorValidation = (user) => {
|
|
27
|
+
return user.account_type === user_1.UserRoleEnum.ADMINISTRATOR;
|
|
28
|
+
};
|
|
29
|
+
exports.handleAdministratorValidation = handleAdministratorValidation;
|
|
30
|
+
const handleVendorValidation = (user) => {
|
|
31
|
+
return user.account_type === user_1.UserRoleEnum.ADMINISTRATOR;
|
|
32
|
+
};
|
|
33
|
+
exports.handleVendorValidation = handleVendorValidation;
|
|
34
|
+
const handleCustomerValidation = (user) => {
|
|
35
|
+
return user.account_type === user_1.UserRoleEnum.ADMINISTRATOR;
|
|
36
|
+
};
|
|
37
|
+
exports.handleCustomerValidation = handleCustomerValidation;
|