0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00
logto/packages/core/src/queries/user.ts

14 lines
403 B
TypeScript
Raw Normal View History

import { UserDBEntry, Users } from '@logto/schemas';
import { sql } from 'slonik';
import pool from '../database/pool';
import { convertToIdentifiers } from '../database/utils';
const { table, fields } = convertToIdentifiers(Users);
export const findUserById = async (id: string) =>
pool.one<UserDBEntry>(sql`
select ${sql.join(Object.values(fields), sql`,`)}
from ${table}
where id=${id}
`);