-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat-T3-204] 제보하기 로직 구현, 제보 히스토리 로직 구현 #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fab85f1
feat: NetworkService 로직 수정
taipaise 898e3e5
feat: 제보하기 로직 구현
taipaise c00b652
refactor: 제보하기 수정된 디자인 적용
taipaise 064990b
feat: 제보하기 필터링 로직 구현
taipaise c5f69a3
feat: 제보히스토리 -> 제보상세 플로우 미비사항 구현
taipaise 4239784
fix: 제보하기 로직 수정
taipaise 3d08636
refactor: 코드래빗 리뷰 반영
taipaise File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Projects/DataSource/Sources/Common/Enum/EndpointBodyType.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // | ||
| // EndpointBodyType.swift | ||
| // DataSource | ||
| // | ||
| // Created by 이동현 on 11/22/25. | ||
| // | ||
|
|
||
| public enum EndpointBodyType { | ||
| case json | ||
| case rawData | ||
| } |
11 changes: 11 additions & 0 deletions
11
Projects/DataSource/Sources/DTO/FilePresignedConditionDTO.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // | ||
| // FilePresignedConditionDTO.swift | ||
| // DataSource | ||
| // | ||
| // Created by 이동현 on 11/22/25. | ||
| // | ||
|
|
||
| struct FilePresignedConditionDTO: Codable { | ||
| let prefix: String? | ||
| let fileName: String | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // | ||
| // FilePresignedDTO.swift | ||
| // DataSource | ||
| // | ||
| // Created by 이동현 on 11/22/25. | ||
| // | ||
|
|
||
| struct FilePresignedDTO: Decodable { | ||
| let file1: String? | ||
| let file2: String? | ||
| let file3: String? | ||
|
|
||
| enum CodingKeys: String, CodingKey { | ||
| case file1 = "additionalProp1" | ||
| case file2 = "additionalProp2" | ||
| case file3 = "additionalProp3" | ||
|
Comment on lines
+14
to
+16
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요거 json이 "additionalProp1" 자체로 오는게 아니고 요청 값에 따라 달라지지 않나유 ? ?? ? |
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,32 +7,32 @@ | |
|
|
||
| import Domain | ||
|
|
||
| struct ReportDTO: Decodable { | ||
| struct ReportDTO: Codable { | ||
| let reportId: Int? | ||
| let reportDate: String? | ||
| let reportTitle: String | ||
| let reportContent: String? | ||
| let reportLocation: String | ||
| let reportStatus: String | ||
| let reportStatus: String? | ||
| let reportCategory: String | ||
| let reportImageUrl: String? | ||
| let reportImageUrls: [String]? | ||
| let latitude: Double? | ||
| let longitude: Double? | ||
|
|
||
| func toReportEntity() throws -> ReportEntity { | ||
| guard let reportId else { throw NetworkError.decodingError } | ||
| return ReportEntity( | ||
| id: reportId, | ||
| title: reportTitle, | ||
| date: reportDate, | ||
| type: ReportType(rawValue: reportCategory) ?? .transportation, | ||
| progress: ReportProgress(rawValue: reportStatus) ?? .received, | ||
| progress: ReportProgress(rawValue: reportStatus ?? "") ?? .received, | ||
| content: reportContent, | ||
| location: LocationEntity( | ||
| longitude: longitude, | ||
| latitude: latitude, | ||
| address: reportLocation), | ||
| thumbnailURL: reportImageUrl, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요거 thumbnailURL로 네이밍 바꾼거 넘 조은것 같아유 !!!!!!! |
||
| photoUrls: reportImageUrls ?? []) | ||
| } | ||
|
|
||
|
|
@@ -43,12 +43,13 @@ struct ReportDTO: Decodable { | |
| title: reportTitle, | ||
| date: date, | ||
| type: ReportType(rawValue: reportCategory) ?? .transportation, | ||
| progress: ReportProgress(rawValue: reportStatus) ?? .received, | ||
| progress: ReportProgress(rawValue: reportStatus ?? "") ?? .received, | ||
| content: reportContent, | ||
| location: LocationEntity( | ||
| longitude: longitude, | ||
| latitude: latitude, | ||
| address: reportLocation), | ||
| thumbnailURL: reportImageUrl, | ||
| photoUrls: reportImageUrls ?? []) | ||
| } | ||
| } | ||
68 changes: 68 additions & 0 deletions
68
Projects/DataSource/Sources/Endpoint/FilePresignedEndpoint.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| // | ||
| // FilePresignedEndpoint.swift | ||
| // DataSource | ||
| // | ||
| // Created by 이동현 on 11/22/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| enum FilePresignedEndpoint { | ||
| case fetchPresignedURL(presignedConditions: [FilePresignedConditionDTO]) | ||
| } | ||
|
|
||
| extension FilePresignedEndpoint: Endpoint { | ||
| var baseURL: String { | ||
| switch self { | ||
| case .fetchPresignedURL: | ||
| return AppProperties.baseURL + "/api/v2/files" | ||
| } | ||
| } | ||
|
|
||
| var path: String { | ||
| switch self { | ||
| case .fetchPresignedURL: | ||
| return baseURL + "/presigned-urls" | ||
| } | ||
| } | ||
|
|
||
| var method: HTTPMethod { | ||
| switch self { | ||
| case .fetchPresignedURL: .post | ||
| } | ||
| } | ||
|
|
||
| var headers: [String : String] { | ||
| let headers: [String: String] = [ | ||
| "Content-Type": "application/json", | ||
| "accept": "*/*" | ||
| ] | ||
| return headers | ||
| } | ||
|
|
||
| var queryParameters: [String : String] { | ||
| return [:] | ||
| } | ||
|
|
||
| var bodyParameters: [String : Any] { | ||
| switch self { | ||
| case .fetchPresignedURL(let presignedConditions): | ||
| return [:] | ||
| } | ||
| } | ||
|
|
||
| var isAuthorized: Bool { | ||
| return true | ||
| } | ||
|
|
||
| var bodyType: EndpointBodyType { | ||
| return .rawData | ||
| } | ||
|
|
||
| var bodyData: Data? { | ||
| switch self { | ||
| case .fetchPresignedURL(let presignedConditions): | ||
| return try? JSONEncoder().encode(presignedConditions) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Projects/DataSource/Sources/Endpoint/S3UploadEndpoint.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| // | ||
| // S3UploadEndpoint.swift | ||
| // DataSource | ||
| // | ||
| // Created by 이동현 on 11/22/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| enum S3Endpoint { | ||
| case uploadImage(uploadURL: String, data: Data) | ||
| } | ||
|
|
||
| extension S3Endpoint: Endpoint { | ||
| var baseURL: String { | ||
| return "" | ||
| } | ||
|
|
||
| var path: String { | ||
| switch self { | ||
| case .uploadImage(let uploadURL, _): | ||
| return uploadURL | ||
| } | ||
| } | ||
|
|
||
| var method: HTTPMethod { | ||
| switch self { | ||
| case .uploadImage: | ||
| return .put | ||
| } | ||
| } | ||
|
|
||
| var headers: [String : String] { | ||
| switch self { | ||
| case .uploadImage: | ||
| return [:] | ||
| } | ||
| } | ||
|
|
||
| var queryParameters: [String : String] { | ||
|
|
||
| return [:] | ||
| } | ||
|
|
||
| var bodyParameters: [String : Any] { | ||
| return [:] | ||
| } | ||
|
|
||
| var isAuthorized: Bool { | ||
| return false | ||
| } | ||
|
|
||
| var bodyType: EndpointBodyType { | ||
| return .rawData | ||
| } | ||
|
|
||
| var bodyData: Data? { | ||
| switch self { | ||
| case .uploadImage(_, let data): | ||
| return data | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Projects/DataSource/Sources/Repository/FileRepository.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // | ||
| // FileRepository.swift | ||
| // DataSource | ||
| // | ||
| // Created by 이동현 on 11/22/25. | ||
| // | ||
|
|
||
| import Domain | ||
| import Foundation | ||
|
|
||
| final class FileRepository: FileRepositoryProtocol { | ||
| private let networkService = NetworkService.shared | ||
|
|
||
| func fetchPresignedURL(prefix: String?, fileNames: [String]) async throws -> [String : String]? { | ||
| let dtos = fileNames.map { FilePresignedConditionDTO(prefix: prefix, fileName: $0) } | ||
| let endpoint = FilePresignedEndpoint.fetchPresignedURL(presignedConditions: dtos) | ||
|
|
||
| return try await networkService.request(endpoint: endpoint, type: [String:String].self) | ||
| } | ||
|
|
||
| func uploadFile(url: String, data: Data) async throws { | ||
| let endPoint = S3Endpoint.uploadImage(uploadURL: url, data: data) | ||
| _ = try await networkService.request(endpoint: endPoint, type: EmptyResponseDTO.self) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.