-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feature] RecordView 데이터 연동 구현
- Loading branch information
Showing
11 changed files
with
191 additions
and
7 deletions.
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
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
19 changes: 19 additions & 0 deletions
19
HongikYeolgong2/Data/DTO/StudySession/StudyTimeResponseDTO.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,19 @@ | ||
// | ||
// StudyDurationResponseDTO.swift | ||
// HongikYeolgong2 | ||
// | ||
// Created by 최주원 on 11/6/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct StudyTimeResponseDTO: Decodable { | ||
let yearHours: Int | ||
let yearMinutes: Int | ||
let monthHours: Int | ||
let monthMinutes: Int | ||
let dayHours: Int | ||
let dayMinutes: Int | ||
let semesterHours: Int | ||
let semesterMinutes: Int | ||
} |
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
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,41 @@ | ||
// | ||
// StudyTime.swift | ||
// HongikYeolgong2 | ||
// | ||
// Created by 최주원 on 11/6/24. | ||
// | ||
|
||
import Foundation | ||
|
||
struct StudyTime { | ||
let yearHours: Int | ||
let yearMinutes: Int | ||
let monthHours: Int | ||
let monthMinutes: Int | ||
let dayHours: Int | ||
let dayMinutes: Int | ||
let semesterHours: Int | ||
let semesterMinutes: Int | ||
|
||
init(yearHours: Int, yearMinutes: Int, monthHours: Int, monthMinutes: Int, dayHours: Int, dayMinutes: Int, semesterHours: Int, semesterMinutes: Int) { | ||
self.yearHours = yearHours | ||
self.yearMinutes = yearMinutes | ||
self.monthHours = monthHours | ||
self.monthMinutes = monthMinutes | ||
self.dayHours = dayHours | ||
self.dayMinutes = dayMinutes | ||
self.semesterHours = semesterHours | ||
self.semesterMinutes = semesterMinutes | ||
} | ||
|
||
init() { | ||
self.yearHours = 0 | ||
self.yearMinutes = 0 | ||
self.monthHours = 0 | ||
self.monthMinutes = 0 | ||
self.dayHours = 0 | ||
self.dayMinutes = 0 | ||
self.semesterHours = 0 | ||
self.semesterMinutes = 0 | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
HongikYeolgong2/Domain/Interactors/StudyTimeInteractor.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,32 @@ | ||
// | ||
// StudyTimeInteractor.swift | ||
// HongikYeolgong2 | ||
// | ||
// Created by 최주원 on 11/6/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
protocol StudyTimeInteractor { | ||
func getStudyTime(StudyTime: Binding<StudyTime>) | ||
} | ||
|
||
final class StudyTimeInteractorImpl: StudyTimeInteractor { | ||
private let cancleBag = CancelBag() | ||
private let studySessionRepository: StudySessionRepository | ||
|
||
init(studySessionRepository: StudySessionRepository) { | ||
self.studySessionRepository = studySessionRepository | ||
} | ||
|
||
func getStudyTime(StudyTime: Binding<StudyTime>) { | ||
studySessionRepository | ||
.getStudyTime() | ||
.sink { _ in | ||
} receiveValue: { | ||
StudyTime.wrappedValue = $0 | ||
} | ||
.store(in: cancleBag) | ||
|
||
} | ||
} |
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
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,21 @@ | ||
// | ||
// StudyTimeMapper.swift | ||
// HongikYeolgong2 | ||
// | ||
// Created by 최주원 on 11/6/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension StudyTimeResponseDTO { | ||
func toEntity() -> StudyTime { | ||
.init(yearHours: yearHours, | ||
yearMinutes: yearMinutes, | ||
monthHours: monthHours, | ||
monthMinutes: monthMinutes, | ||
dayHours: dayHours, | ||
dayMinutes: dayMinutes, | ||
semesterHours: semesterHours, | ||
semesterMinutes: semesterMinutes) | ||
} | ||
} |
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
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
Oops, something went wrong.