mirror of
https://codeberg.org/MarkusThielker/next-ory.git
synced 2025-07-04 13:59:17 +00:00
NORY-41: add new pagination
This commit is contained in:
parent
2d2c021446
commit
9defc8a391
4 changed files with 122 additions and 2 deletions
|
@ -21,6 +21,13 @@ interface QueryIdentitiesProps {
|
|||
|
||||
export async function queryIdentities({ page, pageSize, query }: QueryIdentitiesProps) {
|
||||
|
||||
if (page < 1 || pageSize < 1) {
|
||||
return {
|
||||
data: [],
|
||||
pageCount: 0,
|
||||
};
|
||||
}
|
||||
|
||||
const db = await getDB();
|
||||
const result = await db.select()
|
||||
.from(identities)
|
||||
|
@ -31,6 +38,7 @@ export async function queryIdentities({ page, pageSize, query }: QueryIdentities
|
|||
${`%${query}%`}`,
|
||||
ilike(identityVerifiableAddresses.value, `%${query}%`),
|
||||
))
|
||||
.orderBy(identities.id)
|
||||
.limit(pageSize)
|
||||
.offset((page - 1) * pageSize);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue