Skip to content

Commit

Permalink
[Refactor] 학교 디비 접속 실험
Browse files Browse the repository at this point in the history
  • Loading branch information
hen715 committed May 2, 2024
1 parent be0a71b commit 046c403
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,20 @@ public class OracleConfig {
@Value("${schoolDbPassword}")
private String password;
@Bean(name = "oracleDataSource")
@ConfigurationProperties(prefix = "school.datasource")
//@ConfigurationProperties(prefix = "school.datasource")
public DataSource secondDataSource() {
/*HikariConfig config = new HikariConfig();
HikariConfig config = new HikariConfig();
config.setJdbcUrl(url);
config.setUsername(username);
config.setPassword(password);
config.setDataSourceClassName("oracle.jdbc.OracleDriver");
// 커넥션 풀 설정 추가
config.setMaximumPoolSize(8);
config.setMinimumIdle(1);
config.setConnectionTimeout(60000); // milliseconds
config.setIdleTimeout(600000); // milliseconds
return new HikariDataSource(config);*/
return DataSourceBuilder.create().type(HikariDataSource.class).build();
return new HikariDataSource(config);
//return DataSourceBuilder.create().type(HikariDataSource.class).build();
}

@Bean(name = "oracleJdbc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ public ResponseEntity<ResponseDto<Boolean>> checkMail(@Valid@RequestBody EmailCh
,@ApiResponse(responseCode = "404",description = "만료된 이메일이거나, 인증 요청을 하지 않은 이메일입니다.",content = @Content(schema = @Schema(implementation = ResponseDto.class)))
})
@PostMapping("/login/school")
public ResponseEntity<ResponseDto<Boolean>> checkLogin(@Valid@RequestBody MemberLoginDto memberLoginDto) throws SQLException, ClassNotFoundException {;
return new ResponseEntity<>(new ResponseDto<>(schoolLoginRepository.loginCheck(memberLoginDto.getEmail(),memberLoginDto.getPassword()),"로그인 성공 여부 테스트"),HttpStatus.OK);
public ResponseEntity<ResponseDto<Boolean>> checkLogin(@Valid@RequestBody LoginDto loginDto) {
return new ResponseEntity<>(new ResponseDto<>(schoolLoginRepository.loginCheck(loginDto.getNum(),loginDto.getNum()),"로그인 성공 여부 테스트"),HttpStatus.OK);
}


Expand Down
27 changes: 27 additions & 0 deletions src/main/java/kr/inuappcenterportal/inuportal/dto/LoginDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package kr.inuappcenterportal.inuportal.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Schema(description = "로그인 요청Dto")
@Getter
@NoArgsConstructor
public class LoginDto {
@Schema(description = "학번",example = "201901591")
@NotBlank
private String num;

@Schema(description = "비밀번호",example = "12345")
@NotBlank
private String password;

@Builder
public LoginDto(String num, String password){
this.num = num;
this.password = password;
}
}

0 comments on commit 046c403

Please sign in to comment.