Skip to content

Conversation

@chanani
Copy link

@chanani chanani commented Dec 10, 2025

์•ˆ๋…•ํ•˜์„ธ์š” ! ์ˆ˜๊ฐ•์‹ ์ฒญ 4๋‹จ๊ณ„ ๋ฆฌ๋ทฐ ์š”์ฒญ๋“œ๋ฆฝ๋‹ˆ๋‹ค.๐Ÿ™‡โ€โ™‚๏ธ

์ตœ์ดˆ ํ…Œ์ด๋ธ” ์„ค๊ณ„ ์‹œ session ํ…Œ์ด๋ธ”์—์„œ cover_image_id๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
1:1 ๊ด€๊ณ„์—์„œ 1:N ์ƒํƒœ๋กœ ๋ณ€๊ฒฝ๋˜๋ฉด์„œ ๊ธฐ์กด๊ณผ ๋‹ค๋ฅด๊ฒŒ cover_image ํ…Œ์ด๋ธ”์—์„œ session_id๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์•ผ ๋œ๋‹ค๊ณ  ํŒ๋‹จ๋˜์–ด ๋ถˆ๊ฐ€ํ”ผํ•˜๊ฒŒ ํ…Œ์ด๋ธ”์„ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
DB ํ…Œ์ด๋ธ”์— ๋ฐ์ดํ„ฐ๊ฐ€ ์กด์žฌํ•œ๋‹ค๋Š” ๊ฐ€์ •ํ•˜์— ๋ฆฌํŒฉํ„ฐ๋ง์„ ์ง„ํ–‰ํ•˜๋ผ๋Š” ์š”๊ตฌ์‚ฌํ•ญ์ด ์žˆ์—ˆ๋Š”๋ฐ, ์ด๋ฅผ ์ง€ํ‚ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.

์ œ๊ฐ€ ๋งˆ์ง€๋ง‰ ์š”๊ตฌ์‚ฌํ•ญ์„ ์ž˜ ์ดํ•ดํ•˜๊ณ  ์ง„ํ–‰ํ•œ๊ฑด์ง€ ํ™•์‹ ์ด ๋“ค์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
์šฐ์•„ํ•œํ…Œํฌ์ฝ”์Šค(๋ฌด๋ฃŒ), ์šฐ์•„ํ•œํ…Œํฌ์บ ํ”„ Pro(์œ ๋ฃŒ)์™€ ๊ฐ™์ด ์„ ๋ฐœ๋œ ์ธ์›๋งŒ ์ˆ˜๊ฐ• ๊ฐ€๋Šฅํ•ด์•ผ ํ•œ๋‹ค. ๋ผ๋Š” ์กฐ๊ฑด์—์„œ ์„ ๋ฐœ ์—ฌ๋ถ€๋„ ์ˆ˜์ •์ด ๊ฐ€๋Šฅํ•œ ์ชฝ์œผ๋กœ ์ž‘์—…์„ ์ง„ํ–‰ํ–ˆ๋Š”๋ฐ, ํ˜น์‹œ๋ผ๋„ ์š”๊ตฌ์‚ฌํ•ญ์„ ์ œ๋Œ€๋กœ ํŒŒ์•…ํ•˜์ง€ ๋ชปํ•œ ๋ถ€๋ถ„์ด ์žˆ์„ ๊ฒฝ์šฐ ์ˆ˜์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

โ€ฆ ํ›„ ํ•„์š”ํ•œ ํด๋ž˜์Šค์— ์ƒ์†(SessionCore ์š”๊ตฌ์‚ฌํ•ญ ์ถ”๊ฐ€๋กœ ์ธํ•ด ์ƒ์†์ด ์•„๋‹Œ ์ธ์Šคํ„ด์Šค ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์ข‹๊ฒ ๋‹ค๊ณ  ํŒ๋‹จ.)
SessionCoreV2์—์„œ ์ถ”๊ฐ€๋œ ์š”๊ตฌ์‚ฌํ•ญ ์ ์šฉ ์˜ˆ์ •
- session ํ…Œ์ด๋ธ” ์—์„œ cover_image_id๋ฅผ ๊ด€๋ฆฌํ–ˆ๋Š”๋ฐ cover_image ํ…Œ์ด๋ธ”์—์„œ session_id ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ์ˆ˜์ •
- DB ํ…Œ์ด๋ธ”์— ๋ฐ์ดํ„ฐ๊ฐ€ ์กด์žฌํ•œ๋‹ค๋Š” ๊ฐ€์ •ํ•˜์— ๋ฆฌํŒฉํ„ฐ๋ง ์ง„ํ–‰ํ•˜๋ผ๋Š” ์š”๊ตฌ์‚ฌํ•ญ์ด ์žˆ์—ˆ๋Š”๋ฐ, ์ตœ์ดˆ DB ์„ค๊ณ„ ์‹œ ๋ฌธ์ œ๋กœ ์ด๋ฅผ ์ง€ํ‚ค์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์‹ค๋ฌด์—์„œ ์ด๋Ÿฐ ์ƒํ™ฉ์ด ์˜จ๋‹ค๋ฉด, ๊ธฐ์กด ๋ฐ์ดํ„ฐ์— ๋ฌธ์ œ๋˜์ง€ ์•Š๋„๋ก ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ž‘์„ฑํ•  ๊ฒƒ๊ฐ™์Šต๋‹ˆ๋‹ค.
refactor : ์ˆ˜๊ฐ•์‹ ์ฒญ ๊ฐ์ฒด์— ์ƒํƒœ๊ฐ’ ์ถ”๊ฐ€ ๋ฐ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
Copy link
Contributor

@javajigi javajigi left a comment

Choose a reason for hiding this comment

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

๋“œ๋””์–ด ๋ฏธ์…˜์˜ ๋งˆ์ง€๋ง‰ ๋‹จ๊ณ„๋„จ์š”. ๐Ÿ‘
์š”๊ตฌ์‚ฌํ•ญ์€ ์ •ํ™•ํžˆ ์ž˜ ํŒŒ์•…ํ•ด ๊ตฌํ˜„ ์ž˜ ํ–ˆ๋„ค์š”.
๋‹จ, Session์˜ ๋ณต์žก๋„๋ฅผ ๋‚ฎ์ถ”๊ณ  ์ธํ„ฐํŽ˜์ด์Šค ์‚ฌ์šฉ๊ณผ ๊ด€๋ จํ•œ ํ”ผ๋“œ๋ฐฑ ๋‚จ๊ฒผ์œผ๋‹ˆ ํ•œ๋ฒˆ ๊ณ ๋ฏผํ•ด ๋ณด๋Š” ์‹œ๊ฐ„์„ ๊ฐ€์ง€๋ฉด ์ข‹๊ฒ ์Šต๋‹ˆ๋‹ค.

import java.util.ArrayList;
import java.util.List;

public class CoverImages {
Copy link
Contributor

Choose a reason for hiding this comment

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

์ผ๊ธ‰ ์ฝœ๋ ‰์…˜ ์ ์šฉ ๐Ÿ‘


import java.util.Arrays;

public enum EnrollmentStatus {
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ‘


import java.util.Arrays;

public enum SelectionStatus {
Copy link
Contributor

Choose a reason for hiding this comment

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

๐Ÿ‘

@@ -0,0 +1,15 @@
package nextstep.courses.domain.session.constant;

public enum SessionRecruitmentStatus {
Copy link
Contributor

Choose a reason for hiding this comment

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

์ƒํƒœ ๊ฐ’์„ ๋ถ„๋ฆฌ ๐Ÿ‘

}

private boolean isSelectedAndCancelled(EnrollmentStatus enrollmentStatus) {
return this.selectionStatus.equals(SelectionStatus.SELECTED) && enrollmentStatus.equals(EnrollmentStatus.CANCELLED);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return this.selectionStatus.equals(SelectionStatus.SELECTED) && enrollmentStatus.equals(EnrollmentStatus.CANCELLED);
return this.selectionStatus.isSelected() && enrollmentStatus.isCancled();

enum๋„ class์™€ ๊ฐ™์ด ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ด๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ ๊ฐ€๋Šฅํ•จ


import java.time.LocalDateTime;

public interface SessionCoreFacade {
Copy link
Contributor

Choose a reason for hiding this comment

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

์ธํ„ฐํŽ˜์ด์Šค์˜ ๋ฉ”์„œ๋“œ๊ฐ€ ๋„ˆ๋ฌด ๋งŽ๋‹ค.
์ธํ„ฐํŽ˜์ด์Šค์˜ ๋ฉ”์„œ๋“œ๊ฐ€ ๋„ˆ๋ฌด ๋งŽ์„ ๊ฒฝ์šฐ ์ธํ„ฐํŽ˜์ด์Šค ์„ค๊ณ„๊ฐ€ ์ž˜๋ชป๋˜์—ˆ์„ ๊ฐ€๋Šฅ์„ฑ์ด ๋†’์Œ
์ด๋Ÿด ๊ฒฝ์šฐ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ฑ…์ž„์— ๋”ฐ๋ผ ๋ถ„๋ฆฌํ•˜๊ฑฐ๋‚˜, ๋ถˆํ•„์š”ํ•œ ๋ฉ”์„œ๋“œ๋ฅผ ์ œ๊ฑฐํ•  ํ•„์š”๊ฐ€ ์žˆ์Œ
๋˜ํ•œ ์ด ์ธํ„ฐํŽ˜์ด์Šค๊ฐ€ ํ•„์š”ํ•œ์ง€์— ๋Œ€ํ•ด์„œ๋„ ๊ณ ๋ฏผํ•ด ๋ณด๋ฉด ์ข‹๊ฒ ๋‹ค.

Comment on lines 71 to 78
SessionRecord sessionRecord = sessionRepository.findById(enrollment.getSessionId());
List<EnrollmentRecord> enrollmentRecords = enrollmentRepository.findBySessionId(enrollment.getSessionId());
Session session = sessionRecord.toSession(null, null, toEnrollments(enrollmentRecords));
Session session = SessionMapper.toDomain(sessionRecord, null, null, toEnrollments(enrollmentRecords));
session.addEnrollment(enrollment, payment);

paymentRepository.save(payment);

return enrollmentRepository.save(enrollment);
Copy link
Contributor

Choose a reason for hiding this comment

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

์ด ๋ฏธ์…˜์˜ ๊ฐ์ฒด ์„ค๊ณ„์—์„œ ์ˆ˜๊ฐ• ์‹ ์ฒญ ๊ฐ€๋Šฅ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด ๋ณต์žก๋„๊ฐ€ ๊ฐ€์žฅ ๋†’์€ ๋ถ€๋ถ„์ด์ด๋‹ค.
์ด ๋ถ€๋ถ„์€ Session ๊ฐ์ฒด ๋‚ด์— ๋‘๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ์•„๋ž˜์™€ ๊ฐ™์ด Session์„ ํ†ตํ•ด ์ˆ˜๊ฐ•์‹ ์ฒญ์— ํ•„์š”ํ•œ ๊ฐ์ฒด๋ฅผ ์•„๋ž˜์˜ Enrollment์™€ ๊ฐ™์€ ๊ฐ์ฒด๋กœ ์ƒ์„ฑํ•œ ํ›„ ์œ„์ž„ํ•จ์œผ๋กœ์จ ๋ณต์žก๋„๋ฅผ ๋‚ฎ์ถ”๋Š” ๋ฐฉ์‹์œผ๋กœ ์ ‘๊ทผํ•ด ๋ณด๋Š” ๊ฒƒ์€ ์–ด๋–จ๊นŒ?

์•„๋ž˜ ์ฝ”๋“œ์—์„œ Enrollment๋Š” ์ˆ˜๊ฐ• ์‹ ์ฒญ ๊ฐ€๋Šฅ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•˜๋Š” ๋กœ์ง์„ ๋‹ด๋‹นํ•˜๋Š” ๊ฐ์ฒด๋กœ ์ฐฌํ•œ๋‹˜ ์ฝ”๋“œ์˜ Enrollment์™€๋Š” ๋‹ค๋ฆ„
์ฐฌํ•œ๋‹˜์˜ Enrollment๋Š” ์•„๋ž˜ ์ฝ”๋“œ์—์„œ Student์ž„

    SessionRecord sessionRecord = ...
    List<EnrollmentRecord> enrollmentRecords = ...
    Enrollment enrollment = sessionRecord.createEnrollment(enrollmentRecords);
    Student student = enrollment.enroll(user);
    enrollmentRepository.save(student.getUserId(), student.getSessionId());

์œ„ ์ฝ”๋“œ์—์„œ ๋ฆฌํŒฉํ„ฐ๋ง ํžŒํŠธ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๋Š” ๋ถ€๋ถ„์ด ์žˆ๋‹ค๋ฉด ๋ฆฌํŒฉํ„ฐ๋งํ•ด ๋ณธ๋‹ค.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants