ejoo
ejoo
TTCTheo's Typesafe Cult
Created by Bartholomeas on 11/21/2023 in #questions
How to invalidate query in T3?
const utils = api.useUtils();
utils.user.getMe.invalidate();
const utils = api.useUtils();
utils.user.getMe.invalidate();
13 replies
DTDrizzle Team
Created by SteveS on 7/13/2023 in #help
defaultNow(), onUpdateNow() not available on the datetime data type
I guess postgre does not support this
4 replies
DTDrizzle Team
Created by philbookst on 5/11/2023 in #help
uuid missing in drizzle-orm/mysql-core?
Why is it not recommended?
12 replies
DTDrizzle Team
Created by Suji on 5/30/2023 in #help
can you Infer relations?
I do it likes this
type Post = InferModel<typeof schema.posts> & {author: InferModel<typeof schema.users>} & {likes: InferModel<typeof schema.likes>[]};
type Post = InferModel<typeof schema.posts> & {author: InferModel<typeof schema.users>} & {likes: InferModel<typeof schema.likes>[]};
4 replies
DTDrizzle Team
Created by BinaryArtifex on 7/31/2023 in #help
onDuplicateKeyUpdate ???
.onDuplicateKeyUpdate({
set: {
description: item.description
},
})
.onDuplicateKeyUpdate({
set: {
description: item.description
},
})
2 replies
DTDrizzle Team
Created by philbookst on 5/11/2023 in #help
uuid missing in drizzle-orm/mysql-core?
first importimport { sql } from "drizzle-orm"; then add
.default(sql`(uuid())`)
.default(sql`(uuid())`)
12 replies
DTDrizzle Team
Created by interdrifter on 7/2/2023 in #help
How to properly do foreign keys in schema with PlanetScale?
https://planetscale.com/docs/learn/operating-without-foreign-key-constraints
import { pgTable, serial, text, integer } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';

export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name'),
});

export const usersRelations = relations(users, ({ many }) => ({
posts: many(posts),
}));

export const posts = pgTable('posts', {
id: serial('id').primaryKey(),
content: text('content'),
authorId: integer('author_id'),
});

export const postsRelations = relations(posts, ({ one }) => ({
author: one(users, {
fields: [posts.authorId],
references: [users.id],
}),
}));
import { pgTable, serial, text, integer } from 'drizzle-orm/pg-core';
import { relations } from 'drizzle-orm';

export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: text('name'),
});

export const usersRelations = relations(users, ({ many }) => ({
posts: many(posts),
}));

export const posts = pgTable('posts', {
id: serial('id').primaryKey(),
content: text('content'),
authorId: integer('author_id'),
});

export const postsRelations = relations(posts, ({ one }) => ({
author: one(users, {
fields: [posts.authorId],
references: [users.id],
}),
}));
3 replies
TTCTheo's Typesafe Cult
Created by Trader Launchpad on 5/11/2023 in #questions
How do i properly set up nextjs external pages/api/* routes using trpc?
lucky for the webhook secret key
19 replies
TTCTheo's Typesafe Cult
Created by Trader Launchpad on 5/11/2023 in #questions
How do i properly set up nextjs external pages/api/* routes using trpc?
And i think external api doesn’t work on protected routes. i have clerk user event webhook set up and it only works on public procedure
19 replies
TTCTheo's Typesafe Cult
Created by plyglt on 12/3/2022 in #questions
Optimistic Updates with TRPC (react-query)?
import api from t3 utils
const ctx = api.useContext();

ctx.word.update.useMutation({
onMutate: () => {
const params = ['text', 'getOne']
await ctx.user.getByIDorWhateverYouCallItInYourProject.cancel();
const previousText = ctx.user.getByIDorWhateverYouCallItInYourProject.getData(params);
if (!previousText) return;
ctx.user.getByIDorWhateverYouCallItInYourProject.setData(params, old => {
//...
// return..
});
}
})
const ctx = api.useContext();

ctx.word.update.useMutation({
onMutate: () => {
const params = ['text', 'getOne']
await ctx.user.getByIDorWhateverYouCallItInYourProject.cancel();
const previousText = ctx.user.getByIDorWhateverYouCallItInYourProject.getData(params);
if (!previousText) return;
ctx.user.getByIDorWhateverYouCallItInYourProject.setData(params, old => {
//...
// return..
});
}
})
4 replies
TTCTheo's Typesafe Cult
Created by Trader Launchpad on 5/11/2023 in #questions
How do i properly set up nextjs external pages/api/* routes using trpc?
19 replies
TTCTheo's Typesafe Cult
Created by frenetic.ts on 4/16/2023 in #questions
Webhooks (localhost) in Clerk fails for the most part
ngrok works fine for me. I have tried using https://webhookthing.com/ by theo it works great on local without a tunnel. but can't figure out what header to set for it to work with clerk secret token verification. any advice for this @jamesperkins
14 replies