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

feat:study필드에 title 추가 #27

Merged
merged 1 commit into from
Jul 8, 2024
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
4 changes: 2 additions & 2 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 2 additions & 21 deletions src/main/java/hamsung/hamsung_project/dto/StudyDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,15 @@ public class StudyDto {
private LocalDate endDate;
private Integer score;
private Long leader_id;
private String title;


// public StudyDto(String category, String place, LocalDate startDate, LocalDate endDate) {
// this.category = category;
// this.place = place;
// this.startDate = startDate;
// this.endDate = endDate;
// }
//
// public static StudyDto createStudyFromRequest(RecruitsRequestsDto requestsDto){
// String category= requestsDto.getCategory();
// String place= requestsDto.getPlace();
// LocalDate startDate=requestsDto.getStartDate();
// LocalDate endDate=requestsDto.getEndDate();
//
// return new StudyDto(category,place,startDate,endDate);
// }
//
// public static hamsung.hamsung_project.recruits.dto.StudyDto toStudyDto(Study study) {
// return new StudyDto(study.getId(), study.getCategory(), study.getPlace(), study.getMember_num(), study.getStatus(),
// study.getStartDate(), study.getEndDate(), study.getScore(), study.getLeader_id());
// }


//entity->dto
public static StudyDto createStudyDto(Study study){
return new StudyDto(study.getId(),study.getCategory(),study.getPlace(),study.getMember_num(),
study.getStatus(),study.getStartDate(),study.getEndDate(),study.getScore(),study.getLeader_id());
study.getStatus(),study.getStartDate(),study.getEndDate(),study.getScore(),study.getLeader_id(),study.getTitle());
}


Expand Down
6 changes: 5 additions & 1 deletion src/main/java/hamsung/hamsung_project/entity/Study.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class Study {
@Column(name="leader_id",nullable = false)
private Long leader_id;

@Column
private String title;



//dto->entity
Expand All @@ -62,7 +65,8 @@ public static Study createStudyEntity(RecruitsRequestsDto requestsDto) {
null, // startDate 기본값
null, //endDate 기본값
null, //score 기본값
requestsDto.getUser_id() //leader_id
requestsDto.getUser_id(), //leader_id,
requestsDto.getTitle()
);
}

Expand Down
15 changes: 1 addition & 14 deletions src/main/java/hamsung/hamsung_project/service/StudyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,10 @@ public boolean endStudy(Long id){
}

public Study showStudy(Long id){

return studyRepository.findById(id).orElse(null);
}

/* 로그인 한 userId 가져올 수 있게 시큐리티 구현 후 사용할 스터디 삭제 메소드(아래 껀 삭제하기)
(스터디 주인의 id와 로그인한 유저의 id가 일치한다면 삭제)
public boolean deleteStudy(Long id, Long userId){
Study target=studyRepository.findById(id).orElse(null);

if(target!=null){
if(target.getLeader_id().equals(userId)){
studyRepository.delete(target);
return true;
}
}
return false;
}
*/
public boolean deleteStudy(Long id){
Study target=studyRepository.findById(id).orElse(null);
if(target!=null){
Expand Down
Loading