mirror of
https://github.com/docmost/docmost.git
synced 2026-07-25 09:44:42 +10:00
refactor(base): rename baseId to pageId in BasePropertyRepo
This commit is contained in:
@@ -27,28 +27,28 @@ export class BasePropertyRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findByBaseId(
|
async findByBaseId(
|
||||||
baseId: string,
|
pageId: string,
|
||||||
opts?: { trx?: KyselyTransaction },
|
opts?: { trx?: KyselyTransaction },
|
||||||
): Promise<BaseProperty[]> {
|
): Promise<BaseProperty[]> {
|
||||||
const db = dbOrTx(this.db, opts?.trx);
|
const db = dbOrTx(this.db, opts?.trx);
|
||||||
return db
|
return db
|
||||||
.selectFrom('baseProperties')
|
.selectFrom('baseProperties')
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.where('baseId', '=', baseId)
|
.where('pageId', '=', pageId)
|
||||||
.where('deletedAt', 'is', null)
|
.where('deletedAt', 'is', null)
|
||||||
.orderBy('position', 'asc')
|
.orderBy('position', 'asc')
|
||||||
.execute() as Promise<BaseProperty[]>;
|
.execute() as Promise<BaseProperty[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLastPosition(
|
async getLastPosition(
|
||||||
baseId: string,
|
pageId: string,
|
||||||
trx?: KyselyTransaction,
|
trx?: KyselyTransaction,
|
||||||
): Promise<string | null> {
|
): Promise<string | null> {
|
||||||
const db = dbOrTx(this.db, trx);
|
const db = dbOrTx(this.db, trx);
|
||||||
const result = await db
|
const result = await db
|
||||||
.selectFrom('baseProperties')
|
.selectFrom('baseProperties')
|
||||||
.select('position')
|
.select('position')
|
||||||
.where('baseId', '=', baseId)
|
.where('pageId', '=', pageId)
|
||||||
.orderBy(sql`position COLLATE "C"`, 'desc')
|
.orderBy(sql`position COLLATE "C"`, 'desc')
|
||||||
.limit(1)
|
.limit(1)
|
||||||
.executeTakeFirst();
|
.executeTakeFirst();
|
||||||
|
|||||||
Reference in New Issue
Block a user