feat(base): add findByIds and softDeleteMany to base-row repo

This commit is contained in:
Philipinho
2026-04-18 16:28:39 +01:00
parent 901445305d
commit 1466d95078
@@ -59,6 +59,21 @@ export class BaseRowRepo {
.executeTakeFirst()) as BaseRow | undefined;
}
async findByIds(
rowIds: string[],
opts: WorkspaceOpts,
): Promise<BaseRow[]> {
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<void> {
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,