📦 EqualifyEverything / equalify

📄 checkIfUserExists.ts · 12 lines
1
2
3
4
5
6
7
8
9
10
11
12import { db, event } from '#src/utils'

export const checkIfUserExists = async () => {
    await db.connect();
    const userExists = (await db.query({
        text: `SELECT "id" FROM "users" WHERE "email"=$1`,
        values: [event.body.email],
    })).rows?.[0]?.id;
    await db.clean();

    return { userExists };
}