@lenne.tech/nest-server 9.0.30 → 9.0.31
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.31",
|
|
4
4
|
"description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -395,14 +395,15 @@ export abstract class CrudService<T extends CoreModel = any> extends ModuleServi
|
|
|
395
395
|
* Update item via ID
|
|
396
396
|
*/
|
|
397
397
|
async update(id: string, input: any, serviceOptions?: ServiceOptions): Promise<T> {
|
|
398
|
-
const dbObject = await this.mainDbModel.findById(id).
|
|
398
|
+
const dbObject = await this.mainDbModel.findById(id).lean();
|
|
399
399
|
if (!dbObject) {
|
|
400
400
|
throw new NotFoundException(`No ${this.mainModelConstructor.name} found with ID: ${id}`);
|
|
401
401
|
}
|
|
402
402
|
return this.process(
|
|
403
403
|
async (data) => {
|
|
404
404
|
const currentUserId = serviceOptions?.currentUser?.id;
|
|
405
|
-
|
|
405
|
+
const merged = mergePlain(dbObject, data.input, { updatedBy: currentUserId });
|
|
406
|
+
return await this.mainDbModel.findByIdAndUpdate(id, merged, { returnDocument: 'after' }).exec();
|
|
406
407
|
},
|
|
407
408
|
{ dbObject, input, serviceOptions }
|
|
408
409
|
);
|