Skip to content

Commit 1f2aa82

Browse files
authored
Merge pull request #31 from kameiryohei/refcta-deleteComponents
必要のないコンポーネントとテストコードを削除とレスポンシブ画面のUI修正
2 parents 1ad0700 + d878158 commit 1f2aa82

File tree

15 files changed

+359
-583
lines changed

15 files changed

+359
-583
lines changed

__test__/LoginPage.test.tsx

Lines changed: 0 additions & 76 deletions
This file was deleted.

__test__/NotAllowPage.test.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.

__test__/RegisterPage.test.tsx

Lines changed: 0 additions & 60 deletions
This file was deleted.

app/allPost/[id]/components/CourseReview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const CourseReview = ({ id, auth_id }: CourseReviewProps) => {
3636
body: JSON.stringify({
3737
title: data.title,
3838
planId: Number(id),
39-
auth_id: auth_id,
39+
auth_id: auth_id || null,
4040
}),
4141
headers: {
4242
"Content-Type": "application/json",

app/api/post/coursepost/route.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ export const POST = async (req: Request) => {
77

88
await prisma.$connect();
99

10-
const author = await prisma.user.findUnique({
11-
where: {
12-
auth_id: auth_id,
13-
},
14-
select: {
15-
id: true,
16-
},
17-
});
10+
// auth_idがある場合のみユーザーを検索
11+
const author = auth_id
12+
? await prisma.user.findUnique({
13+
where: { auth_id: auth_id },
14+
select: { id: true },
15+
})
16+
: null;
1817

1918
const post = await prisma.post.create({
2019
data: {
2120
title: title,
2221
planId: planId,
23-
authorId: author?.id,
22+
authorId: author?.id || null, // authorが見つからない場合またはauth_idが無い場合はnull
2423
},
2524
});
25+
2626
return NextResponse.json({ message: "Success", post }, { status: 201 });
2727
} catch (error) {
2828
return NextResponse.json(

app/components/NotAllowPage.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)