0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(core): sort users data by createdAt (#2643)

This commit is contained in:
Xiao Yijun 2022-12-13 12:25:08 +08:00 committed by GitHub
parent 91b82fef3f
commit 9345c10301
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -307,6 +307,7 @@ describe('user query', () => {
where ${fields.primaryEmail} ilike $1 or ${fields.primaryPhone} ilike $2 or ${ where ${fields.primaryEmail} ilike $1 or ${fields.primaryPhone} ilike $2 or ${
fields.username fields.username
} ilike $3 or ${fields.name} ilike $4 } ilike $3 or ${fields.name} ilike $4
order by "created_at" desc
limit $5 limit $5
offset $6 offset $6
`; `;
@ -339,6 +340,7 @@ describe('user query', () => {
and (${fields.primaryEmail} ilike $2 or ${fields.primaryPhone} ilike $3 or ${ and (${fields.primaryEmail} ilike $2 or ${fields.primaryPhone} ilike $3 or ${
fields.username fields.username
} ilike $4 or ${fields.name} ilike $5) } ilike $4 or ${fields.name} ilike $5)
order by "created_at" desc
limit $6 limit $6
offset $7 offset $7
`; `;
@ -371,6 +373,7 @@ describe('user query', () => {
where ${fields.primaryEmail} like $1 or ${fields.primaryPhone} like $2 or ${ where ${fields.primaryEmail} like $1 or ${fields.primaryPhone} like $2 or ${
fields.username fields.username
} like $3 or ${fields.name} like $4 } like $3 or ${fields.name} like $4
order by "created_at" desc
limit $5 limit $5
offset $6 offset $6
`; `;

View file

@ -145,6 +145,7 @@ export const findUsers = async (
select ${sql.join(Object.values(fields), sql`,`)} select ${sql.join(Object.values(fields), sql`,`)}
from ${table} from ${table}
${buildUserConditions(search, hideAdminUser, isCaseSensitive)} ${buildUserConditions(search, hideAdminUser, isCaseSensitive)}
order by ${fields.createdAt} desc
limit ${limit} limit ${limit}
offset ${offset} offset ${offset}
` `