Skip to content

Commit 73d07ad

Browse files
authored
Merge pull request #131 from wafflestudio/127-bug-api-schema
api 스키마 버그 수정
2 parents cd788a3 + 70e7179 commit 73d07ad

File tree

18 files changed

+31
-42
lines changed

18 files changed

+31
-42
lines changed

src/entities/album/model/schema.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ export const CreateAlbumRequestSchema = z.object({
66

77
export const AlbumPostSchema = z.object({
88
postId: z.number(),
9-
imageUrl: z.string().min(1),
9+
imageUrl: z.string(),
10+
likeCount: z.number(),
11+
commentCount: z.number(),
1012
})
1113

1214
export const AlbumDetailSchema = z.object({

src/entities/feed/model/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const FeedAuthorSchema = z.object({
99
export const FeedItemSchema = z.object({
1010
postId: z.number(),
1111
author: FeedAuthorSchema,
12-
thumbnailImageUrl: z.string().min(1),
12+
thumbnailImageUrl: z.string().nullable(),
1313
likeCount: z.number().nonnegative(),
1414
commentCount: z.number().nonnegative(),
1515
createdAt: z.string(),

src/entities/feed/ui/FeedCard.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,15 @@ export function FeedCard({ item, className, onOpenPost }: FeedCardProps) {
102102
onClick={handleOpenPost}
103103
className="block w-full focus-visible:outline-none"
104104
>
105-
<LazyImage
106-
src={item.thumbnailImageUrl}
107-
alt={`Post by ${item.author.nickname}`}
108-
wrapperClassName="w-full bg-black/5 aspect-square"
109-
/>
105+
{item.thumbnailImageUrl ? (
106+
<LazyImage
107+
src={item.thumbnailImageUrl}
108+
alt={`Post by ${item.author.nickname}`}
109+
wrapperClassName="w-full bg-black/5 aspect-square"
110+
/>
111+
) : (
112+
<div className="aspect-square w-full bg-black/5" />
113+
)}
110114
</button>
111115

112116
<CardFooter className="flex items-center justify-between px-2 py-1">

src/entities/search/api/getRecentSearch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ export async function getRecentSearch(): Promise<RecentSearchItem[]> {
1111
throw new Error(parsed.message || 'Failed to load recent searches')
1212
}
1313

14-
return parsed.data.items
14+
return parsed.data.items ?? []
1515
}

src/entities/search/model/schema.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ export const RecentSearchItemSchema = z.object({
55
userId: z.number(),
66
nickname: z.string(),
77
profileImageUrl: z.string().nullable(),
8-
name: z.string().nullable(),
9-
isFollowed: z.boolean(),
108
})
119

1210
export const RecentSearchListResponseSchema = z.object({
1311
code: z.string(),
1412
message: z.string(),
1513
data: z.object({
16-
items: z.array(RecentSearchItemSchema),
14+
items: z.array(RecentSearchItemSchema).nullable(),
1715
}),
1816
isSuccess: z.boolean(),
1917
})

src/entities/user/model/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const ProfileUserSchema = z.object({
4040
name: z.string().nullable(),
4141
bio: z.string().nullable(),
4242
profileImageUrl: z.string().nullable(),
43-
postsCount: z.number(),
43+
postCount: z.number(),
4444
followerCount: z.number(),
4545
followingCount: z.number(),
4646
isMe: z.boolean(),

src/features/follow-user/model/schema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { z } from 'zod'
33
export const FollowUserSchema = z.object({
44
userId: z.number(),
55
nickname: z.string(),
6-
name: z.string().nullable(),
76
profileImageUrl: z.string().nullable(),
87
isFollowing: z.boolean(),
98
})

src/features/follow-user/ui/FollowListItem.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { useCurrentUserId } from '@/shared/auth/useCurrentUser'
1111
type User = {
1212
userId: number
1313
nickname: string
14-
name: string | null
1514
profileImageUrl: string | null
1615
isFollowing?: boolean
1716
}
@@ -115,9 +114,6 @@ export function FollowListItem({
115114
<p className="truncate text-sm font-semibold text-gray-900">
116115
{user.nickname}
117116
</p>
118-
{user.name && (
119-
<p className="truncate text-sm text-gray-500">{user.name}</p>
120-
)}
121117
</div>
122118
</Link>
123119

src/features/follow-user/ui/FollowListModal.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ export function FollowListModal({
4040
const filteredUsers = useMemo(() => {
4141
const query = searchQuery.trim().toLowerCase()
4242
if (!query) return users
43-
return users.filter(
44-
(user) =>
45-
user.nickname.toLowerCase().includes(query) ||
46-
(user.name?.toLowerCase().includes(query) ?? false)
47-
)
43+
return users.filter((user) => user.nickname.toLowerCase().includes(query))
4844
}, [users, searchQuery])
4945

5046
const handleOpenChange = (newOpen: boolean) => {

src/features/search/ui/RecentSearchList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export function RecentSearchList({
4444
userId: item.userId,
4545
nickname: item.nickname,
4646
profileImageUrl: item.profileImageUrl,
47-
name: item.name,
48-
isFollowed: item.isFollowed,
47+
name: null,
48+
isFollowed: false,
4949
}}
5050
type="recent"
5151
onRemove={() => onRemoveItem(item.userId)}

0 commit comments

Comments
 (0)