mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
chore: Update api service type directories to maintain consistency
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[];
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user