@wrcb/cb-common 1.0.255 → 1.0.257
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.
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
1
|
+
import { UserPayload } from 'src/types/userPayload';
|
|
2
|
+
export declare function signUpReturnCookie(id?: string, overrides?: Partial<UserPayload>): string[];
|
|
3
|
+
export declare function signUpReturnCookieAdmin(id?: string, overrides?: Partial<UserPayload>): string[];
|
|
@@ -9,21 +9,10 @@ const mongoose_1 = __importDefault(require("mongoose"));
|
|
|
9
9
|
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
10
10
|
const userRole_1 = require("../types/userRole");
|
|
11
11
|
const country_1 = require("../types/country");
|
|
12
|
-
function signUpReturnCookie(id) {
|
|
12
|
+
function signUpReturnCookie(id, overrides) {
|
|
13
13
|
// Build a JWT payload
|
|
14
|
-
const payload = {
|
|
15
|
-
|
|
16
|
-
email: 'test@test.com',
|
|
17
|
-
nickName: 'apelido',
|
|
18
|
-
role: userRole_1.UserRole.User,
|
|
19
|
-
language: country_1.Language.Português,
|
|
20
|
-
country: country_1.Country.Brasil,
|
|
21
|
-
isKycDone: true,
|
|
22
|
-
isEmailVerified: false,
|
|
23
|
-
isPhoneNumberVerified: false,
|
|
24
|
-
isPersonalDataProvided: false,
|
|
25
|
-
isAddressDataProvided: false
|
|
26
|
-
};
|
|
14
|
+
const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.User, language: country_1.Language.Português, country: country_1.Country.Brasil, isKycDone: true, isEmailVerified: false, isPhoneNumberVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false }, overrides // sobrescreve os valores padrão
|
|
15
|
+
);
|
|
27
16
|
// Create the JWT
|
|
28
17
|
const token = jsonwebtoken_1.default.sign(payload, process.env.JWT_KEY);
|
|
29
18
|
// Build session object {jwt: MY_JWT}
|
|
@@ -36,21 +25,10 @@ function signUpReturnCookie(id) {
|
|
|
36
25
|
const cookieString = [`session=${base64}`];
|
|
37
26
|
return cookieString;
|
|
38
27
|
}
|
|
39
|
-
function signUpReturnCookieAdmin(id) {
|
|
28
|
+
function signUpReturnCookieAdmin(id, overrides) {
|
|
40
29
|
// Build a JWT payload
|
|
41
|
-
const payload = {
|
|
42
|
-
|
|
43
|
-
email: 'test@test.com',
|
|
44
|
-
nickName: 'apelido',
|
|
45
|
-
role: userRole_1.UserRole.Admin,
|
|
46
|
-
isKycDone: true,
|
|
47
|
-
language: country_1.Language.Português,
|
|
48
|
-
country: country_1.Country.Brasil,
|
|
49
|
-
isEmailVerified: false,
|
|
50
|
-
isPhoneNumberVerified: false,
|
|
51
|
-
isPersonalDataProvided: false,
|
|
52
|
-
isAddressDataProvided: false
|
|
53
|
-
};
|
|
30
|
+
const payload = Object.assign({ id: id !== null && id !== void 0 ? id : new mongoose_1.default.Types.ObjectId().toHexString(), email: 'test@test.com', nickName: 'apelido', role: userRole_1.UserRole.Admin, isKycDone: true, language: country_1.Language.Português, country: country_1.Country.Brasil, isEmailVerified: false, isPhoneNumberVerified: false, isPersonalDataProvided: false, isAddressDataProvided: false }, overrides // sobrescreve os valores padrão
|
|
31
|
+
);
|
|
54
32
|
// Create the JWT
|
|
55
33
|
const token = jsonwebtoken_1.default.sign(payload, process.env.JWT_KEY);
|
|
56
34
|
// Build session object {jwt: MY_JWT}
|