eh-commons 0.0.2-testing.79 → 0.0.2-testing.81
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/modules/session/services/session-v2.service.d.ts +1 -0
- package/dist/modules/session/services/session-v2.service.js +35 -1
- package/dist/modules/session/services/session-v2.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/modules/session/services/session-v2.service.ts +41 -1
package/package.json
CHANGED
|
@@ -116,7 +116,47 @@ export class SessionV2Service {
|
|
|
116
116
|
if (!response) {
|
|
117
117
|
throw new RESTError('user_client_not_found', clientId, 400);
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
|
|
120
|
+
const result: any = JSON.parse(response);
|
|
121
|
+
if (!result || !result.client) {
|
|
122
|
+
throw new RESTError('user_client_not_found', 'json parse', 400);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
clientId: result.client._id,
|
|
127
|
+
type: result.client.type,
|
|
128
|
+
name: result.client.name,
|
|
129
|
+
address: result.client.address,
|
|
130
|
+
highland: result.client.highland,
|
|
131
|
+
code: result.client.code,
|
|
132
|
+
contacts: result.client.contacts,
|
|
133
|
+
region: result.client.region,
|
|
134
|
+
district: result.client.district,
|
|
135
|
+
languageSectors: result.client.languageSectors,
|
|
136
|
+
levels: result.client.levels,
|
|
137
|
+
subjects: result.client.subjects,
|
|
138
|
+
permissions: result.permissions
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public async readUserClients(userId: string): Promise<ISessionClientData[]> {
|
|
143
|
+
const key = generateUserClientsKeyword(userId);
|
|
144
|
+
const response = await this._redisService.get(key);
|
|
145
|
+
if (!response) {
|
|
146
|
+
throw new RESTError('user_clients_not_found', userId, 400);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const result: any = JSON.parse(response);
|
|
150
|
+
if (!result) {
|
|
151
|
+
throw new RESTError('user_clients_not_found', 'json parse', 400);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const clients: ISessionClientData[] = [];
|
|
155
|
+
for (const key in result) {
|
|
156
|
+
clients.push(result[key]);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return clients;
|
|
120
160
|
}
|
|
121
161
|
//#endregion
|
|
122
162
|
}
|