diff --git a/src/main/java/com/soongsil/CoffeeChat/config/S3Config.java b/src/main/java/com/soongsil/CoffeeChat/config/S3Config.java new file mode 100644 index 0000000..a5499bb --- /dev/null +++ b/src/main/java/com/soongsil/CoffeeChat/config/S3Config.java @@ -0,0 +1,34 @@ +package com.soongsil.CoffeeChat.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; + +@Configuration +public class S3Config { + @Value("${cloud.aws.credentials.access-key}") // AWS 액세스 키를 application.properties 또는 application.yml 파일에서 가져옵니다. + private String awsAccessKey; + + @Value("${cloud.aws.credentials.secret-key}") // AWS 비밀 키를 application.properties 또는 application.yml 파일에서 가져옵니다. + private String awsSecretKey; + + @Value("${cloud.aws.region.static}") // AWS 리전을 application.properties 또는 application.yml 파일에서 가져옵니다. + private String region; + + @Bean // 이 어노테이션은 이 메소드가 Spring Bean을 생성하는 팩토리 메소드임을 나타냅니다. + public AmazonS3 s3client() { + BasicAWSCredentials awsCredentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey); // AWS 액세스 키와 비밀 키를 사용하여 AWS 자격 증명을 생성합니다. + + // AmazonS3 클라이언트를 생성합니다. 이 클라이언트는 AWS S3 서비스와 상호 작용하는 데 사용됩니다. + // 클라이언트는 설정된 리전과 자격 증명을 사용합니다. + return AmazonS3ClientBuilder.standard() + .withRegion(region) + .withCredentials(new AWSStaticCredentialsProvider(awsCredentials)) + .build(); + } +} diff --git a/src/main/java/com/soongsil/CoffeeChat/config/oauth2/CustomSuccessHandler.java b/src/main/java/com/soongsil/CoffeeChat/config/oauth2/CustomSuccessHandler.java index 6a833b0..4a0444e 100644 --- a/src/main/java/com/soongsil/CoffeeChat/config/oauth2/CustomSuccessHandler.java +++ b/src/main/java/com/soongsil/CoffeeChat/config/oauth2/CustomSuccessHandler.java @@ -76,8 +76,8 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo response.setStatus(HttpStatus.OK.value()); //response.sendRedirect("http://localhost:8080/swagger-ui/index.html"); //서버 로컬 테스트용 - response.sendRedirect("https://localhost:3000/callback"); - //response.sendRedirect("https://coffeego-ssu.web.app/callback"); + //response.sendRedirect("https://localhost:3000/callback"); + response.sendRedirect("https://coffeego-ssu.web.app/callback"); } private void addSameSiteCookie(HttpServletResponse response, String name, String value) { diff --git a/src/main/java/com/soongsil/CoffeeChat/dto/ApplicationCreateRequest.java b/src/main/java/com/soongsil/CoffeeChat/dto/ApplicationCreateRequest.java new file mode 100644 index 0000000..e2099d4 --- /dev/null +++ b/src/main/java/com/soongsil/CoffeeChat/dto/ApplicationCreateRequest.java @@ -0,0 +1,49 @@ +package com.soongsil.CoffeeChat.dto; + +import java.time.LocalDate; +import java.time.LocalTime; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.soongsil.CoffeeChat.entity.Application; +import com.soongsil.CoffeeChat.entity.Mentee; +import com.soongsil.CoffeeChat.entity.Mentor; + +import lombok.Getter; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Getter +public class ApplicationCreateRequest { + @JsonProperty("date") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate date; + + @JsonProperty("start_time") + @JsonFormat(pattern = "HH:mm") + private LocalTime startTime; + + @JsonProperty("end_time") + @JsonFormat(pattern = "HH:mm") + private LocalTime endTime; + + @JsonProperty("mentor_id") + private Long mentorId; + + public ApplicationCreateRequest(LocalDate date, LocalTime startTime, LocalTime endTime, Long mentorId) { + this.date=date; + this.startTime=startTime; + this.endTime=endTime; + this.mentorId=mentorId; + } + + public Application toEntity(Mentor mentor, Mentee mentee) { + return Application.builder() + + + + .mentor(mentor) + .mentee(mentee) + .build(); + } +} \ No newline at end of file diff --git a/src/main/java/com/soongsil/CoffeeChat/dto/ApplicationCreateResponse.java b/src/main/java/com/soongsil/CoffeeChat/dto/ApplicationCreateResponse.java new file mode 100644 index 0000000..6b1a771 --- /dev/null +++ b/src/main/java/com/soongsil/CoffeeChat/dto/ApplicationCreateResponse.java @@ -0,0 +1,22 @@ +package com.soongsil.CoffeeChat.dto; + +import java.time.LocalDate; +import java.time.LocalTime; + +import com.soongsil.CoffeeChat.entity.Application; +import lombok.Builder; +import lombok.Getter; + +@Builder +@Getter +public class ApplicationCreateResponse { + private LocalDate date; + private LocalTime startTime; + private LocalTime endTime; + + public static ApplicationCreateResponse from(Application application) { + return ApplicationCreateResponse.builder() + + .build(); + } +} diff --git a/src/main/java/com/soongsil/CoffeeChat/dto/PossibleDateRequestDto.java b/src/main/java/com/soongsil/CoffeeChat/dto/PossibleDateRequestDto.java new file mode 100644 index 0000000..8746fcd --- /dev/null +++ b/src/main/java/com/soongsil/CoffeeChat/dto/PossibleDateRequestDto.java @@ -0,0 +1,43 @@ +package com.soongsil.CoffeeChat.dto; + +import java.time.LocalDate; +import java.time.LocalTime; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.querydsl.core.annotations.QueryProjection; +import com.soongsil.CoffeeChat.entity.PossibleDate; + +import lombok.*; + +@Getter +@Builder +@NoArgsConstructor +@Data +public class PossibleDateRequestDto { + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate date; + + @JsonFormat(pattern = "HH:mm") + private LocalTime startTime; + + @JsonFormat(pattern = "HH:mm") + private LocalTime endTime; + + private Long possibleDateId; + + @QueryProjection + public PossibleDateRequestDto(LocalDate date, LocalTime startTime, LocalTime endTime, Long possibleDateId) { + this.date = date; + this.startTime = startTime; + this.endTime = endTime; + this.possibleDateId=possibleDateId; + } + + public static PossibleDateRequestDto toDto(PossibleDate possibleDate) { + return PossibleDateRequestDto.builder() + .date(possibleDate.getDate()) + .startTime(possibleDate.getStartTime()) + .endTime(possibleDate.getEndTime()) + .build(); + } +} diff --git a/src/main/java/com/soongsil/CoffeeChat/dto/ResponseMentorListInfo.java b/src/main/java/com/soongsil/CoffeeChat/dto/ResponseMentorListInfo.java new file mode 100644 index 0000000..28bea98 --- /dev/null +++ b/src/main/java/com/soongsil/CoffeeChat/dto/ResponseMentorListInfo.java @@ -0,0 +1,36 @@ +package com.soongsil.CoffeeChat.dto; + +import java.util.ArrayList; +import java.util.List; + +import com.querydsl.core.annotations.QueryProjection; +import com.soongsil.CoffeeChat.entity.Mentor; +import com.soongsil.CoffeeChat.entity.User; + +import lombok.Builder; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +@Builder +@Getter +@Setter +@Data +public class ResponseMentorListInfo { + private String picture; + private String mentorName; + private int part; + private int club; + private String username; + + + @QueryProjection + public ResponseMentorListInfo(String picture, String mentorName, int part, int club, String username) { + this.picture = picture; + this.mentorName = mentorName; + this.part=part; + this.club=club; + this.username = username; + } + +}