Skip to content

Commit

Permalink
fix: form_id, answer_id を string にする
Browse files Browse the repository at this point in the history
  • Loading branch information
rito528 committed Feb 12, 2025
1 parent cbbe6ca commit 5f526c9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const Comment = (props: {
};

const SendCommentForm = (props: {
answerId: number;
answerId: string;
handleSubmit: UseFormHandleSubmit<SendCommentSchema, undefined>;
register: UseFormRegister<SendCommentSchema>;
}) => {
Expand All @@ -84,7 +84,7 @@ const SendCommentForm = (props: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
answer_id: Number(data.answer_id),
answer_id: data.answer_id,
content: data.content,
}),
});
Expand Down Expand Up @@ -137,11 +137,11 @@ const SendCommentForm = (props: {
};

type SendCommentSchema = {
answer_id: number;
answer_id: string;
content: string;
};

const Comments = (props: { comments: Comment[]; answerId: number }) => {
const Comments = (props: { comments: Comment[]; answerId: string }) => {
const { handleSubmit, register } = useForm<SendCommentSchema>();
const { handleSubmit: handleDeleteSubmit, register: registerDelete } =
useForm<{ comment_id: number }>();
Expand Down
2 changes: 1 addition & 1 deletion src/app/(authed)/(standard)/forms/_components/FormList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const formatResponsePeriod = (startAt: string | null, endAt: string | null) => {
};

type Form = {
id: number;
id: string;
title: string;
description: string;
response_period: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/(authed)/admin/_components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const columns: GridColDef[] = [
];

interface Row {
id: number;
id: string;
category: string;
title: string;
date: string;
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/_schemas/RequestSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type CreateFormSchema = z.infer<typeof createFormSchema>;

// POST /forms/questions
export const createQuestionSchema = z.object({
form_id: z.number(),
form_id: z.string().uuid(),
questions: z
.object({
title: z.string(),
Expand Down Expand Up @@ -43,7 +43,7 @@ export const updateFormSchema = z.object({

// PUT /forms/questions
export const updateQuestionSchema = z.object({
form_id: z.number(),
form_id: z.string().uuid(),
questions: z
.object({
id: z.number().nullable(),
Expand Down
12 changes: 6 additions & 6 deletions src/app/api/_schemas/ResponseSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ export type GetQuestionsResponse = z.infer<typeof getQuestionsResponseSchema>;
// GET /forms/answers
export const getAnswersResponseSchema = z
.object({
id: z.number(),
id: z.string().uuid(),
user: z.object({
uuid: z.string(),
name: z.string(),
role: z.enum(['ADMINISTRATOR', 'STANDARD_USER']),
}),
timestamp: z.string().datetime(),
form_id: z.number(),
form_id: z.string().uuid(),
title: z.string(),
answers: z
.object({
Expand Down Expand Up @@ -139,14 +139,14 @@ export type GetAnswersResponse = z.infer<typeof getAnswersResponseSchema>;
// GET /forms/:formId/answers
export const getFormAnswersResponseSchema = z
.object({
id: z.number(),
id: z.string().uuid(),
user: z.object({
uuid: z.string(),
name: z.string(),
role: z.enum(['ADMINISTRATOR', 'STANDARD_USER']),
}),
timestamp: z.string().datetime(),
form_id: z.number(),
form_id: z.string().uuid(),
title: z.string(),
answers: z
.object({
Expand Down Expand Up @@ -203,14 +203,14 @@ export type GetFormLabelsResponse = z.infer<typeof getFormLabelsResponseSchema>;

// GET /forms/answers/:answerId
export const getAnswerResponseSchema = z.object({
id: z.number(),
id: z.string().uuid(),
user: z.object({
uuid: z.string(),
name: z.string(),
role: z.enum(['ADMINISTRATOR', 'STANDARD_USER']),
}),
timestamp: z.string().datetime(),
form_id: z.number(),
form_id: z.string().uuid(),
title: z.string(),
answers: z
.object({
Expand Down

0 comments on commit 5f526c9

Please sign in to comment.