Refactor: rename [:id] to [:postId] for api routes

This commit is contained in:
Aaron William Po
2023-12-24 12:34:51 -05:00
parent b21924b89c
commit 0e99782557
36 changed files with 118 additions and 105 deletions

View File

@@ -9,8 +9,9 @@ import {
export const editBeerPostCommentRequest: SendEditBeerPostCommentRequest = async ({
body,
commentId,
beerPostId,
}) => {
const response = await fetch(`/api/beer-post-comments/${commentId}`, {
const response = await fetch(`/api/beers/${beerPostId}/comments/${commentId}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
@@ -33,8 +34,9 @@ export const editBeerPostCommentRequest: SendEditBeerPostCommentRequest = async
export const deleteBeerPostCommentRequest: SendDeleteBeerPostCommentRequest = async ({
commentId,
beerPostId,
}) => {
const response = await fetch(`/api/beer-post-comments/${commentId}`, {
const response = await fetch(`/api/beers/${beerPostId}/comments/${commentId}`, {
method: 'DELETE',
});

View File

@@ -5,10 +5,12 @@ import { z } from 'zod';
export type SendEditBeerPostCommentRequest = (args: {
body: { content: string; rating: number };
commentId: string;
beerPostId: string;
}) => Promise<z.infer<typeof APIResponseValidationSchema>>;
export type SendDeleteBeerPostCommentRequest = (args: {
commentId: string;
beerPostId: string;
}) => Promise<z.infer<typeof APIResponseValidationSchema>>;
export type SendCreateBeerCommentRequest = (args: {