Restructure codebase to use src directory

This commit is contained in:
Aaron William Po
2023-04-11 23:32:06 -04:00
parent 90f2cc2c0c
commit 08422fe24e
141 changed files with 6 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import GetUserSchema from '../User/schema/GetUserSchema';
const createBeerPostLike = async ({
id,
user,
}: {
id: string;
user: z.infer<typeof GetUserSchema>;
}) => {
return DBClient.instance.beerPostLike.create({
data: {
beerPost: { connect: { id } },
likedBy: { connect: { id: user.id } },
},
});
};
export default createBeerPostLike;

View File

@@ -0,0 +1,6 @@
import DBClient from '@/prisma/DBClient';
const findBeerPostLikeById = async (beerPostId: string, likedById: string) =>
DBClient.instance.beerPostLike.findFirst({ where: { beerPostId, likedById } });
export default findBeerPostLikeById;

View File

@@ -0,0 +1,11 @@
import DBClient from '@/prisma/DBClient';
const getBeerPostLikeCount = async (beerPostId: string) => {
const count = await DBClient.instance.beerPostLike.count({
where: { beerPostId },
});
return count;
};
export default getBeerPostLikeCount;

View File

@@ -0,0 +1,11 @@
import DBClient from '@/prisma/DBClient';
const removeBeerPostLikeById = async (id: string) => {
return DBClient.instance.beerPostLike.delete({
where: {
id,
},
});
};
export default removeBeerPostLikeById;