Tajin
03/28/2022, 2:05 PM/*
* 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" }>;
rp
03/28/2022, 2:06 PMTajin
03/28/2022, 2:08 PMrp
03/28/2022, 2:09 PMTajin
03/28/2022, 2:44 PMteacher = 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?rp
03/28/2022, 4:12 PMTajin
03/28/2022, 4:29 PMrp
03/28/2022, 4:30 PMTajin
03/28/2022, 4:33 PM