-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Feat] 보관함 캘린더 구현 #212
Merged
Merged
[Feat] 보관함 캘린더 구현 #212
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
There are no files selected for viewing
This file contains 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
101 changes: 37 additions & 64 deletions
101
Namo_SwiftUI/Projects/Core/Network/Sources/API/EndPoint/Diary/DiaryEndPoint.swift
This file contains 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 |
---|---|---|
@@ -1,78 +1,51 @@ | ||
// | ||
// DiaryEndPoint.swift | ||
// Namo_SwiftUI | ||
// CoreNetwork | ||
// | ||
// Created by 서은수 on 3/16/24. | ||
// Created by 정현우 on 11/1/24. | ||
// | ||
|
||
import Alamofire | ||
import Foundation | ||
import SwiftUICalendar | ||
|
||
import SharedUtil | ||
|
||
public enum DiaryEndPoint { | ||
case createDiary(scheduleId: Int, content: String, images: [Data?]) | ||
case getMonthDiary(request: GetDiaryRequestDTO) | ||
case getOneDiary(scheduleId: Int) | ||
case changeDiary(scheduleId: Int, content: String, images: [Data?], deleteImageIds: [Int]) | ||
case deleteDiary(diaryId: Int) | ||
case getCalendarByMonth(ym: YearMonth) | ||
case getDiaryByDate(ymd: YearMonthDay) | ||
} | ||
|
||
extension DiaryEndPoint: EndPoint { | ||
public var baseURL: String { | ||
return "\(SecretConstants.baseURL)/diaries" | ||
} | ||
|
||
public var path: String { | ||
switch self { | ||
case .createDiary(_, _, _): | ||
return "" | ||
case .getMonthDiary(let req): | ||
return "/month/\(req.year),\(req.month)" | ||
case .getOneDiary(let scheduleId): | ||
return "/\(scheduleId)" | ||
case .changeDiary: | ||
return "" | ||
case .deleteDiary(let diaryId): | ||
return "/\(diaryId)" | ||
} | ||
} | ||
|
||
public var method: Alamofire.HTTPMethod { | ||
switch self { | ||
case .createDiary: | ||
return .post | ||
case .getMonthDiary, .getOneDiary: | ||
return .get | ||
case .changeDiary: | ||
return .patch | ||
case .deleteDiary: | ||
return .delete | ||
} | ||
} | ||
|
||
public var task: APITask { | ||
switch self { | ||
case .createDiary(let scheduleId, let content, let images): | ||
let body = ["scheduleId": scheduleId, "content": content] as [String : Any] | ||
return .uploadImagesWithBody(imageDatas: images, body: body) | ||
case .changeDiary(let scheduleId, let content, let images, let deleteImageIds): | ||
let params = ["scheduleId": scheduleId, "content": content, "deleteImageIds": deleteImageIds] as [String : Any] | ||
return .uploadImagesWithParameter(imageDatas: images, parameters: params, imageKeyName: "createImages") | ||
case .getMonthDiary(let req): | ||
let params = ["page": req.page, "size": req.size] | ||
return .requestParameters(parameters: params, encoding: URLEncoding.default) | ||
case .deleteDiary, .getOneDiary: | ||
return .requestPlain | ||
} | ||
} | ||
|
||
public var headers: HTTPHeaders? { | ||
switch self { | ||
case .createDiary, .changeDiary: | ||
return ["Content-Type": "multipart/form-data"] | ||
default: | ||
return ["Content-Type": "application/json"] | ||
} | ||
} | ||
public var baseURL: String { | ||
return "\(SecretConstants.baseURL)/diaries" | ||
} | ||
|
||
public var path: String { | ||
switch self { | ||
case .getCalendarByMonth(let ym): | ||
return "/calendar/\(ym.year)-\(String(format: "%02d", ym.month))" | ||
case .getDiaryByDate(let ymd): | ||
return "/date/\(ymd.year)-\(String(format: "%02d", ymd.month))-\(String(format: "%02d", ymd.day))" | ||
} | ||
} | ||
|
||
public var method: Alamofire.HTTPMethod { | ||
switch self { | ||
case .getCalendarByMonth: | ||
return .get | ||
case .getDiaryByDate: | ||
return .get | ||
} | ||
} | ||
|
||
public var task: APITask { | ||
switch self { | ||
case .getCalendarByMonth: | ||
return .requestPlain | ||
case .getDiaryByDate: | ||
return .requestPlain | ||
} | ||
} | ||
|
||
|
||
} |
103 changes: 0 additions & 103 deletions
103
Namo_SwiftUI/Projects/Core/Network/Sources/API/EndPoint/Diary/MoimDiaryEndPoint.swift
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
Namo_SwiftUI/Projects/Core/Network/Sources/DTO/Diary/DiaryCalendarDTO.swift
This file contains 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,22 @@ | ||
// | ||
// DiaryCalendarDTO.swift | ||
// CoreNetwork | ||
// | ||
// Created by 정현우 on 11/1/24. | ||
// | ||
|
||
public struct DiaryCalendarDTO: Decodable { | ||
public let year: Int | ||
public let month: Int | ||
public let diaryDateForPersonal: [Int] | ||
public let diaryDateForMeeting: [Int] | ||
public let diaryDateForBirthday: [Int] | ||
|
||
public init(year: Int, month: Int, diaryDateForPersonal: [Int], diaryDateForMeeting: [Int], diaryDateForBirthday: [Int]) { | ||
self.year = year | ||
self.month = month | ||
self.diaryDateForPersonal = diaryDateForPersonal | ||
self.diaryDateForMeeting = diaryDateForMeeting | ||
self.diaryDateForBirthday = diaryDateForBirthday | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
Namo_SwiftUI/Projects/Core/Network/Sources/DTO/Diary/DiaryScheduleDTO.swift
This file contains 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,48 @@ | ||
// | ||
// DiaryScheduleDTO.swift | ||
// CoreNetwork | ||
// | ||
// Created by 정현우 on 11/1/24. | ||
// | ||
|
||
public struct DiaryScheduleDTO: Decodable { | ||
public let scheduleId: Int | ||
public let scheduleType: Int | ||
public let categoryInfo: DiaryScheduleCategoryDTO | ||
public let scheduleStartDate: String | ||
public let scheduleEndDate: String | ||
public let scheduleTitle: String | ||
public let diaryId: Int | ||
public let participantInfo: DiaryScheduleParticipantDTO | ||
|
||
public init(scheduleId: Int, scheduleType: Int, categoryInfo: DiaryScheduleCategoryDTO, scheduleStartDate: String, scheduleEndDate: String, scheduleTitle: String, diaryId: Int, participantInfo: DiaryScheduleParticipantDTO) { | ||
self.scheduleId = scheduleId | ||
self.scheduleType = scheduleType | ||
self.categoryInfo = categoryInfo | ||
self.scheduleStartDate = scheduleStartDate | ||
self.scheduleEndDate = scheduleEndDate | ||
self.scheduleTitle = scheduleTitle | ||
self.diaryId = diaryId | ||
self.participantInfo = participantInfo | ||
} | ||
} | ||
|
||
public struct DiaryScheduleCategoryDTO: Decodable { | ||
public let name: String | ||
public let colorId: Int | ||
|
||
public init(name: String, colorId: Int) { | ||
self.name = name | ||
self.colorId = colorId | ||
} | ||
} | ||
|
||
public struct DiaryScheduleParticipantDTO: Decodable { | ||
public let participantsCount: Int | ||
public let participantsNames: String | ||
|
||
public init(participantsCount: Int, participantsNames: String) { | ||
self.participantsCount = participantsCount | ||
self.participantsNames = participantsNames | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Namo_SwiftUI/Projects/Domain/Diary/Interface/Sources/DomainDiaryInterfaceTemplate.swift
This file contains 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,7 @@ | ||
// | ||
// emptyfile.swift | ||
// Manifests | ||
// | ||
// Created by 정현우 on 10/1/24. | ||
// | ||
|
This file contains 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,46 @@ | ||
import ProjectDescription | ||
import ProjectDescriptionHelpers | ||
import DependencyPlugin | ||
|
||
let targets: [Target] = [ | ||
.domain( | ||
interface: .Diary, | ||
factory: .init( | ||
dependencies: [ | ||
.core | ||
] | ||
) | ||
), | ||
.domain( | ||
implements: .Diary, | ||
factory: .init( | ||
dependencies: [ | ||
.domain(interface: .Diary) | ||
] | ||
) | ||
), | ||
.domain( | ||
testing: .Diary, | ||
factory: .init( | ||
dependencies: [ | ||
.domain(interface: .Diary) | ||
] | ||
) | ||
), | ||
.domain( | ||
tests: .Diary, | ||
factory: .init( | ||
dependencies: [ | ||
.domain(testing: .Diary) | ||
] | ||
) | ||
) | ||
] | ||
|
||
let project: Project = .makeModule( | ||
name: ModulePath.Domain.name+ModulePath.Domain.Diary.rawValue, | ||
targets: targets | ||
) | ||
|
||
|
||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 포맷의 경우는 따로 유지보수하기 편하게 String Extension이나 ymd의 함수로 만들어 놓으면 좋을 것 같아보여요!