UNPKG

mlgta

Version:

Can log in via google, x, discord. ![alt text](https://raw.githubusercontent.com/verazza/branding/refs/heads/master/repo/mlgta/login_form.png) After login successfully, redirecting. ![alt text](https://raw.githubusercontent.com/verazza/branding/refs

28 lines (23 loc) 552 B
import knex from '../config/knex'; const TABLE_NAME: string = "users"; async function findById(userId: number) { const user = await where({ id: userId }); if (user == null) { throw new Error('User not found'); } return { ...user }; } async function where(condition: Record<string, any>) { return await knex(TABLE_NAME) .where(condition) //.debug(true) // for debug option .then((results) => { if (results.length == 0) { return null; } return results[0]; }); } export default { findById, };