diff --git a/apps/server/src/database/repos/base/base-row.repo.ts b/apps/server/src/database/repos/base/base-row.repo.ts index 62f2b5ff..9f709abf 100644 --- a/apps/server/src/database/repos/base/base-row.repo.ts +++ b/apps/server/src/database/repos/base/base-row.repo.ts @@ -59,6 +59,21 @@ export class BaseRowRepo { .executeTakeFirst()) as BaseRow | undefined; } + async findByIds( + rowIds: string[], + opts: WorkspaceOpts, + ): Promise { + if (rowIds.length === 0) return []; + const db = dbOrTx(this.db, opts.trx); + return (await db + .selectFrom('baseRows') + .select(BASE_ROW_COLUMNS) + .where('id', 'in', rowIds) + .where('workspaceId', '=', opts.workspaceId) + .where('deletedAt', 'is', null) + .execute()) as BaseRow[]; + } + async list(opts: { baseId: string; workspaceId: string; @@ -217,6 +232,26 @@ export class BaseRowRepo { .execute(); } + async softDeleteMany( + rowIds: string[], + opts: { + baseId: string; + workspaceId: string; + trx?: KyselyTransaction; + }, + ): Promise { + if (rowIds.length === 0) return; + const db = dbOrTx(this.db, opts.trx); + await db + .updateTable('baseRows') + .set({ deletedAt: new Date() }) + .where('id', 'in', rowIds) + .where('baseId', '=', opts.baseId) + .where('workspaceId', '=', opts.workspaceId) + .where('deletedAt', 'is', null) + .execute(); + } + async removeCellKey( baseId: string, propertyId: string,