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

πŸ”— :: (#275) 반 별 μ·¨μ—… ν˜„ν™© API 연동 #276

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

leejh08
Copy link
Member

@leejh08 leejh08 commented Mar 4, 2025

κ°œμš”

  • 반 별 μ·¨μ—… ν˜„ν™© API κ΅¬ν˜„

μž‘μ—…μ‚¬ν•­

  • 반 별 μ·¨μ—… ν˜„ν™© API κ΅¬ν˜„

UI

@leejh08 leejh08 added the ✨feat μƒˆλ‘œμš΄ κΈ°λŠ₯을 μΆ”κ°€ ν•  경우 label Mar 4, 2025
@leejh08 leejh08 self-assigned this Mar 4, 2025
@leejh08 leejh08 linked an issue Mar 4, 2025 that may be closed by this pull request
@cyj513
Copy link
Contributor

cyj513 commented Mar 4, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@leejh08 leejh08 changed the title πŸ”— :: (#275) 반 별 μ·¨μ—… ν˜„ν™© API πŸ”— :: (#275) 반 별 μ·¨μ—… ν˜„ν™© API 연동 Mar 4, 2025
@cyj513
Copy link
Contributor

cyj513 commented Mar 4, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 4, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

Comment on lines 30 to 48
let classInfo = input.viewWillAppear
.flatMapLatest { [fetchEmploymentStatusUseCase] in
fetchEmploymentStatusUseCase.execute()
}
.map { applications in
applications.first { $0.classId == self.classNumber } ?? ApplicationEntity(
applicationID: 0,
recruitmentID: 0,
company: "",
companyLogoUrl: "",
attachments: [],
applicationStatus: .approved,
classId: self.classNumber,
employmentRateResponseList: [],
totalStudents: 0,
passedStudents: 0
)
}
.share(replay: 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

@leejh08 share(replay: 1)λ₯Ό μ‚¬μš©ν•΄ μ²˜λ¦¬ν•œ μ΄μœ κ°€ μžˆμ„κΉŒμš”?

Copy link
Member Author

Choose a reason for hiding this comment

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

classinfoλ₯Ό κ΅¬λ…ν• λ•Œ 쀑볡 μš”μ²­μ΄ 생길거같아 μ¨λ΄€μŠ΅λ‹ˆλ‹€

Copy link
Contributor

@juyeong525 juyeong525 Mar 6, 2025

Choose a reason for hiding this comment

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

share 은 μ—¬λŸ¬κ³³μ—μ„œ subscribe을 ν–ˆμ„κ²½μš° μ—¬λŸ¬ 슀트림이 생겨 쀑볡 ν˜ΈμΆœλ λ•Œ 단일 슀트림으둜 λ§Œλ“€μ–΄ μ£ΌκΈ° μœ„ν•΄ μ‚¬μš©ν•©λ‹ˆλ‹€.
ν•˜μ§€λ§Œ ν˜„μž¬ μ½”λ“œ μƒμœΌλ‘œλŠ” ViewController에 bind λΆ€λΆ„μ—μ„œ outputλ₯Ό subscribeλ₯Ό ν•˜μ—¬ 쀑볡 슀트림이 생기지 μ•Šμ„ κ²ƒμœΌλ‘œ λ³΄μž…λ‹ˆλ‹€.
μ¨λ΄€λ‹€λ³΄λ‹€λŠ” μ“΄ μ΄μœ κ°€ λͺ…ν™•ν•΄μ•Ό ν•œλ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€.

Copy link
Contributor

Choose a reason for hiding this comment

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

κ·Έλž˜λ„ μ€‘λ³΅ν˜ΈμΆœμ„ μƒκ°ν•˜κ³  share둜 미리 방지 ν•˜λŠ”κ±΄ 쒋은거 κ°™μ•„μš”πŸ‘πŸΏ

@cyj513
Copy link
Contributor

cyj513 commented Mar 4, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 4, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

Comment on lines 34 to 47
.map { applications in
applications.first { $0.classId == self.classNumber } ?? ApplicationEntity(
applicationID: 0,
recruitmentID: 0,
company: "",
companyLogoUrl: "",
attachments: [],
applicationStatus: .approved,
classId: self.classNumber,
employmentRateResponseList: [],
totalStudents: 0,
passedStudents: 0
)
}
Copy link
Member

Choose a reason for hiding this comment

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

리뷰 λ‚¨κ²¨λ“œλ¦° λ‚΄μš© ν† λŒ€λ‘œ ApplicationEntity μˆ˜μ • 및 μΆ”κ°€ ν•˜μ‹œλ©΄ κ°œμ„ μ΄ ν•„μš”ν•œ λΆ€λΆ„ κ°™μŠ΅λ‹ˆλ‹€.

Copy link
Member

Choose a reason for hiding this comment

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

μ½”λ“œκ°€ λ„ˆλ¬΄ μ§€μ €λΆ„ν•œ κ±° κ°™μ•„μš” μ€‘λ³΅μž‘μ—… 이 λ§Žμ•„μš”

Comment on lines +102 to +107
.forEach { classNumber, button in
button.rx.tap
.map { classNumber + 1 }
.bind(to: classButtonTapped)
.disposed(by: disposeBag)
}
Copy link
Member

Choose a reason for hiding this comment

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

classNumberκ°€ μ•„λ‹ˆλΌ index라고 ν•˜λŠ”κ²Œ λ§žλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€

Copy link
Member

Choose a reason for hiding this comment

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

μ•„λ‹ˆλ©΄ ꡳ이 enumerated()λ₯Ό 쓰지 말고 foreachμ—μ„œ button에 μ ‘κ·Ό ν•  수 μžˆλŠ”λ°
ClassButton에 μƒμˆ˜λ₯Ό λ§Œλ“€μ–΄ classNumberλ₯Ό κ°€μ Έμ˜¬ 수 있게 ν•˜λ©΄ 쒋을 것 κ°™μ•„μš”

Copy link
Member Author

Choose a reason for hiding this comment

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

μ•„λ‹ˆλ©΄ ꡳ이 enumerated()λ₯Ό 쓰지 말고 foreachμ—μ„œ button에 μ ‘κ·Ό ν•  수 μžˆλŠ”λ° ClassButton에 μƒμˆ˜λ₯Ό λ§Œλ“€μ–΄ classNumberλ₯Ό κ°€μ Έμ˜¬ 수 있게 ν•˜λ©΄ 쒋을 것 κ°™μ•„μš”

μ„ λ°°λ‹˜μ΄ λ§μ”€ν•˜μ‹  λ°©μ‹μœΌλ‘œ 처음 μ½”λ“œλ₯Ό μž‘μ„±ν•˜μ˜€λŠ”λ° 주영 μ„ λ°°λ‹˜μ΄ μΆ”μ²œν•˜λŠ” λ°©μ‹μœΌλ‘œ λ°”κΎΌκ²Œ 이 μ½”λ“œμž…λ‹ˆλ‹€
ν˜Ήμ‹œ μ–΄λ–€ 방식이 쑰금 더 νš¨μœ¨μ μΌκΉŒμš”?

Copy link
Member

Choose a reason for hiding this comment

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

음 μ—„μ—°νžˆ λ‹€λ₯Έ μ½”λ“œλΌκ³  μƒκ°ν•΄μš”. 기쑴에 νŠœν”Œλ‘œ 맀핑해둔 ꡬ문을 enumerateλ₯Ό μ‚¬μš©ν•΄ 더 κΉ”λ”ν•œ μ½”λ“œλ₯Ό μ œμ•ˆν–ˆμ–΄μš”
μ €λŠ” Projects/Presentation/Sources/Home/EmployStatus/Components/ClassButton.swift #line=25 에 init으둜 이미 classNumberλ₯Ό λ°›κ³  μžˆμœΌλ‹ˆ μƒμˆ˜λ‘œ classNumber을 ν•˜λ‚˜ κ°–κ³ , μž‡μœΌλ©΄

Suggested change
.forEach { classNumber, button in
button.rx.tap
.map { classNumber + 1 }
.bind(to: classButtonTapped)
.disposed(by: disposeBag)
}
.forEach { button in
button.rx.tap
.map { button.classNumber }
.bind(to: classButtonTapped)
.disposed(by: disposeBag)
}

μ΄λŸ°μ‹μœΌλ‘œ ꡳ이 index(offset)을 μ‚¬μš©ν•˜μ§€ μ•Šκ³ λ„ ν™œμš©ν•  수 μžˆμ–΄μš”. 이것도 가독성 μ°¨μ›μ—μ„œ μ•½κ°„ μ˜κ²¬μ„ λ‚Έ κ±° 뿐이긴 ν•˜λ‹ˆ 뭐가 더 λ‚˜μ„μ§€λŠ” 개인이 νŒλ‹¨ν•΄λ³΄μ„Έμš”!

μΆ”κ°€λ‘œ tagλ₯Ό μ¨μ„œ mapping ν•˜λΌλŠ”κ±°λž‘λ„ 거의 λΉ„μŠ·ν•œ λ‚΄μš©μž…λ‹ˆλ‹€~ ν•œλ²ˆ μƒκ°ν•΄λ΄μš”!

@cyj513
Copy link
Contributor

cyj513 commented Mar 5, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 6, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 7, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 7, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 9, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 9, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 9, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 9, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

Comment on lines 81 to 84
private func updateCompanyList(_ info: EmploymentEntity) {
let allCompanies = info.employmentRateResponseList + Array(
repeating: EmploymentCompany.empty,
count: max(0, 16 - info.employmentRateResponseList.count)
Copy link
Member

Choose a reason for hiding this comment

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

μ˜κ²¬μž…λ‹ˆλ‹€λ§Œμ€, emptyλ₯Ό μ œκ°€ ν™œμš©ν•΄λ³΄λΌ ν–ˆμ§€λ§Œ.. 그것두 더미 λ°μ΄ν„°λ‹ˆκΉŒ κ·Έλƒ₯ nil을 λ„£λŠ” 방법도 μžˆλ‹€λŠ”κ±° μ•Œμ•„λ‘λ©΄ μ’‹μ•„μš”~

Copy link
Member Author

Choose a reason for hiding this comment

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

μ„ λ°°λ‹˜κ»˜μ„œ 남겨주신 의견이 더 쒋은 μ½”λ“œλΌκ³  μƒκ°λ˜μ–΄, nil을 ν™œμš©ν•˜μ—¬ μˆ˜μ •ν•΄λ³΄μ•˜μŠ΅λ‹ˆλ‹€! 😊

Comment on lines +28 to +35
public func with(classID: Int) -> EmploymentEntity {
EmploymentEntity(
classID: classID,
employmentRateResponseList: self.employmentRateResponseList,
totalStudents: self.totalStudents,
passedStudents: self.passedStudents
)
}
Copy link
Member

Choose a reason for hiding this comment

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

μ–΄λ””μ„œ ν™œμš©λ˜λŠ”κ±ΈκΉŒμš”?

Copy link
Member Author

Choose a reason for hiding this comment

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

λ¨Όμ € ClassEmploymentViewModelμ—μ„œ with λ©”μ„œλ“œλ₯Ό ν™œμš©ν•˜μ˜€μŠ΅λ‹ˆλ‹€.
employments.first { $0.classID == classNumber } ?? EmploymentEntity.empty.with(classID: classNumber)
μΆ”κ°€μ μœΌλ‘œ μ„€λͺ… λ“œλ¦¬μžλ©΄
λͺ¨λ“  반의 μ·¨μ—… apiλ₯Ό κ°€μ Έμ˜¨ ν›„ 정보λ₯Ό λ³΄λ €λŠ” 반의 데이터λ₯Ό μ°ΎμŠ΅λ‹ˆλ‹€.
λ§Œμ•½ μ—†λ‹€λ©΄ empty 객체λ₯Ό μƒμ„±ν•˜κ³  classID만 ν•΄λ‹Ή 반 번호둜 λ³€κ²½ν•˜μ—¬ λ°˜ν™˜ν•©λ‹ˆλ‹€.
μ΄λŠ” 데이터가 μ—†λŠ” κ²½μš°μ—λ„ ν•΄λ‹Ή 반의 빈 정보λ₯Ό ν‘œμ‹œν•˜κΈ° μœ„ν•˜μ—¬ μž‘μ—…ν–ˆμŠ΅λ‹ˆλ‹€

@cyj513
Copy link
Contributor

cyj513 commented Mar 12, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

@cyj513
Copy link
Contributor

cyj513 commented Mar 12, 2025

All File Checked βœ…

βœ… Auto Pull Request SwiftLint Success!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨feat μƒˆλ‘œμš΄ κΈ°λŠ₯을 μΆ”κ°€ ν•  경우
Projects
None yet
Development

Successfully merging this pull request may close these issues.

반 별 μ·¨μ—… ν˜„ν™© API 연동
4 participants