code_sanchu
code_sanchu
TTCTheo's Typesafe Cult
Created by code_sanchu on 3/30/2023 in #questions
Keep order of a list of items in prisma
I have an app that allows the user to reorder a list of items, with each item being a prisma model. To facilitate this, I have an index field that I can then order the items by when fetching. The problem with this approach is I have to update each item every time I delete or add an item. I'm wandering if: - there's a built-in way to do this in prisma? - is there a better way of doing this myself? My model looks something like: model Album { id String @id index Int title String? }
10 replies
TTCTheo's Typesafe Cult
Created by code_sanchu on 3/24/2023 in #questions
How to automatically add type prefix to type imports?
Hi all, is there a way to automatically add the type prefix for type imports in vscode? Either on auto-import or with prettier/eslint formmating. I like the rule and don't want to remove it, it's just a bit annoying to have to manually add 'type' on each type import.
3 replies
TTCTheo's Typesafe Cult
Created by code_sanchu on 3/1/2023 in #questions
Prisma Schema Single Type
Hi fellow cult members. I want to create a model for a 'single' type (not sure if that's the correct term) in my Prisma schema. My understanding is a Prisma Model is something that can be created multiple times. I don't want this. I want just a single instance of a model. It'll be something like: model PageText { title String description String } Is this possible?
18 replies