From 2ecd6c1c217fcd334b239e1598a6e50552ba413f Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 4 Jan 2024 13:19:19 +0000 Subject: [PATCH] feat: method for updating last modified time programmatically --- packages/nocodb/src/db/BaseModelSqlv2.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index f43e14e51a..ac09368923 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3846,7 +3846,7 @@ class BaseModelSqlv2 { } // method for validating otpions if column is single/multi select - private async validateOptions( + private async avalidateOptions( column: Column, insertOrUpdateObject: Record, ) { @@ -5515,6 +5515,20 @@ class BaseModelSqlv2 { } } + async updateLastModifiedTime({ rowIds }: { rowIds: any | any[] }) { + const columnName = 'updated_at'; + + const qb = this.dbDriver(this.tnPath).update({ + [columnName]: this.dbDriver.fn.now(), + }); + + for(const rowId of rowIds) { + qb.orWhere(await this._wherePk(rowId)); + } + + await qb; + } + async prepareNocoData(data) { if ( this.model.columns.some((c) =>