code_sanchu
TTCTheo's Typesafe Cult
•Created by braincel on 4/14/2023 in #questions
Supabase + Next (help with DB rules)
Hi. Bit of a noob myself here. Couldn't you just provide any secure key through .env through the web client and check it exists on the server?
3 replies
TTCTheo's Typesafe Cult
•Created by code_sanchu on 3/30/2023 in #questions
Keep order of a list of items in prisma
Thanks for the responses. I did a bit more research and found another method which stores a foreign key reference for the next record (https://stackoverflow.com/questions/4115053/how-to-keep-ordering-of-records-in-a-database-table). This seems like a good solution since you only have to update one record with each add and delete and 2 with a reorder. I'll try this i think, though I also like @zthomas's solution.
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?
Thanks. I used the following vscode setting to apply all eslint rules on save:
"editor.codeActionsOnSave": { "source.fixAll.eslint": true }
3 replies
TTCTheo's Typesafe Cult
•Created by code_sanchu on 3/1/2023 in #questions
Prisma Schema Single Type
I think the page type is good idea. I'm sure I'll come to a decent workaround, it's just I was wandering if the 'single type' was possible. I've used the headless CMS "Strapi" before and they had it on there, but it's not a big deal really. Thanks for your help.!
18 replies
TTCTheo's Typesafe Cult
•Created by code_sanchu on 3/1/2023 in #questions
Prisma Schema Single Type
I could make fields optional, but then my model wouldn't be typed as strongly as is ideal. If I was on the about page and querying my data, I'd have to assert the value of the data which seems like it should be unnecessary.
18 replies
TTCTheo's Typesafe Cult
•Created by code_sanchu on 3/1/2023 in #questions
Prisma Schema Single Type
The shape of the model changes. For example: there's an 'albums' page which has a title and subtitle; there's also an about page which has a body of text, links, and more.
18 replies
TTCTheo's Typesafe Cult
•Created by code_sanchu on 3/1/2023 in #questions
Prisma Schema Single Type
I could just create a
Model
for AllPagesText
with a single entry but would prefer not to do this.18 replies
TTCTheo's Typesafe Cult
•Created by code_sanchu on 3/1/2023 in #questions
Prisma Schema Single Type
Sure. I'm building a cms for a site that has normal collections, e.g. images; it also has pages with various text elements on that I want the user to be able update themselves. This text changes page to page so I can't create a uniform model for
PageText
.18 replies
TTCTheo's Typesafe Cult
•Created by code_sanchu on 3/1/2023 in #questions
Prisma Schema Single Type
Apologies for the lack of clarity, though I think you've understood what I want to do. My prisma schema, (which describes my db) has, for example, a model for a
User
, of which there can be many of. I want an entry/model which there can only be one of. I only ever want to have one of e.g. AllPagesText
for the whole app/database. I hope this makes sense lol .18 replies