kacakthegreat
kacakthegreat
TTCTheo's Typesafe Cult
Created by kacakthegreat on 9/19/2023 in #questions
Any known projects or websites using T3 stack?
I remembered Theo mentioned about the cost of lambda can skyrocket so i'm just wondering whether is it still a good idea to do a full stack with T3 or just Next.js + custom backend I'm worried about the cost only for the time being, any opinions are welcome. Thanks!
7 replies
TTCTheo's Typesafe Cult
Created by kacakthegreat on 12/7/2022 in #questions
Anyone can share their package.json for deploying prisma to vercel?
I'm looking at this tutorial https://www.prisma.io/docs/guides/deployment/deployment-guides/deploying-to-vercel#vercel-build-hook and it says to use vercel-build instead build My goal is to apply migration whenever i push to github and vercel (both for staging and production) any help would be appreciated. Thanks!
3 replies
TTCTheo's Typesafe Cult
Created by kacakthegreat on 11/30/2022 in #questions
How to properly redirect to different page using trpc?
export default function Post() { const { id } = useRouter().query; const postByIdQuery = trpc.post?.byId.useQuery({ userId: session?.user?.id, id: String(id), }); const { data: post } = postByIdQuery if (!post) { return <Error statusCode=404> } return ( <h1>{post.title}</h1> <p>{post.desc}</p> ) } Previously i use the getServersideProps and if the api returns nothing then simply redirect the above method does not render the 404 page for some reason
124 replies
TTCTheo's Typesafe Cult
Created by kacakthegreat on 11/13/2022 in #questions
for next-auth how to include a different model to a User Object
user {
id: 'cla6t4y450000rpsvp6eijgdh',
name: 'Batman',
email: 'batman@gmail.com',
emailVerified: null,
image: 'https://lh3.googleusercontent.com/a/ALm5wu0MqN4wvAyLfGEz5Q6JlttF_yrj5Mti4NUWX-qh=s96-c',
createdAt: 2022-11-07T13:16:46.132Z,
updatedAt: 2022-11-07T13:16:46.132Z
}
user {
id: 'cla6t4y450000rpsvp6eijgdh',
name: 'Batman',
email: 'batman@gmail.com',
emailVerified: null,
image: 'https://lh3.googleusercontent.com/a/ALm5wu0MqN4wvAyLfGEz5Q6JlttF_yrj5Mti4NUWX-qh=s96-c',
createdAt: 2022-11-07T13:16:46.132Z,
updatedAt: 2022-11-07T13:16:46.132Z
}
What i want
user {
id: 'cla6t4y450000rpsvp6eijgdh',
name: 'Batman',
email: 'batman@gmail.com',
emailVerified: null,
image: 'http://example.com',
teacher: {} <----- another object
createdAt: 2022-11-07T13:16:46.132Z,
updatedAt: 2022-11-07T13:16:46.132Z
}
user {
id: 'cla6t4y450000rpsvp6eijgdh',
name: 'Batman',
email: 'batman@gmail.com',
emailVerified: null,
image: 'http://example.com',
teacher: {} <----- another object
createdAt: 2022-11-07T13:16:46.132Z,
updatedAt: 2022-11-07T13:16:46.132Z
}
so that i can attach the user. teacher in the
async session({ session, user }) {
if (session.user) {
session.user.id = user.id;
session.user.teacher = user.teacher;
}

return session;
},
async session({ session, user }) {
if (session.user) {
session.user.id = user.id;
session.user.teacher = user.teacher;
}

return session;
},
The goal is to use that teacher object to verify certain things. Thanks
78 replies