refactor image services

This commit is contained in:
Aaron William Po
2023-12-13 09:49:31 -05:00
parent 685c86e0c1
commit fdbadb63dc
17 changed files with 285 additions and 99 deletions

View File

@@ -4,12 +4,12 @@ import ServerError from '@/config/util/ServerError';
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
import { NextApiResponse, NextApiRequest } from 'next';
import { z } from 'zod';
import { LikeRequest } from '../types';
import createBeerPostLike from '@/services/likes/beer-post-like/createBeerPostLike';
import findBeerPostLikeById from '@/services/likes/beer-post-like/findBeerPostLikeById';
import getBeerPostLikeCountByBeerPostId from '@/services/likes/beer-post-like/getBeerPostLikeCount';
import removeBeerPostLikeById from '@/services/likes/beer-post-like/removeBeerPostLikeById';
import { getBeerPostById } from '@/services/posts/beer-post';
import { LikeRequest } from '../types';
export const sendBeerPostLikeRequest = async (
req: LikeRequest,
@@ -20,7 +20,7 @@ export const sendBeerPostLikeRequest = async (
const beer = await getBeerPostById({ beerPostId: id });
if (!beer) {
throw new ServerError('Could not find a beer post with that id', 404);
throw new ServerError('Could not find a beer post with that id.', 404);
}
const alreadyLiked = await findBeerPostLikeById({