Skip to content

Commit

Permalink
Merge pull request #171 from Soongsil-CoffeeChat/ref/#170
Browse files Browse the repository at this point in the history
REF: 로그인 성공시 배포링크로 redirect(#170)
  • Loading branch information
KimKyoHwee authored Oct 22, 2024
2 parents dadec13 + dc04f86 commit 776fda7
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 2 deletions.
34 changes: 34 additions & 0 deletions src/main/java/com/soongsil/CoffeeChat/config/S3Config.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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;
}

}

0 comments on commit 776fda7

Please sign in to comment.