Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
elyudwo committed Feb 12, 2024
2 parents 13f98a5 + 9e7147e commit 7527c0c
Show file tree
Hide file tree
Showing 44 changed files with 643 additions and 128 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package kr.co.studyhubinu.studyhubserver.apply.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;


/**
* QRejectEntity is a Querydsl query type for RejectEntity
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QRejectEntity extends EntityPathBase<RejectEntity> {

private static final long serialVersionUID = -1259208686L;

public static final QRejectEntity rejectEntity = new QRejectEntity("rejectEntity");

public final kr.co.studyhubinu.studyhubserver.common.domain.QBaseTimeEntity _super = new kr.co.studyhubinu.studyhubserver.common.domain.QBaseTimeEntity(this);

//inherited
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate;

public final NumberPath<Long> id = createNumber("id", Long.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> modifiedDate = _super.modifiedDate;

public final NumberPath<Long> rejectedUserId = createNumber("rejectedUserId", Long.class);

public final StringPath rejectReason = createString("rejectReason");

public final NumberPath<Long> studyId = createNumber("studyId", Long.class);

public QRejectEntity(String variable) {
super(RejectEntity.class, forVariable(variable));
}

public QRejectEntity(Path<? extends RejectEntity> path) {
super(path.getType(), path.getMetadata());
}

public QRejectEntity(PathMetadata metadata) {
super(RejectEntity.class, metadata);
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package kr.co.studyhubinu.studyhubserver.notice.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;

import com.querydsl.core.types.dsl.*;

import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;


/**
* QTermsOfUseEntity is a Querydsl query type for TermsOfUseEntity
*/
@Generated("com.querydsl.codegen.DefaultEntitySerializer")
public class QTermsOfUseEntity extends EntityPathBase<TermsOfUseEntity> {

private static final long serialVersionUID = -1621487174L;

public static final QTermsOfUseEntity termsOfUseEntity = new QTermsOfUseEntity("termsOfUseEntity");

public final kr.co.studyhubinu.studyhubserver.common.domain.QBaseTimeEntity _super = new kr.co.studyhubinu.studyhubserver.common.domain.QBaseTimeEntity(this);

public final StringPath article = createString("article");

public final StringPath content = createString("content");

//inherited
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate;

public final NumberPath<Long> id = createNumber("id", Long.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> modifiedDate = _super.modifiedDate;

public final StringPath title = createString("title");

public final StringPath version = createString("version");

public QTermsOfUseEntity(String variable) {
super(TermsOfUseEntity.class, forVariable(variable));
}

public QTermsOfUseEntity(Path<? extends TermsOfUseEntity> path) {
super(path.getType(), path.getMetadata());
}

public QTermsOfUseEntity(PathMetadata metadata) {
super(TermsOfUseEntity.class, metadata);
}

}

Binary file removed build/jacoco/test.exec
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.v3.oas.annotations.Operation;
import kr.co.studyhubinu.studyhubserver.apply.dto.request.EnrollApplyRequest;
import kr.co.studyhubinu.studyhubserver.apply.dto.request.FindApplyRequest;
import kr.co.studyhubinu.studyhubserver.apply.dto.request.RejectApplyRequest;
import kr.co.studyhubinu.studyhubserver.apply.dto.request.UpdateApplyRequest;
import kr.co.studyhubinu.studyhubserver.apply.dto.request.*;
import kr.co.studyhubinu.studyhubserver.apply.dto.response.FindApplyResponse;
import kr.co.studyhubinu.studyhubserver.apply.dto.response.FindMyRequestApplyResponse;
import kr.co.studyhubinu.studyhubserver.apply.enums.Inspection;
import kr.co.studyhubinu.studyhubserver.apply.service.ApplyService;
import kr.co.studyhubinu.studyhubserver.apply.dto.response.FindParticipateApplyResponse;
import kr.co.studyhubinu.studyhubserver.user.dto.data.UserId;
Expand All @@ -17,6 +16,8 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api")
Expand All @@ -27,40 +28,56 @@ public class ApplyController {
@Operation(summary = "스터디 참여 신청", description = "studyId와 신청자가 작성한 글을 json 형태로 입력해주세요.")
@PostMapping("/v1/study")
public ResponseEntity<HttpStatus> enrollStudy(UserId userId, EnrollApplyRequest request) {
applyService.enroll(userId.getId(), request);
applyService.enroll(userId, request);
return ResponseEntity.ok().build();
}

@Operation(summary = "스터디 참여 신청 정보 수정",
description = "참여 신청한 유저의 Id, 해당 스터디 Id, 변경하려는 상태(ACCEPT, STANDBY, REJECT)를 보내주세요")
@PutMapping("/v1/study")
public ResponseEntity<HttpStatus> updateStudyInspection(UpdateApplyRequest request) {
applyService.update(request);
@Operation(summary = "스터디 참여 신청 거절",
description = "JWT 헤더에 보내주시면 됩니다!")
@PutMapping("/v1/study-reject")
public ResponseEntity<HttpStatus> rejectApply(@RequestBody @Valid final RejectApplyRequest rejectApplyRequest, final UserId userId) {
applyService.rejectApply(rejectApplyRequest, userId);
return ResponseEntity.ok().build();
}

@Operation(summary = "스터디 참여 신청 거절",
description = "JWT토큰 헤더에 보내주시면 됩니다!")
@PutMapping("/v1/study-reject")
public ResponseEntity<HttpStatus> rejectApply(@RequestBody final RejectApplyRequest rejectApplyRequest, final UserId userId) {
applyService.rejectApply(rejectApplyRequest, userId.getId());
@Operation(summary = "스터디 참여 신청 수락",
description = "JWT 헤더에 보내주시면 됩니다!")
@PutMapping("/v1/study-accept")
public ResponseEntity<HttpStatus> acceptApply(@RequestBody @Valid final AcceptApplyRequest acceptApplyRequest, final UserId userId) {
applyService.acceptApply(acceptApplyRequest, userId);
return ResponseEntity.ok().build();
}

@Operation(summary = "스터디 참여 신청 정보 조회", description = "해당 스터디 Id를 보내주세요.")
@Operation(summary = "스터디 참여 신청 정보 조회", description = "해당 스터디 Id, 신청 정보를 파라미터로 보내주세요.")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "페이지", required = true),
@ApiImplicitParam(name = "size", value = "사이즈", required = true)
@ApiImplicitParam(name = "size", value = "사이즈", required = true),
@ApiImplicitParam(name = "studyId", value = "스터디 식별자", required = true),
@ApiImplicitParam(name = "inspection", value = "상태", required = true)
})
@GetMapping("/v1/study")
public FindApplyResponse findStudyEnroll(FindApplyRequest request, @RequestParam int page, @RequestParam int size) {
return applyService.findApply(request, page, size);
@GetMapping("/v2/study")
public FindApplyResponse findStudyEnroll(@RequestParam Long studyId, @RequestParam Inspection inspection, @RequestParam int page, @RequestParam int size) {
return applyService.findApply(new FindApplyRequest(studyId, inspection), page, size);
}

@Operation(summary = "내가 참여한 스터디 목록", description = "헤더에 JWT토큰 보내주시면 됩니다")
@Operation(summary = "내가 참여한 스터디 목록", description = "헤더에 JWT 보내주시면 됩니다.")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "페이지", required = true),
@ApiImplicitParam(name = "size", value = "사이즈", required = true)
})
@GetMapping("/v1/participated-study")
public ResponseEntity<FindParticipateApplyResponse> getParticipateApply(UserId userId, @RequestParam int page, @RequestParam int size) {
return ResponseEntity.ok().body(applyService.getParticipateApply(userId.getId(), page, size));
return ResponseEntity.ok().body(applyService.getParticipateApply(userId, page, size));
}

@Operation(summary = "내가 신청한 스터디 목록", description = "헤더에 JWT 보내주시면 됩니다.")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "페이지", required = true),
@ApiImplicitParam(name = "size", value = "사이즈", required = true)
})
@GetMapping("/v1/study-request")
public ResponseEntity<FindMyRequestApplyResponse> getMyRequestApply(UserId userId, @RequestParam int page, @RequestParam int size) {
return ResponseEntity.ok(applyService.getMyRequestApply(userId, page, size));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ public void update(Inspection inspection) {
public void updateReject() {
this.inspection = Inspection.REJECT;
}

public void updateAccept() {
this.inspection = Inspection.ACCEPT;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package kr.co.studyhubinu.studyhubserver.apply.dto.data;

import kr.co.studyhubinu.studyhubserver.apply.enums.Inspection;
import lombok.Getter;

@Getter
public class RequestApplyData {

private final Long studyId;
private final String studyTitle;
private final Inspection inspection;
private final String introduce;

public RequestApplyData(Long studyId, String studyTitle, Inspection inspection, String introduce) {
this.studyId = studyId;
this.studyTitle = studyTitle;
this.inspection = inspection;
this.introduce = introduce;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package kr.co.studyhubinu.studyhubserver.apply.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

@Getter
@NoArgsConstructor
public class AcceptApplyRequest {

@Schema(description = "스터디 아이디")
@NotNull(message = "스터디 아이디는 필수입니다!")
private Long studyId;

@Schema(description = "거절당하는 유저 아이디")
@NotNull(message = "거절된 유저 아이디는 필수입니다!")
private Long rejectedUserId;

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package kr.co.studyhubinu.studyhubserver.apply.dto.request;

import kr.co.studyhubinu.studyhubserver.apply.enums.Inspection;
import lombok.Builder;
import lombok.Getter;

@Getter
public class FindApplyRequest {

private Long studyId;
private final Long studyId;
private final Inspection inspection;

@Builder
public FindApplyRequest(Long studyId) {
public FindApplyRequest(Long studyId, Inspection inspection) {
this.studyId = studyId;
this.inspection = inspection;
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
package kr.co.studyhubinu.studyhubserver.apply.dto.request;

import io.swagger.v3.oas.annotations.media.Schema;
import kr.co.studyhubinu.studyhubserver.apply.domain.RejectEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Getter
@NoArgsConstructor
public class RejectApplyRequest {

private final Long studyId;
private final Long rejectedUserId;
private final String rejectReason;
@Schema(description = "스터디 아이디")
@NotNull(message = "스터디 아이디는 필수입니다!")
private Long studyId;

@Schema(description = "거절당하는 유저 아이디")
@NotNull(message = "거절된 유저 아이디는 필수입니다!")
private Long rejectedUserId;

@Schema(description = "거절 사유", example = "ㄴㄴ")
@NotBlank(message = "거절 사유는 필수입니다!")
private String rejectReason;

public RejectApplyRequest(Long studyId, Long rejectedUserId, String rejectReason) {
this.studyId = studyId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kr.co.studyhubinu.studyhubserver.apply.dto.response;

import kr.co.studyhubinu.studyhubserver.apply.dto.data.ParticipateApplyData;
import kr.co.studyhubinu.studyhubserver.apply.dto.data.RequestApplyData;
import lombok.Getter;
import org.springframework.data.domain.Slice;

@Getter
public class FindMyRequestApplyResponse {

private Long totalCount;
Slice<RequestApplyData> requestStudyData;

public FindMyRequestApplyResponse(Long totalCount, Slice<RequestApplyData> requestStudyData) {
this.totalCount = totalCount;
this.requestStudyData = requestStudyData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
public class FindParticipateApplyResponse {
private Long totalCount;
Slice<ParticipateApplyData> participateStudyData;

public FindParticipateApplyResponse(Long totalCount, Slice<ParticipateApplyData> participateStudyData) {
this.totalCount = totalCount;
this.participateStudyData = participateStudyData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import kr.co.studyhubinu.studyhubserver.apply.dto.data.ApplyUserData;
import kr.co.studyhubinu.studyhubserver.apply.dto.data.ParticipateApplyData;
import kr.co.studyhubinu.studyhubserver.apply.dto.data.RequestApplyData;
import kr.co.studyhubinu.studyhubserver.apply.dto.request.FindApplyRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
Expand All @@ -11,4 +14,8 @@ public interface ApplyRepositoryCustom {
List<ApplyUserData> findByStudy(Long studyId, Pageable pageable);

List<ParticipateApplyData> findByUserIdAndInspection(Long userId, Pageable pageable);

List<ApplyUserData> findStudyByIdAndInspection(FindApplyRequest request, Pageable pageable);

List<RequestApplyData> findApplyByUserId(Long userId, Pageable pageable);
}
Loading

0 comments on commit 7527c0c

Please sign in to comment.