refactor: add 2fa

This commit is contained in:
Mauricio Siu
2025-02-16 20:56:50 -06:00
parent e1632cbdb3
commit 0e8e92c715
7 changed files with 119 additions and 65 deletions

View File

@@ -106,26 +106,25 @@ export const isAdminPresent = async () => {
};
export const getUserByToken = async (token: string) => {
// const user = await db.query.users.findFirst({
// where: eq(users.token, token),
// with: {
// auth: {
// columns: {
// password: false,
// },
// },
// },
// });
// if (!user) {
// throw new TRPCError({
// code: "NOT_FOUND",
// message: "Invitation not found",
// });
// }
// return {
// ...user,
// isExpired: user.isRegistered,
// };
const user = await db.query.users_temp.findFirst({
where: eq(users_temp.token, token),
columns: {
id: true,
email: true,
token: true,
isRegistered: true,
},
});
if (!user) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Invitation not found",
});
}
return {
...user,
isExpired: user.isRegistered,
};
};
export const removeUserById = async (userId: string) => {