Skip to content

Commit

Permalink
Merge pull request #87 from YAPP-Github/TNT-213-TrainerTraineeList
Browse files Browse the repository at this point in the history
[TNT-213] ํŠธ๋ ˆ์ด๋„ˆ ํšŒ์› ๋ชฉ๋ก์—์„œ ํšŒ์› ์ดˆ๋Œ€ ์—ฐ๊ฒฐ & ํŠธ๋ ˆ์ด๋„ˆ ์บ˜๋ฆฐ๋” API์—ฐ๊ฒฐ
  • Loading branch information
syss220211 authored Feb 14, 2025
2 parents 5882116 + ee9c1ad commit 2a91d51
Show file tree
Hide file tree
Showing 26 changed files with 433 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ public struct TrainerRepositoryImpl: TrainerRepository {
return try await networkService.request(TrainerTargetType.getMonthlyLessonList(year: year, month: month), decodingType: GetMonthlyLessonListResDTO.self)
}

public func getMembersList() async throws -> GetActiveTraineesListResDTO {
return try await networkService.request(
TrainerTargetType.getMemebersList,
decodingType: GetActiveTraineesListResDTO.self
)
}

public func getConnectedTraineeInfo(trainerId: Int, traineeId: Int) async throws -> GetConnectedTraineeInfoResponseDTO {
return try await networkService.request(TrainerTargetType.getConnectedTraineeInfo(trainerId: trainerId, traineeId: traineeId), decodingType: GetConnectedTraineeInfoResponseDTO.self)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "icn_check_mark_green.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_plus_gray.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "icn_plus_white.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "icn_write_gray.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public struct TCalendarRepresentable: UIViewRepresentable {
calendar.appearance.titleDefaultColor = .clear
calendar.calendarWeekdayView.weekdayLabels[0].textColor = UIColor(.red500)


return calendar
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ public extension ImageResource {
static let icnMypageFilled: ImageResource = DesignSystemAsset.icnMypageFilled.imageResource
static let icnWriteWhite: ImageResource = DesignSystemAsset.icnWriteWhite.imageResource
static let icnWriteBlack: ImageResource = DesignSystemAsset.icnWriteBlack.imageResource
static let icnWriteGray: ImageResource = DesignSystemAsset.icnWriteGray.imageResource
static let icnRadioButtonUnselected: ImageResource = DesignSystemAsset.icnRadioButtonUnselected.imageResource
static let icnRadioButtonSelected: ImageResource = DesignSystemAsset.icnRadioButtonSelected.imageResource
static let icnCheckMarkEmpty: ImageResource = DesignSystemAsset.icnCheckMarkEmpty.imageResource
static let icnCheckMarkGreen: ImageResource = DesignSystemAsset.icnCheckMarkGreen.imageResource
static let icnCheckMarkFilled: ImageResource = DesignSystemAsset.icnCheckMarkFilled.imageResource
static let icnCheckButtonUnselected: ImageResource = DesignSystemAsset.icnCheckButtonUnselected.imageResource
static let icnCheckButtonSelected: ImageResource = DesignSystemAsset.icnCheckButtonSelected.imageResource
Expand All @@ -50,6 +52,7 @@ public extension ImageResource {
static let icnWriteBlackFilled: ImageResource = DesignSystemAsset.icnWriteBlackFilled.imageResource
static let icnPlus: ImageResource = DesignSystemAsset.icnPlus.imageResource
static let icnPlusEmpty: ImageResource = DesignSystemAsset.icnPlusEmpty.imageResource
static let icnPlusGray: ImageResource = DesignSystemAsset.icnPlusGray.imageResource
static let icnAlarm: ImageResource = DesignSystemAsset.icnAlarm.imageResource
static let icnCalendar: ImageResource = DesignSystemAsset.icnCalendar.imageResource
static let icnDelete24px: ImageResource = DesignSystemAsset.icnDelete24.imageResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public struct SessonDTO: Decodable {
public let ptLessonId: String
public let traineeId: String
public let traineeName: String
public let traineeProfileImageUrl: String
public let session: Int
public let startTime: String
public let endTime: String
Expand All @@ -38,6 +39,7 @@ public struct SessonDTO: Decodable {
ptLessonId: String,
traineeId: String,
traineeName: String,
traineeProfileImageUrl: String,
session: Int,
startTime: String,
endTime: String,
Expand All @@ -46,6 +48,7 @@ public struct SessonDTO: Decodable {
self.ptLessonId = ptLessonId
self.traineeId = traineeId
self.traineeName = traineeName
self.traineeProfileImageUrl = traineeProfileImageUrl
self.session = session
self.startTime = startTime
self.endTime = endTime
Expand Down Expand Up @@ -75,6 +78,7 @@ public struct SessonEntity: Equatable, Encodable {
public let ptLessonId: String
public let traineeId: String
public let traineeName: String
public let traineeProfileImageUrl: String
public let session: Int
public let startTime: String
public let endTime: String
Expand All @@ -84,6 +88,7 @@ public struct SessonEntity: Equatable, Encodable {
ptLessonId: String,
traineeId: String,
traineeName: String,
traineeProfileImageUrl: String,
session: Int,
startTime: String,
endTime: String,
Expand All @@ -92,6 +97,7 @@ public struct SessonEntity: Equatable, Encodable {
self.ptLessonId = ptLessonId
self.traineeId = traineeId
self.traineeName = traineeName
self.traineeProfileImageUrl = traineeProfileImageUrl
self.session = session
self.startTime = startTime
self.endTime = endTime
Expand Down Expand Up @@ -122,14 +128,15 @@ public extension GetDateSessionListDTO {

// MARK: - SessonDTO -> SessonEntity
public extension SessonDTO {
public func toEntity() -> SessonEntity {
func toEntity() -> SessonEntity {
return SessonEntity(
ptLessonId: self.ptLessonId,
traineeId: self.traineeId,
traineeName: self.traineeName,
traineeProfileImageUrl: self.traineeProfileImageUrl,
session: self.session,
startTime: self.startTime,
endTime: self.endTime,
startTime: self.startTime.toDate(format: .ISO8601)?.toString(format: .a_HHmm) ?? "",
endTime: self.endTime.toDate(format: .ISO8601)?.toString(format: .a_HHmm) ?? "",
isCompleted: self.isCompleted
)
}
Expand All @@ -140,6 +147,7 @@ public extension SessonDTO {
ptLessonId: self.ptLessonId,
traineeId: self.traineeId,
traineeName: self.traineeName,
traineeProfileImageUrl: self.traineeProfileImageUrl,
session: self.session,
startTime: self.startTime,
endTime: self.endTime,
Expand All @@ -166,6 +174,7 @@ public extension SessonEntity {
ptLessonId: self.ptLessonId,
traineeId: self.traineeId,
traineeName: self.traineeName,
traineeProfileImageUrl: self.traineeProfileImageUrl,
session: self.session,
startTime: self.startTime,
endTime: self.endTime,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public protocol TrainerRepository {
/// ๋‹ฌ๋ ฅ ์Šค์ผ€์ค„ ์นด์šดํŠธ ํ‘œ์‹œ์— ํ•„์š”ํ•œ PT ๋ฆฌ์ŠคํŠธ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
func getMonthlyLessonList(year: Int, month: Int) async throws -> GetMonthlyLessonListResDTO

/// ํšŒ์› ์กฐํฌ
func getMembersList() async throws -> GetActiveTraineesListResDTO

/// ์—ฐ๊ฒฐ ์™„๋ฃŒ๋œ ํŠธ๋ ˆ์ด๋‹ˆ ์ •๋ณด ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
func getConnectedTraineeInfo(trainerId: Int, traineeId: Int) async throws -> GetConnectedTraineeInfoResponseDTO

Expand Down
4 changes: 0 additions & 4 deletions TnT/Projects/Domain/Sources/UseCase/TrainerUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public struct DefaultTrainerUseCase: TrainerRepository {
return try await trainerRepository.getDateSessionList(date: date)
}

public func getMembersList() async throws -> GetActiveTraineesListResDTO {
return try await trainerRepository.getMembersList()
}

public func getConnectedTraineeInfo(trainerId: Int, traineeId: Int) async throws -> GetConnectedTraineeInfoResponseDTO {
return try await trainerRepository.getConnectedTraineeInfo(trainerId: trainerId, traineeId: traineeId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ public struct TrainerMainFlowFeature {
}

/// ํŠธ๋ ˆ์ด๋„ˆ ํšŒ์›๋ชฉ๋ก
case .trainerTraineeList:
state.path.append(.trainerManagment(.init()))
return .none
case .trainerTraineeList(let screen):
switch screen {
case .addTrainee:
state.path.append(.addTrainee(.init()))
return .none
}

/// ํŠธ๋ ˆ์ด๋„ˆ ๋งˆ์ดํŽ˜์ด์ง€
case .trainerMyPage(let screen):
Expand Down Expand Up @@ -119,8 +122,10 @@ extension TrainerMainFlowFeature {
case connectionComplete(ConnectionCompleteFeature)
/// ์—ฐ๊ฒฐ๋œ ํŠธ๋ ˆ์ด๋‹ˆ ํ”„๋กœํ•„
case connectedTraineeProfile(ConnectedTraineeProfileFeature)
/// ํŠธ๋ ˆ์ด๋„ˆ ํšŒ์› ๊ด€๋ฆฌ ํŽ˜์ด์ง€
case trainerManagment(TrainerManagementFeature)

// MARK: - ํšŒ์› ๋ชฉ๋ก
/// ํšŒ์› ์ถ”๊ฐ€
case addTrainee(AddTraineeFeature)

// MARK: MyPage
/// ์ดˆ๋Œ€์ฝ”๋“œ ๋ฐœ๊ธ‰
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ public struct TrainerMainFlowView: View {
ConnectionCompleteView(store: store)
case .connectedTraineeProfile(let store):
ConnectedTraineeProfileView(store: store)

// MARK: - TraineeList
case .addTrainee(let store):
AddTraineeView(store: store)

// MARK: MyPage
case .trainerMakeInvitationCodePage(let store):
MakeInvitationCodeView(store: store)
case .trainerManagment(let store):
TrainerManagementView(store: store)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public struct TrainerHomeFeature {
case calendarDateTap
/// ํƒญํ•œ ์ผ์ž api ํ˜•ํƒœ์— ๋งž์ถฐ ๋ณ€ํ™˜ํ•˜๊ธฐ(yyyy-mm-dd)
case settingSessionList(sessions: GetDateSessionListEntity)
/// ์ˆ˜์—… ์™„๋ฃŒ ํ›„ ํ† ์ŠคํŠธ ๋ฉ”์‹œ์ง€
case completeToastMessage
}
}

Expand All @@ -126,7 +128,7 @@ public struct TrainerHomeFeature {
case .view(let action):
switch action {
case .binding(\.selectedDate):
print("state.events[state.selectedDate] \(state.events[state.selectedDate])")
// print("state.events[state.selectedDate] \(state.events[state.selectedDate])")
return .none

case .binding:
Expand All @@ -136,8 +138,15 @@ public struct TrainerHomeFeature {
return .send(.setNavigating(.alarmPage))

case .tapSessionCompleted(let id):
// TODO: ๋„ค๋น„๊ฒŒ์ด์…˜ ์—ฐ๊ฒฐ ์‹œ ์ถ”๊ฐ€
print("tapSessionCompleted otLessionID \(id)")
guard let id = Int(id) else { return .none }
return .run { send in
let result: PutCompleteLessonResDTO = try await trainerRepoUseCase.putCompleteLesson(lessonId: id)
await send(.view(.completeToastMessage))
await send(.view(.calendarDateTap))
}

case .completeToastMessage:
NotificationCenter.default.post(toast: .init(presentType: .image(.icnCheckMarkGreen), message: "PT ์ˆ˜์—…์„ ์™„๋ฃŒํ–ˆ์–ด์š”"))
return .none

case .tapAddSessionButton:
Expand Down Expand Up @@ -175,7 +184,12 @@ public struct TrainerHomeFeature {
state.view_isPopUpPresented = true
}

return .send(.view(.fetchMonthlyLessons(year: year, month: month)))
return .concatenate(
.send(.view(.fetchMonthlyLessons(year: month == 1 ? year-1 : year, month: month == 1 ? 12 : month-1))),
.send(.view(.fetchMonthlyLessons(year: year, month: month))),
.send(.view(.fetchMonthlyLessons(year: year, month: month+1))),
.send(.view(.calendarDateTap))
)

case .fetchMonthlyLessons(year: let year, month: let month):
return .run { send in
Expand Down Expand Up @@ -206,7 +220,7 @@ public struct TrainerHomeFeature {
return .none

case .calendarDateTap:
let formattedDate = TDateFormatUtility.formatter(for: .yyyyMMdd).string(from: state.selectedDate)
let formattedDate: String = TDateFormatUtility.formatter(for: .yyyyMMdd).string(from: state.selectedDate)

return .run { send in
do {
Expand Down
Loading

0 comments on commit 2a91d51

Please sign in to comment.