feat: add Clerk Auth #43

Merged
piopi merged 4 commits from please-god-help-us into master 2025-01-04 21:24:47 -05:00
8 changed files with 46 additions and 34 deletions
Showing only changes of commit dd0d3126fe - Show all commits

BIN
bun.lockb

Binary file not shown.

View file

@ -3,10 +3,10 @@
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "bun validate-env && bun database:up && bun prisma:generate && bun prisma:push && vite dev",
"dev": "bun validate-env && bun database:up && bun prisma:generate && vite dev",
"build": "vite build",
"build-storybook": "storybook build",
"database:up": "docker compose -p hestia -f devops/docker-compose.dev.yml up -d && docker compose -p hestia -f devops/docker-compose.dev.yml -f devops/docker-compose.wait.yml run --rm wait -c hestia-database:5432",
"database:up": "docker compose -p hestia -f devops/docker-compose.dev.yml up -d && docker compose -p hestia -f devops/docker-compose.dev.yml -f devops/docker-compose.wait.yml run --rm wait -c hestia-database:5432 && bun prisma:push",
"database:down": "docker compose -p hestia -f devops/docker-compose.dev.yml down",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
@ -65,8 +65,7 @@
"vitest": "^2.0.4"
},
"dependencies": {
"@clerk/clerk-js": "^5.43.4",
"@clerk/express": "^1.3.31",
"@clerk/backend": "1.21.4",
"@clerk/themes": "^2.2.3",
"@flaticon/flaticon-uicons": "^3.3.1",
"@inlang/paraglide-sveltekit": "^0.15.0",

View file

@ -1,18 +0,0 @@
/*
Warnings:
- You are about to drop the column `password` on the `User` table. All the data in the column will be lost.
- You are about to drop the `Session` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey";
-- DropIndex
DROP INDEX "User_email_key";
-- AlterTable
ALTER TABLE "User" DROP COLUMN "password";
-- DropTable
DROP TABLE "Session";

View file

@ -1,8 +0,0 @@
/*
Warnings:
- Added the required column `clerkId` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "User" ADD COLUMN "clerkId" TEXT NOT NULL;

View file

@ -0,0 +1,24 @@
/*
Warnings:
- You are about to drop the column `password` on the `User` table. All the data in the column will be lost.
- You are about to drop the `Session` table. If the table is not empty, all the data it contains will be lost.
- A unique constraint covering the columns `[clerkId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Added the required column `clerkId` to the `User` table without a default value. This is not possible if the table is not empty.
*/
-- DropForeignKey
ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey";
-- DropIndex
DROP INDEX "User_email_key";
-- AlterTable
ALTER TABLE "User" DROP COLUMN "password",
ADD COLUMN "clerkId" TEXT NOT NULL;
-- DropTable
DROP TABLE "Session";
-- CreateIndex
CREATE UNIQUE INDEX "User_clerkId_key" ON "User"("clerkId");

View file

@ -16,7 +16,7 @@ datasource db {
model User {
id String @id @default(uuid())
clerkId String
clerkId String @unique
email String?
name String

View file

@ -1,15 +1,16 @@
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
import { redirect, type ServerLoadEvent } from '@sveltejs/kit';
import { prisma } from '../prisma';
import { createClerkClient } from '@clerk/express';
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
import { createClerkClient } from '@clerk/backend';
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
import { CLERK_SECRET_KEY } from '$env/static/private';
import { clerkClient } from 'clerk-sveltekit/server';
import { logger } from '$lib/server/logger';
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
const clerkSessionClient = createClerkClient({
secretKey: CLERK_SECRET_KEY,
});
export async function validateSession({ locals }: ServerLoadEvent) {
if (!locals.auth.userId) {
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
if (!locals.auth.userId || !locals.auth.sessionId) {
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
return redirect(307, '/login');
}
@ -28,13 +29,24 @@ export async function validateSession({ locals }: ServerLoadEvent) {
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
});
if (!user) {
if (clerkUser.emailAddresses.length === 0) {
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
logger.error('User has no email address');
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
await clerkSessionClient.sessions.revokeSession(locals.auth.sessionId);
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
return redirect(307, '/login');
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
}
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
user = await prisma.user.create({
data: {
clerkId: clerkUser.id,
email: clerkUser.emailAddresses[0].emailAddress,
name: clerkUser.fullName ?? 'Ben the Man',
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
name: clerkUser.fullName ?? '',
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
},
});
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
if (clerkUser.fullName === null) {
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
logger.error('User has no name');
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
}
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
}
return {

BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema
BenjaminPalko commented 2025-01-02 13:52:59 -05:00 (Migrated from github.com)
Review

???

???
piopi commented 2025-01-02 13:57:40 -05:00 (Migrated from github.com)
Review

don't like that 😉 ?

don't like that 😉 ?
BenjaminPalko commented 2025-01-02 16:25:24 -05:00 (Migrated from github.com)
Review

Why are we using clerk/express?

Why are we using clerk/express?
piopi commented 2025-01-02 20:04:05 -05:00 (Migrated from github.com)
Review

Because clerk is deprecating the nodejs package and is recommending to use this one for backend

Because clerk is deprecating the nodejs package and is recommending to use this one for backend
BenjaminPalko commented 2025-01-02 20:04:47 -05:00 (Migrated from github.com)
Review

WE ARE PROFESSIONALS HERE MOE

WE ARE PROFESSIONALS HERE MOE
piopi commented 2025-01-02 20:09:50 -05:00 (Migrated from github.com)
Review

I will change it to an empty string, I thought we were fun professionals

I will change it to an empty string, I thought we were fun professionals
BenjaminPalko commented 2025-01-02 21:03:38 -05:00 (Migrated from github.com)
Review

is the user fullName optional...? I'd rather not default to a magic string

is the user fullName optional...? I'd rather not default to a magic string
BenjaminPalko commented 2025-01-02 21:04:40 -05:00 (Migrated from github.com)
Review

If there is a situation where name will be empty/undefined consider changing the db schema

If there is a situation where name will be empty/undefined consider changing the db schema

View file

@ -26,6 +26,9 @@
return;
}
BenjaminPalko commented 2025-01-02 14:03:24 -05:00 (Migrated from github.com)
Review

Can you explain what this is doing?

Can you explain what this is doing?
piopi commented 2025-01-02 20:05:44 -05:00 (Migrated from github.com)
Review

I will add some comment, it is automatically selecting the first organization that the user is part of, if you don't do that the user get login without an organization

I will add some comment, it is automatically selecting the first organization that the user is part of, if you don't do that the user get login without an organization
BenjaminPalko commented 2025-01-03 10:57:36 -05:00 (Migrated from github.com)
Review

It would be better to do this check on the server to prevent anything from being leaked to the client side, you can use +layout.server.ts. We could throw an error, 403 - User does not belong to a Tenant

It would be better to do this check on the server to prevent anything from being leaked to the client side, you can use `+layout.server.ts`. We could throw an error, `403 - User does not belong to a Tenant`
piopi commented 2025-01-03 10:59:11 -05:00 (Migrated from github.com)
Review

I am already logging out the user on the backend, this is only selecting an org for him

I am already logging out the user on the backend, this is only selecting an org for him
BenjaminPalko commented 2025-01-03 10:59:12 -05:00 (Migrated from github.com)
Review

Also, modify the error page to contain a signout button, perhaps under certain http codes (like 403)

Also, modify the error page to contain a signout button, perhaps under certain http codes (like 403)
/**
* Set the active organization to the first one in the list, this is temporary until we let the user choose the organization
*/
try {
// Set the active organization to the first one in the list
await clerk.setActive({