MCPcopy
hub / github.com/graphile/starter / addEmail

Function addEmail

@app/db/__tests__/app_public/tables/user_emails.test.ts:12–28  ·  view source on GitHub ↗
(client: PoolClient, email: string, verified = false)

Source from the content-addressed store, hash-verified

10} from "../../helpers";
11
12async function addEmail(client: PoolClient, email: string, verified = false) {
13 const {
14 rows: [row],
15 } = await client.query(
16 `insert into app_public.user_emails (email) values ($1) returning *`,
17 [email]
18 );
19 if (verified) {
20 await asRoot(client, () =>
21 client.query(
22 "update app_public.user_emails set is_verified = true where id = $1",
23 [row.id]
24 )
25 );
26 }
27 return row;
28}
29
30it("can add an email (unverified), receive code, verify email (and marks account as verified)", () =>
31 withUserDb(async (client, user) => {

Callers 2

AddEmailFormFunction · 0.85

Calls 1

asRootFunction · 0.90

Tested by

no test coverage detected