om3r
TTCTheo's Typesafe Cult
•Created by om3r on 11/20/2024 in #questions
how to use bun or elysiajs with t3stack ?
is there anyway to use elysia js or bun in t3stack , also what about performance , does next js will decrease performance because of its bottleneck ?
2 replies
TTCTheo's Typesafe Cult
•Created by om3r on 11/7/2024 in #questions
using T3 Stack with Elysia ( Bun )
I am using T3 stack all over my projects because its a very easy to use stack but I want to use Elysia instead of node js into T3 Stack faster response times.
1 replies
TTCTheo's Typesafe Cult
•Created by om3r on 11/1/2024 in #questions
can T3 stack build big apps like erp system ?
Hello, I am using T3 stack for over a year now and its very amazing and easy to use but what about large apps like erp systems that alot of users will use and it will have alot of requests per second , can T3 stack handle that or should I use normal Next JS with bun backend , please advice.
5 replies
TTCTheo's Typesafe Cult
•Created by om3r on 4/17/2024 in #questions
how to pass trpc typescript between parent and children ?
I have data types when using useQuery but I want to also include these types inside the component that I am using here is an example
const { data , isLoading, refetch } = api.users.submission.useQuery(undefined, { refetchOnWindowFocus: false });
<Submissions refetch={refetch} data={data} />
export default function Submission({refetch,data}) {}
I want when I use data into Submission component I can see the data types that comes from useQuery, how can I achieve that ?7 replies
TTCTheo's Typesafe Cult
•Created by om3r on 1/23/2024 in #questions
prisma foreign key constraint error after merging user & admin into 1 table
I was handling authorization like this that i make a model for users and model for admin and each one has an email and password but now i am trying to refactor my code by merging users and admin into 1 table and handle auths like below
model all_users {
id String @id @default(uuid())
name String
email String @unique(map: "user_email_key")
password String
role String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user user?
admin admin?
}
model user{
id String?
alluserId String? @unique
user all_users ? @relation(fields: [userId], references: [id])
votes votes[]
}
model admin{
id String?
alluserId String? @unique
user all_users ? @relation(fields: [userId], references: [id])
votes votes[]
}
model votes{
id String @id @default(uuid())
votes Json?
user user @relation(fields: [userId], references: [alluserId])
userId String
admin admin @relation(fields: [adminId], references: [alluserId])
adminId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([entrepreneurId], name: "index_votes")
}
but now when I try to make npx prisma db push so I can use votes i always get this error
insert or update on table "votes" violates foreign key constraint "votes_userId_fkey"
0: sql_schema_connector::apply_migration::migration_step
I am not sure why this happens , therefor prisma has no errors.1 replies
TTCTheo's Typesafe Cult
•Created by om3r on 1/8/2024 in #questions
How can I api useQuery when calling a function?
const { data: allData, isLoading } = api.admin.limitAccess.useQuery(
{first,rows},
{ refetchOnWindowFocus: false }
I am using useQuery to fetch first , rows depends on a pagination but I have a button to click so I can download all the data from the query so I want to use it like this
const exportCSV = async () => {
try {
const response = await api.admin.limitAccess.useQuery({ first: 0, rows: totalRecords });
setAllData(response?.data);
tableRef?.current?.exportCSV();
} catch (error) {
console.error("Error exporting CSV:", error);
}
};
but when I use something like this I get an error , why I cannot use the api inside a function ?
Error exporting CSV: Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
10 replies
TTCTheo's Typesafe Cult
•Created by om3r on 11/15/2023 in #questions
uploading files locally
Its my first time using T3 stack about a month now and when it comes to upload files to my local server I got stuck for days I used to use multer to upload files but It didn't work for me so I used formidable and it worked but I have alot of issues handling file size to tell user his errors , also to handle specific file for uploads , also when I send the error to the user it keeps also uploading the file even if the user got error please need help on what to do and what is best, should I use formidable or is there anything else that T3 stack specify ? and this is my code just incase someone can tell me what is wrong.
6 replies
TTCTheo's Typesafe Cult
•Created by om3r on 10/9/2023 in #questions
Uploading Files in T3-Stack
I have a question , I got a project from someone that used T3-Stack to upload files to the database but he made a big mistake and uploaded base64 to the database ( postgres with prisma ) but I want to upload multiple files to the server instead of uploading it via base64, how can i achieve this , I tried to find a way to use multer but I cannot please I need help
also can I convert base64 files from database and save it as a string values and then fetch it with next js frontend ?
please explain like I am a noob because its my first time using T3-Stack and everything is confusing to me
8 replies