Add stepper

This commit is contained in:
Owen Schwartz 2024-10-14 19:30:38 -04:00
parent b67e03677c
commit 0599421975
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
9 changed files with 365 additions and 27 deletions

View file

@ -3,7 +3,7 @@ import db from "@server/db";
import { hash } from "@node-rs/argon2";
import HttpCode from "@server/types/HttpCode";
import { z } from "zod";
import { users } from "@server/db/schema";
import { userActions, users } from "@server/db/schema";
import { fromError } from "zod-validation-error";
import createHttpError from "http-errors";
import response from "@server/utils/response";
@ -18,6 +18,7 @@ import {
generateSessionToken,
serializeSessionCookie,
} from "@server/auth";
import { ActionsEnum } from "@server/auth/actions";
export const signupBodySchema = z.object({
email: z.string().email(),
@ -100,6 +101,13 @@ export async function signup(
dateCreated: moment().toISOString(),
});
// give the user their default permissions:
// await db.insert(userActions).values({
// userId: userId,
// actionId: ActionsEnum.createOrg,
// orgId: null,
// });
const token = generateSessionToken();
await createSession(token, userId);
const cookie = serializeSessionCookie(token);