chore: move interactions to repo directory

This commit is contained in:
Henry
2024-07-24 15:50:39 +01:00
parent e50991f72f
commit bfd23406dd
16 changed files with 11287 additions and 537 deletions

View File

@@ -8,18 +8,15 @@ import {
import { env } from "~/env.mjs";
import * as userRepo from "~/server/db/repository/user.repo";
export const authRouter = createTRPCRouter({
getUser: protectedProcedure.query(async ({ ctx }) => {
if (!ctx.user?.id) return;
const { data } = await ctx.db
.from("user")
.select(`id, name, email`)
.eq("id", ctx.user.id)
.limit(1)
.single();
const result = await userRepo.getById(ctx.db, ctx.user.id);
return data;
return result;
}),
loginWithEmail: publicProcedure
.input(z.object({ email: z.string() }))