mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Update: change identifiers to cuid
This commit is contained in:
@@ -3,8 +3,8 @@ import { z } from 'zod';
|
||||
import CreateCommentValidationSchema from '../types/CommentSchema/CreateCommentValidationSchema';
|
||||
|
||||
const CreateNewBeerCommentServiceSchema = CreateCommentValidationSchema.extend({
|
||||
userId: z.string().uuid(),
|
||||
beerPostId: z.string().uuid(),
|
||||
userId: z.string().cuid(),
|
||||
beerPostId: z.string().cuid(),
|
||||
});
|
||||
|
||||
const createNewBeerComment = async ({
|
||||
|
||||
@@ -4,7 +4,7 @@ import beerPostQueryResult from './schema/BeerPostQueryResult';
|
||||
import CreateBeerPostValidationSchema from './schema/CreateBeerPostValidationSchema';
|
||||
|
||||
const CreateBeerPostWithUserSchema = CreateBeerPostValidationSchema.extend({
|
||||
userId: z.string().uuid(),
|
||||
userId: z.string().cuid(),
|
||||
});
|
||||
|
||||
const createNewBeerPost = async ({
|
||||
|
||||
@@ -31,13 +31,13 @@ const CreateBeerPostValidationSchema = z.object({
|
||||
required_error: 'Type id is required.',
|
||||
invalid_type_error: 'Type id must be a string.',
|
||||
})
|
||||
.uuid({ message: 'Invalid type id.' }),
|
||||
.cuid({ message: 'Invalid type id.' }),
|
||||
breweryId: z
|
||||
.string({
|
||||
required_error: 'Brewery id is required.',
|
||||
invalid_type_error: 'Brewery id must be a string.',
|
||||
})
|
||||
.uuid({ message: 'Invalid brewery id.' }),
|
||||
.cuid({ message: 'Invalid brewery id.' }),
|
||||
});
|
||||
|
||||
export default CreateBeerPostValidationSchema;
|
||||
|
||||
@@ -4,6 +4,6 @@ import CreateBeerPostValidationSchema from './CreateBeerPostValidationSchema';
|
||||
const EditBeerPostValidationSchema = CreateBeerPostValidationSchema.omit({
|
||||
breweryId: true,
|
||||
typeId: true,
|
||||
}).extend({ id: z.string().uuid() });
|
||||
}).extend({ id: z.string().cuid() });
|
||||
|
||||
export default EditBeerPostValidationSchema;
|
||||
|
||||
@@ -3,8 +3,8 @@ import { z } from 'zod';
|
||||
import CreateCommentValidationSchema from '../types/CommentSchema/CreateCommentValidationSchema';
|
||||
|
||||
const CreateNewBreweryCommentServiceSchema = CreateCommentValidationSchema.extend({
|
||||
userId: z.string().uuid(),
|
||||
breweryPostId: z.string().uuid(),
|
||||
userId: z.string().cuid(),
|
||||
breweryPostId: z.string().cuid(),
|
||||
});
|
||||
|
||||
const createNewBreweryComment = async ({
|
||||
|
||||
@@ -15,6 +15,7 @@ const findUserById = async (id: string) => {
|
||||
dateOfBirth: true,
|
||||
createdAt: true,
|
||||
accountIsVerified: true,
|
||||
updatedAt: true
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const GetUserSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
id: z.string().cuid(),
|
||||
username: z.string(),
|
||||
createdAt: z.coerce.date(),
|
||||
updatedAt: z.coerce.date().nullable(),
|
||||
|
||||
@@ -14,6 +14,7 @@ const updateUserToBeConfirmedById = async (id: string) => {
|
||||
createdAt: true,
|
||||
firstName: true,
|
||||
lastName: true,
|
||||
updatedAt: true,
|
||||
dateOfBirth: true,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const CommentQueryResult = z.object({
|
||||
id: z.string().uuid(),
|
||||
id: z.string().cuid(),
|
||||
content: z.string().min(1).max(500),
|
||||
rating: z.number().int().min(1).max(5),
|
||||
createdAt: z.coerce.date(),
|
||||
postedBy: z.object({
|
||||
id: z.string().uuid(),
|
||||
id: z.string().cuid(),
|
||||
username: z.string().min(1).max(50),
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user