@vasrefil/api-toolkit 1.2.8 → 1.3.1

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.
Files changed (59) hide show
  1. package/dist/helpers/query.helper.js +6 -0
  2. package/dist/utilities/date.util.d.ts +1 -1
  3. package/dist/utilities/go-mailer.util.js +2 -2
  4. package/package.json +1 -1
  5. package/dist/middlewares/auth.midware.d.ts +0 -8
  6. package/dist/middlewares/auth.midware.js +0 -52
  7. package/dist/out-tsc/api-response/user.response.d.ts +0 -48
  8. package/dist/out-tsc/api-response/user.response.js +0 -33
  9. package/dist/out-tsc/app-middlewares/airbrake.d.ts +0 -10
  10. package/dist/out-tsc/app-middlewares/airbrake.js +0 -58
  11. package/dist/out-tsc/controllers/_root.control.d.ts +0 -53
  12. package/dist/out-tsc/controllers/_root.control.js +0 -127
  13. package/dist/out-tsc/controllers/index.d.ts +0 -1
  14. package/dist/out-tsc/controllers/index.js +0 -17
  15. package/dist/out-tsc/controllers/sample.control.d.ts +0 -6
  16. package/dist/out-tsc/controllers/sample.control.js +0 -13
  17. package/dist/out-tsc/env.d.ts +0 -12
  18. package/dist/out-tsc/env.js +0 -16
  19. package/dist/out-tsc/helpers/currency-formatter.helper.d.ts +0 -1
  20. package/dist/out-tsc/helpers/currency-formatter.helper.js +0 -11
  21. package/dist/out-tsc/helpers/query.helper.d.ts +0 -22
  22. package/dist/out-tsc/helpers/query.helper.js +0 -133
  23. package/dist/out-tsc/index.d.ts +0 -1
  24. package/dist/out-tsc/index.js +0 -41
  25. package/dist/out-tsc/interfaces/interface.d.ts +0 -27
  26. package/dist/out-tsc/interfaces/interface.js +0 -2
  27. package/dist/out-tsc/interfaces/root-controller.interface.d.ts +0 -21
  28. package/dist/out-tsc/interfaces/root-controller.interface.js +0 -2
  29. package/dist/out-tsc/interfaces/status.interface.d.ts +0 -13
  30. package/dist/out-tsc/interfaces/status.interface.js +0 -17
  31. package/dist/out-tsc/middlewares/auth.midware.d.ts +0 -8
  32. package/dist/out-tsc/middlewares/auth.midware.js +0 -52
  33. package/dist/out-tsc/middlewares/validator.midware.d.ts +0 -12
  34. package/dist/out-tsc/middlewares/validator.midware.js +0 -32
  35. package/dist/out-tsc/models/_config.d.ts +0 -1
  36. package/dist/out-tsc/models/_config.js +0 -27
  37. package/dist/out-tsc/models/sample.model.d.ts +0 -33
  38. package/dist/out-tsc/models/sample.model.js +0 -14
  39. package/dist/out-tsc/public-api.d.ts +0 -1
  40. package/dist/out-tsc/public-api.js +0 -17
  41. package/dist/out-tsc/routes/index.route.d.ts +0 -9
  42. package/dist/out-tsc/routes/index.route.js +0 -54
  43. package/dist/out-tsc/routes/sample.route.d.ts +0 -16
  44. package/dist/out-tsc/routes/sample.route.js +0 -53
  45. package/dist/out-tsc/services/_root.service.d.ts +0 -12
  46. package/dist/out-tsc/services/_root.service.js +0 -75
  47. package/dist/out-tsc/services/sample.service.d.ts +0 -16
  48. package/dist/out-tsc/services/sample.service.js +0 -127
  49. package/dist/out-tsc/utilities/date.util.d.ts +0 -42
  50. package/dist/out-tsc/utilities/date.util.js +0 -93
  51. package/dist/out-tsc/utilities/logger.util.d.ts +0 -4
  52. package/dist/out-tsc/utilities/logger.util.js +0 -48
  53. package/dist/out-tsc/utilities/token.util.d.ts +0 -6
  54. package/dist/out-tsc/utilities/token.util.js +0 -48
  55. package/dist/out-tsc/validations/sample.validator.d.ts +0 -6
  56. package/dist/out-tsc/validations/sample.validator.js +0 -35
  57. package/dist/package.json +0 -54
  58. package/dist/utilities/token.util.d.ts +0 -6
  59. package/dist/utilities/token.util.js +0 -48
@@ -33,6 +33,12 @@ class QueryHelper_ {
33
33
  const value = isNaN(fit.value) ? fit.value : Number(fit.value);
34
34
  result.push({ [fit.field]: { $lte: value } });
35
35
  }
36
+ else if (fit.operator === 'date_gte') {
37
+ result.push({ [fit.field]: { $gte: date_util_1.DateUtil.get_local_date(fit.value) } });
38
+ }
39
+ else if (fit.operator === 'date_lte') {
40
+ result.push({ [fit.field]: { $lte: date_util_1.DateUtil.get_local_date(fit.value) } });
41
+ }
36
42
  });
37
43
  filter_query = { [logical_operator]: result };
38
44
  }
@@ -1,5 +1,5 @@
1
1
  declare class DateUtil_ {
2
- get_local_date: (date?: Date) => Date;
2
+ get_local_date: (date?: string | Date) => Date;
3
3
  get_start_date(date: any): number;
4
4
  get_end_date(date: any): number;
5
5
  get_date_format(date: Date, format: string): Date;
@@ -63,7 +63,7 @@ class GoMailerUtil_ {
63
63
  this.trigger_event = async (payload) => {
64
64
  try {
65
65
  const headers = { Authorization: `Bearer ${env_1.default.GO_MAILER.API_KEY}` };
66
- const url = 'https://automata.go-mailer.com/api/v1/events/trigger';
66
+ const url = 'https://api.go-mailer.com/v1/automations';
67
67
  const { data } = await axios_1.default.post(url, payload, { headers });
68
68
  return data;
69
69
  }
@@ -75,7 +75,7 @@ class GoMailerUtil_ {
75
75
  this.send_transactional_email = async (payload) => {
76
76
  try {
77
77
  const headers = { Authorization: `Bearer ${env_1.default.GO_MAILER.API_KEY}` };
78
- const url = 'https://mailing.go-mailer.com/api/v1/transactionals/dispatch';
78
+ const url = 'https://api.go-mailer.com/v1/transactionals';
79
79
  const { data } = await axios_1.default.post(url, payload, { headers });
80
80
  return data;
81
81
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vasrefil/api-toolkit",
3
3
  "description": "This is Vasrefil API toolkit",
4
- "version": "1.2.8",
4
+ "version": "1.3.1",
5
5
  "author": "Sodiq Alabi",
6
6
  "main": "dist/public-api.js",
7
7
  "types": "dist/public-api.d.ts",
@@ -1,8 +0,0 @@
1
- import { RootService } from '../services/_root.service';
2
- import { Request, Response, NextFunction } from 'express';
3
- declare class AuthMidWare extends RootService {
4
- private _is_authenticated;
5
- auth: (req: Request, res: Response, next: NextFunction) => Promise<any>;
6
- }
7
- declare const _default: AuthMidWare;
8
- export default _default;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const token_util_1 = __importDefault(require("../utilities/token.util"));
7
- const _root_service_1 = require("../services/_root.service");
8
- const status_interface_1 = require("../interfaces/status.interface");
9
- const user_response_1 = require("../api-response/user.response");
10
- const env_1 = __importDefault(require("../env"));
11
- class AuthMidWare extends _root_service_1.RootService {
12
- constructor() {
13
- super(...arguments);
14
- this._is_authenticated = async (req) => {
15
- try {
16
- const apiKey = req.headers['api-key'];
17
- if (apiKey) {
18
- if (apiKey !== env_1.default.API_KEY)
19
- throw user_response_1.UserApiResp.NOT_AUTHORIZED;
20
- }
21
- else {
22
- const authHeader = req.headers.authorization;
23
- if (!authHeader)
24
- throw user_response_1.UserApiResp.NO_AUTHORIZATION_HEADER;
25
- const token = authHeader.split(' ')[1];
26
- const tokenData = await token_util_1.default.verify_admin_user(token);
27
- if (!tokenData)
28
- throw user_response_1.UserApiResp.NOT_AUTHORIZED;
29
- req.user = tokenData;
30
- }
31
- return req;
32
- }
33
- catch (error) {
34
- const status = error.status || status_interface_1.Status.UN_AUTHORIZED;
35
- const message = error.message || 'You are not authorized';
36
- throw { status, message, error, req };
37
- }
38
- };
39
- this.auth = async (req, res, next) => {
40
- const actionType = 'USER_AUTH_MIDWARE';
41
- try {
42
- await this._is_authenticated(req);
43
- next();
44
- }
45
- catch (error) {
46
- const { status, message, data } = this.get_error(error);
47
- return this.sendResponse({ req, res, status, actionType, message, data, error });
48
- }
49
- };
50
- }
51
- }
52
- exports.default = new AuthMidWare;
@@ -1,48 +0,0 @@
1
- import { Status } from '../interfaces/status.interface';
2
- export declare const UserApiResp: {
3
- NO_AUTHORIZATION_HEADER: {
4
- code: string;
5
- status: Status;
6
- message: string;
7
- };
8
- NOT_AUTHORIZED: {
9
- code: string;
10
- status: Status;
11
- message: string;
12
- };
13
- USER_NOT_FOUND: {
14
- code: string;
15
- status: Status;
16
- message: string;
17
- };
18
- USER_DEACTIVATED: {
19
- code: string;
20
- status: Status;
21
- message: string;
22
- };
23
- UNVERIFIED_EMAIL: {
24
- code: string;
25
- status: Status;
26
- message: string;
27
- };
28
- UNCOMPELETE_ACCOUNT_SETUP: {
29
- code: string;
30
- status: Status;
31
- message: string;
32
- };
33
- UNCOMPELETE_PIN_SETUP: {
34
- code: string;
35
- status: Status;
36
- message: string;
37
- };
38
- NO_PIN_TOKEN_HEADER: {
39
- code: string;
40
- status: Status;
41
- message: string;
42
- };
43
- EXPIRED_PIN_TOKEN: {
44
- code: string;
45
- status: Status;
46
- message: string;
47
- };
48
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserApiResp = void 0;
4
- const status_interface_1 = require("../interfaces/status.interface");
5
- exports.UserApiResp = {
6
- NO_AUTHORIZATION_HEADER: {
7
- code: 'NAH0401', status: status_interface_1.Status.UN_AUTHORIZED, message: 'Please specify authorization header'
8
- },
9
- NOT_AUTHORIZED: {
10
- code: 'NA00401', status: status_interface_1.Status.UN_AUTHORIZED, message: 'You are not authorized'
11
- },
12
- USER_NOT_FOUND: {
13
- code: 'UNF0401', status: status_interface_1.Status.UN_AUTHORIZED, message: 'User not found'
14
- },
15
- USER_DEACTIVATED: {
16
- code: 'UD00401', status: status_interface_1.Status.UN_AUTHORIZED, message: 'Your account has been deactivated'
17
- },
18
- UNVERIFIED_EMAIL: {
19
- code: 'UE00403', status: status_interface_1.Status.FORBIDDEN, message: 'Your email address is not verified'
20
- },
21
- UNCOMPELETE_ACCOUNT_SETUP: {
22
- code: 'UAS0403', status: status_interface_1.Status.FORBIDDEN, message: 'Account setup is not completed'
23
- },
24
- UNCOMPELETE_PIN_SETUP: {
25
- code: 'UPS0403', status: status_interface_1.Status.FORBIDDEN, message: 'Pin setup is not completed'
26
- },
27
- NO_PIN_TOKEN_HEADER: {
28
- code: 'NPTH401', status: status_interface_1.Status.UN_AUTHORIZED, message: 'Please specify pin_token header'
29
- },
30
- EXPIRED_PIN_TOKEN: {
31
- code: 'EPT0401', status: status_interface_1.Status.UN_AUTHORIZED, message: 'Your session has expired, Please login with your pin'
32
- },
33
- };
@@ -1,10 +0,0 @@
1
- import { ServiceRespI } from '../interfaces/interface';
2
- declare class AirbrakeLogger {
3
- private airbrake;
4
- constructor(projectId: string, projectKey: string);
5
- logRequestError(serviceResponse: ServiceRespI): void;
6
- logError(error: any, params: any, route: any): void;
7
- getAirbrakeInstance(): any;
8
- getAirbrakeExpress(): any;
9
- }
10
- export { AirbrakeLogger };
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AirbrakeLogger = void 0;
7
- const env_1 = __importDefault(require("../env"));
8
- const Airbrake = require('@airbrake/node');
9
- const airbrakeExpress = require('@airbrake/node/dist/instrumentation/express');
10
- const json_stringify_safe = require('json-stringify-safe');
11
- class AirbrakeLogger {
12
- constructor(projectId, projectKey) {
13
- this.airbrake = new Airbrake.Notifier({
14
- projectId: projectId,
15
- projectKey: projectKey,
16
- environment: `${env_1.default.NODE_ENV}`
17
- });
18
- }
19
- logRequestError(serviceResponse) {
20
- try {
21
- const { request, error, data, message, actionType } = serviceResponse;
22
- const dataErr = data ? json_stringify_safe(data) : null;
23
- const errorErr = error ? json_stringify_safe(error, null) : null;
24
- const messageErr = message ? json_stringify_safe(message) : null;
25
- const error_ = messageErr || errorErr || dataErr;
26
- const actionType_ = actionType || 'App Error';
27
- const body = request && request.body ? request.body : 'no body';
28
- const url = request && request.url ? request.url : 'no url';
29
- this.airbrake.notify({
30
- error: error_,
31
- params: { url, body, actionType: actionType_ },
32
- route: url
33
- });
34
- }
35
- catch (error) {
36
- this.airbrake.notify(error);
37
- }
38
- }
39
- logError(error, params, route) {
40
- try {
41
- this.airbrake.notify({
42
- error: json_stringify_safe(error, null),
43
- params,
44
- route
45
- });
46
- }
47
- catch (error) {
48
- this.airbrake.notify(error);
49
- }
50
- }
51
- getAirbrakeInstance() {
52
- return this.airbrake;
53
- }
54
- getAirbrakeExpress() {
55
- return airbrakeExpress;
56
- }
57
- }
58
- exports.AirbrakeLogger = AirbrakeLogger;
@@ -1,53 +0,0 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- import { Model } from 'mongoose';
26
- import { FetchAllQuery, FetchWithPaginationDataI, ModelPopulateI, NestedRecordQueryOptionsI } from '../interfaces/root-controller.interface';
27
- export declare class RootController {
28
- private model;
29
- private modelName;
30
- constructor(model: Model<any>, modelName?: string);
31
- unique: (conditions: {
32
- key: string;
33
- value: string;
34
- }) => Promise<boolean>;
35
- getDocumentCount: (conditon?: {}, query?: object) => Promise<number>;
36
- create: (payload: any) => Promise<any>;
37
- fetchAll(condition?: object, query?: FetchAllQuery, select?: string | object, populate?: any): import("mongoose").Query<Omit<any, never>[], any, {}, any>;
38
- fetchAllWithPagination: (conditon: object, query?: FetchAllQuery, select?: string | object, populate?: ModelPopulateI[]) => Promise<FetchWithPaginationDataI>;
39
- getOneP: (condition: object, select?: any) => Promise<any>;
40
- getOne(condition: object, select?: string | object, populate?: any): any;
41
- getById: (id: string, select?: string | object) => Promise<any>;
42
- updateOne(condition: object, updateValues: object): any;
43
- updateMany(condition: object, updateValues: object): import("mongoose").Query<import("mongodb").UpdateResult, any, {}, any>;
44
- updateById(id: string, updateValues: object): any;
45
- deleteOne(condition: object): import("mongoose").Query<import("mongodb").DeleteResult, any, {}, any>;
46
- deleteMany(condition: object): import("mongoose").Query<import("mongodb").DeleteResult, any, {}, any>;
47
- deleteById(id: string): import("mongoose").Query<any, any, {}, any>;
48
- search: (payload: {
49
- key: any;
50
- value: any;
51
- }, select?: string) => Promise<never>;
52
- getNestedRecord: (options: NestedRecordQueryOptionsI, errorMessage?: string) => Promise<any>;
53
- }
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RootController = void 0;
4
- const query_helper_1 = require("../helpers/query.helper");
5
- class RootController {
6
- constructor(model, modelName = 'Document') {
7
- this.unique = async (conditions) => {
8
- const { key, value } = conditions;
9
- const res = await this.model.findOne({ [key]: value });
10
- if (res) {
11
- return false;
12
- }
13
- else {
14
- return true;
15
- }
16
- };
17
- this.getDocumentCount = async (conditon = {}, query) => {
18
- const { filter } = query_helper_1.QueryHelper.build_query(query);
19
- return await this.model.countDocuments({ ...filter, ...conditon });
20
- };
21
- this.create = async (payload) => {
22
- try {
23
- const document = await (this.model.create({ ...payload }));
24
- return document.toJSON();
25
- }
26
- catch (error) {
27
- throw error;
28
- }
29
- };
30
- this.fetchAllWithPagination = async (conditon, query, select = '', populate) => {
31
- try {
32
- const records = await this.fetchAll(conditon, query, select, populate);
33
- const total_records = await this.getDocumentCount(conditon, query);
34
- return { records, total_records };
35
- }
36
- catch (error) {
37
- throw error;
38
- }
39
- };
40
- this.getOneP = async (condition, select) => {
41
- try {
42
- select = select ? select : '';
43
- const document = await this.model.findOne(condition).select(select).lean();
44
- if (!document)
45
- throw { message: `${this.modelName} not found` };
46
- return document;
47
- }
48
- catch (error) {
49
- throw error;
50
- }
51
- };
52
- this.getById = async (id, select = '') => {
53
- try {
54
- const document = await this.model.findById(id).select(select).lean();
55
- if (!document)
56
- throw { message: `${this.modelName} not found` };
57
- return document;
58
- }
59
- catch (error) {
60
- throw error;
61
- }
62
- };
63
- this.search = async (payload, select = '') => {
64
- try {
65
- const regrex = new RegExp(`${payload.value}`, 'i');
66
- const records = await this.model.find({ [payload.key]: { $regex: regrex } }).select(select);
67
- if (!records)
68
- throw { message: `${this.modelName} not found` };
69
- throw records;
70
- }
71
- catch (error) {
72
- throw error;
73
- }
74
- };
75
- this.getNestedRecord = async (options, errorMessage) => {
76
- const { parentField, childIdField = '_id', parentId, childId } = options;
77
- // Build the query
78
- const query = {
79
- _id: parentId,
80
- [`${parentField}.${childIdField}`]: { $eq: childId }
81
- };
82
- // Build the projection
83
- const projection = {
84
- [parentField]: {
85
- $elemMatch: {
86
- [childIdField]: childId
87
- }
88
- }
89
- };
90
- // Execute the query
91
- const result = await this.model.findOne(query, projection);
92
- if (!result) {
93
- throw new Error(errorMessage || `Nested record not found in ${parentField}`);
94
- }
95
- // Return the first element of the matched array
96
- return result[parentField][0];
97
- };
98
- this.model = model;
99
- this.modelName = modelName;
100
- }
101
- fetchAll(condition = {}, query, select = '', populate) {
102
- const { filter, skip, limit, sort } = query_helper_1.QueryHelper.build_query(query);
103
- return this.model.find({ ...filter, ...condition }).select(select).skip(skip).limit(limit).sort(sort).populate(populate);
104
- }
105
- getOne(condition, select = '', populate) {
106
- return this.model.findOne(condition).select(select).populate(populate).lean();
107
- }
108
- updateOne(condition, updateValues) {
109
- return this.model.updateOne({ ...condition }, { ...updateValues }, { new: true });
110
- }
111
- updateMany(condition, updateValues) {
112
- return this.model.updateMany({ ...condition }, { ...updateValues }).lean();
113
- }
114
- updateById(id, updateValues) {
115
- return this.model.findByIdAndUpdate(id, { ...updateValues }, { new: true }).lean();
116
- }
117
- deleteOne(condition) {
118
- return this.model.deleteOne({ ...condition });
119
- }
120
- deleteMany(condition) {
121
- return this.model.deleteMany({ ...condition });
122
- }
123
- deleteById(id) {
124
- return this.model.findByIdAndDelete(id);
125
- }
126
- }
127
- exports.RootController = RootController;
@@ -1 +0,0 @@
1
- export * from "./_root.control";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./_root.control"), exports);
@@ -1,6 +0,0 @@
1
- import { RootController } from './_root.control';
2
- declare class SampleController extends RootController {
3
- constructor();
4
- }
5
- declare const _default: SampleController;
6
- export default _default;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const _root_control_1 = require("./_root.control");
7
- const sample_model_1 = __importDefault(require("../models/sample.model"));
8
- class SampleController extends _root_control_1.RootController {
9
- constructor() {
10
- super(sample_model_1.default);
11
- }
12
- }
13
- exports.default = new SampleController;
@@ -1,12 +0,0 @@
1
- declare const env: {
2
- MONGODB_URI: string | undefined;
3
- ADMIN_JWT_KEY: string;
4
- NODE_ENV: string | undefined;
5
- RATE_LIMIT_REDIS_URL: string | undefined;
6
- API_KEY: string | undefined;
7
- AIRBRAKE: {
8
- PROJECT_ID: string | undefined;
9
- PROJECT_KEY: string | undefined;
10
- };
11
- };
12
- export default env;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const dotenv = require('dotenv');
4
- dotenv.config();
5
- const env = {
6
- MONGODB_URI: process.env.MONGODB_URI,
7
- ADMIN_JWT_KEY: process.env.ADMIN_JWT_KEY,
8
- NODE_ENV: process.env.NODE_ENV,
9
- RATE_LIMIT_REDIS_URL: process.env.RATE_LIMIT_REDIS_URL,
10
- API_KEY: process.env.API_KEY,
11
- AIRBRAKE: {
12
- PROJECT_ID: process.env.AIRBRAKE_PROJECT_ID,
13
- PROJECT_KEY: process.env.AIRBRAKE_PROJECT_KEY
14
- },
15
- };
16
- exports.default = env;
@@ -1 +0,0 @@
1
- export declare const currency_fmt: (value: any) => string;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.currency_fmt = void 0;
4
- const currency_fmt = (value) => {
5
- const result = new Intl.NumberFormat('en-NG', {
6
- style: 'currency',
7
- currency: 'NGN',
8
- }).format(value);
9
- return result;
10
- };
11
- exports.currency_fmt = currency_fmt;
@@ -1,22 +0,0 @@
1
- declare class QueryHelper_ {
2
- build_query(query: any): {
3
- sort: any;
4
- limit: number;
5
- skip: number;
6
- filter: any;
7
- page: number;
8
- };
9
- get_date_range(payload: {
10
- date_type: string;
11
- date_range: {
12
- start_date: Date;
13
- end_date: Date;
14
- };
15
- }): {};
16
- get_filters(filter: any): any;
17
- process_filters: (query: any) => {} | undefined;
18
- private get_sort;
19
- private str_to_obj;
20
- }
21
- declare const QueryHelper: QueryHelper_;
22
- export { QueryHelper };