Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release : 1.1.2 배포 #200

Merged
merged 49 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
52a5518
Merge pull request #188 from TEAM-SAMSION/release
tlarbals824 Dec 22, 2023
c84defa
PET-277 refactor : Todo 생성 로직 batch insert로 변경
tlarbals824 Dec 24, 2023
b8f7bf3
PET-277 feat : BatchInsertRepository 인터페이스 추가
tlarbals824 Dec 24, 2023
257c367
PET-277 feat : Assign Batch Insert 제공 리포지토리 추가
tlarbals824 Dec 24, 2023
e3b2097
PET-277 feat : Register 엔티티에 userId 일치 여부 조회 메소드 추가
tlarbals824 Dec 24, 2023
1bc928e
PET-277 chore : jdbc 의존성 제거
tlarbals824 Dec 24, 2023
89c0009
Merge pull request #189 from TEAM-SAMSION/PET-277
tlarbals824 Dec 24, 2023
4cdbcf8
Merge pull request #193 from TEAM-SAMSION/release
tlarbals824 Dec 26, 2023
c6dcfd2
PET-281 feat : ValueOperator에 모든 키 조회 메소드 추가 및 구현
tlarbals824 Dec 26, 2023
b6669d6
PET-281 feat : Cache, CacheManger 구현체 추가
tlarbals824 Dec 26, 2023
a9e1652
PET-281 feat : CacheManger 빈 등록
tlarbals824 Dec 26, 2023
5f19cab
PET-280 feat : key(todo id) : value(todo notification) 형태의 맵 반환 메소드 추가
tlarbals824 Dec 26, 2023
12addb0
PET-280 refactor : 사용자 id 기반 맵 반환 메소드 이름 변경
tlarbals824 Dec 26, 2023
5bf7b53
PET-280 refactor : TodoNotificationInfoResponse record로 변경 및 인스턴스 생성 …
tlarbals824 Dec 26, 2023
0986a8a
PET-280 refactor : Todo 조회 로직 리팩터링
tlarbals824 Dec 26, 2023
7930892
PET-280 refactor : Todo 완료 여부 조회 메소드 분리
tlarbals824 Dec 26, 2023
0ec0100
PET-280 refactor : user 조회 메소드 이름 변경 반영
tlarbals824 Dec 26, 2023
bcc0b37
PET-280 refactor : user 조회 메소드 이름 변경 반영
tlarbals824 Dec 26, 2023
9a3d53b
PET-280 refactor : Key(todo) : Value(List<Assign>) 형태의 맵 반환 메소드 추가
tlarbals824 Dec 26, 2023
ac7ba0e
PET-280 fix : @Cacheable 제거
tlarbals824 Dec 26, 2023
5707dd4
Merge pull request #194 from TEAM-SAMSION/PET-281
tlarbals824 Dec 26, 2023
8332f89
Merge pull request #195 from TEAM-SAMSION/PET-280
tlarbals824 Dec 26, 2023
00d4b03
PET-282 fix : 날짜 비교시 Period에서 ChronoUnit 사용해 비교하도록 수정
tlarbals824 Dec 28, 2023
dcd739f
PET-282 refactor : TodoCompletionCheckEvent record로 변경
tlarbals824 Dec 28, 2023
7cab16a
Merge pull request #196 from TEAM-SAMSION/PET-282
tlarbals824 Dec 28, 2023
0c11356
PET-284 docs : Infra Diagram 추가
tlarbals824 Jan 2, 2024
e9cb5ba
Merge pull request #197 from TEAM-SAMSION/PET-284
tlarbals824 Jan 2, 2024
ed7a9c7
PET-285 feat : Register 엔티티 관련 유틸 클래스 추가
tlarbals824 Jan 2, 2024
0fad14c
PET-285 refactor : RegisterUtils 클래스 기반으로 Register 조회 로직 리팩터링
tlarbals824 Jan 2, 2024
ca90a5f
PET-285 refactor : UserSignUpEvent class -> record로 변경
tlarbals824 Jan 2, 2024
7e3bcab
PET-285 refactor : UserSignUpEvent class -> record로 변경에 따른 조회 메소드 호출 변경
tlarbals824 Jan 2, 2024
574f935
PET-285 refactor : UserAccountDeleteEvent class -> record로 변경
tlarbals824 Jan 2, 2024
49cbeaf
PET-285 refactor : todoTeam 조회 로직 불변성 보장
tlarbals824 Jan 2, 2024
68b6040
PET-285 refactor : 불필요 의존성 제거 및 RegisterUtils 사용으로 리팩터링
tlarbals824 Jan 2, 2024
01e7263
PET-285 refactor : 미사용 메소드 제거
tlarbals824 Jan 2, 2024
8f6bcf7
PET-285 refactor : 미사용 메소드 제거
tlarbals824 Jan 2, 2024
8f2f0f3
PET-285 refactor : AlarmBatchRepository 인터페이스 BatchInsertRepository 확…
tlarbals824 Jan 2, 2024
4e7c1fd
PET-285 feat : AssignUtils 추가
tlarbals824 Jan 2, 2024
74577ec
PET-285 refactor : 패밀리 코드 조회 로직 리팩터링
tlarbals824 Jan 2, 2024
5494633
PET-285 refactor : 불필요 롬복 에노테이션 제거
tlarbals824 Jan 2, 2024
4ff498a
PET-285 refactor : UserSignUpEvent class -> record 변경에 따른 조회 메소드 변경
tlarbals824 Jan 2, 2024
17b73b3
Merge pull request #198 from TEAM-SAMSION/PET-285
tlarbals824 Jan 2, 2024
eec8fdb
PET-257 refactor : 검증 API 응답 DTO 통일
isprogrammingfun Jan 12, 2024
feb955c
PET-257 test : 투두 삭제 및 수정 검증 API 테스트 코드 수정
isprogrammingfun Jan 12, 2024
d86722d
PET-257 refactor : 팀 탈퇴, 서비스 탈퇴 검증 API 수정
isprogrammingfun Jan 12, 2024
358b2e4
PET-257 refactor : 팀 탈퇴, 서비스 탈퇴 검증 API 테스트 코드 수정, 문서 반영
isprogrammingfun Jan 12, 2024
ea5a159
PET-257 test : RegisterValidateServiceTest 수정
isprogrammingfun Jan 12, 2024
cf6b588
PET-257 test : ValidateResponse 생성 방식 수정
isprogrammingfun Jan 12, 2024
8798cc4
Merge pull request #199 from TEAM-SAMSION/PET-257
isprogrammingfun Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/docs/infra-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.pawith.alarmmodule.repository;

import com.pawith.alarmmodule.entity.Alarm;
import com.pawith.commonmodule.domain.BatchInsertRepository;
import org.springframework.data.repository.NoRepositoryBean;

import java.util.Collection;

@NoRepositoryBean
public interface AlarmBatchRepository{
void saveAllBatch(Collection<Alarm> entities);
public interface AlarmBatchRepository extends BatchInsertRepository<Alarm> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class AlarmBatchRepositoryImpl implements AlarmBatchRepository{
private final JdbcTemplate jdbcTemplate;

@Override
public void saveAllBatch(Collection<Alarm> entities) {
public void batchInsert(Collection<Alarm> entities) {
final String insertSql = """
INSERT INTO alarm (domain_id, message, alarm_category,is_read,alarm_user_id,created_at, updated_at)
VALUES (?, ?, ?, ?, ?,now(),now())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public void changeAllAlarmStatusToRead(){
}

public void saveAllAlarm(List<Alarm> alarms){
alarmBatchRepository.saveAllBatch(alarms);
alarmBatchRepository.batchInsert(alarms);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.pawith.commonmodule.cache;

import com.pawith.commonmodule.cache.operators.impl.ExpiredStorage;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

@RequiredArgsConstructor
public class DefaultCache extends ExpiredStorage<Object, Object> implements Cache {
private final String name;

public void setTimeToLive(long timeToLive, TimeUnit timeUnit) {
storage.setExpiration(timeToLive, timeUnit);
}

@Override
public String getName() {
return name;
}

@Override
public Object getNativeCache() {
return storage;
}

@Override
public ValueWrapper get(Object key) {
Object value = storage.get(key);
return value == null ? null : () -> value;
}

@Override
public <T> T get(Object key, Class<T> type) {
return (T) storage.get(key);
}

@Override
public <T> T get(Object key, Callable<T> valueLoader) {
final Object value = storage.get(key);
try {
return value == null ? valueLoader.call() : (T) value;
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}

@Override
public void put(Object key, Object value) {
storage.put(key, value);
}

@Override
public void evict(Object key) {
storage.remove(key);
}

@Override
public void clear() {
storage.clear();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.pawith.commonmodule.cache;

import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

@RequiredArgsConstructor
public class DefaultCacheManger implements CacheManager {
private static final Map<String, DefaultCache> caches = new ConcurrentHashMap<>();

public void setupTimeToLive(long timeToLive, TimeUnit timeUnit) {
caches.values().forEach(cache -> cache.setTimeToLive(timeToLive, timeUnit));
}

@Override
public Cache getCache(String name) {
return caches.computeIfAbsent(name, DefaultCache::new);
}

@Override
public Collection<String> getCacheNames() {
return caches.keySet();
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
package com.pawith.commonmodule.cache.config;

import com.pawith.commonmodule.cache.CacheTemplate;
import com.pawith.commonmodule.cache.DefaultCacheManger;
import com.pawith.commonmodule.cache.DefaultCacheTemplate;
import com.pawith.commonmodule.cache.operators.SetOperator;
import com.pawith.commonmodule.cache.operators.ValueOperator;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

@EnableCaching
@Configuration
public class CacheConfig {

Expand All @@ -24,4 +30,11 @@ public SetOperator<?> setOperator() {
public ValueOperator<?,?> valueOperator() {
return cacheTemplate().opsForValue();
}

@Bean
public CacheManager cacheManager() {
final DefaultCacheManger defaultCacheManger = new DefaultCacheManger();
defaultCacheManger.setupTimeToLive(10, TimeUnit.SECONDS);
return defaultCacheManger;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.pawith.commonmodule.cache.operators;

import java.util.Collection;
import java.util.concurrent.TimeUnit;

public interface ValueOperator<K,V> {
Expand All @@ -10,6 +11,8 @@ public interface ValueOperator<K,V> {

V get(K k);

Collection<K> getKeys();

void remove(K k);

boolean contains(K k);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.pawith.commonmodule.cache.operators.ValueOperator;
import net.jodah.expiringmap.ExpirationPolicy;

import java.util.Collection;
import java.util.concurrent.TimeUnit;

public class DefaultValueOperator<K,V> extends ExpiredStorage<K,V> implements ValueOperator<K,V> {
Expand All @@ -21,6 +22,11 @@ public V get(K k) {
return storage.get(k);
}

@Override
public Collection<K> getKeys() {
return storage.keySet();
}

@Override
public void remove(K k) {
storage.remove(k);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.pawith.commonmodule.domain;

import java.util.Collection;

public interface BatchInsertRepository<T> {
void batchInsert(Collection<T> entities);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
package com.pawith.commonmodule.event;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public class UserAccountDeleteEvent {
private final Long userId;
public record UserAccountDeleteEvent(Long userId) {
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
package com.pawith.commonmodule.event;

import com.pawith.commonmodule.enums.Provider;
import lombok.*;

@Getter
public class UserSignUpEvent {
private String nickname;
private String email;
private Provider provider;

public UserSignUpEvent(String nickname, String email, Provider provider) {
this.nickname = nickname;
this.email = email;
this.provider = provider;
}
public record UserSignUpEvent(
String nickname,
String email,
Provider provider
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ public Token generateToken(final String email){
return new Token(accessToken, refreshToken);
}

/**
* refresh token을 이용하여 access token 재발급
*
* @throws InvalidTokenException : 잘못된 토큰 요청시 발생
* @throws ExpiredTokenException : 만료된 토큰 요청시 발생
*/
public String reIssueAccessToken(final String refreshToken) {
validateToken(refreshToken, TokenType.REFRESH_TOKEN);
final String email = extractEmailFromToken(refreshToken, TokenType.REFRESH_TOKEN);
return generateAccessToken(email);
}

public Token reIssueToken(final String refreshToken){
validateToken(refreshToken, TokenType.REFRESH_TOKEN);
final String email = extractEmailFromToken(refreshToken, TokenType.REFRESH_TOKEN);
Expand All @@ -75,18 +63,6 @@ public Token reIssueToken(final String refreshToken){
return new Token(newAccessToken, newRefreshToken);
}

/**
* refresh token을 이용하여 refresh token 재발급
*
* @throws InvalidTokenException : 잘못된 토큰 요청시 발생
* @TODO : RefreshToken 인증 범위 결정
*/
public String reIssueRefreshToken(final String refreshToken) {
validateToken(refreshToken, TokenType.REFRESH_TOKEN);
final String email = extractEmailFromToken(refreshToken, TokenType.REFRESH_TOKEN);
return generateRefreshToken(email);
}

public String extractEmailFromToken(String token, TokenType tokenType) {
return initializeJwtParser(tokenType)
.parseClaimsJws(token)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.pawith.authdomain.jwt;

import lombok.Getter;

@Getter
public enum TokenType {
ACCESS_TOKEN,
REFRESH_TOKEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,6 @@ void generateRefreshTokenByEmail(){
Assertions.assertThat(body.get(JWTConsts.TOKEN_TYPE)).isEqualTo(TokenType.REFRESH_TOKEN.toString());
}

@Test
@DisplayName("refreshToken이 만료되었을 때, accessToken 재발급시 예외가 발생한다.")
@SneakyThrows
void reIssueAccessTokenWithExpiredRefreshToken(){
//given
final String randomEmail = FixtureMonkeyUtils.getConstructBasedFixtureMonkey().giveMeOne(String.class);
final String refreshToken = jwtProvider.generateRefreshToken(randomEmail);
Thread.sleep(JWTTestConsts.REFRESH_TOKEN_EXPIRED_TIME+1);
//when
//then
Assertions.assertThatCode(() -> jwtProvider.reIssueAccessToken(refreshToken))
.isInstanceOf(ExpiredTokenException.class);
}

@Test
@DisplayName("validateToken 메소드에 잘못된 token이 입력되면 InvalidTokenException 예외가 발생한다.")
void validateTokenWithInvalidToken(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
package com.pawith.todoapplication.dto.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Getter;
import com.pawith.tododomain.entity.TodoNotification;

import java.time.LocalTime;
import java.util.Optional;
import java.util.function.Supplier;

@AllArgsConstructor
@Getter
public class TodoNotificationInfoResponse {
private Boolean isNotification;
@JsonInclude(JsonInclude.Include.NON_NULL)
private LocalTime notificationTime;
public record TodoNotificationInfoResponse(
Boolean isNotification,
@JsonInclude(JsonInclude.Include.NON_NULL) LocalTime notificationTime
) {
public static TodoNotificationInfoResponse of(Supplier<Optional<TodoNotification>> todoNotificationSupplier) {
return todoNotificationSupplier.get()
.map(todoNotification -> new TodoNotificationInfoResponse(true, todoNotification.getNotificationTime()))
.orElse(new TodoNotificationInfoResponse(false, null));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public class TodoTeamInfoResponse {
private String teamProfileImageUrl;
private String teamName;
private Authority authority;
private Integer registerPeriod;
private Long registerPeriod;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.pawith.todoapplication.dto.response;

public record ValidateResponse(Boolean isNotValidate) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void cachingUserInfo(List<IncompleteTodoCountInfoDao> executionResult) {
.map(IncompleteTodoCountInfoDao::getUserId)
.filter(userId -> !valueOperator.contains(userId))
.toList();
userQueryService.findUserMapByIds(userIds)
userQueryService.findMapWithUserIdKeyByIds(userIds)
.forEach((userId, user) -> valueOperator.setWithExpire(userId, user.getNickname(), 1, TimeUnit.MINUTES));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class TodoCompletionCheckOnTodoHandler {
public void changeTodoStatus(TodoCompletionCheckEvent todoCompletionCheckEvent) throws InterruptedException {
while(true) {
try {
final List<Assign> assigns = assignQueryService.findAllAssignByTodoId(todoCompletionCheckEvent.getTodoId());
final Todo todo = todoQueryService.findTodoByTodoId(todoCompletionCheckEvent.getTodoId());
final List<Assign> assigns = assignQueryService.findAllAssignByTodoId(todoCompletionCheckEvent.todoId());
final Todo todo = todoQueryService.findTodoByTodoId(todoCompletionCheckEvent.todoId());
final boolean isAllCompleteTodo = assigns.stream().allMatch(Assign::isCompleted);
todo.updateCompletionStatus(isAllCompleteTodo);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class UserAccountDeleteOnTodoHandler {

@EventListener
public void deleteUserInfo(UserAccountDeleteEvent userAccountDeleteEvent) {
final List<Register> registers = registerQueryService.findAllRegistersByUserId(userAccountDeleteEvent.getUserId());
final List<Register> registers = registerQueryService.findAllRegistersByUserId(userAccountDeleteEvent.userId());
final List<Long> registerIds = registers.stream()
.map(Register::getId)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
package com.pawith.todoapplication.handler.event;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public class TodoCompletionCheckEvent {
private final Long todoId;
public record TodoCompletionCheckEvent(Long todoId) {
}
Loading
Loading