Skip to content
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

[TNT-213] 트레이너 회원 목록에서 회원 초대 연결 & 트레이너 캘린더 API연결 #87

Merged
merged 4 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) ?? "",
Comment on lines +138 to +139
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 와서 보니까 해당 내용은 Entity에서 Date로 관리하고,
화면에 표시할때 toString 해주면 더 좋았을 것 같네요!
나중에 한 번 반영해보죠..!

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