Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/lab-cherry/nw-backend in…
Browse files Browse the repository at this point in the history
…to yby654
  • Loading branch information
yby654321 committed Nov 9, 2023
2 parents da9ce02 + 8a0f1b6 commit e4eccd0
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 174 deletions.
3 changes: 2 additions & 1 deletion nw/src/main/java/lab/cherry/nw/controller/OrgController.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ public ResponseEntity<?> deleteOrganization(@PathVariable("id") String id) {

@GetMapping("/invite")
@Operation(summary = "사용자(랑부) 초대", description = "이메일로 조직 초대 메일을 발송합니다.")
public ResponseEntity<?> inviteUser(@RequestParam(required = false) String orgid, @RequestParam(required = false) String email) {
public ResponseEntity<?> inviteUser(@RequestParam(required = false) String orgid,
@RequestParam(required = false) String email) {
log.info("[OrgController] inviteUser...!");

orgService.inviteOrgSend(orgid, email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lab.cherry.nw.error.ErrorResponse;
import lab.cherry.nw.model.FinalTemplEntity;
import lab.cherry.nw.model.ScheduleEntity;
import lab.cherry.nw.service.ScheduleService;
import lab.cherry.nw.util.Common;
Expand All @@ -23,9 +22,6 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;

/**
* <pre>
Expand Down Expand Up @@ -93,34 +89,7 @@ public ResponseEntity<?> findByScheduleId(@PathVariable("id") String id) {
return new ResponseEntity<>(scheduleService.findById(id), new HttpHeaders(), HttpStatus.OK);
}

/**
* [ScheduleController] 스케줄표 컬럼 변경 함수
*
* @param tranClounm 최종확인서에서 스케줄표에 필요한 컬럼만 담고 있는 객체입니다.
* @return
* <pre>
* true : 성공(200)을 반환합니다.
* false : 에러(400)를 반환합니다.
* </pre>
*
* Author : hhhaeri(yhoo0020@gmail.com)
*/
@PostMapping("/column")
@Operation(summary = "스케줄표 컬럼 변환", description = "최종확인서에 있는 컬럼을 스케줄표로 변환.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "스케줄표 컬럼 변환이 완료되었습니다.", content = @Content(schema = @Schema(implementation = ResponseEntity.class))),
@ApiResponse(responseCode = "400", description = "입력 값이 잘못되었습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
public ResponseEntity<?> fianlToSchedule(@Valid @RequestBody(required = false) ScheduleEntity.transDto scheduleTransDto) {

log.info("[ScheduleController] fianlToSchedule...!");

ScheduleEntity scheduleEntity = scheduleService.transColumn(scheduleTransDto);

return new ResponseEntity<>(scheduleEntity, new HttpHeaders(), HttpStatus.OK);
}



/**
* [ScheduleController] 스케줄표 생성 함수
*
Expand Down Expand Up @@ -148,41 +117,4 @@ public ResponseEntity<?> createFinalTemplate(@Valid @RequestBody(required = fals
return new ResponseEntity<>(scheduleEntity, new HttpHeaders(), HttpStatus.OK);
}




// /**
// * [ScheduleController] 스케줄표 날짜 기준 조회
// *
// * @param 날짜 기준으로 스케줄표를 조회합니다.
// * @return
// * <pre>
// * true : 성공(200)을 반환합니다.
// * false : 에러(400)를 반환합니다.
// * </pre>
// *
// * Author : hhhaeri(yhoo0020@gmail.com)
// */
// @PostMapping("/date/{start}/{end}")
// @Operation(summary = "스케줄표 날짜 조회", description = "최종확인서에 있는 날짜 기준 조회")
// @ApiResponses(value = {
// @ApiResponse(responseCode = "200", description = "날짜 기준으로 조회를 완료되었습니다.", content = @Content(schema = @Schema(implementation = ResponseEntity.class))),
// @ApiResponse(responseCode = "400", description = "입력 값이 잘못되었습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
// })
// public ResponseEntity<?> fianlToDateSchedule(@Valid @PathVariable("start") String start, @PathVariable("end") String end) {

// log.info("[ScheduleController] fianlToDateSchedule...!");

// LocalDate localStartDate = LocalDate.parse(start);
// LocalDate localEndDate = LocalDate.parse(end);

// // LocalDate를 Instant로 변환 (00:00:00 시간으로 설정)
// Instant startDate = localStartDate.atStartOfDay(ZoneId.systemDefault()).toInstant();
// Instant endDate = localEndDate.atStartOfDay(ZoneId.systemDefault()).toInstant();

// ScheduleEntity scheduleEntity = scheduleService.scheduleByDate(startDate,endDate);

// return new ResponseEntity<>(scheduleEntity, new HttpHeaders(), HttpStatus.OK);
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lab.cherry.nw.error.enums.ErrorCode;
import lab.cherry.nw.util.FormatConverter;
import lombok.extern.slf4j.Slf4j;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package lab.cherry.nw.error.handler;

import lab.cherry.nw.error.ErrorResponse;
import lab.cherry.nw.error.enums.ErrorCode;
import lab.cherry.nw.error.exception.CustomException;
import lab.cherry.nw.error.exception.EntityNotFoundException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -13,14 +9,13 @@
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.servlet.NoHandlerFoundException;
import jakarta.servlet.http.HttpServletResponse;
import java.nio.file.AccessDeniedException;
import java.util.HashMap;
import lab.cherry.nw.error.ErrorResponse;
import lab.cherry.nw.error.enums.ErrorCode;
import lab.cherry.nw.error.exception.CustomException;
import lab.cherry.nw.error.exception.EntityNotFoundException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestControllerAdvice
Expand Down
12 changes: 6 additions & 6 deletions nw/src/main/java/lab/cherry/nw/model/EventEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@
@Builder
@NoArgsConstructor @AllArgsConstructor
@Document(collection = "events")
@JsonPropertyOrder({ "eventSeq", "eventTitle", "eventLocation", "resDate", "weddingDate", "evenDate", "updated_at" })
@JsonPropertyOrder({ "id", "title", "location", "resDate", "weddingDate", "updated_at" })
public class EventEntity implements Serializable {

@Id
@JsonProperty("eventSeq")
@Schema(title = "이벤트 고유번호", example = "64ed89aa9e813b5ab16da6de")
private String id;

@NotNull
@JsonProperty("eventTitle")
@Schema(title = "이벤트 이름", example = "{time}시 {title}")
@Size(min = 1, max = 20, message = "이벤트 이름은 20자 이내로만 가능합니다.")
private String title;
Expand All @@ -48,18 +46,20 @@ public class EventEntity implements Serializable {
// private String description;

@NotNull
@JsonProperty("eventLocation")
@Schema(title = "이벤트 장소", example = "더모멘트홀")
@Size(min = 1, max = 20, message = "이벤트 장소명은 20글자 이내로만 가능합니다.")
private String location;

@NotBlank
@JsonFormat(pattern="yyyy-MM-dd hh:mm:ss", locale = "ko_KR", timezone = "Asia/Seoul")
@JsonProperty("resDate")
@JsonFormat(locale = "ko_KR", timezone = "Asia/Seoul")
// @JsonFormat(pattern="yyyy-MM-dd hh:mm:ss", locale = "ko_KR", timezone = "Asia/Seoul")
@Schema(title = "예약 날짜", example = "2023-08-29T05:11:38.002Z")
private String resDate;

@NotBlank
@JsonFormat(pattern="yyyy-MM-dd hh:mm:ss", locale = "ko_KR", timezone = "Asia/Seoul")
@JsonFormat(locale = "ko_KR", timezone = "Asia/Seoul")
// @JsonFormat(pattern="yyyy-MM-dd hh:mm:ss", locale = "ko_KR", timezone = "Asia/Seoul")
@Schema(title = "예식 날짜", example = "2023-08-29T05:11:38.002Z")

private String weddingDate;
Expand Down
21 changes: 12 additions & 9 deletions nw/src/main/java/lab/cherry/nw/model/FinalTemplEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.Serializable;
import java.time.Instant;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -53,7 +54,9 @@ public class FinalTemplEntity implements Serializable {

@JsonProperty("content")
@Schema(title = "최종확인서 템플릿 내용", example = "문서 내용")
private Map<String, Object> content;
// private Map<String, Object> content;
private List<Object> content;


@JsonProperty("updated_at")
@JsonFormat(pattern="yyyy-MM-dd hh:mm:ss", locale = "ko_KR", timezone = "Asia/Seoul")
Expand Down Expand Up @@ -81,23 +84,23 @@ public static class FinalTemplCreateDto {
private String orgId;

@Schema(title = "최종확인서 템플릿 내용", example = "문서 내용")
private Map<String, Object> content;

private List<Object> content;
}

@Getter
@Builder
@NoArgsConstructor @AllArgsConstructor
public static class FinalTemplUpdateDto {

@Schema(title = "사용자 고유 번호", example = "64ed89aa9e813b5ab16da6de")
private String userSeq;
@Schema(title = "사용자 고유 번호", example = "64ed89aa9e813b5ab16da6de")
private String userSeq;

@Schema(title = "조직 고유 번호", example = "64ed89aa9e813b5ab16da6de")
private String orgId;
@Schema(title = "조직 고유 번호", example = "64ed89aa9e813b5ab16da6de")
private String orgId;

@Schema(title = "최종확인서 템플릿 내용", example = "문서 내용")
private Map<String, Object> content;
@Schema(title = "최종확인서 템플릿 내용", example = "문서 내용")
private List<Object> content;

}

Expand Down
8 changes: 4 additions & 4 deletions nw/src/main/java/lab/cherry/nw/model/FinaldocsEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.Serializable;
import java.time.Instant;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -64,8 +65,7 @@ public class FinaldocsEntity implements Serializable {

@JsonProperty("content")
@Schema(title = "최종확인서 내용", example = "")
private Map<String,String> content;

private List<Object> content;


@JsonProperty("updated_at")
Expand Down Expand Up @@ -109,7 +109,7 @@ public static class FinaldocsCreateDto {
// @NotBlank
@JsonProperty("content")
@Schema(title = "최종확인서 내용", example = "")
private Map<String,String> content;
private List<Object> content;


}
Expand All @@ -133,7 +133,7 @@ public static class FinaldocsUpdateDto {
private String org;

@Schema(title = "최종확인서 내용", example = "")
private Map<String,String> content;
private List<Object> content;


}
Expand Down
27 changes: 2 additions & 25 deletions nw/src/main/java/lab/cherry/nw/model/ScheduleEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ScheduleEntity implements Serializable {

@JsonProperty("scheduleContent")
@Schema(title = "스케줄표 내용", example = "[]")
private Map<String, Object> content;
private List<Object> content;

@JsonProperty("column")
@Schema(title = "스케줄표 컬럼", example = "")
Expand All @@ -65,36 +65,13 @@ public class ScheduleEntity implements Serializable {
@NoArgsConstructor @AllArgsConstructor
public static class ScheduleCreateDto {


@NotBlank
@Schema(title = "조직 고유번호", example = "64ed89aa9e813b5ab16da6de")
private String orgId;


@Schema(title = "스케줄표 템플릿 내용", example = "문서 내용")
private Map<String, Object> content;
private List<Object> content;

}


//////////////////////////////////////////////////////////////////////////

@Getter
@Setter
@Builder
@NoArgsConstructor @AllArgsConstructor
public static class transDto {

@Schema(title = "스케줄표 고유번호", example = "64ed89aa9e813b5ab16da6de")
private String finalTemplId;

@Schema(title = "조직 고유번호", example = "64ed89aa9e813b5ab16da6de")
private String orgId;

@JsonProperty("scheduleContent")
@Schema(title = "스케줄표 내용", example = "[]")
private Map<String, Object> content;

}

}
4 changes: 1 addition & 3 deletions nw/src/main/java/lab/cherry/nw/service/EventService.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
public interface EventService {
Page<EventEntity> getEvents(Pageable pageable);
EventEntity createEvent(String id);
// void updateById(String id, WeddinghallEntity.UpdateDto weddinghall);
EventEntity findById(String id);
// WeddinghallEntity findByName(String name);
void deleteById(String id);
// Page<EventEntity> findPageByName(String name, Pageable pageable);
boolean checkExistsWithEventId(String id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void ResetPasswordSend(String email, String password) {
public void InviteOrgSend(String orgid, String orgname, String email) {

MimeMessage message = javaMmailSender.createMimeMessage();
String _link = FRONTEND_ADDR + "/auth/register/org/" + orgid;
String _link = FRONTEND_ADDR + "/register/org/" + orgid;

try {
message.addRecipients(MimeMessage.RecipientType.TO, email);
Expand Down
14 changes: 12 additions & 2 deletions nw/src/main/java/lab/cherry/nw/service/Impl/EventServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public EventEntity createEvent(String id) {
dateFormat = FormatConverter.convertDateFormat(userCardEntity.getResDate());

// {hour}:{min} {groom}♥{bride}
String eventName = dateFormat.get("hour") + ":" + dateFormat.get("minute") + " " + userCardEntity.getGroom().getName() + "♥" + userCardEntity.getBride().getName();
String eventName = dateFormat.get("hour") + ":" + ((dateFormat.get("minute") == 0) ? "00" : dateFormat.get("minute")) + " " + userCardEntity.getGroom().getName() + "♥" + userCardEntity.getBride().getName();

EventEntity eventEntity = EventEntity.builder()
.id(userCardEntity.getUserinfo().getId())
.id(userCardEntity.getId())
.title(eventName)
.location(userCardEntity.getWeddinghall().getName())
.resDate(userCardEntity.getResDate())
Expand Down Expand Up @@ -161,4 +161,14 @@ public UserCardEntity userCardFindById(String id) {
return userCardRepository.findById(id).orElseThrow(() -> new EntityNotFoundException("Usercard with Id " + id + " Not Found."));
}

@Transactional(readOnly = true)
public boolean checkExistsWithEventId(String id) {
if (eventRepository.findById(id).isPresent()) {
return true;
} else {
return false;
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ public Page<OrgEntity> findPageByName(String name, Pageable pageable) {

public void inviteOrgSend(String orgid, String email) {

log.error("orgid is {}", orgid);

OrgEntity orgEntity = findById(orgid);
emailAuthService.InviteOrgSend(orgEntity.getId(), orgEntity.getName(), email);

Expand Down
Loading

0 comments on commit e4eccd0

Please sign in to comment.