Skip to content

Commit

Permalink
Merge branch 'develop' into feat/#91
Browse files Browse the repository at this point in the history
  • Loading branch information
nahowo authored Nov 10, 2024
2 parents a5285c6 + 8036913 commit 182243e
Show file tree
Hide file tree
Showing 24 changed files with 254 additions and 330 deletions.
82 changes: 41 additions & 41 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,47 +38,47 @@ services:
# networks:
# - alchive

# Monitoring
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- "9090:9090"
networks:
- alchive

grafana:
container_name: grafana
image: grafana/grafana:latest
volumes:
- ./monitoring/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- ./monitoring/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
- ./monitoring/grafana/provisioning/dashboards:/var/lib/grafana/dashboards
ports:
- "3000:3000"
depends_on:
- prometheus
networks:
- alchive

cadvisor:
container_name: cadvisor
image: gcr.io/cadvisor/cadvisor:latest
ports:
- "8081:8081"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /var/run/docker.sock:/var/run/docker.sock
privileged: true
networks:
- alchive
# # Monitoring
# prometheus:
# container_name: prometheus
# image: prom/prometheus:latest
# volumes:
# - ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
# command:
# - '--config.file=/etc/prometheus/prometheus.yml'
# ports:
# - "9090:9090"
# networks:
# - alchive
#
# grafana:
# container_name: grafana
# image: grafana/grafana:latest
# volumes:
# - ./monitoring/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
# - ./monitoring/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
# - ./monitoring/grafana/provisioning/dashboards:/var/lib/grafana/dashboards
# ports:
# - "3000:3000"
# depends_on:
# - prometheus
# networks:
# - alchive
#
# cadvisor:
# container_name: cadvisor
# image: gcr.io/cadvisor/cadvisor:latest
# ports:
# - "8081:8081"
# volumes:
# - /:/rootfs:ro
# - /var/run:/var/run:ro
# - /sys:/sys:ro
# - /var/lib/docker/:/var/lib/docker:ro
# - /var/run/docker.sock:/var/run/docker.sock
# privileged: true
# networks:
# - alchive

networks:
alchive:
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/Alchive/backend/BackendApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@PropertySource("classpath:env.properties")
@SpringBootApplication
@EnableJpaAuditing
public class BackendApplication {

public static void main(String[] args) {
SpringApplication.run(BackendApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(BackendApplication.class, args);
}

}
37 changes: 8 additions & 29 deletions src/main/java/com/Alchive/backend/config/DataInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@ public void run(String... args) throws Exception {

// User 목업 데이터 생성
User user1 = User.builder()
.userEmail("[email protected]")
.userNickName("조하나")
.email("[email protected]")
.name("조하나")
.build();
userRepository.save(user1);

User user2 = User.builder()
.userEmail("[email protected]")
.userNickName("박나현")
.email("[email protected]")
.name("박나현")
.build();
userRepository.save(user2);

User user3 = User.builder()
.userEmail("[email protected]")
.userNickName("송유림")
.email("[email protected]")
.name("송유림")
.build();
userRepository.save(user3);

User user4 = User.builder()
.userEmail("[email protected]")
.userNickName("김미영")
.email("[email protected]")
.name("김미영")
.build();
userRepository.save(user4);

Expand Down Expand Up @@ -112,7 +112,6 @@ public void run(String... args) throws Exception {
.memo("Hash Map을 사용하면 되지 않을까?")
.status(BoardStatus.INCORRECT)
.description("사용 알고리즘: **Hash Map**")
.createdAt(LocalDateTime.parse("2024-08-27T15:08:50"))
.build();
boardRepository.save(board1);

Expand Down Expand Up @@ -286,7 +285,6 @@ public void run(String... args) throws Exception {
"name과 yearning 매칭은 map 사용하거나 for문은 같은 인덱스 별로 묶어 계산<br>" +
"배열은 0부터 N까지 돌아가면서 탐색<br>" +
"map은 해당 key에 있는 value를 바로 가져온다 → 속도 빠름")
.createdAt(LocalDateTime.parse("2024-09-03T15:08:50"))
.build();
boardRepository.save(board2);

Expand Down Expand Up @@ -372,7 +370,6 @@ public void run(String... args) throws Exception {
.memo("Two Pointer를 사용해보자")
.status(BoardStatus.INCORRECT)
.description("사용 알고리즘: Two Pointer")
.createdAt(LocalDateTime.parse("2024-09-16T15:08:50"))
.build();
boardRepository.save(board3);

Expand Down Expand Up @@ -425,8 +422,6 @@ public void run(String... args) throws Exception {
.memo("큐와 우선순위 큐 개념 복습 필요")
.status(BoardStatus.COMPLETED)
.description("사용 알고리즘: Queue, Priority Queue")
.createdAt(LocalDateTime.parse("2024-09-17T22:08:50"))

.build();
boardRepository.save(board4);

Expand Down Expand Up @@ -486,7 +481,6 @@ public void run(String... args) throws Exception {
.memo("작업 속도와 진도 계산 방법 이해 필요")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: Queue")
.createdAt(LocalDateTime.parse("2024-09-18T03:08:50"))
.build();
boardRepository.save(board5);

Expand Down Expand Up @@ -546,7 +540,6 @@ public void run(String... args) throws Exception {
.memo("Stack 자료구조로 해결해보자")
.status(BoardStatus.INCORRECT)
.description("사용 알고리즘: Stack")
.createdAt(LocalDateTime.parse("2024-09-21T16:08:50"))
.build();
boardRepository.save(board6);

Expand Down Expand Up @@ -594,7 +587,6 @@ public void run(String... args) throws Exception {
.memo("Dynamic Programming으로 해결 가능")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: Dynamic Programming")
.createdAt(LocalDateTime.parse("2024-10-01T15:08:50"))
.build();
boardRepository.save(board7);

Expand Down Expand Up @@ -641,7 +633,6 @@ public void run(String... args) throws Exception {
.memo("2차원 배열에 대한 이해 필요")
.status(BoardStatus.COMPLETED)
.description("사용 알고리즘: Array")
.createdAt(LocalDateTime.parse("2024-10-02T15:08:50"))
.build();
boardRepository.save(board8);

Expand Down Expand Up @@ -686,7 +677,6 @@ public void run(String... args) throws Exception {
.memo("DFS/BFS 재귀적으로 구현해보기")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: DFS, BFS")
.createdAt(LocalDateTime.parse("2024-10-08T15:08:50"))
.build();
boardRepository.save(board9);

Expand Down Expand Up @@ -736,7 +726,6 @@ public void run(String... args) throws Exception {
.memo("완전탐색으로 해결 가능")
.status(BoardStatus.INCORRECT)
.description("사용 알고리즘: Brute Force")
.createdAt(LocalDateTime.parse("2024-10-10T15:08:50"))
.build();
boardRepository.save(board10);

Expand Down Expand Up @@ -783,7 +772,6 @@ public void run(String... args) throws Exception {
.memo("이진 탐색을 통해 효율적으로 풀이 가능")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: Binary Search")
.createdAt(LocalDateTime.parse("2024-10-11T15:08:50"))
.build();
boardRepository.save(board11);

Expand Down Expand Up @@ -833,7 +821,6 @@ public void run(String... args) throws Exception {
.memo("압축 단위별로 반복적으로 확인 필요")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: String Manipulation, Brute Force")
.createdAt(LocalDateTime.parse("2024-10-11T23:08:50"))
.build();
boardRepository.save(board12);

Expand Down Expand Up @@ -889,7 +876,6 @@ public void run(String... args) throws Exception {
.memo("주어진 문자열 파싱과 순서 찾기 필요")
.status(BoardStatus.INCORRECT)
.description("사용 알고리즘: String Parsing, Set")
.createdAt(LocalDateTime.parse("2024-10-15T23:08:50"))
.build();
boardRepository.save(board13);

Expand Down Expand Up @@ -940,7 +926,6 @@ public void run(String... args) throws Exception {
.memo("백트래킹을 이용해 조합 생성 필요")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: Backtracking, Set")
.createdAt(LocalDateTime.parse("2024-10-16T23:08:50"))
.build();
boardRepository.save(board14);

Expand Down Expand Up @@ -1003,7 +988,6 @@ public void run(String... args) throws Exception {
.memo("좌표와 Set을 이용해 방문 체크 필요")
.status(BoardStatus.NOT_SUBMITTED)
.description("사용 알고리즘: Set, 2D Coordinates")
.createdAt(LocalDateTime.parse("2024-10-18T23:08:50"))
.build();
boardRepository.save(board15);

Expand Down Expand Up @@ -1060,7 +1044,6 @@ public void run(String... args) throws Exception {
.memo("유일성과 최소성을 모두 만족하는 조합 찾기 필요")
.status(BoardStatus.COMPLETED)
.description("사용 알고리즘: Bit Masking, Set, Combination")
.createdAt(LocalDateTime.parse("2024-10-18T23:08:50"))
.build();
boardRepository.save(board16);

Expand Down Expand Up @@ -1121,7 +1104,6 @@ public void run(String... args) throws Exception {
.memo("정규 표현식과 DFS/BFS를 통해 조합을 찾기")
.status(BoardStatus.INCORRECT)
.description("사용 알고리즘: DFS, Regex, Set")
.createdAt(LocalDateTime.parse("2024-10-20T23:08:50"))
.build();
boardRepository.save(board17);

Expand Down Expand Up @@ -1178,7 +1160,6 @@ public void run(String... args) throws Exception {
.memo("2D 배열 회전과 이동 구현 필요")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: Array Manipulation, Brute Force")
.createdAt(LocalDateTime.parse("2024-10-22T23:08:50"))
.build();
boardRepository.save(board18);

Expand Down Expand Up @@ -1250,7 +1231,6 @@ public void run(String... args) throws Exception {
.memo("최소 비용 신장 트리 문제")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: Kruskal's Algorithm, Union-Find")
.createdAt(LocalDateTime.parse("2024-10-22T23:08:50"))
.build();
boardRepository.save(board19);

Expand Down Expand Up @@ -1314,7 +1294,6 @@ public void run(String... args) throws Exception {
.memo("Map을 사용해 아이디와 닉네임을 추적")
.status(BoardStatus.CORRECT)
.description("사용 알고리즘: HashMap")
.createdAt(LocalDateTime.parse("2024-10-24T23:08:50"))
.build();
boardRepository.save(board20);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.Alchive.backend.config.auth.dto;

import com.Alchive.backend.domain.user.User;
import lombok.Builder;
import lombok.Getter;

Expand All @@ -17,8 +16,8 @@ public class OAuth2Attributes {

@Builder
public OAuth2Attributes(Map<String, Object> attributes,
String nameAttributeKey, String name,
String email, boolean isNewUser) {
String nameAttributeKey, String name,
String email, boolean isNewUser) {
this.attributes = attributes;
this.nameAttributeKey = nameAttributeKey;
this.name = name;
Expand All @@ -27,28 +26,20 @@ public OAuth2Attributes(Map<String, Object> attributes,

// OAuth2User에서 반환하는 사용자 정보는 Map. 따라서 값 하나하나를 변환해야함.
public static OAuth2Attributes of(String registrationId,
String userNameAttributeName,
Map<String, Object> attributes) {
String userNameAttributeName,
Map<String, Object> attributes) {

return ofGoogle(userNameAttributeName, attributes);
}

// 구글 생성자
private static OAuth2Attributes ofGoogle(String usernameAttributeName,
Map<String, Object> attributes) {
Map<String, Object> attributes) {
return OAuth2Attributes.builder()
.name((String) attributes.get("name"))
.email((String) attributes.get("email"))
.attributes(attributes)
.nameAttributeKey(usernameAttributeName)
.build();
}

// User 엔티티 생성
public User toEntity() {
return User.builder()
.userEmail(email)
.userNickName(name)
.build();
}
}
Loading

0 comments on commit 182243e

Please sign in to comment.