Skip to content

Commit

Permalink
Merge pull request #27 from potenday-project/release
Browse files Browse the repository at this point in the history
자동 배포 환경 구축을 위한 PR
  • Loading branch information
cyzlcyzl authored Dec 15, 2023
2 parents 7b66eac + cc10733 commit 763fac8
Show file tree
Hide file tree
Showing 75 changed files with 1,760 additions and 59 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ out/

### custom ###
/src/main/resources/db-application.properties
/src/main/resources/application-api-key.properties
15 changes: 14 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,25 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-web-services'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation group: 'javax.persistence', name: 'persistence-api', version: '1.0.2'
implementation group: 'com.querydsl', name: 'querydsl-jpa', version: '5.0.0'

implementation 'mysql:mysql-connector-java:8.0.32'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.projectlombok:lombok:1.18.26'
//implementation 'org.springframework.boot:spring-boot-starter-security'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
// runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

implementation 'com.amazonaws:aws-java-sdk-s3:1.12.609'
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'org.apache.httpcomponents:httpmime:4.5.13'
implementation 'com.google.code.gson:gson:2.8.9'

}

tasks.named('test') {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/mvc/promiseme/PromiseMeApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ public static void main(String[] args) {
SpringApplication.run(PromiseMeApplication.class, args);
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package mvc.promiseme.calendar.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import mvc.promiseme.calendar.dto.CalendarResponseDTO;
import mvc.promiseme.calendar.service.CalendarService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/calendar")
public class CalendarController {
private final CalendarService calendarService;

// @GetMapping("/")
// public ResponseEntity<List<CalendarResponseDTO>>calendarAll(@RequestParam Long projectId){
// return ResponseEntity.ok(calendarService.calendarAll(projectId));
//
// }

}
17 changes: 17 additions & 0 deletions src/main/java/mvc/promiseme/calendar/dto/CalendarResponseDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package mvc.promiseme.calendar.dto;

import lombok.*;

import java.time.LocalDate;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
public class CalendarResponseDTO {
private String content;
private LocalDate startDate;
private LocalDate finishDate;
private String nickname;
}
17 changes: 10 additions & 7 deletions src/main/java/mvc/promiseme/calendar/entity/Calendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

import mvc.promiseme.project.entity.Member;
import mvc.promiseme.project.entity.Project;
import mvc.promiseme.project.entity.Role;
import mvc.promiseme.todo.entity.Todo;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -24,21 +27,21 @@ public class Calendar {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long calendarId;

private LocalDateTime startDate;
private LocalDateTime finishDate;
private LocalDate startDate;
private LocalDate finishDate;

@Column(name = "CONTENT", length = 255)
private String content;

//== 연관 관계 설정 ==//
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn
@JoinColumn(name = "project_id")
private Project project;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn
private Member member;

@OneToMany(mappedBy = "calendar")
private List<Todo> todoList = new ArrayList<>();

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "role_id")
private Role role;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package mvc.promiseme.calendar.repository;

import mvc.promiseme.calendar.dto.CalendarResponseDTO;
import mvc.promiseme.calendar.entity.Calendar;
import mvc.promiseme.project.entity.Project;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CalendarRepository extends JpaRepository<Calendar, Long> {
// @Query("SELECT NEW mvc.promiseme.calendar.dto.CalendarResponseDTO(c.content, c.startDate, c.finishDate, u.nickname) from Calendar c join c.member m join m.users u where c.project = :project")
// List<CalendarResponseDTO> findByProject(Project project);
}
10 changes: 10 additions & 0 deletions src/main/java/mvc/promiseme/calendar/service/CalendarService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package mvc.promiseme.calendar.service;

import mvc.promiseme.calendar.dto.CalendarResponseDTO;

import java.util.List;

public interface CalendarService {

//public List<CalendarResponseDTO>calendarAll(Long projectId);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package mvc.promiseme.calendar.service;

import lombok.RequiredArgsConstructor;
import mvc.promiseme.calendar.dto.CalendarResponseDTO;
import mvc.promiseme.calendar.repository.CalendarRepository;
import mvc.promiseme.project.entity.Project;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class CalendarServiceImpl implements CalendarService{
private final CalendarRepository calendarRepository;
// @Override
// public List<CalendarResponseDTO> calendarAll(Long projectId) {
// Project project = Project.builder().projectId(projectId).build();
// return calendarRepository.findByProject(project);
// }
}
19 changes: 19 additions & 0 deletions src/main/java/mvc/promiseme/common/NaverKey.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package mvc.promiseme.common;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class NaverKey {

@Value("${ACCESS_KEY_ID}")
private String accessKey;
@Value("${KEY}")
private String key;
}
5 changes: 5 additions & 0 deletions src/main/java/mvc/promiseme/common/NaverObjectStrage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package mvc.promiseme.common;

public class NaverObjectStrage {
public static final String BUCKET_NAME = "promise-me";
}
6 changes: 6 additions & 0 deletions src/main/java/mvc/promiseme/common/exception/EnumModel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package mvc.promiseme.common.exception;

public interface EnumModel {
String getKey();
String getValue();
}
41 changes: 41 additions & 0 deletions src/main/java/mvc/promiseme/common/exception/ErrorCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package mvc.promiseme.common.exception;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
@JsonFormat
public enum ErrorCode implements EnumModel{

//예시
//회원 로그인 시 발생 가능 예외
INVALID_User_Login(401, "U001", "존재하지 않는 고객 정보입니다."),
INVALID_User_Password(401, "U002", "비밀번호가 일치하지 않습니다."),

//중복여부 체크
DUPLICATE_USER(400,"D001","중복된 이메일입니다.");


private int status;
private String code;
private String message;

ErrorCode(int status, String code, String message){
this.status = status;
this.code = code;
this.message = message;

}
@Override
public String getKey() {
return null;
}

@Override
public String getValue() {
return null;
}
}
21 changes: 21 additions & 0 deletions src/main/java/mvc/promiseme/common/exception/ErrorResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package mvc.promiseme.common.exception;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
public class ErrorResponse {

private String message;
private String code;
private int status;

public ErrorResponse(ErrorCode code){
this.message = code.getMessage();
this.code = code.getCode();
this.status = code.getStatus();
}

}
14 changes: 14 additions & 0 deletions src/main/java/mvc/promiseme/common/exception/UserException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package mvc.promiseme.common.exception;

public class UserException extends RuntimeException{
private final ErrorCode errorCode;

public UserException(ErrorCode errorCode){
super(errorCode.getMessage());
this.errorCode = errorCode;
}

public ErrorCode getErrorCode(){
return errorCode;
}
}
20 changes: 20 additions & 0 deletions src/main/java/mvc/promiseme/config/AppConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package mvc.promiseme.config;


import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Configuration
public class AppConfig {

@PersistenceContext
private EntityManager entityManager;

@Bean
public JPAQueryFactory queryFactory(){
return new JPAQueryFactory(entityManager);
}
}
18 changes: 18 additions & 0 deletions src/main/java/mvc/promiseme/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package mvc.promiseme.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

@Override
public void addCorsMappings(CorsRegistry corsRegistry) {

//http://localhost:3000로 들어오는 모든 CORS 허용
corsRegistry.addMapping("/**")
.allowedOrigins("*");

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package mvc.promiseme.meeting.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import mvc.promiseme.meeting.dto.MeetingResponseDTO;
import mvc.promiseme.meeting.service.MeetingService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@Slf4j
@RestController
@CrossOrigin(origins ="*", allowedHeaders = "*")
@RequestMapping("/meeting")
@RequiredArgsConstructor
public class MeetingController {

private final MeetingService meetingService;

@GetMapping("/")
public ResponseEntity<List<MeetingResponseDTO>> meetingAll(@RequestParam(name="projectId") Long projectId){
return ResponseEntity.ok(meetingService.meetingAll(projectId));
}

@PostMapping("/transfer")
public ResponseEntity<String> transferVoice(@RequestParam("voiceFile") MultipartFile multipartFile, @RequestParam("projectId") Long projectId){
return ResponseEntity.ok(meetingService.voiceToMeeting(multipartFile, projectId));
}

@PostMapping("/summary")
public ResponseEntity<String> summaryText(@RequestParam("meetingContent") String meetingContent, @RequestParam("projectId") Long projectId){
return ResponseEntity.ok(meetingService.textToMeeting(meetingContent, projectId));
}
}
13 changes: 13 additions & 0 deletions src/main/java/mvc/promiseme/meeting/dto/ClovaSpeechRequestDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package mvc.promiseme.meeting.dto;

import lombok.*;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
public class ClovaSpeechRequestDTO {
private String language;
private String callback;
}
18 changes: 18 additions & 0 deletions src/main/java/mvc/promiseme/meeting/dto/MeetingResponseDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package mvc.promiseme.meeting.dto;

import lombok.*;

import java.time.LocalDate;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
public class MeetingResponseDTO {
private Long meetingId;
private String summary;
private String meetingContent;
private LocalDate meetingDate;
private String meetingName;
}
Loading

0 comments on commit 763fac8

Please sign in to comment.