Fuzbo
Fuzbo
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Fuzbo on 4/14/2023 in #questions
tRPC but just the React Query abstraction?
Not quite, but I might look into doing that still. I'm okay with the loose safety between the NextJS backend and the Python backend, as I'm using Zod on the NextJS backend still to validate the request inputs and response from the Python backend. The main thing I want is basically to just be able to use TRPC for the react query abstraction so I can just write the one fetch call I want to make to the Python backend, and then automatically have things like trpc.foo.bar.useQuery() and utils.foo.bar.prefetch() available without having to write a bunch of redundant code.
7 replies
TTCTheo's Typesafe Cult
Created by packofm&ms on 4/15/2023 in #questions
Want all records to be deleted given a specified datetime
Easiest way IMO would be to setup your database queries such that any posts with a deleteAt value after the current time are not queried from your table, so any user-facing behavior will make them appear as deleted. This could also be useful if a user wants to restore something they marked to delete after a while, or view a history of all posts (deleted & non-deleted). If you really want these posts to be deleted from your table, I would still do the above, but also setup a cron job to just delete any posts that have a deleteAt value after the current time. If you're using vercel, I believe they added support for crons like that: https://vercel.com/blog/cron-jobs. This would not delete the post exactly at the time specified by the user, but with the query restriction AND the cron job, it would effectively accomplish what you're looking for.
12 replies