Skip to content

Commit

Permalink
feat: 横断検索にコメントの検索結果が表示されるように
Browse files Browse the repository at this point in the history
  • Loading branch information
rito528 committed Sep 25, 2024
1 parent 9db8acd commit a37f64d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/(authed)/admin/_components/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ const SearchResult = (props: {
url: `/admin/labels/answers`,
};
}),
data.right.comments.map((comment) => ({
category: 'コメント',
title: comment.content,
url: `/admin/answer/${comment.answer_id}`,
})),
]
.flat()
.map((row, index) => ({ ...row, id: index }));
Expand Down
12 changes: 12 additions & 0 deletions src/app/api/_schemas/ResponseSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,18 @@ export const searchResponseSchema = z.object({
name: z.string(),
})
.array(),
comments: z
.object({
answer_id: z.number(),
id: z.number(),
content: z.string(),
commented_by: z.object({
id: z.string(),
name: z.string(),
role: z.enum(['ADMINISTRATOR', 'STANDARD_USER']),
}),
})
.array(),
});

export type SearchResponse = z.infer<typeof searchResponseSchema>;

0 comments on commit a37f64d

Please sign in to comment.