@aurispec/core-backend 1.0.3 → 1.0.4
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/dist/common/configs/cloudinary.d.ts +1 -1
- package/dist/common/configs/cloudinary.d.ts.map +1 -1
- package/dist/common/configs/cloudinary.js +2 -1
- package/dist/common/utils/index.d.ts +5 -0
- package/dist/common/utils/index.d.ts.map +1 -1
- package/dist/common/utils/index.js +16 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudinary.d.ts","sourceRoot":"","sources":["../../../src/common/configs/cloudinary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAS9C,
|
|
1
|
+
{"version":3,"file":"cloudinary.d.ts","sourceRoot":"","sources":["../../../src/common/configs/cloudinary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,UAAU,EAAE,MAAM,YAAY,CAAC;AAS9C,OAAO,EACL,UAAU,EACX,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cloudinary = void 0;
|
|
3
4
|
const cloudinary_1 = require("cloudinary");
|
|
5
|
+
Object.defineProperty(exports, "cloudinary", { enumerable: true, get: function () { return cloudinary_1.v2; } });
|
|
4
6
|
const _1 = require(".");
|
|
5
7
|
cloudinary_1.v2.config({
|
|
6
8
|
cloud_name: _1.CONFIGS.CLOUDINARY.CLOUDINARY_CLOUD_NAME,
|
|
7
9
|
api_key: _1.CONFIGS.CLOUDINARY.CLOUDINARY_API_KEY,
|
|
8
10
|
api_secret: _1.CONFIGS.CLOUDINARY.CLOUDINARY_API_SECRET,
|
|
9
11
|
});
|
|
10
|
-
exports.default = cloudinary_1.v2;
|
|
@@ -20,6 +20,11 @@ export declare function encrypt(text: string): {
|
|
|
20
20
|
};
|
|
21
21
|
export declare function decrypt(encryptedData: string, ivHex: string): string;
|
|
22
22
|
export declare const isAllowedByPlan: (existingUser: UserModel, subject: string, examType: string) => boolean;
|
|
23
|
+
export declare function calculateAgeBracket(date_of_birth: Date): {
|
|
24
|
+
userAge: number;
|
|
25
|
+
minAge: number;
|
|
26
|
+
maxAge: number;
|
|
27
|
+
};
|
|
23
28
|
export * from "./number_utils";
|
|
24
29
|
export * from "./responseHandlers";
|
|
25
30
|
export * from "./security";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/utils/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAE7C,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAG1C;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU/D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM;;;EAUvC;AAED,wBAAgB,YAAY;;;EAQ3B;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASjF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,GAAE,OAAO,GAAG,MAAe,UA4BxE;AAED,wBAAgB,UAAU,CAAC,sBAAsB,EAAE,GAAG,WAMrD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,UAE9C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAKD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM;;;EAKnC;AAGD,wBAAgB,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAS3D;AAED,eAAO,MAAM,eAAe,GAC1B,cAAc,SAAS,EACvB,SAAS,MAAM,EACf,UAAU,MAAM,YAuBjB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/utils/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAE7C,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,UAG1C;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU/D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM;;;EAUvC;AAED,wBAAgB,YAAY;;;EAQ3B;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASjF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,GAAE,OAAO,GAAG,MAAe,UA4BxE;AAED,wBAAgB,UAAU,CAAC,sBAAsB,EAAE,GAAG,WAMrD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,UAE9C;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAKD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM;;;EAKnC;AAGD,wBAAgB,OAAO,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAS3D;AAED,eAAO,MAAM,eAAe,GAC1B,cAAc,SAAS,EACvB,SAAS,MAAM,EACf,UAAU,MAAM,YAuBjB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,IAAI;;;;EAgBtD;AAED,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA"}
|
|
@@ -29,6 +29,7 @@ exports.remove_url_protocol = remove_url_protocol;
|
|
|
29
29
|
exports.stripHtmlTags = stripHtmlTags;
|
|
30
30
|
exports.encrypt = encrypt;
|
|
31
31
|
exports.decrypt = decrypt;
|
|
32
|
+
exports.calculateAgeBracket = calculateAgeBracket;
|
|
32
33
|
const bcryptjs_1 = __importDefault(require("bcryptjs"));
|
|
33
34
|
const configs_1 = require("../configs");
|
|
34
35
|
const moment_1 = __importDefault(require("moment"));
|
|
@@ -152,6 +153,21 @@ const isAllowedByPlan = (existingUser, subject, examType) => {
|
|
|
152
153
|
return allowed; // return true = allowed, false = restricted
|
|
153
154
|
};
|
|
154
155
|
exports.isAllowedByPlan = isAllowedByPlan;
|
|
156
|
+
function calculateAgeBracket(date_of_birth) {
|
|
157
|
+
if (!date_of_birth) {
|
|
158
|
+
throw new AppError_1.AppError('Date of birth is required!');
|
|
159
|
+
}
|
|
160
|
+
const today = new Date();
|
|
161
|
+
const dob = new Date(date_of_birth);
|
|
162
|
+
const userAge = today.getFullYear() - dob.getFullYear();
|
|
163
|
+
const minAge = userAge - 5;
|
|
164
|
+
const maxAge = userAge + 5;
|
|
165
|
+
return {
|
|
166
|
+
userAge,
|
|
167
|
+
minAge,
|
|
168
|
+
maxAge
|
|
169
|
+
};
|
|
170
|
+
}
|
|
155
171
|
__exportStar(require("./number_utils"), exports);
|
|
156
172
|
__exportStar(require("./responseHandlers"), exports);
|
|
157
173
|
__exportStar(require("./security"), exports);
|