fix(core): update

This commit is contained in:
2024-04-14 01:24:21 +02:00
parent cfe733621f
commit 30ae641a9c
5 changed files with 24 additions and 7 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartdata',
version: '5.0.42',
version: '5.0.43',
description: 'do more with data'
}

View File

@ -188,6 +188,18 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
*/
public creationStatus: TDocCreation = 'new';
/**
* updated from db in any case where doc comes from db
*/
@svDb()
_createdAt: number = Date.now();
/**
* will be updated everytime the doc is saved
*/
@svDb()
_updatedAt: number = Date.now();
/**
* unique indexes
*/
@ -221,6 +233,9 @@ export class SmartDataDbDoc<T extends TImplements, TImplements, TManager extends
// tslint:disable-next-line: no-this-assignment
const self: any = this;
let dbResult: any;
this._updatedAt = Date.now();
switch (this.creationStatus) {
case 'db':
dbResult = await this.collection.update(self);