Skip to content
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
@@ -0,0 +1,29 @@
package com.back.domain.mentoring.mentoring.entity;

import com.back.domain.member.mentor.entity.Mentor;
import com.back.global.jpa.BaseEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.Getter;

@Entity
@Getter
public class Mentoring extends BaseEntity {
@ManyToOne
@JoinColumn(name = "mentor_id")
private Mentor mentor;

@Column(length = 100)
private String title;

@Column(columnDefinition = "TEXT")
private String bio;

@Column(columnDefinition = "JSON")
private String tags;

@Column(length = 255)
private String thumb;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.back.domain.mentoring.mentoring.entity;

import com.back.domain.mentoring.reservation.entity.Reservation;
import com.back.global.jpa.BaseEntity;
import jakarta.persistence.*;
import lombok.Getter;

@Entity
@Getter
public class Review extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reservation_id", nullable = false)
private Reservation reservation;

@Column(nullable = false)
private double rating;

@Column(columnDefinition = "TEXT")
private String content;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.back.domain.mentoring.mentoring.repository;

import com.back.domain.mentoring.mentoring.entity.Mentoring;
import org.springframework.data.jpa.repository.JpaRepository;

public interface MentoRepository extends JpaRepository<Mentoring, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.back.domain.mentoring.mentoring.repository;

import com.back.domain.mentoring.mentoring.entity.Review;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ReviewRepository extends JpaRepository<Review, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.back.domain.mentoring.reservation.constant;

public enum ReservationStatus {
PENDING, // 예약 승인 대기
APPROVED, // 승인됨
REJECTED, // 거절됨
CANCELED, // 취소됨
COMPLETED // 완료됨
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.back.domain.mentoring.reservation.entity;

import com.back.domain.member.mentee.entity.Mentee;
import com.back.domain.member.mentor.entity.Mentor;
import com.back.domain.mentoring.mentoring.entity.Mentoring;
import com.back.domain.mentoring.reservation.constant.ReservationStatus;
import com.back.domain.mentoring.slot.entity.MentorSlot;
import com.back.global.jpa.BaseEntity;
import jakarta.persistence.*;
import lombok.Getter;

@Entity
@Getter
public class Reservation extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "mentoring_id", nullable = false)
private Mentoring mentoring;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "mentor_id", nullable = false)
private Mentor mentor;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "mentee_id", nullable = false)
private Mentee mentee;

@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "mentor_slot_id", nullable = false)
private MentorSlot mentorSlot;

@Column(columnDefinition = "TEXT")
private String preQuestion;

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private ReservationStatus status;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.back.domain.mentoring.reservation.repository;

import com.back.domain.mentoring.reservation.entity.Reservation;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ReservationRepository extends JpaRepository<Reservation, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.back.domain.mentoring.slot.constant;

public enum MentorSlotStatus {
AVAILABLE, // 예약 가능
PENDING, // 예약 승인 대기
APPROVED, // 예약 승인됨(확정)
COMPLETED // 멘토링 완료
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.back.domain.mentoring.slot.entity;

import com.back.domain.member.mentor.entity.Mentor;
import com.back.domain.mentoring.reservation.constant.ReservationStatus;
import com.back.domain.mentoring.reservation.entity.Reservation;
import com.back.domain.mentoring.slot.constant.MentorSlotStatus;
import com.back.global.jpa.BaseEntity;
import jakarta.persistence.*;
import lombok.Getter;

import java.time.LocalDateTime;

@Entity
@Getter
public class MentorSlot extends BaseEntity {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "mentor_id", nullable = false)
private Mentor mentor;

@Column(nullable = false)
private LocalDateTime startDateTime;

@Column(nullable = false)
private LocalDateTime endDateTime;

@OneToOne(mappedBy = "mentorSlot")
private Reservation reservation;

public MentorSlotStatus getStatus() {
if (reservation == null) {
return MentorSlotStatus.AVAILABLE;
}

return switch (reservation.getStatus()) {
case PENDING -> MentorSlotStatus.PENDING;
case APPROVED -> MentorSlotStatus.APPROVED;
case COMPLETED -> MentorSlotStatus.COMPLETED;
default -> MentorSlotStatus.AVAILABLE;
};
}

public boolean isAvailable() {
return reservation == null ||
reservation.getStatus().equals(ReservationStatus.REJECTED) ||
reservation.getStatus().equals(ReservationStatus.CANCELED);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.back.domain.mentoring.slot.repository;

import com.back.domain.mentoring.slot.entity.MentorSlot;
import org.springframework.data.jpa.repository.JpaRepository;

public interface MentorSlotRepository extends JpaRepository<MentorSlot, Long> {
}