Lecture 모듈
학원 강의 등록·수정·삭제, 학생용 강의 조회 및 YouTube 시청 URL 제공을 담당하는 모듈입니다.
모듈 개요
| 항목 | 내용 |
|---|---|
| Gradle 서브프로젝트 | modules/lecture |
| 베이스 패키지 | com.lumie.lecture |
| 데이터베이스 | PostgreSQL (멀티테넌트 RLS, lectures, lecture_class_targets 테이블) |
| 외부 노출 internal-api | LectureService |
주요 책임
- 한 강의를 여러 반(
classIds)에 공개하는 대상 관리 - 강의 공개 범위(
visibility) 관리 - YouTube URL 기반 동영상 강의 제공
- 학생 전용 조회 뷰 (공개된 강의만 노출)
- 수강 중인 반의 시청 URL 반환
도메인 모델
Lecture 엔티티
@Entity
@Table(name = "lectures")
public class Lecture extends TenantScopedEntity {
private Long id;
@Version Long version;
Long classId; // 호환용 대표 반
Long teacherId;
String title;
String description;
String youtubeUrl;
LectureVisibility visibility; // TEACHER_ONLY | STUDENT
LocalDate lectureDate;
}
LectureClassTarget 엔티티
@Entity
@Table(name = "lecture_class_targets")
public class LectureClassTarget extends TenantScopedEntity {
private Long id;
@Version Long version;
Long lectureId;
Long classId;
}
visibility = STUDENT인 강의는 하나 이상의 LectureClassTarget을 가져야 합니다.
lectures.class_id는 기존 API 호환을 위한 대표 반 값으로 유지되며, 실제 학생 접근
대상은 lecture_class_targets가 결정합니다.
LectureVisibility
| 값 | 의미 |
|---|---|
TEACHER_ONLY | 강사만 접근 가능 (기본값) |
STUDENT | 수강생에게 공개 |
REST API
강사 관리 API — 기본 경로: /v1/lectures
| 메서드 | 경로 | 설명 |
|---|---|---|
POST | /v1/lectures | 강의 생성 (201 Created) |
GET | /v1/lectures | 강의 목록 조회 (classId, teacherId, 날짜 범위, 검색, 페이지) |
GET | /v1/lectures/\{id\} | 강의 상세 조회 |
PATCH | /v1/lectures/\{id\} | 강의 수정 |
DELETE | /v1/lectures/\{id\} | 강의 삭제 |
정렬 허용 필드
createdAt, title, lectureDate
생성·수정 요청은 학생 공개 강의에 대해 classIds 배열을 받을 수 있습니다.
응답은 호환용 classId와 전체 대상 목록인 classIds를 함께 제공합니다.
학생 뷰 API — 기본 경로: /v1/lectures/student
| 메서드 | 경로 | 설명 |
|---|---|---|
GET | /v1/lectures/student/class/\{classId\} | 반별 학생 공개 강의 목록 |
GET | /v1/lectures/student/\{id\}/watch | 시청 URL 조회 (WatchResponse, classId 쿼리 선택) |
/v1/lectures/student/** 경로는 visibility = STUDENT이고 현재 학생이 수강 중인
반이 공개 대상에 포함된 강의만 반환합니다.
내부 API (libs/internal-api)
LectureService 인터페이스를 구현한 LectureServiceAdapter가 adapter/in/internal/에 위치합니다.
public interface LectureService {
Optional<LectureData> getLecture(String tenantSlug, Long lectureId);
LectureListData getLecturesByClass(String tenantSlug, Long classId, int page, int size);
}
멀티테넌시
lectures와 lecture_class_targets 테이블에 tenant_id BIGINT NOT NULL이 있으며
RLS 정책이 적용됩니다.
관련 문서
- Class 모듈 — 강의 공개 대상 반 검증
- Student 모듈 — 수강생 조회
- Assignment 모듈 — 반별 과제 연계