@nextage/nx-frame-be 1.0.26 → 1.0.28
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.
|
@@ -152,6 +152,13 @@ export declare class BaseModel<TAttrs, TDoc extends BaseMongoDoc, TMongoModel ex
|
|
|
152
152
|
* @param {*} params
|
|
153
153
|
*/
|
|
154
154
|
findOneNative(params: FilterParams): Promise<mongoose.mongo.WithId<mongoose.mongo.BSON.Document> | null>;
|
|
155
|
+
/**
|
|
156
|
+
*
|
|
157
|
+
* @param id
|
|
158
|
+
* @param context
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
beforeGet(filter: FilterParams, context: NxContext): Promise<FilterParams>;
|
|
155
162
|
/**
|
|
156
163
|
*
|
|
157
164
|
* @param {*} item
|
|
@@ -197,8 +197,10 @@ class BaseModel extends events_1.EventEmitter {
|
|
|
197
197
|
get(id_1) {
|
|
198
198
|
return __awaiter(this, arguments, void 0, function* (id, context = {}) {
|
|
199
199
|
if (!id)
|
|
200
|
-
return
|
|
201
|
-
|
|
200
|
+
return null;
|
|
201
|
+
const filter = { _id: (0, mongo_utils_1.toObjectId)(id) };
|
|
202
|
+
yield this.beforeGet(filter, context);
|
|
203
|
+
return this.mgModel.findOne(filter);
|
|
202
204
|
});
|
|
203
205
|
}
|
|
204
206
|
/**
|
|
@@ -247,6 +249,17 @@ class BaseModel extends events_1.EventEmitter {
|
|
|
247
249
|
findOneNative(params) {
|
|
248
250
|
return this.mgModel.collection.findOne(params);
|
|
249
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
*
|
|
254
|
+
* @param id
|
|
255
|
+
* @param context
|
|
256
|
+
* @returns
|
|
257
|
+
*/
|
|
258
|
+
beforeGet(filter, context) {
|
|
259
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
return filter;
|
|
261
|
+
});
|
|
262
|
+
}
|
|
250
263
|
/**
|
|
251
264
|
*
|
|
252
265
|
* @param {*} item
|