Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

강의 브런치 강의 CRUD 개발 (S3 기능 제외) #37

Open
wants to merge 51 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
9b2bbec
Feat :: 기본 이슈 템플릿 생성
seu1a Apr 3, 2024
b1db02c
Merge :: 기본 이슈 템플릿 생성 (#9)
seu1a Apr 3, 2024
84985d5
Feat :: 기본 이슈 템플릿 생성
seu1a Apr 3, 2024
14f2871
Feat :: Board 도메인 FileEntity 생성
alexipharmical Apr 8, 2024
431e02d
Feat :: Board 도메인 BoardEntity 생성
alexipharmical Apr 8, 2024
bb4f37c
Feat :: 글로벌 BaseTimeEntity 생성
alexipharmical Apr 8, 2024
b9e5bad
Fix :: BoardEntity BaseTimeEntity 상속
alexipharmical Apr 8, 2024
add094d
Feat :: Board 도메인 BoardRepository 생성
alexipharmical Apr 8, 2024
ba7da9a
Feat :: Board 도메인 FileRepository 생성
alexipharmical Apr 8, 2024
02a9866
Fix :: DucademiApplication 수정
alexipharmical Apr 8, 2024
b5a1fb1
Merge remote-tracking branch 'refs/remotes/origin/feature/board' into…
alexipharmical Apr 8, 2024
60c495c
Feat :: DucademiApplication 수정
heunseoRyu Apr 8, 2024
13b3078
Feat :: Lecture 객체 생성
heunseoRyu Apr 8, 2024
70b9df8
Feat :: LectureType 생성
heunseoRyu Apr 8, 2024
bc8aff5
NEW::develop 브런치파기
heunseoRyu Apr 1, 2024
38d9f07
Feat :: Lecture 객체 생성
heunseoRyu Apr 8, 2024
fd106eb
Feat :: LectureType 생성
heunseoRyu Apr 8, 2024
23d4317
Feat :: feature/board로부터 rebase
heunseoRyu Apr 8, 2024
57df7a7
Feat :: LectureRepository 생성
heunseoRyu Apr 11, 2024
38bb27e
Feat :: UserLectureController 요청 정리
heunseoRyu Apr 11, 2024
38c9386
Feat :: DucamiLectureController 요청 정리
heunseoRyu Apr 11, 2024
95b4633
Merge branch 'feature/lecture' into feature/lecture2
heunseoRyu Apr 15, 2024
b212e33
Merge pull request #24 from ducami-org/feature/lecture2
heunseoRyu Apr 15, 2024
cbe0e3c
Feat :: DucademiApplication 수정
heunseoRyu Apr 19, 2024
7ba0f13
Feat :: DucamiLectureController 수정
heunseoRyu Apr 19, 2024
a643fdc
Feat :: Lecture 엔티티 수정
heunseoRyu Apr 19, 2024
6068825
Feat :: CreateLectureRequest 생성
heunseoRyu Apr 19, 2024
d1d8c6c
Feat :: DucamiLectureService 생성
heunseoRyu Apr 19, 2024
a16ffb9
Feat :: application.yml 수정
heunseoRyu Apr 20, 2024
8629fcf
Feat :: Apply 엔티티 생성
heunseoRyu Apr 20, 2024
f6eb672
Feat :: CreateLecturesRequest 수정
heunseoRyu Apr 20, 2024
505dd27
Feat :: DucamiLectureController 수정
heunseoRyu Apr 20, 2024
55b214b
Feat :: DucamiLectureService 수정
heunseoRyu Apr 20, 2024
197f1a1
Feat :: Lecture 엔티티 수정
heunseoRyu Apr 20, 2024
94e7823
Feat :: LectureRepository 수정
heunseoRyu Apr 20, 2024
9222761
Feat :: MemberEntity 수정
heunseoRyu Apr 20, 2024
a66a327
Feat :: MemberRegisterDTO 수정
heunseoRyu Apr 20, 2024
d793b36
Feat :: MemberRepository 수정
heunseoRyu Apr 20, 2024
1071445
Feat :: UserLectureController 수정
heunseoRyu Apr 20, 2024
8204a54
Feat :: ApplierResponse dto 생성
heunseoRyu Apr 20, 2024
898db49
Feat :: ApplyRepository 생성
heunseoRyu Apr 20, 2024
131c9d1
Feat :: DeleteLectureRepository 생성
heunseoRyu Apr 20, 2024
9dfd4fa
Feat :: GetManagingListResponse dto 생성
heunseoRyu Apr 20, 2024
d898e97
Feat :: GetManagingResponse dto 생성
heunseoRyu Apr 20, 2024
67328ba
Feat :: LectureController 생성
heunseoRyu Apr 20, 2024
455f717
Feat :: LectureInfoResponse dto 생성
heunseoRyu Apr 20, 2024
0f49587
Feat :: LectureListResponse dto 생성
heunseoRyu Apr 20, 2024
384a8f1
Feat :: LectureResponse dto 생성
heunseoRyu Apr 20, 2024
7ab62a7
Feat :: LectureService 생성
heunseoRyu Apr 20, 2024
e95940c
Feat :: UpdateLectureRequest dto 생성
heunseoRyu Apr 20, 2024
825a9d2
Feat :: UserLectureService 생성
heunseoRyu Apr 20, 2024
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
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/📧-기본-이슈-템플릿.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: "\U0001F4E7:기본 이슈 템플릿"
about: "\b기능 또는 버그 이슈를 올릴 때 유용합니다"
title: ''
labels: ''
assignees: ''

---

### 🔗 할 일
- [ ] 밥먹기
- [ ] 공부하기
- [ ] 잠자기
5 changes: 5 additions & 0 deletions src/main/java/ducami/org/ducademi/DucademiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;


@SpringBootApplication
@ConfigurationPropertiesScan
@EnableJpaAuditing
public class DucademiApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package ducami.org.ducademi.domain.board.entity;

import ducami.org.ducademi.global.entity.BaseTimeEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(name = "board")
public class BoardEntity extends BaseTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long boardIdx;

@Column(nullable = false)
private String title;

@Column(nullable = false)
private String content;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package ducami.org.ducademi.domain.board.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Getter
@Setter
@NoArgsConstructor
@Table(name = "file")
public class FileEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long fileIdx;

@ManyToOne
@JoinColumn(nullable = false)
private BoardEntity board;

@Column(nullable = false)
private String fileName;

@Column(nullable = false)
private String fileUrl;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ducami.org.ducademi.domain.board.repository;

import org.springframework.data.jpa.repository.JpaRepository;

public interface BoardRepository extends JpaRepository<BoardRepository, Long> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ducami.org.ducademi.domain.board.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;

public interface FileRepository extends CrudRepository<FileRepository, Long> {

}
33 changes: 33 additions & 0 deletions src/main/java/ducami/org/ducademi/domain/lecture/domain/Apply.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package ducami.org.ducademi.domain.lecture.domain;


import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "lecture")
public class Apply {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idx;

@Column(nullable = false)
private Long applierIdx;
private Long lectureIdx;

@Builder
public Apply(Long applierIdx, Long lectureIdx) {
this.applierIdx = applierIdx;
this.lectureIdx = lectureIdx;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package ducami.org.ducademi.domain.lecture.domain;


import ducami.org.ducademi.domain.lecture.domain.enums.LectureType;
import ducami.org.ducademi.global.entity.BaseTimeEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Entity
@Getter @NoArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "lecture")
public class Lecture extends BaseTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idx;

@Column(nullable = false)
private String title;
private String description;
private LocalDateTime applyStartDate;
private LocalDateTime applyEndDate;
private LocalDate startDate;
private LocalDate endDate;
private String target;

@Enumerated(EnumType.STRING)
private LectureType category;

@Column(nullable = false)
private int maxApplier = 0;

@Column(unique = true,nullable = false)
private Long teacherIdx;

@Builder
public Lecture(String title,String introduction,LocalDateTime applyStartDate,LocalDateTime applyEndDate,LocalDate startDate,LocalDate endDate,String target,LectureType category,Long teacherIdx, Integer maxApplier){
this.title = title;
this.maxApplier = maxApplier;
this.description = introduction;
this.applyStartDate = applyStartDate;
this.applyEndDate = applyEndDate;
this.startDate = startDate;
this.endDate = endDate;
this.target = target;
this.category = category;
this.teacherIdx = teacherIdx;
}

public void updateLecture(String title,String introduction,int maxApplier,LocalDate startDate,LocalDate endDate,String target,LocalDateTime applyEndDate,LectureType category) {
this.title = title.isBlank() ? this.title : title;
this.description = title.isBlank() ? this.description : introduction;
this.maxApplier = String.valueOf(maxApplier).isBlank() ? this.maxApplier : maxApplier;
this.startDate = startDate == null ? this.startDate : startDate;
this.endDate = endDate == null ? this.endDate : endDate;
this.target = target.isBlank() ? this.target : target;
this.applyEndDate = applyEndDate == null ? this.applyEndDate : applyEndDate;
this.category = category.getCategory().isBlank() ? this.category : category;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package ducami.org.ducademi.domain.lecture.domain.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum LectureType {
WEB("웹"),
ANDROID("안드로이드"),
IOS("iOS"),
SERVER("서버"),
PYTHON("파이썬"),
C("C언어"),
KOTLIN("코틀린"),
SWIFT("스위프트"),
ARDUINO("아두이노"),
AI("인공지능"),
ROBOT("로봇"),
GAME("게임");

private final String category;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ducami.org.ducademi.domain.lecture.domain.repository;


import ducami.org.ducademi.domain.lecture.domain.Apply;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ApplyRepository extends JpaRepository<Apply,Long> {

int countByLectureIdx(Long LectureIdx);

@Query("SELECT a FROM Apply a WHERE a.applierIdx = :applierIdx")
Page<Apply> findAllByApplierIdx(Pageable pageable, Long applierIdx);

@Query("SELECT a FROM Apply a WHERE a.lectureIdx = :lectureIdx")
List<Apply> findAllByLectureIdx(Long lectureIdx);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ducami.org.ducademi.domain.lecture.domain.repository;

import ducami.org.ducademi.domain.lecture.domain.Lecture;
import ducami.org.ducademi.domain.lecture.domain.enums.LectureType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface LectureRepository extends JpaRepository<Lecture,Long> {

@Query("SELECT l FROM Lecture l WHERE l.teacherIdx = :teacherIdx")
Page<Lecture> findAllByTeacherIdx(Pageable pageable,Long teacherIdx);

@Query("SELECT l FROM Lecture l WHERE l.category = :category")
Page<Lecture> findAllByCategory(Pageable pageable, LectureType category);

@Query("SELECT l FROM Lecture l WHERE l.title LIKE %:keyword%")
Page<Lecture> findAllByKeyword(Pageable pageable, String keyword);

Lecture findByIdx(long idx);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package ducami.org.ducademi.domain.lecture.presentation;


import ducami.org.ducademi.domain.lecture.presentation.dto.request.CreateLecturesRequest;
import ducami.org.ducademi.domain.lecture.presentation.dto.request.DeleteLectureRequest;
import ducami.org.ducademi.domain.lecture.presentation.dto.request.UpdateLectureRequest;
import ducami.org.ducademi.domain.lecture.presentation.dto.response.ApplierResponse;
import ducami.org.ducademi.domain.lecture.presentation.dto.response.GetManagingListResponse;
import ducami.org.ducademi.domain.lecture.service.DucamiLectureService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class DucamiLectureController {

public final DucamiLectureService ducamiLectureService;

/**
* 강의 생성
* */
@PostMapping("users/{idx}/lectures")
@ResponseStatus(HttpStatus.CREATED)
public void createLecture(
@PathVariable Long idx,
@RequestBody CreateLecturesRequest request
) {
ducamiLectureService.createLecture(idx,request);
}

/**
* 강의 수정
* */
@PutMapping("lectures/{idx}")
@ResponseStatus(HttpStatus.CREATED)
public void updateLecture(
@PathVariable Long idx,
@RequestBody UpdateLectureRequest request
) {
ducamiLectureService.updateLecture(idx,request);
}

/**
* 강의 삭제
* */
@DeleteMapping("lectures/{idx}")
@ResponseStatus(HttpStatus.OK)
public void deleteLecture(
@PathVariable Long idx,
@RequestBody DeleteLectureRequest request
) {
ducamiLectureService.deleteLecture(idx,request);
}

/**
* 내 강의실 & 내가 관리하는 강의
* */
@GetMapping("ducamis/{idx}/lectures")
@ResponseStatus(HttpStatus.OK)
public GetManagingListResponse getManagingLectures(
@RequestParam int page,
@RequestParam int size,
@PathVariable Long idx
) {
return ducamiLectureService.getManagingLectures(page,size,idx);
}

/**
* 강의 수강자 정보 조회
* */
@GetMapping("lectures/{idx}")
@ResponseStatus(HttpStatus.OK)
public List<ApplierResponse> getAllAppliers(
@PathVariable Long idx
) {
return ducamiLectureService.getAllAppliers(idx);
}
}
Loading