@fiado/api-invoker 1.4.6 → 1.4.8
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/bin/container.config.js +2 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/onboarding-business/api/OnboardingBusinessApi.d.ts +25 -0
- package/bin/onboarding-business/api/OnboardingBusinessApi.js +202 -0
- package/bin/onboarding-business/api/interfaces/IOnboardingBusinessApi.d.ts +19 -0
- package/bin/onboarding-business/api/interfaces/IOnboardingBusinessApi.js +2 -0
- package/bin/onboarding-business/index.d.ts +2 -0
- package/bin/onboarding-business/index.js +18 -0
- package/package.json +1 -1
- package/src/container.config.ts +3 -0
- package/src/index.ts +2 -0
- package/src/onboarding-business/api/OnboardingBusinessApi.ts +205 -0
- package/src/onboarding-business/api/interfaces/IOnboardingBusinessApi.ts +8 -0
- package/src/onboarding-business/index.ts +2 -0
package/bin/container.config.js
CHANGED
|
@@ -62,6 +62,7 @@ const appselectondata_1 = require("./appselectondata");
|
|
|
62
62
|
const directorySetting_1 = require("./directorySetting");
|
|
63
63
|
const firebase_connector_1 = require("./firebase-connector");
|
|
64
64
|
const OnboardingApi_1 = __importDefault(require("./onboarding/api/OnboardingApi"));
|
|
65
|
+
const OnboardingBusinessApi_1 = __importDefault(require("./onboarding-business/api/OnboardingBusinessApi"));
|
|
65
66
|
exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
66
67
|
// UTILS bindings
|
|
67
68
|
bind("InvokerUtils").to(InvokerUtils_1.InvokerUtils);
|
|
@@ -122,4 +123,5 @@ exports.apiInvokerBindings = new inversify_1.ContainerModule((bind) => {
|
|
|
122
123
|
bind("IDirectorySettingApi").to(directorySetting_1.DirectorySettingApi);
|
|
123
124
|
bind("IFirebaseConnectorApi").to(firebase_connector_1.FirebaseConnectorApi);
|
|
124
125
|
bind("IOnboardingApi").to(OnboardingApi_1.default);
|
|
126
|
+
bind("IOnboardingBusinessApi").to(OnboardingBusinessApi_1.default);
|
|
125
127
|
});
|
package/bin/index.d.ts
CHANGED
package/bin/index.js
CHANGED
|
@@ -65,3 +65,4 @@ __exportStar(require("./appselectondata"), exports);
|
|
|
65
65
|
__exportStar(require("./directorySetting"), exports);
|
|
66
66
|
__exportStar(require("./firebase-connector"), exports);
|
|
67
67
|
__exportStar(require("./onboarding"), exports);
|
|
68
|
+
__exportStar(require("./onboarding-business"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { IOnboardingBusinessApi } from "./interfaces/IOnboardingBusinessApi";
|
|
3
|
+
export default class OnboardingBusinessApi implements IOnboardingBusinessApi {
|
|
4
|
+
private httpRequest;
|
|
5
|
+
private readonly baseUrl;
|
|
6
|
+
constructor(httpRequest: IHttpRequest);
|
|
7
|
+
getById(id: string): Promise<any>;
|
|
8
|
+
getByPhoneNumber(phoneNumber: string): Promise<any>;
|
|
9
|
+
getByReferralDirectoryId(params: {
|
|
10
|
+
referralDirectoryId: string;
|
|
11
|
+
index?: string;
|
|
12
|
+
pageSize?: string;
|
|
13
|
+
sort?: "ascending" | "descending";
|
|
14
|
+
}): Promise<any>;
|
|
15
|
+
getByReferralCode(params: {
|
|
16
|
+
referralCode: string;
|
|
17
|
+
index?: string;
|
|
18
|
+
pageSize?: string;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
getByMyReferralCode(referralCode: string): Promise<any>;
|
|
21
|
+
getList(params: {
|
|
22
|
+
index?: string;
|
|
23
|
+
pageSize?: string;
|
|
24
|
+
}): Promise<any>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const inversify_1 = require("inversify");
|
|
16
|
+
let OnboardingBusinessApi = class OnboardingBusinessApi {
|
|
17
|
+
constructor(httpRequest) {
|
|
18
|
+
this.httpRequest = httpRequest;
|
|
19
|
+
this.baseUrl = process.env.ONBOARDING_BUSINESS_LAMBDA_URL || "";
|
|
20
|
+
}
|
|
21
|
+
//**
|
|
22
|
+
// Function: getById
|
|
23
|
+
// Description: Search onboarding by id
|
|
24
|
+
// Parameters: id
|
|
25
|
+
// Return: Onboarding
|
|
26
|
+
// **/
|
|
27
|
+
async getById(id) {
|
|
28
|
+
const url = `${this.baseUrl}private/getById/${id}`;
|
|
29
|
+
return await this.httpRequest.get(`${url}`);
|
|
30
|
+
}
|
|
31
|
+
//**
|
|
32
|
+
// Function: getByPhoneNumber
|
|
33
|
+
// Description: Search onboarding by phone number
|
|
34
|
+
// Parameters: phoneNumber
|
|
35
|
+
// Return: Onboarding
|
|
36
|
+
// **/
|
|
37
|
+
async getByPhoneNumber(phoneNumber) {
|
|
38
|
+
const url = `${this.baseUrl}private/getByPhoneNumber/${phoneNumber}`;
|
|
39
|
+
return await this.httpRequest.get(`${url}`);
|
|
40
|
+
}
|
|
41
|
+
//**
|
|
42
|
+
// Function: getByReferralDirectoryId
|
|
43
|
+
// Description: Search onboarding by referral directory id
|
|
44
|
+
// Parameters: params
|
|
45
|
+
// Return: Onboarding
|
|
46
|
+
// **/
|
|
47
|
+
async getByReferralDirectoryId(params) {
|
|
48
|
+
const queryParams = [];
|
|
49
|
+
if (params.index)
|
|
50
|
+
queryParams.push(`index=${params.index}`);
|
|
51
|
+
if (params.pageSize)
|
|
52
|
+
queryParams.push(`pageSize=${params.pageSize}`);
|
|
53
|
+
if (params.sort)
|
|
54
|
+
queryParams.push(`sort=${params.sort}`);
|
|
55
|
+
const query = queryParams.length > 0 ? `?${queryParams.join("&")}` : "";
|
|
56
|
+
const url = `${this.baseUrl}private/getByReferralDirectoryId/${params.referralDirectoryId}${query}`;
|
|
57
|
+
return await this.httpRequest.get(`${url}`);
|
|
58
|
+
}
|
|
59
|
+
//**
|
|
60
|
+
// Function: getByReferralCode
|
|
61
|
+
// Description: Search onboarding by referral code
|
|
62
|
+
// Parameters: params
|
|
63
|
+
// Return: Onboarding
|
|
64
|
+
// **/
|
|
65
|
+
async getByReferralCode(params) {
|
|
66
|
+
const url = `${this.baseUrl}private/getByReferralCode/${params.referralCode}`;
|
|
67
|
+
return await this.httpRequest.get(`${url}`);
|
|
68
|
+
}
|
|
69
|
+
//**
|
|
70
|
+
// Function: getByMyReferralCode
|
|
71
|
+
// Description: Search onboarding by my referral code
|
|
72
|
+
// Parameters: referralCode
|
|
73
|
+
// Return: Onboarding
|
|
74
|
+
// **/
|
|
75
|
+
async getByMyReferralCode(referralCode) {
|
|
76
|
+
const url = `${this.baseUrl}private/getByMyReferralCode/${referralCode}`;
|
|
77
|
+
return await this.httpRequest.get(`${url}`);
|
|
78
|
+
}
|
|
79
|
+
//**
|
|
80
|
+
// Function: getList
|
|
81
|
+
// Description: Search onboarding list
|
|
82
|
+
// Parameters: params
|
|
83
|
+
// Return: Onboarding list
|
|
84
|
+
// **/
|
|
85
|
+
async getList(params) {
|
|
86
|
+
const url = `${this.baseUrl}private/getList`;
|
|
87
|
+
return await this.httpRequest.get(`${url}`);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
OnboardingBusinessApi = __decorate([
|
|
91
|
+
(0, inversify_1.injectable)(),
|
|
92
|
+
__param(0, (0, inversify_1.inject)("IHttpRequest")),
|
|
93
|
+
__metadata("design:paramtypes", [Object])
|
|
94
|
+
], OnboardingBusinessApi);
|
|
95
|
+
exports.default = OnboardingBusinessApi;
|
|
96
|
+
// @Endpoint({
|
|
97
|
+
// method: HttpMethod.GET,
|
|
98
|
+
// path: '/private/getById/{id}',
|
|
99
|
+
// summary: 'Get user by ID endpoint',
|
|
100
|
+
// tags: ['PrivateController']
|
|
101
|
+
// })
|
|
102
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
103
|
+
// async getById(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
104
|
+
// const { id } = request.pathParameter;
|
|
105
|
+
// try {
|
|
106
|
+
// log.info(`PrivateController [getById]: Processing request to get user by ID: ${id}`);
|
|
107
|
+
// return await this._getOnboardingUserManager.getById(id);
|
|
108
|
+
// } catch (error) {
|
|
109
|
+
// log.error("PrivateController [getById]:", error);
|
|
110
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
111
|
+
// }
|
|
112
|
+
// }
|
|
113
|
+
// @Endpoint({
|
|
114
|
+
// method: HttpMethod.GET,
|
|
115
|
+
// path: '/private/getByPhoneNumber/{phoneNumber}',
|
|
116
|
+
// summary: 'Get user by phone number endpoint',
|
|
117
|
+
// tags: ['PrivateController']
|
|
118
|
+
// })
|
|
119
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
120
|
+
// async getByPhoneNumber(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
121
|
+
// const { phoneNumber } = request.pathParameter;
|
|
122
|
+
// try {
|
|
123
|
+
// log.info(`PrivateController [getByPhoneNumber]: Processing request to get user by phone number: ${phoneNumber}`);
|
|
124
|
+
// return await this._getOnboardingUserManager.getByPhoneNumber(phoneNumber);
|
|
125
|
+
// } catch (error) {
|
|
126
|
+
// log.error("PrivateController [getByPhoneNumber]:", error);
|
|
127
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
128
|
+
// }
|
|
129
|
+
// }
|
|
130
|
+
// @Endpoint({
|
|
131
|
+
// method: HttpMethod.GET,
|
|
132
|
+
// path: '/private/getByReferralDirectoryId/{referralDirectoryId}',
|
|
133
|
+
// summary: 'Get users by referral directory ID endpoint',
|
|
134
|
+
// tags: ['PrivateController']
|
|
135
|
+
// })
|
|
136
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
137
|
+
// async getByReferralDirectoryId(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
138
|
+
// const { referralDirectoryId } = request.pathParameter;
|
|
139
|
+
// const index = request?.queryStringParameters?.index ?? "null";
|
|
140
|
+
// const pageSize = !isNaN(parseInt(request?.queryStringParameters?.pageSize)) ? parseInt(request?.queryStringParameters?.pageSize) : parseInt(process.env.PAGE_SIZE);
|
|
141
|
+
// try {
|
|
142
|
+
// log.info(`PrivateController [getByReferralDirectoryId]: Processing request to get users by referral directory ID: ${referralDirectoryId}`);
|
|
143
|
+
// return await this._getOnboardingUserManager.getByReferralDirectoryId({ referralDirectoryId, index, pageSize: pageSize });
|
|
144
|
+
// } catch (error) {
|
|
145
|
+
// log.error("PrivateController [getByReferralDirectoryId]:", error);
|
|
146
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
147
|
+
// }
|
|
148
|
+
// }
|
|
149
|
+
// @Endpoint({
|
|
150
|
+
// method: HttpMethod.GET,
|
|
151
|
+
// path: '/private/getByReferralCode/{referralCode}',
|
|
152
|
+
// summary: 'Get users by referral code endpoint',
|
|
153
|
+
// tags: ['PrivateController']
|
|
154
|
+
// })
|
|
155
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
156
|
+
// async getByReferralCode(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
157
|
+
// const { referralCode } = request.pathParameter;
|
|
158
|
+
// const index = request?.queryStringParameters?.index ?? "null";
|
|
159
|
+
// const pageSize = !isNaN(parseInt(request?.queryStringParameters?.pageSize)) ? parseInt(request?.queryStringParameters?.pageSize) : parseInt(process.env.PAGE_SIZE);
|
|
160
|
+
// try {
|
|
161
|
+
// log.info(`PrivateController [getByReferralCode]: Processing request to get users by referral code: ${referralCode}`);
|
|
162
|
+
// return await this._getOnboardingUserManager.getByReferralCode({ referralCode, index, pageSize: pageSize });
|
|
163
|
+
// } catch (error) {
|
|
164
|
+
// log.error("PrivateController [getByReferralCode]:", error);
|
|
165
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
166
|
+
// }
|
|
167
|
+
// }
|
|
168
|
+
// @Endpoint({
|
|
169
|
+
// method: HttpMethod.GET,
|
|
170
|
+
// path: '/private/getByMyReferralCode/{referralCode}',
|
|
171
|
+
// summary: 'Get user by my referral code endpoint',
|
|
172
|
+
// tags: ['PrivateController']
|
|
173
|
+
// })
|
|
174
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
175
|
+
// async getByMyReferralCode(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
176
|
+
// const { referralCode } = request.pathParameter;
|
|
177
|
+
// try {
|
|
178
|
+
// log.info(`PrivateController [getByMyReferralCode]: Processing request to get user by my referral code: ${referralCode}`);
|
|
179
|
+
// return await this._getOnboardingUserManager.getByMyReferralCode(referralCode);
|
|
180
|
+
// } catch (error) {
|
|
181
|
+
// log.error("PrivateController [getByMyReferralCode]:", error);
|
|
182
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
183
|
+
// }
|
|
184
|
+
// }
|
|
185
|
+
// @Endpoint({
|
|
186
|
+
// method: HttpMethod.GET,
|
|
187
|
+
// path: '/private/getList',
|
|
188
|
+
// summary: 'Get list of users endpoint',
|
|
189
|
+
// tags: ['PrivateController'],
|
|
190
|
+
// })
|
|
191
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
192
|
+
// async getList(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
193
|
+
// const index = request?.queryStringParameters?.index ?? "null";
|
|
194
|
+
// const pageSize = !isNaN(parseInt(request?.queryStringParameters?.pageSize)) ? parseInt(request?.queryStringParameters?.pageSize) : parseInt(process.env.PAGE_SIZE);
|
|
195
|
+
// try {
|
|
196
|
+
// log.info(`PrivateController [getList]: Processing request to get list of users`);
|
|
197
|
+
// return await this._getOnboardingUserManager.getList({ index, pageSize: pageSize });
|
|
198
|
+
// } catch (error) {
|
|
199
|
+
// log.error("PrivateController [getList]:", error);
|
|
200
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
201
|
+
// }
|
|
202
|
+
// }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface IOnboardingBusinessApi {
|
|
2
|
+
getById(id: string): Promise<any>;
|
|
3
|
+
getByPhoneNumber(phoneNumber: string): Promise<any>;
|
|
4
|
+
getByReferralDirectoryId(params: {
|
|
5
|
+
referralDirectoryId: string;
|
|
6
|
+
index?: string;
|
|
7
|
+
pageSize?: string;
|
|
8
|
+
}): Promise<any>;
|
|
9
|
+
getByReferralCode(params: {
|
|
10
|
+
referralCode: string;
|
|
11
|
+
index?: string;
|
|
12
|
+
pageSize?: string;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
getByMyReferralCode(referralCode: string): Promise<any>;
|
|
15
|
+
getList(params: {
|
|
16
|
+
index?: string;
|
|
17
|
+
pageSize?: string;
|
|
18
|
+
}): Promise<any>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./api/OnboardingBusinessApi"), exports);
|
|
18
|
+
__exportStar(require("./api/interfaces/IOnboardingBusinessApi"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
package/src/container.config.ts
CHANGED
|
@@ -79,6 +79,8 @@ import { DirectorySettingApi, IDirectorySettingApi } from "./directorySetting";
|
|
|
79
79
|
import { FirebaseConnectorApi, IFirebaseConnectorApi } from "./firebase-connector";
|
|
80
80
|
import { IOnboardingApi } from "./onboarding";
|
|
81
81
|
import OnboardingApi from "./onboarding/api/OnboardingApi";
|
|
82
|
+
import OnboardingBusinessApi from "./onboarding-business/api/OnboardingBusinessApi";
|
|
83
|
+
import { IOnboardingBusinessApi } from "./onboarding-business";
|
|
82
84
|
|
|
83
85
|
export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) => {
|
|
84
86
|
// UTILS bindings
|
|
@@ -141,4 +143,5 @@ export const apiInvokerBindings = new ContainerModule((bind: interfaces.Bind) =>
|
|
|
141
143
|
bind<IDirectorySettingApi>("IDirectorySettingApi").to(DirectorySettingApi);
|
|
142
144
|
bind<IFirebaseConnectorApi>("IFirebaseConnectorApi").to(FirebaseConnectorApi);
|
|
143
145
|
bind<IOnboardingApi>("IOnboardingApi").to(OnboardingApi);
|
|
146
|
+
bind<IOnboardingBusinessApi>("IOnboardingBusinessApi").to(OnboardingBusinessApi);
|
|
144
147
|
});
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { IOnboardingBusinessApi } from "./interfaces/IOnboardingBusinessApi";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@injectable()
|
|
7
|
+
export default class OnboardingBusinessApi implements IOnboardingBusinessApi {
|
|
8
|
+
|
|
9
|
+
private readonly baseUrl = process.env.ONBOARDING_BUSINESS_LAMBDA_URL || "";
|
|
10
|
+
|
|
11
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//**
|
|
15
|
+
// Function: getById
|
|
16
|
+
// Description: Search onboarding by id
|
|
17
|
+
// Parameters: id
|
|
18
|
+
// Return: Onboarding
|
|
19
|
+
// **/
|
|
20
|
+
async getById(id: string): Promise<any> {
|
|
21
|
+
const url = `${this.baseUrl}private/getById/${id}`;
|
|
22
|
+
return await this.httpRequest.get(`${url}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//**
|
|
26
|
+
// Function: getByPhoneNumber
|
|
27
|
+
// Description: Search onboarding by phone number
|
|
28
|
+
// Parameters: phoneNumber
|
|
29
|
+
// Return: Onboarding
|
|
30
|
+
// **/
|
|
31
|
+
async getByPhoneNumber(phoneNumber: string): Promise<any> {
|
|
32
|
+
const url = `${this.baseUrl}private/getByPhoneNumber/${phoneNumber}`;
|
|
33
|
+
return await this.httpRequest.get(`${url}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//**
|
|
37
|
+
// Function: getByReferralDirectoryId
|
|
38
|
+
// Description: Search onboarding by referral directory id
|
|
39
|
+
// Parameters: params
|
|
40
|
+
// Return: Onboarding
|
|
41
|
+
// **/
|
|
42
|
+
async getByReferralDirectoryId(params: { referralDirectoryId: string; index?: string; pageSize?: string; sort?: "ascending" | "descending"; }): Promise<any> {
|
|
43
|
+
const queryParams = []
|
|
44
|
+
if (params.index) queryParams.push(`index=${params.index}`)
|
|
45
|
+
if (params.pageSize) queryParams.push(`pageSize=${params.pageSize}`)
|
|
46
|
+
if (params.sort) queryParams.push(`sort=${params.sort}`)
|
|
47
|
+
|
|
48
|
+
const query = queryParams.length > 0 ? `?${queryParams.join("&")}` : "";
|
|
49
|
+
|
|
50
|
+
const url = `${this.baseUrl}private/getByReferralDirectoryId/${params.referralDirectoryId}${query}`;
|
|
51
|
+
return await this.httpRequest.get(`${url}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//**
|
|
55
|
+
// Function: getByReferralCode
|
|
56
|
+
// Description: Search onboarding by referral code
|
|
57
|
+
// Parameters: params
|
|
58
|
+
// Return: Onboarding
|
|
59
|
+
// **/
|
|
60
|
+
async getByReferralCode(params: { referralCode: string; index?: string; pageSize?: string; }): Promise<any> {
|
|
61
|
+
const url = `${this.baseUrl}private/getByReferralCode/${params.referralCode}`;
|
|
62
|
+
return await this.httpRequest.get(`${url}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
//**
|
|
66
|
+
// Function: getByMyReferralCode
|
|
67
|
+
// Description: Search onboarding by my referral code
|
|
68
|
+
// Parameters: referralCode
|
|
69
|
+
// Return: Onboarding
|
|
70
|
+
// **/
|
|
71
|
+
async getByMyReferralCode(referralCode: string): Promise<any> {
|
|
72
|
+
const url = `${this.baseUrl}private/getByMyReferralCode/${referralCode}`;
|
|
73
|
+
return await this.httpRequest.get(`${url}`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//**
|
|
77
|
+
// Function: getList
|
|
78
|
+
// Description: Search onboarding list
|
|
79
|
+
// Parameters: params
|
|
80
|
+
// Return: Onboarding list
|
|
81
|
+
// **/
|
|
82
|
+
async getList(params: { index?: string; pageSize?: string; }): Promise<any> {
|
|
83
|
+
const url = `${this.baseUrl}private/getList`;
|
|
84
|
+
return await this.httpRequest.get(`${url}`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
// @Endpoint({
|
|
95
|
+
// method: HttpMethod.GET,
|
|
96
|
+
// path: '/private/getById/{id}',
|
|
97
|
+
// summary: 'Get user by ID endpoint',
|
|
98
|
+
// tags: ['PrivateController']
|
|
99
|
+
// })
|
|
100
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
101
|
+
// async getById(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
102
|
+
// const { id } = request.pathParameter;
|
|
103
|
+
// try {
|
|
104
|
+
// log.info(`PrivateController [getById]: Processing request to get user by ID: ${id}`);
|
|
105
|
+
// return await this._getOnboardingUserManager.getById(id);
|
|
106
|
+
// } catch (error) {
|
|
107
|
+
// log.error("PrivateController [getById]:", error);
|
|
108
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
109
|
+
// }
|
|
110
|
+
// }
|
|
111
|
+
|
|
112
|
+
// @Endpoint({
|
|
113
|
+
// method: HttpMethod.GET,
|
|
114
|
+
// path: '/private/getByPhoneNumber/{phoneNumber}',
|
|
115
|
+
// summary: 'Get user by phone number endpoint',
|
|
116
|
+
// tags: ['PrivateController']
|
|
117
|
+
// })
|
|
118
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
119
|
+
// async getByPhoneNumber(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
120
|
+
// const { phoneNumber } = request.pathParameter;
|
|
121
|
+
// try {
|
|
122
|
+
// log.info(`PrivateController [getByPhoneNumber]: Processing request to get user by phone number: ${phoneNumber}`);
|
|
123
|
+
// return await this._getOnboardingUserManager.getByPhoneNumber(phoneNumber);
|
|
124
|
+
// } catch (error) {
|
|
125
|
+
// log.error("PrivateController [getByPhoneNumber]:", error);
|
|
126
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
127
|
+
// }
|
|
128
|
+
// }
|
|
129
|
+
|
|
130
|
+
// @Endpoint({
|
|
131
|
+
// method: HttpMethod.GET,
|
|
132
|
+
// path: '/private/getByReferralDirectoryId/{referralDirectoryId}',
|
|
133
|
+
// summary: 'Get users by referral directory ID endpoint',
|
|
134
|
+
// tags: ['PrivateController']
|
|
135
|
+
// })
|
|
136
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
137
|
+
// async getByReferralDirectoryId(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
138
|
+
// const { referralDirectoryId } = request.pathParameter;
|
|
139
|
+
// const index = request?.queryStringParameters?.index ?? "null";
|
|
140
|
+
// const pageSize = !isNaN(parseInt(request?.queryStringParameters?.pageSize)) ? parseInt(request?.queryStringParameters?.pageSize) : parseInt(process.env.PAGE_SIZE);
|
|
141
|
+
// try {
|
|
142
|
+
// log.info(`PrivateController [getByReferralDirectoryId]: Processing request to get users by referral directory ID: ${referralDirectoryId}`);
|
|
143
|
+
// return await this._getOnboardingUserManager.getByReferralDirectoryId({ referralDirectoryId, index, pageSize: pageSize });
|
|
144
|
+
// } catch (error) {
|
|
145
|
+
// log.error("PrivateController [getByReferralDirectoryId]:", error);
|
|
146
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
147
|
+
// }
|
|
148
|
+
// }
|
|
149
|
+
|
|
150
|
+
// @Endpoint({
|
|
151
|
+
// method: HttpMethod.GET,
|
|
152
|
+
// path: '/private/getByReferralCode/{referralCode}',
|
|
153
|
+
// summary: 'Get users by referral code endpoint',
|
|
154
|
+
// tags: ['PrivateController']
|
|
155
|
+
// })
|
|
156
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
157
|
+
// async getByReferralCode(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
158
|
+
// const { referralCode } = request.pathParameter;
|
|
159
|
+
// const index = request?.queryStringParameters?.index ?? "null";
|
|
160
|
+
// const pageSize = !isNaN(parseInt(request?.queryStringParameters?.pageSize)) ? parseInt(request?.queryStringParameters?.pageSize) : parseInt(process.env.PAGE_SIZE);
|
|
161
|
+
// try {
|
|
162
|
+
// log.info(`PrivateController [getByReferralCode]: Processing request to get users by referral code: ${referralCode}`);
|
|
163
|
+
// return await this._getOnboardingUserManager.getByReferralCode({ referralCode, index, pageSize: pageSize });
|
|
164
|
+
// } catch (error) {
|
|
165
|
+
// log.error("PrivateController [getByReferralCode]:", error);
|
|
166
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
167
|
+
// }
|
|
168
|
+
// }
|
|
169
|
+
|
|
170
|
+
// @Endpoint({
|
|
171
|
+
// method: HttpMethod.GET,
|
|
172
|
+
// path: '/private/getByMyReferralCode/{referralCode}',
|
|
173
|
+
// summary: 'Get user by my referral code endpoint',
|
|
174
|
+
// tags: ['PrivateController']
|
|
175
|
+
// })
|
|
176
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
177
|
+
// async getByMyReferralCode(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
178
|
+
// const { referralCode } = request.pathParameter;
|
|
179
|
+
// try {
|
|
180
|
+
// log.info(`PrivateController [getByMyReferralCode]: Processing request to get user by my referral code: ${referralCode}`);
|
|
181
|
+
// return await this._getOnboardingUserManager.getByMyReferralCode(referralCode);
|
|
182
|
+
// } catch (error) {
|
|
183
|
+
// log.error("PrivateController [getByMyReferralCode]:", error);
|
|
184
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
185
|
+
// }
|
|
186
|
+
// }
|
|
187
|
+
|
|
188
|
+
// @Endpoint({
|
|
189
|
+
// method: HttpMethod.GET,
|
|
190
|
+
// path: '/private/getList',
|
|
191
|
+
// summary: 'Get list of users endpoint',
|
|
192
|
+
// tags: ['PrivateController'],
|
|
193
|
+
// })
|
|
194
|
+
// @AuthorizedFeatures(Feature.ANONIMUS)
|
|
195
|
+
// async getList(request: ApiGatewayRequest<any>): Promise<ApiResponse> {
|
|
196
|
+
// const index = request?.queryStringParameters?.index ?? "null";
|
|
197
|
+
// const pageSize = !isNaN(parseInt(request?.queryStringParameters?.pageSize)) ? parseInt(request?.queryStringParameters?.pageSize) : parseInt(process.env.PAGE_SIZE);
|
|
198
|
+
// try {
|
|
199
|
+
// log.info(`PrivateController [getList]: Processing request to get list of users`);
|
|
200
|
+
// return await this._getOnboardingUserManager.getList({ index, pageSize: pageSize });
|
|
201
|
+
// } catch (error) {
|
|
202
|
+
// log.error("PrivateController [getList]:", error);
|
|
203
|
+
// return ApiResponse.badRequest({code: error.code ?? "UNKNOWN", msg: error.message ?? "Unknown error"});
|
|
204
|
+
// }
|
|
205
|
+
// }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface IOnboardingBusinessApi {
|
|
2
|
+
getById(id: string): Promise<any>
|
|
3
|
+
getByPhoneNumber(phoneNumber: string): Promise<any>
|
|
4
|
+
getByReferralDirectoryId(params:{referralDirectoryId: string; index?: string; pageSize?: string;}): Promise<any>
|
|
5
|
+
getByReferralCode(params:{referralCode: string; index?: string; pageSize?: string;}): Promise<any>
|
|
6
|
+
getByMyReferralCode(referralCode: string): Promise<any>
|
|
7
|
+
getList(params:{index?: string; pageSize?: string; }): Promise<any>
|
|
8
|
+
}
|