@vasrefil/api-toolkit 1.0.40 → 1.0.42
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.
|
@@ -14,7 +14,7 @@ export declare class RootController {
|
|
|
14
14
|
fetchAll(condition?: object, query?: FetchAllQuery, select?: string | object, populate?: any): import("mongoose").Query<Omit<any, never>[], any, {}, any>;
|
|
15
15
|
fetchAllWithPagination: (conditon: object, query?: FetchAllQuery, select?: string | object, populate?: ModelPopulateI[]) => Promise<FetchWithPaginationDataI>;
|
|
16
16
|
getOneP: (condition: object, select?: any) => Promise<any>;
|
|
17
|
-
getOne(condition: any, select?: any): import("mongoose").Query<any, any, {}, any>;
|
|
17
|
+
getOne(condition: any, select?: any, populate?: any): import("mongoose").Query<any, any, {}, any>;
|
|
18
18
|
getOnePSes: (condition: object, session: ClientSession, select?: string) => Promise<any>;
|
|
19
19
|
getById: (id: string, select?: string | object) => Promise<any>;
|
|
20
20
|
getByIdSes: (id: string, session: ClientSession, select?: object | string) => Promise<any>;
|
|
@@ -144,13 +144,13 @@ class RootController {
|
|
|
144
144
|
const { filter, skip, limit, sort } = query_helper_1.QueryHelper.build_query(query);
|
|
145
145
|
return this.model.find({ ...filter, ...condition }).select(select).skip(skip).limit(limit).sort(sort).populate(populate);
|
|
146
146
|
}
|
|
147
|
-
getOne(condition, select) {
|
|
147
|
+
getOne(condition, select, populate) {
|
|
148
148
|
select = select ? select : '';
|
|
149
149
|
let cond = condition;
|
|
150
150
|
if (this.modelName === 'User') {
|
|
151
151
|
cond = { is_deleted: false, ...condition };
|
|
152
152
|
}
|
|
153
|
-
return (this.model.findOne(cond).select(select).lean());
|
|
153
|
+
return (this.model.findOne(cond).select(select).populate(populate).lean());
|
|
154
154
|
}
|
|
155
155
|
updateOne(condition, updateValues) {
|
|
156
156
|
return this.model.updateOne({ ...condition }, { ...updateValues }, { new: true });
|
|
@@ -28,7 +28,8 @@ class UserAuthMidWare_ extends _root_service_1.RootService {
|
|
|
28
28
|
const baseurl = env_1.default.VASREFIL.BASEURL;
|
|
29
29
|
const headers = {
|
|
30
30
|
Authorization: req.headers.authorization,
|
|
31
|
-
'pin-token': req.headers['pin-token']
|
|
31
|
+
'pin-token': req.headers['pin-token'],
|
|
32
|
+
'x-service-name': env_1.default.SERVICE_NAME,
|
|
32
33
|
};
|
|
33
34
|
const { data } = await axios_1.default.get(`${baseurl}/users/details`, { headers });
|
|
34
35
|
return { user: data.data.user };
|