Skip to content

Commit 8550f37

Browse files
committed
fix: API Response 에 맞춰 paging 이름 변경
1 parent 8b25a7e commit 8550f37

9 files changed

Lines changed: 44 additions & 25 deletions

File tree

Alarm/Sources/Data/NotificationDTO.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ import AlarmDomain
1010

1111
public struct NotificationListDataDTO: Decodable, Sendable {
1212
public let content: [NotificationResponseDTO]
13-
public let lastId: Int?
14-
public let hasNext: Bool
13+
public let netxCursorId: Int?
14+
public let nextPage: Bool
1515

1616
private enum CodingKeys: String, CodingKey {
1717
case content
18-
case lastId
19-
case hasNext
18+
case netxCursorId
19+
case nextPage
2020
}
2121
}
2222

2323
extension NotificationListDataDTO {
2424
func toDomain() -> NotificationListData {
2525
return NotificationListData(
2626
content: content.map { $0.toDomain()},
27-
lastId: lastId,
28-
hasNext: hasNext
27+
netxCursorId: netxCursorId,
28+
nextPage: nextPage
2929
)
3030
}
3131
}

Alarm/Sources/Domain/AlarmEntities.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ extension [AlarmPayload] {
3939

4040
public struct NotificationListData: Sendable {
4141
public let content: [AlarmPayload]
42-
public let lastId: Int?
43-
public let hasNext: Bool
42+
public let netxCursorId: Int?
43+
public let nextPage: Bool
4444

4545
private enum CodingKeys: String, CodingKey {
4646
case content
47-
case lastId
48-
case hasNext
47+
case netxCursorId
48+
case nextPage
4949
}
5050

51-
public init(content: [AlarmPayload], lastId: Int?, hasNext: Bool) {
51+
public init(content: [AlarmPayload], netxCursorId: Int?, nextPage: Bool) {
5252
self.content = content
53-
self.lastId = lastId
54-
self.hasNext = hasNext
53+
self.netxCursorId = netxCursorId
54+
self.nextPage = nextPage
5555
}
5656
}

Community/Sources/Data/DTO/BoardResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ extension BoardListDataDTO {
8080
return BoardListData(
8181
content: content.map { $0.toDomain() },
8282
nextCursorId: nextCursorId,
83-
hasNextPage: nextPage
83+
nextPage: nextPage
8484
)
8585
}
8686
}

Community/Sources/Domain/Entities/Board.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ public struct BoardListData: Sendable {
152152
public let nextCursorId: Int?
153153
public let hasNextPage: Bool
154154

155-
public init(content: [Board], nextCursorId: Int?, hasNextPage: Bool) {
155+
public init(content: [Board], nextCursorId: Int?, nextPage: Bool) {
156156
self.content = content
157157
self.nextCursorId = nextCursorId
158-
self.hasNextPage = hasNextPage
158+
self.hasNextPage = nextPage
159159
}
160160
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// PagingContent.swift
3+
// Infrastructure
4+
//
5+
// Created by 강동영 on 1/19/26.
6+
//
7+
8+
9+
public struct PagingContent<T: Decodable & Sendable>: Decodable, Sendable {
10+
public let content: T
11+
public let nextCursorId: Int?
12+
public let nextPage: Bool
13+
14+
private enum CodingKeys: String, CodingKey {
15+
case content
16+
case nextCursorId
17+
case nextPage
18+
}
19+
}

MyPage/Sources/Data/DTO/MyActivitiesDTO.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extension MyBoardsResponseDTO {
5151
return BoardListData(
5252
content: content.map { $0.toDomain() },
5353
nextCursorId: nextCursorId,
54-
hasNextPage: nextPage
54+
nextPage: nextPage
5555
)
5656
}
5757
}

MyPage/Sources/Presentation/MyActivitiesView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public struct MyActivitiesView: View {
3535
}
3636
.background(Color.bgG75)
3737
}
38+
.task {
39+
await viewModel.loadBoards()
40+
}
3841
.toolbar(.hidden, for: .navigationBar)
3942
.refreshable {
4043
viewModel.refreshCurrentTab()
@@ -294,7 +297,7 @@ struct HambugNavigationView<Content: View>: View {
294297
// MARK: - Mock UseCases for Preview
295298
private final class MockGetMyBoardsUseCase: GetMyBoardsUseCase {
296299
func execute(lastId: Int?, limit: Int, order: String) async throws -> BoardListData {
297-
return BoardListData(content: [], nextCursorId: nil, hasNextPage: false)
300+
return BoardListData(content: [], nextCursorId: nil, nextPage: false)
298301
}
299302
}
300303

MyPage/Sources/Presentation/MyActivitiesViewModel.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public final class MyActivitiesViewModel {
2424
public var isLoadingMoreComments: Bool = false
2525

2626
public var errorMessage: String? = nil
27-
public var selectedTab: ActivityTab = .posts
27+
public var selectedTab: ActivityTab = .posts {
28+
didSet { refreshCurrentTab() }
29+
}
2830

2931
// MARK: - Dependencies
3032
private let getMyBoardsUseCase: GetMyBoardsUseCase
@@ -45,11 +47,6 @@ public final class MyActivitiesViewModel {
4547
) {
4648
self.getMyBoardsUseCase = getMyBoardsUseCase
4749
self.getMyCommentsUseCase = getMyCommentsUseCase
48-
49-
Task {
50-
await loadBoards()
51-
await loadComments()
52-
}
5350
}
5451

5552
// MARK: - Public Methods - Boards

MyPage/Sources/Presentation/MyPage/MyPageViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public final class MyPageViewModel {
3535
do {
3636
let response = try await usecase.fetchProfile()
3737
isLoading = false
38-
user = user
38+
user = response
3939
profileNickName = response.nickname
4040
} catch {
4141

0 commit comments

Comments
 (0)