dl-commons 0.0.1-testing.2 → 0.0.1-testing.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/dl-commons.module.js +3 -2
- package/dist/dl-commons.module.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/models/interfaces/person.interface.d.ts +2 -0
- package/dist/models/schemas/embedded/person.schema.d.ts +2 -0
- package/dist/models/schemas/embedded/person.schema.js +5 -0
- package/dist/models/schemas/embedded/person.schema.js.map +1 -1
- package/dist/services/dictionaries.service.d.ts +12 -0
- package/dist/services/dictionaries.service.js +89 -0
- package/dist/services/dictionaries.service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/dl-commons.module.ts +3 -2
- package/src/index.ts +2 -0
- package/src/models/interfaces/person.interface.ts +2 -0
- package/src/models/schemas/embedded/person.schema.ts +5 -0
- package/src/services/dictionaries.service.ts +99 -0
|
@@ -14,6 +14,7 @@ const mongoose_1 = require("@nestjs/mongoose");
|
|
|
14
14
|
const env_vars_const_1 = require("./models/consts/env-vars.const");
|
|
15
15
|
const session_schema_1 = require("./models/schemas/session.schema");
|
|
16
16
|
const axios_1 = require("@nestjs/axios");
|
|
17
|
+
const dictionaries_service_1 = require("./services/dictionaries.service");
|
|
17
18
|
let DLCommonsModule = class DLCommonsModule {
|
|
18
19
|
};
|
|
19
20
|
exports.DLCommonsModule = DLCommonsModule;
|
|
@@ -32,8 +33,8 @@ exports.DLCommonsModule = DLCommonsModule = __decorate([
|
|
|
32
33
|
mongoose_1.MongooseModule.forFeature([{ name: session_schema_1.Session.name, schema: session_schema_1.SessionSchema }], 'sessions-store'),
|
|
33
34
|
],
|
|
34
35
|
controllers: [],
|
|
35
|
-
providers: [sessions_service_1.SessionsService],
|
|
36
|
-
exports: [sessions_service_1.SessionsService],
|
|
36
|
+
providers: [sessions_service_1.SessionsService, dictionaries_service_1.DictionariesService],
|
|
37
|
+
exports: [sessions_service_1.SessionsService, dictionaries_service_1.DictionariesService],
|
|
37
38
|
})
|
|
38
39
|
], DLCommonsModule);
|
|
39
40
|
//# sourceMappingURL=dl-commons.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dl-commons.module.js","sourceRoot":"","sources":["../src/dl-commons.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA6D;AAC7D,kEAA8D;AAC9D,+CAAkD;AAClD,mEAAwE;AACxE,oEAAyE;AACzE,yCAA2C;
|
|
1
|
+
{"version":3,"file":"dl-commons.module.js","sourceRoot":"","sources":["../src/dl-commons.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,2CAA6D;AAC7D,kEAA8D;AAC9D,+CAAkD;AAClD,mEAAwE;AACxE,oEAAyE;AACzE,yCAA2C;AAE3C,0EAAsE;AA2B/D,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IAjB3B,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,qBAAY;YACZ,kBAAU;YACV,yBAAc,CAAC,YAAY,CAAC;gBACxB,cAAc,EAAE,gBAAgB;gBAChC,UAAU,EAAE,KAAK,EAAE,aAA4B,EAAE,EAAE,CAAC,CAAC;oBACjD,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,uCAAsB,CAAC;iBACjD,CAAC;gBACF,MAAM,EAAE,CAAC,sBAAa,CAAC;aAC1B,CAAC;YACF,yBAAc,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,wBAAO,CAAC,IAAI,EAAE,MAAM,EAAE,8BAAa,EAAE,CAAC,EAAE,gBAAgB,CAAC;SAC/F;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,CAAC,kCAAe,EAAE,0CAAmB,CAAC;QACjD,OAAO,EAAE,CAAC,kCAAe,EAAE,0CAAmB,CAAC;KAClD,CAAC;GACW,eAAe,CAAG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,4 +38,5 @@ import { transformers } from './transformers/common.transformer';
|
|
|
38
38
|
import { IUser } from './models/interfaces/user.interface';
|
|
39
39
|
import { SessionUser, SessionUserDocument, SessionUserSchema } from './models/schemas/embedded/session-user.schema';
|
|
40
40
|
import { Session, SessionDocument, SessionSchema } from './models/schemas/session.schema';
|
|
41
|
-
|
|
41
|
+
import { DictionariesService } from './services/dictionaries.service';
|
|
42
|
+
export { SessionsService, DictionariesService, RESTError, RESTPage, RESTPaging, RESTQueryParams, RESTRequestBody, RESTResponseBody, RESTResult, RESTSort, SortDirection, IMongoPage, AccessTokenGuard, PermissionGuard, AllowPermissions, APP__PORT, APP__DEBUG, APP__ACCESS_TOKEN, MONGO__CS, REDIS__CS, KAFKA__BROKERS, RecordState, ContactType, UserVerificationLevel, I18nDTO, IIdentifable, IBase, IRecord, II18n, IDictionary, IPermission, IRole, IContact, IPerson, IResidence, ISessionUser, ISession, IUser, Identifable, IdentifableSchema, IdentifableDocument, Base, BaseSchema, BaseDocument, Record, RecordSchema, RecordDocument, I18n, I18nSchema, I18nDocument, Residence, ResidenceSchema, ResidenceDocument, Contact, ContactSchema, ContactDocument, Person, PersonSchema, PersonDocument, DictionaryEmbedded, DictionaryEmbeddedSchema, DictionaryEmbeddedDocument, SessionUser, SessionUserSchema, SessionUserDocument, Session, SessionSchema, SessionDocument, BaseExceptionsFilter, validationExceptionFactory, HandledException, IsMapOfStrings, transformers, MongoIdPipe, MongoIdsPipe, DLCommonsModule, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.DLCommonsModule = void 0;
|
|
3
|
+
exports.MongoIdPipe = exports.transformers = exports.IsMapOfStrings = exports.HandledException = exports.validationExceptionFactory = exports.BaseExceptionsFilter = exports.SessionSchema = exports.Session = exports.SessionUserSchema = exports.SessionUser = exports.DictionaryEmbeddedSchema = exports.DictionaryEmbedded = exports.PersonSchema = exports.Person = exports.ContactSchema = exports.Contact = exports.ResidenceSchema = exports.Residence = exports.I18nSchema = exports.I18n = exports.RecordSchema = exports.Record = exports.BaseSchema = exports.Base = exports.IdentifableSchema = exports.Identifable = exports.I18nDTO = exports.UserVerificationLevel = exports.ContactType = exports.RecordState = exports.KAFKA__BROKERS = exports.REDIS__CS = exports.MONGO__CS = exports.APP__ACCESS_TOKEN = exports.APP__DEBUG = exports.APP__PORT = exports.AllowPermissions = exports.PermissionGuard = exports.AccessTokenGuard = exports.SortDirection = exports.RESTSort = exports.RESTResult = exports.RESTResponseBody = exports.RESTRequestBody = exports.RESTQueryParams = exports.RESTPaging = exports.RESTPage = exports.RESTError = exports.DictionariesService = exports.SessionsService = void 0;
|
|
4
|
+
exports.DLCommonsModule = exports.MongoIdsPipe = void 0;
|
|
5
5
|
const is_map_of_strings_decorator_1 = require("./decorators/is-map-of-strings.decorator");
|
|
6
6
|
Object.defineProperty(exports, "IsMapOfStrings", { enumerable: true, get: function () { return is_map_of_strings_decorator_1.IsMapOfStrings; } });
|
|
7
7
|
const dl_commons_module_1 = require("./dl-commons.module");
|
|
@@ -80,4 +80,6 @@ Object.defineProperty(exports, "SessionUserSchema", { enumerable: true, get: fun
|
|
|
80
80
|
const session_schema_1 = require("./models/schemas/session.schema");
|
|
81
81
|
Object.defineProperty(exports, "Session", { enumerable: true, get: function () { return session_schema_1.Session; } });
|
|
82
82
|
Object.defineProperty(exports, "SessionSchema", { enumerable: true, get: function () { return session_schema_1.SessionSchema; } });
|
|
83
|
+
const dictionaries_service_1 = require("./services/dictionaries.service");
|
|
84
|
+
Object.defineProperty(exports, "DictionariesService", { enumerable: true, get: function () { return dictionaries_service_1.DictionariesService; } });
|
|
83
85
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,0FAA0E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,0FAA0E;AA4KtE,+FA5KK,4CAAc,OA4KL;AA3KlB,2DAAsD;AA2LlD,gGA3LK,mCAAe,OA2LL;AA1LnB,oEAAiE;AAqK7D,iGArKK,mCAAgB,OAqKL;AApKpB,qEAA2E;AA+JvE,2GA/JK,8CAA0B,OA+JL;AA9J9B,2EAAuE;AAyJnE,qGAzJK,4CAAoB,OAyJL;AAxJxB,oEAA+D;AAwE3D,iGAxEK,qCAAgB,OAwEL;AAvEpB,gEAA8E;AAyE1E,iGAzEK,mCAAgB,OAyEL;AADhB,gGAxEuB,kCAAe,OAwEvB;AAvEnB,mEAAgI;AA6E5H,0FA7EK,0BAAS,OA6EL;AACT,2FA9EgB,2BAAU,OA8EhB;AACV,kGA/E4B,kCAAiB,OA+E5B;AACjB,0FAhF+C,0BAAS,OAgF/C;AACT,0FAjF0D,0BAAS,OAiF1D;AACT,+FAlFqE,+BAAc,OAkFrE;AAjFlB,6DAAyD;AA6FrD,wFA7FK,kBAAO,OA6FL;AA5FX,kFAWmD;AA2C/C,0FApDA,8BAAS,OAoDA;AACT,yFApDA,6BAAQ,OAoDA;AACR,2FApDA,+BAAU,OAoDA;AACV,gGApDA,oCAAe,OAoDA;AACf,gGApDA,oCAAe,OAoDA;AACf,iGApDA,qCAAgB,OAoDA;AAChB,2FApDA,+BAAU,OAoDA;AACV,yFApDA,6BAAQ,OAoDA;AACR,8FApDA,kCAAa,OAoDA;AAlDjB,wEAA+D;AA0E3D,4FA1EK,+BAAW,OA0EL;AAzEf,wEAA+D;AAwE3D,4FAxEK,+BAAW,OAwEL;AAvEf,4FAAmF;AAyE/E,sGAzEK,mDAAqB,OAyEL;AA5DzB,8DAA8E;AA0F1E,qFA1FK,kBAAI,OA0FL;AACJ,2FA3FyB,wBAAU,OA2FzB;AA1Fd,6EAAmG;AAqG/F,wFArGK,wBAAO,OAqGL;AACP,8FAtG+B,8BAAa,OAsG/B;AArGjB,qGAAgJ;AA0G5I,mGA1GK,+CAAkB,OA0GL;AAClB,yGA3GqD,qDAAwB,OA2GrD;AA1G5B,2EAAyF;AA6FrF,qFA7FK,oBAAI,OA6FL;AACJ,2FA9FW,0BAAU,OA8FX;AA7Fd,2EAA+F;AAqG3F,uFArGK,sBAAM,OAqGL;AACN,6FAtGa,4BAAY,OAsGb;AArGhB,+EAAiG;AAwF7F,uFAxFK,wBAAM,OAwFL;AACN,6FAzFa,8BAAY,OAyFb;AAxFhB,iFAA2G;AA6FvG,0FA7FK,4BAAS,OA6FL;AACT,gGA9FmC,kCAAe,OA8FnC;AA7FnB,4EAA0G;AAgFtG,4FAhFK,gCAAW,OAgFL;AACX,kGAjFuC,sCAAiB,OAiFvC;AAhFrB,yDAAoD;AA0IhD,4FA1IK,2BAAW,OA0IL;AAzIf,2DAAsD;AA0IlD,6FA1IK,6BAAY,OA0IL;AAzIhB,kEAA8D;AAW1D,gGAXK,kCAAe,OAWL;AAVnB,0EAAiE;AAkI7D,6FAlIK,iCAAY,OAkIL;AAhIhB,uFAAoH;AAkGhH,4FAlGK,iCAAW,OAkGL;AACX,kGAnGuC,uCAAiB,OAmGvC;AAlGrB,oEAA0F;AAoGtF,wFApGK,wBAAO,OAoGL;AACP,8FArG+B,8BAAa,OAqG/B;AApGjB,0EAAsE;AAOlE,oGAPK,0CAAmB,OAOL"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { IDictionary } from './dictionary.interface';
|
|
1
2
|
import { IResidence } from './residence.interface';
|
|
2
3
|
export interface IPerson {
|
|
3
4
|
pid?: string | null | undefined;
|
|
4
5
|
firstName: string;
|
|
5
6
|
lastName: string;
|
|
7
|
+
gender?: IDictionary | null | undefined;
|
|
6
8
|
birthDate?: Date | null | undefined;
|
|
7
9
|
residence?: IResidence | null | undefined;
|
|
8
10
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { IPerson } from '../../interfaces/person.interface';
|
|
2
2
|
import { HydratedDocument } from 'mongoose';
|
|
3
3
|
import { IResidence } from '../../interfaces/residence.interface';
|
|
4
|
+
import { IDictionary } from '../../interfaces/dictionary.interface';
|
|
4
5
|
export declare class Person implements IPerson {
|
|
5
6
|
pid: string;
|
|
6
7
|
firstName: string;
|
|
7
8
|
lastName: string;
|
|
8
9
|
birthDate: Date;
|
|
10
|
+
gender: IDictionary;
|
|
9
11
|
residence: IResidence;
|
|
10
12
|
}
|
|
11
13
|
export declare const PersonSchema: import("mongoose").Schema<Person, import("mongoose").Model<Person, any, any, any, import("mongoose").Document<unknown, any, Person> & Person & {
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.PersonSchema = exports.Person = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
14
|
const residence_schema_1 = require("./residence.schema");
|
|
15
|
+
const dictionary_embedded_schema_1 = require("./dictionary-embedded.schema");
|
|
15
16
|
let Person = class Person {
|
|
16
17
|
};
|
|
17
18
|
exports.Person = Person;
|
|
@@ -31,6 +32,10 @@ __decorate([
|
|
|
31
32
|
(0, mongoose_1.Prop)({ type: Date, required: false, default: null }),
|
|
32
33
|
__metadata("design:type", Date)
|
|
33
34
|
], Person.prototype, "birthDate", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, mongoose_1.Prop)({ type: dictionary_embedded_schema_1.DictionaryEmbeddedSchema, required: false }),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], Person.prototype, "gender", void 0);
|
|
34
39
|
__decorate([
|
|
35
40
|
(0, mongoose_1.Prop)({ type: residence_schema_1.ResidenceSchema, required: true, default: () => new residence_schema_1.Residence() }),
|
|
36
41
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"person.schema.js","sourceRoot":"","sources":["../../../../src/models/schemas/embedded/person.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAI/D,yDAAgE;
|
|
1
|
+
{"version":3,"file":"person.schema.js","sourceRoot":"","sources":["../../../../src/models/schemas/embedded/person.schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAI/D,yDAAgE;AAChE,6EAAwE;AAIjE,IAAM,MAAM,GAAZ,MAAM,MAAM;CAkBlB,CAAA;AAlBY,wBAAM;AAEf;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mCAC3C;AAGZ;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACrB;AAGlB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACtB;AAGjB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8BAC1C,IAAI;yCAAC;AAGhB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,qDAAwB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;sCACtC;AAGpB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,kCAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,4BAAS,EAAE,EAAE,CAAC;;yCAC1D;iBAjBb,MAAM;IADlB,IAAA,iBAAM,EAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;GACV,MAAM,CAkBlB;AAEY,QAAA,YAAY,GAAG,wBAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpService } from '@nestjs/axios';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { IDictionary } from '../models/interfaces/dictionary.interface';
|
|
4
|
+
export declare class DictionariesService {
|
|
5
|
+
private readonly _httpService;
|
|
6
|
+
private readonly _configService;
|
|
7
|
+
private _baseUrl;
|
|
8
|
+
constructor(_httpService: HttpService, _configService: ConfigService);
|
|
9
|
+
fetchById(id: string): Promise<IDictionary>;
|
|
10
|
+
fetchByKeyword(keyword: string): Promise<IDictionary>;
|
|
11
|
+
validateIds(ids: string[]): Promise<IDictionary[]>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DictionariesService = void 0;
|
|
13
|
+
const axios_1 = require("@nestjs/axios");
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const config_1 = require("@nestjs/config");
|
|
16
|
+
const rest_wrapper_class_1 = require("../models/dtos/wrappers/rest-wrapper.class");
|
|
17
|
+
const rxjs_1 = require("rxjs");
|
|
18
|
+
const mongoose_1 = require("mongoose");
|
|
19
|
+
let DictionariesService = class DictionariesService {
|
|
20
|
+
constructor(_httpService, _configService) {
|
|
21
|
+
this._httpService = _httpService;
|
|
22
|
+
this._configService = _configService;
|
|
23
|
+
this._baseUrl = this._configService.getOrThrow('DL_DICTIONARIES__REST__BASE_URL');
|
|
24
|
+
}
|
|
25
|
+
async fetchById(id) {
|
|
26
|
+
try {
|
|
27
|
+
const endpoint = `${this._baseUrl}/v1/dictionaries/by-id/${id}`;
|
|
28
|
+
const response$ = this._httpService.get(endpoint);
|
|
29
|
+
const response = await (0, rxjs_1.firstValueFrom)(response$);
|
|
30
|
+
if (response.data.errors) {
|
|
31
|
+
throw new rest_wrapper_class_1.RESTError('dictionaries_api_error', response.data.errors);
|
|
32
|
+
}
|
|
33
|
+
if (!response.data || !response.data.result) {
|
|
34
|
+
throw new rest_wrapper_class_1.RESTError('dictionaries_api_error', 'empty response');
|
|
35
|
+
}
|
|
36
|
+
const result = Object.assign(Object.assign({}, response.data.result.data), { _id: new mongoose_1.Types.ObjectId(response.data.result.data._id) });
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw rest_wrapper_class_1.RESTError.createFromCatch(e, { keyword: 'unknown', debug: e });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async fetchByKeyword(keyword) {
|
|
44
|
+
try {
|
|
45
|
+
const endpoint = `${this._baseUrl}/v1/dictionaries/by-keyword/${keyword}`;
|
|
46
|
+
const response$ = this._httpService.get(endpoint);
|
|
47
|
+
const response = await (0, rxjs_1.firstValueFrom)(response$);
|
|
48
|
+
if (response.data.errors) {
|
|
49
|
+
throw new rest_wrapper_class_1.RESTError('dictionaries_api_error', response.data.errors);
|
|
50
|
+
}
|
|
51
|
+
if (!response.data || !response.data.result) {
|
|
52
|
+
throw new rest_wrapper_class_1.RESTError('dictionaries_api_error', 'empty response');
|
|
53
|
+
}
|
|
54
|
+
const result = Object.assign(Object.assign({}, response.data.result.data), { _id: new mongoose_1.Types.ObjectId(response.data.result.data._id) });
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throw rest_wrapper_class_1.RESTError.createFromCatch(e, { keyword: 'unknown', debug: e });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async validateIds(ids) {
|
|
62
|
+
try {
|
|
63
|
+
const endpoint = `${this._baseUrl}/v1/dictionaries/validate/by-ids`;
|
|
64
|
+
const requestBody = { data: { ids } };
|
|
65
|
+
const response$ = this._httpService.post(endpoint, requestBody);
|
|
66
|
+
const response = await (0, rxjs_1.firstValueFrom)(response$);
|
|
67
|
+
if (response.data.errors) {
|
|
68
|
+
throw new rest_wrapper_class_1.RESTError('dictionaries_api_error', response.data.errors);
|
|
69
|
+
}
|
|
70
|
+
if (!response.data || !response.data.result) {
|
|
71
|
+
throw new rest_wrapper_class_1.RESTError('dictionaries_api_error', 'empty response');
|
|
72
|
+
}
|
|
73
|
+
const result = [];
|
|
74
|
+
for (let item of response.data.result.data) {
|
|
75
|
+
result.push(Object.assign(Object.assign({}, item), { _id: new mongoose_1.Types.ObjectId(item._id) }));
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
throw rest_wrapper_class_1.RESTError.createFromCatch(e, { keyword: 'unknown', debug: e });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.DictionariesService = DictionariesService;
|
|
85
|
+
exports.DictionariesService = DictionariesService = __decorate([
|
|
86
|
+
(0, common_1.Injectable)(),
|
|
87
|
+
__metadata("design:paramtypes", [axios_1.HttpService, config_1.ConfigService])
|
|
88
|
+
], DictionariesService);
|
|
89
|
+
//# sourceMappingURL=dictionaries.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionaries.service.js","sourceRoot":"","sources":["../../src/services/dictionaries.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,y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