https://supertokens.com/ logo
#support-questions
Title
# support-questions
t

Tajin

03/28/2022, 2:05 PM
Can I override the user interface, and the signUp function?
Copy code
/* 
    * Called to sign-up a new user
    * 
    * @params: email
    *          password
    * 
    * @returns: "OK": on successfully signing up the user
    *           "EMAIL_ALREADY_EXISTS_ERROR": if the email is already been used
    */
    signUp(input: {
        email: string;
        password: string;
    }): Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>;
r

rp

03/28/2022, 2:06 PM
What do you mean? Can you please elaborate?
t

Tajin

03/28/2022, 2:08 PM
I just want to add another column in the emailpassword_users table
is that possible?
r

rp

03/28/2022, 2:09 PM
You should add that to your own db against the user ID.
t

Tajin

03/28/2022, 2:44 PM
thanks for ur answer but I'm trying to add a column named 'role' , so after getting ur answer I think I ended up with 2 solutions to my situation: 1- Considering the 'role' as a computed attribute , I'll have to query each role table in order to find the role of the user as follows
Copy code
teacher = await prisma.teacherAccount.findMany({where : {userId : userId});
if teacher !== [] : {teacher.role = "teacher"; return teacher;}
student = await prisma.studentAccount.findMany({where : {userId : userId});
if student !== [] : {student.role = "student"; return student;}
admin = await prisma.adminAccount.findMany({where : {userId : userId});
if admin !== [] : {admin.role = "admin"; return admin;}
2- Creating another "account" table that stores shared columns (username, phone number etc...) between the users AND the role column, also creating relation tables for each role between "account" and the associated role table because we can have columns specific for each role. Which option do you recommend for this case?
I added a new column in the table userpassword_users which fixed most of my problems
is it safe to do that?
r

rp

03/28/2022, 4:12 PM
You added this table to our postgresql db? form the dev env?
you can do that, however, you won't have access to the db for prod env.
So you might want to create your own db somewhere and make this table there
t

Tajin

03/28/2022, 4:29 PM
by "our" postgresql db you mean when using the hosting provided by supertokens?
im using self hosted for now
r

rp

03/28/2022, 4:30 PM
Yes. They one whose credentials are on the supertokens dashboard
t

Tajin

03/28/2022, 4:33 PM
alright!
2 Views