dl-commons 0.0.2-testing.7 → 0.0.2-testing.9

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dl-commons",
3
3
  "type": "commonjs",
4
- "version": "0.0.2-testing.7",
4
+ "version": "0.0.2-testing.9",
5
5
  "description": "distance learning commons",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -100,6 +100,7 @@ import {
100
100
  FileEmbeddedDocument,
101
101
  FileEmbeddedSchema,
102
102
  } from './models/schemas/embedded/s3.schema';
103
+ import { IUserMeta } from './models/interfaces/user-meta.interface';
103
104
 
104
105
  export {
105
106
  /**
@@ -188,10 +189,8 @@ export {
188
189
  IFileRecord,
189
190
  IFileMeta,
190
191
  IFileLog,
191
- FileEmbedded,
192
- FileEmbeddedSchema,
193
- FileEmbeddedDocument,
194
-
192
+ IUserMeta,
193
+
195
194
  /**
196
195
  * Schemas & Documents
197
196
  */
@@ -258,6 +257,10 @@ export {
258
257
  S3File,
259
258
  S3FileSchema,
260
259
  S3FileDocument,
260
+ FileEmbedded,
261
+ FileEmbeddedSchema,
262
+ FileEmbeddedDocument,
263
+
261
264
 
262
265
  /**
263
266
  * Filters
@@ -0,0 +1,4 @@
1
+ export interface IUserMeta {
2
+ userId?: string;
3
+ fullName: string;
4
+ }
@@ -58,5 +58,23 @@ export class SessionsService {
58
58
 
59
59
  return session;
60
60
  }
61
+
62
+ public async fetchAllById(id: string): Promise<ISession[]> {
63
+ try {
64
+ const endpoint = `${this._baseUrl}/v1/sessions/${id}/all`;
65
+ const response$ = this._httpService.get<RESTResponseBody<ISession[]>>(endpoint);
66
+ const response = await firstValueFrom(response$);
67
+
68
+ if (response.data.errors) {
69
+ throw new RESTError('sessions_api_error', response.data.errors);
70
+ }
71
+ if (!response.data || !response.data.result) {
72
+ throw new RESTError('sessions_api_error', 'empty response');
73
+ }
74
+ return response.data.result.data;
75
+ } catch (e) {
76
+ throw RESTError.createFromCatch(e, { keyword: 'unknown', debug: e });
77
+ }
78
+ }
61
79
  //#endregion
62
80
  }