chore: Update api service type directories to maintain consistency

This commit is contained in:
Aaron William Po
2023-07-07 23:23:04 -04:00
parent ee47f99f8a
commit 5292c47a2a
69 changed files with 99 additions and 99 deletions

View File

@@ -1,6 +1,6 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import CreateCommentValidationSchema from '../types/CommentSchema/CreateCommentValidationSchema';
import CreateCommentValidationSchema from '../schema/CommentSchema/CreateCommentValidationSchema';
const CreateNewBeerCommentServiceSchema = CreateCommentValidationSchema.extend({
userId: z.string().cuid(),

View File

@@ -1,10 +1,10 @@
import DBClient from '@/prisma/DBClient';
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import { z } from 'zod';
import CommentQueryResult from '../types/CommentSchema/CommentQueryResult';
import CommentQueryResult from '../schema/CommentSchema/CommentQueryResult';
const getAllBeerComments = async (
{ id }: Pick<z.infer<typeof beerPostQueryResult>, 'id'>,
{ id }: Pick<z.infer<typeof BeerPostQueryResult>, 'id'>,
{ pageSize, pageNum = 0 }: { pageSize: number; pageNum?: number },
) => {
const skip = (pageNum - 1) * pageSize;

View File

@@ -1,7 +1,7 @@
import DBClient from '@/prisma/DBClient';
import { BeerImage } from '@prisma/client';
import { z } from 'zod';
import ImageMetadataValidationSchema from '../types/ImageSchema/ImageMetadataValidationSchema';
import ImageMetadataValidationSchema from '../schema/ImageSchema/ImageMetadataValidationSchema';
interface ProcessImageDataArgs {
files: Express.Multer.File[];

View File

@@ -1,6 +1,6 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import beerPostQueryResult from './schema/BeerPostQueryResult';
import BeerPostQueryResult from './schema/BeerPostQueryResult';
import CreateBeerPostValidationSchema from './schema/CreateBeerPostValidationSchema';
const CreateBeerPostWithUserSchema = CreateBeerPostValidationSchema.extend({
@@ -16,7 +16,7 @@ const createNewBeerPost = async ({
breweryId,
userId,
}: z.infer<typeof CreateBeerPostWithUserSchema>) => {
const newBeerPost: z.infer<typeof beerPostQueryResult> =
const newBeerPost: z.infer<typeof BeerPostQueryResult> =
await DBClient.instance.beerPost.create({
data: {
name,

View File

@@ -1,5 +1,5 @@
import DBClient from '@/prisma/DBClient';
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import { z } from 'zod';
const prisma = DBClient.instance;
@@ -7,7 +7,7 @@ const prisma = DBClient.instance;
const getAllBeerPosts = async (pageNum: number, pageSize: number) => {
const skip = (pageNum - 1) * pageSize;
const beerPosts: z.infer<typeof beerPostQueryResult>[] = await prisma.beerPost.findMany(
const beerPosts: z.infer<typeof BeerPostQueryResult>[] = await prisma.beerPost.findMany(
{
select: {
id: true,

View File

@@ -1,11 +1,11 @@
import DBClient from '@/prisma/DBClient';
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import { z } from 'zod';
const prisma = DBClient.instance;
const getBeerPostById = async (id: string) => {
const beerPost: z.infer<typeof beerPostQueryResult> | null =
const beerPost: z.infer<typeof BeerPostQueryResult> | null =
await prisma.beerPost.findFirst({
select: {
id: true,

View File

@@ -1,6 +1,6 @@
import { z } from 'zod';
const beerPostQueryResult = z.object({
const BeerPostQueryResult = z.object({
id: z.string(),
name: z.string(),
brewery: z.object({ id: z.string(), name: z.string() }),
@@ -15,4 +15,4 @@ const beerPostQueryResult = z.object({
createdAt: z.coerce.date(),
});
export default beerPostQueryResult;
export default BeerPostQueryResult;

View File

@@ -1,6 +1,6 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import CreateCommentValidationSchema from '../types/CommentSchema/CreateCommentValidationSchema';
import CreateCommentValidationSchema from '../schema/CommentSchema/CreateCommentValidationSchema';
const CreateNewBreweryCommentServiceSchema = CreateCommentValidationSchema.extend({
userId: z.string().cuid(),

View File

@@ -1,10 +1,10 @@
import DBClient from '@/prisma/DBClient';
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import { z } from 'zod';
import CommentQueryResult from '../types/CommentSchema/CommentQueryResult';
import CommentQueryResult from '../schema/CommentSchema/CommentQueryResult';
const getAllBreweryComments = async (
{ id }: Pick<z.infer<typeof beerPostQueryResult>, 'id'>,
{ id }: Pick<z.infer<typeof BeerPostQueryResult>, 'id'>,
{ pageSize, pageNum = 0 }: { pageSize: number; pageNum?: number },
) => {
const skip = (pageNum - 1) * pageSize;

View File

@@ -1,7 +1,7 @@
import DBClient from '@/prisma/DBClient';
import { BreweryImage } from '@prisma/client';
import { z } from 'zod';
import ImageMetadataValidationSchema from '../types/ImageSchema/ImageMetadataValidationSchema';
import ImageMetadataValidationSchema from '../schema/ImageSchema/ImageMetadataValidationSchema';
interface ProcessImageDataArgs {
files: Express.Multer.File[];

View File

@@ -1,7 +1,7 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import CreateBreweryPostSchema from './types/CreateBreweryPostSchema';
import BreweryPostQueryResult from './types/BreweryPostQueryResult';
import CreateBreweryPostSchema from './schema/CreateBreweryPostSchema';
import BreweryPostQueryResult from './schema/BreweryPostQueryResult';
const CreateNewBreweryPostWithUserAndLocationSchema = CreateBreweryPostSchema.omit({
address: true,

View File

@@ -1,5 +1,5 @@
import DBClient from '@/prisma/DBClient';
import BreweryPostQueryResult from '@/services/BreweryPost/types/BreweryPostQueryResult';
import BreweryPostQueryResult from '@/services/BreweryPost/schema/BreweryPostQueryResult';
import { z } from 'zod';

View File

@@ -1,5 +1,5 @@
import DBClient from '@/prisma/DBClient';
import BreweryPostQueryResult from '@/services/BreweryPost/types/BreweryPostQueryResult';
import BreweryPostQueryResult from '@/services/BreweryPost/schema/BreweryPostQueryResult';
import { z } from 'zod';
const prisma = DBClient.instance;