Skip to content

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
* �chore: 유저관련 temp API 추가 (#359)

* del(meeting): 모임 지원자 목록 csv 파일 다운로드 temp 삭제

* del(meeting): 모임 게시글 댓글 리스트 조회 temp 삭제

* chore(meeting): 유저 관련 API temp 버전 추가

* �chore: 모임 관련 API 스웨거에 보이는 응답값 수정 (#361)

* chore(meeting): 모임 활동 시간 Dto 반환 수정

* docs(meeting): status 스웨거상 enum 으로 보이게 수정

* chore(meeting): dto내 NotNull 오류 수정

* docs(meeting): 1,2,3 -> 0,1,2 로 수정

* docs(meeting): number -> integer 로 수정

* feat: 모니터링 서버 구축 (#357)

* add(setting): actuator 및 prometheus exporter 설정

* add(yml): 액츄에이터 관련하여 커스텀 포트 및 path 적용

* chore(config): 헬스체크 엔드포인트 화이트리스트에 추가

* chore(config): 화이트리스트 한 곳에서 관리할 수 있도록 코드 구조 변경

* chore(Advertisement): id, 게시 시작일 데이터 추가 (#365)

* refactor: 시큐리티 config 코드 개선 및 헬스 체크 방식 변경 (#363)

* refactor(config): 중복코드 제거

* del(config): 사용하지 않는 코드 제거

* fix(User): AppliedCount -> ApprovedCount 로 변경 (#374)

* feat(application-local.yml): application-local.yml 세팅 (#375)

* fix(Post): desc 데이터 추가 (#378)

* �chore: 플그 db 연결 작업 (#376)

* feat(MemberBlock): 플그의 MemberBlock 테이블 등록

* infra(Playground): 플그 db 연결

* add(Playground): 차단 관련 repository 추가

* feat(Playground): 기능 테스트를 위한 임시 API 개발 (삭제 필요)

* fix(config): 테스트 db는 기존대로 유지

* chore(config): local db 설정을 위한 수정

* chore(yml): prod yml 수정

* chore(yml): 테스트를 위한 API 수정

* fix(config): validate 추가

* del(config): 사용하지 않는 어노테이션 삭제

* chore(local,config): local-yml 수정

* refactor(ci&cd): docker hub 푸시할 때 태그 추가 (#380)

---------

Co-authored-by: DongHoon Lee <[email protected]>
  • Loading branch information
mikekks and hoonyworld authored Sep 17, 2024
2 parents a354b39 + db2a004 commit 4cb04f4
Show file tree
Hide file tree
Showing 36 changed files with 740 additions and 558 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:

- name: docker image 빌드 및 푸시 (Spring)
run: |
docker build --platform linux/amd64 -t makerscrew/main .
docker push makerscrew/main
docker build --platform linux/amd64 -t makerscrew/main:develop .
docker push makerscrew/main:develop
working-directory: ${{ env.working-directory-spring }}

- name: docker image 빌드 및 푸시 (nestjs)
run: |
docker build --platform linux/amd64 -t makerscrew/server .
docker push makerscrew/server
docker build --platform linux/amd64 -t makerscrew/server:develop .
docker push makerscrew/server:develop
working-directory: ${{ env.working-directory-nestjs }}

- name: 도커 컨테이너 실행
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:

- name: docker image 빌드 및 푸시 (Spring)
run: |
docker build --platform linux/amd64 -t makerscrew/main .
docker push makerscrew/main
docker build --platform linux/amd64 -t makerscrew/main:production .
docker push makerscrew/main:production
working-directory: ${{ env.working-directory-spring }}

- name: docker image 빌드 및 푸시 (nestjs)
run: |
docker build --platform linux/amd64 -t makerscrew/server .
docker push makerscrew/server
docker build --platform linux/amd64 -t makerscrew/server:production .
docker push makerscrew/server:production
working-directory: ${{ env.working-directory-nestjs }}

- name: 도커 컨테이너 실행
Expand Down
3 changes: 3 additions & 0 deletions main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ dependencies {

// csv 관련
implementation 'com.opencsv:opencsv:5.5.2'

// prometheus
implementation 'io.micrometer:micrometer-registry-prometheus'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.sopt.makers.crew.main.advertisement.dto;

import java.time.LocalDateTime;

import org.sopt.makers.crew.main.entity.advertisement.Advertisement;

import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -12,6 +14,10 @@
@Schema(name = "AdvertisementImageDto", description = "광고 구좌 이미지 Dto")
public class AdvertisementGetDto {

@Schema(description = "광고 id", example = "3")
@NotNull
private final Integer advertisementId;

@Schema(description = "[Desktop] 광고 구좌 이미지 url", example = "[pc 버전 url 형식]")
@NotNull
private final String desktopImageUrl;
Expand All @@ -24,8 +30,13 @@ public class AdvertisementGetDto {
@NotNull
private final String advertisementLink;

@Schema(description = "광고 게시 시작일", example = "2024-07-31T00:00:00")
@NotNull
private final LocalDateTime advertisementStartDate;

public static AdvertisementGetDto of(Advertisement advertisement) {
return new AdvertisementGetDto(advertisement.getAdvertisementDesktopImageUrl(),
advertisement.getAdvertisementMobileImageUrl(), advertisement.getAdvertisementLink());
return new AdvertisementGetDto(advertisement.getId(), advertisement.getAdvertisementDesktopImageUrl(),
advertisement.getAdvertisementMobileImageUrl(), advertisement.getAdvertisementLink(),
advertisement.getAdvertisementStartDate());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,6 @@ ResponseEntity<CommentV2GetCommentsResponseDto> getComments(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request,
Principal principal);

@Operation(summary = "[TEMP] 모임 게시글 댓글 리스트 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(
responseCode = "200",
description = "성공"),
})
@Parameters({
@Parameter(name = "page", description = "페이지, default = 1", example = "1", schema = @Schema(type = "integer", format = "int32")),
@Parameter(name = "take", description = "가져올 데이터 개수, default = 12", example = "50", schema = @Schema(type = "integer", format = "int32")),
@Parameter(name = "postId", description = "게시글 id", example = "3", schema = @Schema(type = "integer", format = "int32"))})
ResponseEntity<TempResponseDto<CommentV2GetCommentsResponseDto>> getCommentsTemp(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request,
Principal principal);

@Operation(summary = "모임 게시글 댓글 좋아요 토글")
@ResponseStatus(HttpStatus.CREATED)
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,6 @@ public ResponseEntity<CommentV2GetCommentsResponseDto> getComments(
return ResponseEntity.status(HttpStatus.OK).body(commentDtos);
}

@Override
@GetMapping("/temp")
public ResponseEntity<TempResponseDto<CommentV2GetCommentsResponseDto>> getCommentsTemp(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request,
Principal principal) {

Integer userId = UserUtil.getUserId(principal);
CommentV2GetCommentsResponseDto commentDtos = commentV2Service.getComments(request.getPostId(),
request.getPage(), request.getTake(), userId);

return ResponseEntity.status(HttpStatus.OK).body(TempResponseDto.of(commentDtos));
}

@Override
@PostMapping("/{commentId}/like")
public ResponseEntity<CommentV2SwitchCommentLikeResponseDto> switchCommentLike(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package org.sopt.makers.crew.main.common.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
basePackages = "org.sopt.makers.crew.main.entity", // 첫번째 DB가 있는 패키지(폴더) 경로
entityManagerFactoryRef = "primaryEntityManagerFactory", // EntityManager의 이름
transactionManagerRef = "primaryTransactionManager" // 트랜잭션 매니저의 이름
)
@Profile({"local", "dev", "prod"})
public class CrewDatabaseConfig {

@Bean
@Primary
@ConfigurationProperties("spring.datasource")
public DataSource primaryDatasourceProperties() {
return DataSourceBuilder.create().build();
}

@Bean(name = "primaryEntityManagerFactory")
@Primary
public LocalContainerEntityManagerFactoryBean primaryEntityManagerFactory() {
DataSource dataSource = primaryDatasourceProperties();

LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setPackagesToScan("org.sopt.makers.crew.main.entity");

HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(true);
em.setJpaVendorAdapter(vendorAdapter);

Map<String, Object> properties = new HashMap<>();
properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
properties.put("hibernate.hbm2ddl.auto", "validate");
properties.put("hibernate.format_sql", true);
properties.put("hibernate.physical_naming_strategy", "org.sopt.makers.crew.main.common.config.CamelCaseNamingStrategy");
properties.put("hibernate.globally_quoted_identifiers", true);
em.setJpaPropertyMap(properties);

return em;
}

@Bean(name = "primaryTransactionManager")
@Primary
public PlatformTransactionManager primaryTransactionManager(
final @Qualifier("primaryEntityManagerFactory") LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean
) {
return new JpaTransactionManager(Objects.requireNonNull(localContainerEntityManagerFactoryBean.getObject()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.sopt.makers.crew.main.common.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
basePackages = "org.sopt.makers.crew.main.external.playground.entity",
entityManagerFactoryRef = "secondEntityManagerFactory",
transactionManagerRef = "secondTransactionManager"
)
@Profile({"local", "dev", "prod"})
public class PlaygroundDataSourceConfig {
@Bean
@ConfigurationProperties("spring.playground-datasource")
public DataSource secondDatasourceProperties() {
return DataSourceBuilder.create().build();
}

@Bean(name = "secondEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean secondEntityManagerFactory() {
DataSource dataSource = secondDatasourceProperties();

LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setPackagesToScan("org.sopt.makers.crew.main.external.playground.entity");

HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(true);
em.setJpaVendorAdapter(vendorAdapter);

Map<String, Object> properties = new HashMap<>();
properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
properties.put("hibernate.hbm2ddl.auto", "validate");
properties.put("hibernate.format_sql", true);
properties.put("hibernate.physical_naming_strategy", "org.sopt.makers.crew.main.common.config.CamelCaseNamingStrategy");
properties.put("hibernate.globally_quoted_identifiers", true);
em.setJpaPropertyMap(properties);

return em;
}

@Bean(name = "secondTransactionManager")
public PlatformTransactionManager secondTransactionManager(
final @Qualifier("secondEntityManagerFactory") LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean
) {
return new JpaTransactionManager(Objects.requireNonNull(localContainerEntityManagerFactoryBean.getObject()));
}
}
Loading

0 comments on commit 4cb04f4

Please sign in to comment.