fix(admin): workspace_billing_history user column + rbac listUsers pagination params order
This commit is contained in:
parent
623faf8c55
commit
c41f4efc04
@ -66,7 +66,7 @@ export async function POST(
|
|||||||
// Insert billing history
|
// Insert billing history
|
||||||
await client.query(
|
await client.query(
|
||||||
`INSERT INTO workspace_billing_history
|
`INSERT INTO workspace_billing_history
|
||||||
(workspace_id, user, amount, reason, extra, currency)
|
(workspace_id, user_id, amount, reason, extra, currency)
|
||||||
VALUES ($1, NULL, $2, 'admin_credit', $3, $4)`,
|
VALUES ($1, NULL, $2, 'admin_credit', $3, $4)`,
|
||||||
[id, amount, JSON.stringify({ description: description || "Admin 手动充值" }), currency]
|
[id, amount, JSON.stringify({ description: description || "Admin 手动充值" }), currency]
|
||||||
);
|
);
|
||||||
|
|||||||
@ -201,15 +201,12 @@ export async function listUsers(
|
|||||||
const pageSize = options.pageSize ?? 20;
|
const pageSize = options.pageSize ?? 20;
|
||||||
const offset = (page - 1) * pageSize;
|
const offset = (page - 1) * pageSize;
|
||||||
|
|
||||||
const params: unknown[] = [pageSize, offset];
|
const params: unknown[] = [
|
||||||
let whereClause = "";
|
...(options.search ? [`%${options.search}%`] : []),
|
||||||
let paramIdx = 3;
|
pageSize,
|
||||||
|
offset,
|
||||||
if (options.search) {
|
];
|
||||||
whereClause = `WHERE username ILIKE $1`;
|
const whereClause = options.search ? `WHERE username ILIKE $1` : "";
|
||||||
params.unshift(`%${options.search}%`);
|
|
||||||
paramIdx = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
const countParams = options.search ? [`%${options.search}%`] : [];
|
const countParams = options.search ? [`%${options.search}%`] : [];
|
||||||
const countResult = await query<{ count: string }>(
|
const countResult = await query<{ count: string }>(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user