hyperzone
Explore posts from serversCCConvex Community
•Created by hyperzone on 4/7/2024 in #support-community
Deleting an image when deleting an item
Say I have this part in the schema(using ents):
do I have to delete the image "manually" using
or is there a way to make it happen automatically when an item gets deleted?
2 replies
CCConvex Community
•Created by hyperzone on 3/28/2024 in #support-community
'remove' in convex-ents patch not working
I'm reposting this from my old thread that didn't get any replies:
Creating many to many ents works (using add inside a patch), but remove doesn't work on both sides:
the other side also doesn't work which is - getX each item and remove [category_.id] in a patch call
this is the relevant part of the schema:
I'm not getting errors or anything, it just executes the mutation but the relevant categories_to_items document doesn't get deleted
10 replies
CCConvex Community
•Created by hyperzone on 3/10/2024 in #support-community
delete many in convex-ents
I'm trying to delete multiple ents by IDs but for some reason there is no .delete on Ents returned from getMany unlike an Ent returned from .get.
What is the best way to delete using an array of ids?
11 replies
CCConvex Community
•Created by hyperzone on 3/6/2024 in #support-community
using zCustomMutation with convex-ents
How can I create a zMutation I can use from a mutation with a customCtx? I'm using this from the saas-starter:
I don't know if it's correct but I'm trying to export this:
but I'm getting a gigantic TS error and I'm pretty sure it's because it expects the db property on the context
9 replies
CCConvex Community
•Created by hyperzone on 3/1/2024 in #support-community
Linking teams with Clerk organizations
I've looked at the saas-starter https://github.com/xixixao/saas-starter, and I'm looking to do something similiar and I was wondering, should I create a Clerk organization for each team? Instead of handling the invites by myself like in the example I could use their org features one of them being the invites and etc
Are there downsides to this approach?
10 replies
CCConvex Community
•Created by hyperzone on 2/27/2024 in #support-community
Using clerk sdk inside a mutation
I might be doing this wrong so if so I hope someone corrects me
I'm trying to create a clerk organization inside a mutation because I also create a document with additional fields I need to be linked to the organization. I attempt to do that using the clerkClient from @clerk/clerk-sdk-node but I get Node errors when importing 'dotenv/config' at the top of the file. What is the correct way to do that?
7 replies
CCConvex Community
•Created by hyperzone on 2/24/2024 in #support-community
i18n database schema
Hi everyone! I'm working on a project where users can create items (like 'hammer' and 'screwdriver) and provide translations for these items in multiple languages (English, German, French etc). When a user selects their preferred site language, the item should be displayed in that language. I'm trying to figure out the best way to structure my Convex schema to achieve this multi-language thing. Could anyone share insights or examples on how to implement a schema that stores translations in this way? Any guidance or references to similar implementations in Convex would be really helpful!
2 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 6/16/2023 in #questions
Caching ORM response in Next app dir
I've asked this question on the Next.js discord but wasn't able to get a solid answer, hoping someone here knows
What is the recommended way to cache something like a prisma response?
I have a page.tsx and in it I defined a revalidate variable and I have a getFirstPost function that fetches the first post:
in the page function I go
and then render the data. Even tho I defined the revalidate variable every time I refresh the page (on dev and on prod) I see prisma making a new query in console:
Does the cache get wiped on refresh or am I doing something wrong here?
4 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 2/12/2023 in #questions
Prisma middleware delete
I have 3 models - Category, Product and Color.
Whenever a category gets deleted, its products also get deleted(Cascade) and each product's colors get deleted.
Each color has an image saved in a bucket that I want to delete whenever a Color gets deleted, how can I write an event or middleware that get triggered whenever a Color gets deleted whenever a Category or Product get deleted? I tried doing $use but when deleting a Product I don't get params related to the colors
11 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 2/7/2023 in #questions
Parent model in child model in Prisma?
Sorry for the confusing title, I'm looking to do something like this:
5 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 12/28/2022 in #questions
Best way to implement a cart?
I've implemented a cart using jotai's atomWithStorage to save the items in lcoalStorage, but I was wondering if I should store the cart in the server instead?
In this specific app only logged in users can access the store. Are there other better ways of implementing a cart?
44 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 12/23/2022 in #questions
A very basic thing that can not be done right using NextAuth?
I have an app that uses DB sessions. I've got an /admin route that I want to protect using a Next.js middleware by checking the user's role, but I can't do this because I don't have access to 'user' obj.
How can I do this right without having to copy-paste a block of getServerSideProps?
56 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 12/17/2022 in #questions
Signin in turborepo t3
I'm running a t3 turborepo that has 2 apps, 1 admin (CMS) and the client next app. The login is done using credentials, how can I do so that when you login in the admin app you get redirected to localhost:3001/ (admin), and when you login in the client app you get redirected to localhost:3000/?
Currently when I login in admin I get redirected to the client /
12 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 12/15/2022 in #questions
Next.js middleware with NextAuth server session?
What is the best way to write a Next.js middleware (middleware.ts) that redirects to /login if the user is not logged in? I'm using the t3 stack with db sessions
3 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 12/10/2022 in #questions
Custom admin CMS
Hey, say I have an app and I need a custom CMS I write to control its content, should I create a protected route in that app that leads to the CMS or should I go ct3app-turborepo and have 1 Next app and 1 Next admin app?
3 replies
TTCTheo's Typesafe Cult
•Created by hyperzone on 12/3/2022 in #questions
Using a CMS with the t3 stack?
Say I'm building an e-commerce site and I need to give the client the ability to add/delete/edit products, should I use a CMS or just write this on my own? I looked into Sanity, but it looks like everything defined there is fetched via a REST api so I basically lose all the meaning of an end-to-end typesafety and type completions
16 replies