MadMax
MadMax
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Mike Pollard on 1/23/2024 in #questions
Is the backend of this stack a lambdalith (lambda monolith) when hosted serverless?
all the stuff is done in a one lambda api pages everything
6 replies
TTCTheo's Typesafe Cult
Created by JulieCezar on 1/26/2024 in #questions
Relations using Drizzle and Planetscale
firstly planetscale does support foreign key constraints for relations you have to define them both ways user -> many posts post -> one user that way its kind of guranteed that you are getting and inserting right data depends upon if you did it correctly all your other points relate to data access patterns which is upon you to implement correctly read drizzle docs they are great
5 replies
TTCTheo's Typesafe Cult
Created by Chen on 1/18/2024 in #questions
Running TSC on tRPC client runs type checking on tRPC server
@Scythern you should create separate files for handler and router and router file should only export types nothing else like
const appRouter = router()
export type AppRouter = typeof appRouter;
const appRouter = router()
export type AppRouter = typeof appRouter;
3 replies
TTCTheo's Typesafe Cult
Created by MadMax on 11/27/2023 in #questions
Getting role undefined in session even though it exist in db
at drizzle adapter im getting
ts Type AdapterUser
is not assignable to type Awaitable<AdapterUser>
Property 'role' is missing in type

ts Type AdapterUser
is not assignable to type Awaitable<AdapterUser>
Property 'role' is missing in type

7 replies
TTCTheo's Typesafe Cult
Created by MadMax on 11/27/2023 in #questions
Getting role undefined in session even though it exist in db
export const users = mysqlTable(
"user",
{
id: varchar("id", { length: 255 }).notNull().primaryKey(),
name: varchar("name", { length: 255 }),
email: varchar("email", { length: 255 }).notNull(),
emailVerified: timestamp("emailVerified", {
mode: "date",
fsp: 3,
}).default(sql`CURRENT_TIMESTAMP(3)`),
image: varchar("image", { length: 255 }),
tenantId: varchar("tenantId", { length: 255 }),
role: mysqlEnum("role", ["user", "admin"]).default("admin"),
},
(user) => ({
emailIdx: index("email_idx").on(user.email),
tenantIdIdx: index("tenantId_idx").on(user.tenantId),
}),
);
export const users = mysqlTable(
"user",
{
id: varchar("id", { length: 255 }).notNull().primaryKey(),
name: varchar("name", { length: 255 }),
email: varchar("email", { length: 255 }).notNull(),
emailVerified: timestamp("emailVerified", {
mode: "date",
fsp: 3,
}).default(sql`CURRENT_TIMESTAMP(3)`),
image: varchar("image", { length: 255 }),
tenantId: varchar("tenantId", { length: 255 }),
role: mysqlEnum("role", ["user", "admin"]).default("admin"),
},
(user) => ({
emailIdx: index("email_idx").on(user.email),
tenantIdIdx: index("tenantId_idx").on(user.tenantId),
}),
);
7 replies