Update: change identifiers to cuid

This commit is contained in:
Aaron William Po
2023-05-28 21:24:59 -04:00
parent 2b026b7e5f
commit bc298bce0e
26 changed files with 51 additions and 41 deletions

View File

@@ -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 ({

View File

@@ -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 ({

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 ({

View File

@@ -15,6 +15,7 @@ const findUserById = async (id: string) => {
dateOfBirth: true,
createdAt: true,
accountIsVerified: true,
updatedAt: true
},
});

View File

@@ -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(),

View File

@@ -14,6 +14,7 @@ const updateUserToBeConfirmedById = async (id: string) => {
createdAt: true,
firstName: true,
lastName: true,
updatedAt: true,
dateOfBirth: true,
},
});

View File

@@ -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),
}),
});