Diogo
Diogo
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
No description
8 replies
TTCTheo's Typesafe Cult
Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
it only solves the type error, if i build the project it throws an error
8 replies
TTCTheo's Typesafe Cult
Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
but i am not sure if its the right way to do it
8 replies
TTCTheo's Typesafe Cult
Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
No description
8 replies
TTCTheo's Typesafe Cult
Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
authoptions import { env } from "@/env.mjs"; import { db } from "@/server/db"; import { PrismaAdapter } from "@auth/prisma-adapter"; import { getServerSession, type DefaultSession, type NextAuthOptions, } from "next-auth"; import GithubProvider from "next-auth/providers/github"; import GoogleProvider from "next-auth/providers/google"; import { redirect } from "next/navigation"; declare module "next-auth" { interface Session { user: DefaultSession["user"] & { id: string; }; } } export type AuthSession = { session: { user: { id: string; name?: string; email?: string; image?: string; }; } | null; }; export const authOptions: NextAuthOptions = { adapter: PrismaAdapter(db), callbacks: { session: ({ session, user }) => { session.user.id = user.id; return session; }, }, providers: [ GoogleProvider({ clientId: env.GOOGLE_CLIENT_ID, clientSecret: env.GOOGLE_CLIENT_SECRET, }), GithubProvider({ clientId: env.GITHUB_CLIENT_ID, clientSecret: env.GITHUB_CLIENT_SECRET, }), ], }; export const getUserAuth = async () => { const session = await getServerSession(authOptions); return { session } as AuthSession; }; export const checkAuth = async () => { const { session } = await getUserAuth(); if (!session) redirect("/api/auth/signin"); };
8 replies
TTCTheo's Typesafe Cult
Created by Diogo on 11/17/2023 in #questions
Unsafe assignment of an `any` value. on Auth Options
Anyone knows how to solve these?
8 replies
TTCTheo's Typesafe Cult
Created by test_1 on 6/16/2023 in #questions
i want to display amount of comments a post has before fetching all the comments
6 replies
TTCTheo's Typesafe Cult
Created by test_1 on 6/16/2023 in #questions
i want to display amount of comments a post has before fetching all the comments
the output should look like these if im correct:
{ id: 1, _count: { comments: 39 } },
{ id: 2, _count: { comments: 12} },
{ id: 1, _count: { comments: 39 } },
{ id: 2, _count: { comments: 12} },
6 replies
TTCTheo's Typesafe Cult
Created by test_1 on 6/16/2023 in #questions
i want to display amount of comments a post has before fetching all the comments
try this:
const commentsCount = await prisma.post.findMany({
include: {
_count: {
select: { comments: true },
},
},
})
const commentsCount = await prisma.post.findMany({
include: {
_count: {
select: { comments: true },
},
},
})
6 replies
TTCTheo's Typesafe Cult
Created by hyperzone on 6/16/2023 in #questions
Caching ORM response in Next app dir
could it bc youre using a a const and not a function like in the docs?
4 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
7 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
something like this
7 replies
TTCTheo's Typesafe Cult
Created by .traevelliath on 6/14/2023 in #questions
Prisma query multiple tables
const user = await prisma.user.findFirst({
include: {
widthdraws: true,
},
})
const user = await prisma.user.findFirst({
include: {
widthdraws: true,
},
})
7 replies
TTCTheo's Typesafe Cult
Created by Ayato on 6/14/2023 in #questions
YouTube Data API
never worked with youtube api
7 replies
TTCTheo's Typesafe Cult
Created by Ayato on 6/14/2023 in #questions
YouTube Data API
no idea kkkkk
7 replies
TTCTheo's Typesafe Cult
Created by Ayato on 6/14/2023 in #questions
YouTube Data API
dont forget the api key
7 replies
TTCTheo's Typesafe Cult
Created by Lopen on 6/5/2023 in #questions
drizzle orm is overhyped
showing how fast it is
68 replies
TTCTheo's Typesafe Cult
Created by Lopen on 6/5/2023 in #questions
drizzle orm is overhyped
he's agreeing width you and showing an example of a query with kysely ( that took 4ms )
68 replies
TTCTheo's Typesafe Cult
Created by fasm on 5/23/2023 in #questions
Clerk: auth() was called but it looks like you aren't using authMiddleware in your middleware file
Try moving the middleware file outside the src folder
13 replies