-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from LikelionUniv/main
release : stag 11/14
- Loading branch information
Showing
114 changed files
with
1,694 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: stag-client-api-deploy | ||
|
||
on: | ||
push: | ||
branches: [ "stag/client" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'corretto' | ||
java-version: '17' | ||
|
||
- name: app clean | ||
run: ./gradlew clean | ||
|
||
- name: client api build | ||
run: ./gradlew :likelion-client:build -x test | ||
|
||
- name: Docker login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_EMAIL }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./likelion-client | ||
push: true | ||
tags: ${{ secrets.DOCKER_CLIENT_API_STAG_IMAGE }} | ||
build-args: PROFILE=stag | ||
|
||
- name: client-api-deploy | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.KEY }} | ||
script: | | ||
sudo docker rm -f ${{ secrets.DOCKER_CLIENT_API_STAG_CONTAINER }} | ||
sudo docker rmi ${{ secrets.DOCKER_CLIENT_API_STAG_IMAGE }} | ||
docker-compose -f ${{ secrets.DOCKER_COMPOSE_DIRECTORY }} up -d | ||
docker image prune -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
FROM openjdk:17 | ||
ARG JAR_FILE=build/libs/*.jar | ||
ARG JAR_FILE=./build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
EXPOSE 8090 | ||
|
||
ENTRYPOINT ["java","-jar","-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=${PROFILE}","/app.jar"] | ||
ENTRYPOINT ["java","-jar","-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=${PROFILE}","/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
FROM openjdk:17 | ||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
COPY ./build/libs/*.jar app.jar | ||
|
||
ENTRYPOINT ["java","-jar","-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=${PROFILE}","/app.jar"] | ||
ENTRYPOINT ["java","-jar","-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=${PROFILE}","/app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
likelion-client/src/main/java/likelion/univ/alarm/controller/AlarmController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package likelion.univ.alarm.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import likelion.univ.alarm.dto.request.AlarmRegisterRequestDto; | ||
import likelion.univ.alarm.usecase.RegisterAlarmUseCase; | ||
import likelion.univ.response.SuccessResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping(value = "/v1/alarm") | ||
@Tag(name = "알람", description = "알람 API") | ||
public class AlarmController { | ||
private final RegisterAlarmUseCase registerAlarmUseCase; | ||
|
||
@Operation(summary = "알람 등록", description = "이메일과 알람 타입을 입력받아 해당 기수의 알람을 등록합니다.") | ||
@PostMapping("/{ordinal}/register") | ||
public SuccessResponse registerAlarm(@PathVariable Long ordinal, | ||
@RequestBody AlarmRegisterRequestDto alarmRegisterRequestDto){ | ||
registerAlarmUseCase.execute(ordinal, alarmRegisterRequestDto); | ||
return SuccessResponse.empty(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
likelion-client/src/main/java/likelion/univ/alarm/dto/request/AlarmRegisterRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package likelion.univ.alarm.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import likelion.univ.domain.alarm.entity.Alarm; | ||
import likelion.univ.domain.alarm.entity.AlarmType; | ||
import likelion.univ.domain.alarm.entity.SendStatus; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import static likelion.univ.domain.alarm.entity.SendStatus.NOT_SENT; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class AlarmRegisterRequestDto { | ||
@NotNull | ||
@Schema(description = "이메일", example = "tmfrk0426@gmail.com", required = true) | ||
private String email; | ||
|
||
@NotNull | ||
@Schema(description = "알람 타입", example = "NEW_UNIVERSITY_RECRUITING", required = true, enumAsRef = true) | ||
private AlarmType alarmType; | ||
|
||
public static Alarm toEntity(Long ordinal, AlarmRegisterRequestDto alarmRegisterRequestDto){ | ||
return Alarm.builder() | ||
.ordinal(ordinal) | ||
.email(alarmRegisterRequestDto.getEmail()) | ||
.alarmType(alarmRegisterRequestDto.getAlarmType()) | ||
.sendStatus(NOT_SENT) | ||
.build(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
likelion-client/src/main/java/likelion/univ/alarm/usecase/RegisterAlarmUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package likelion.univ.alarm.usecase; | ||
|
||
import likelion.univ.alarm.dto.request.AlarmRegisterRequestDto; | ||
import likelion.univ.annotation.UseCase; | ||
import likelion.univ.domain.alarm.adaptor.AlarmAdaptor; | ||
import likelion.univ.domain.alarm.entity.Alarm; | ||
import likelion.univ.domain.alarm.service.AlarmDomainService; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class RegisterAlarmUseCase { | ||
private final AlarmAdaptor alarmAdaptor; | ||
private final AlarmDomainService alarmDomainService; | ||
|
||
public void execute(Long ordinal, AlarmRegisterRequestDto alarmRegisterRequestDto){ | ||
alarmAdaptor.existsByOrdinalAndEmailAndAlarmType(ordinal, | ||
alarmRegisterRequestDto.getEmail(), alarmRegisterRequestDto.getAlarmType()); | ||
Alarm newAlarm = AlarmRegisterRequestDto.toEntity(ordinal, alarmRegisterRequestDto); | ||
alarmDomainService.createAlarm(newAlarm); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
likelion-client/src/main/java/likelion/univ/auth/dto/response/AccountUserInfoDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package likelion.univ.auth.dto.response; | ||
|
||
import likelion.univ.domain.user.entity.User; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class AccountUserInfoDto { | ||
private Long userId; | ||
private String profileImage; | ||
private String name; | ||
|
||
public static AccountUserInfoDto of(User user){ | ||
return AccountUserInfoDto.builder() | ||
.userId(user.getId()) | ||
.profileImage(user.getProfile().getProfileImage()) | ||
.name(user.getProfile().getName()) | ||
.build(); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...cessor/GenerateAccountTokenProcessor.java → ...cessor/GenerateAccountTokenProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...se/processor/LoginByIdTokenProcessor.java → ...th/processor/LoginByIdTokenProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...usecase/processor/PublicKeyProcessor.java → ...iv/auth/processor/PublicKeyProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
likelion-client/src/main/java/likelion/univ/auth/usecase/GetUserInfoUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package likelion.univ.auth.usecase; | ||
|
||
import likelion.univ.annotation.UseCase; | ||
import likelion.univ.auth.dto.response.AccountUserInfoDto; | ||
import likelion.univ.domain.user.entity.User; | ||
import likelion.univ.utils.AuthentiatedUserUtils; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class GetUserInfoUseCase { | ||
|
||
private final AuthentiatedUserUtils authentiatedUserUtils; | ||
|
||
public AccountUserInfoDto execute(){ | ||
User user = authentiatedUserUtils.getCurrentUser(); | ||
return AccountUserInfoDto.of(user); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
likelion-client/src/main/java/likelion/univ/follow/controller/FollowController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package likelion.univ.follow.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import likelion.univ.follow.usecase.CancelFollowUseCase; | ||
import likelion.univ.follow.usecase.FollowUserUseCase; | ||
import likelion.univ.response.SuccessResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping(value = "/v1/follow") | ||
@Tag(name = "팔로우", description = "팔로우 관련 API입니다.") | ||
public class FollowController { | ||
private final FollowUserUseCase followUserUseCase; | ||
private final CancelFollowUseCase cancelFollowUseCase; | ||
|
||
@Operation(summary = "팔로우 ", description = "해당 유저를 팔로우 합니다.") | ||
@PostMapping("/{userId}") | ||
public SuccessResponse<Object> follow(@PathVariable("userId") Long userId){ | ||
followUserUseCase.execute(userId); | ||
return SuccessResponse.empty(); | ||
} | ||
|
||
@Operation(summary = "팔로우 취소", description = "해당 유저를 팔로우 취소 합니다.") | ||
@DeleteMapping("/{userId}") | ||
public SuccessResponse<Object> deleteFollow(@PathVariable("userId") Long userId) { | ||
cancelFollowUseCase.execute(userId); | ||
return SuccessResponse.empty(); | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
likelion-client/src/main/java/likelion/univ/follow/usecase/CancelFollowUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package likelion.univ.follow.usecase; | ||
|
||
import likelion.univ.annotation.UseCase; | ||
import likelion.univ.domain.follow.adaptor.FollowAdaptor; | ||
import likelion.univ.follow.dao.FollowNumRedisDao; | ||
import likelion.univ.follow.entity.FollowNum; | ||
import likelion.univ.follow.service.FollowNumRedisService; | ||
import likelion.univ.utils.AuthentiatedUserUtils; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Optional; | ||
|
||
@UseCase | ||
@RequiredArgsConstructor | ||
public class CancelFollowUseCase { | ||
private final AuthentiatedUserUtils authentiatedUserUtils; | ||
private final FollowAdaptor followAdaptor; | ||
private final FollowNumRedisDao followNumRedisDao; | ||
private final FollowNumRedisService followNumRedisService; | ||
|
||
public void execute(Long userId){ | ||
Long currentUserId = authentiatedUserUtils.getCurrentUserId(); | ||
followAdaptor.delete(currentUserId, userId); | ||
updateFollowNumRedis(currentUserId, userId); | ||
} | ||
|
||
private void updateFollowNumRedis(Long currentUserId, Long userId){ | ||
Optional<FollowNum> myFollowNum = followNumRedisDao.findById(currentUserId); | ||
if(myFollowNum.isPresent()) followNumRedisService.followingDown(currentUserId, myFollowNum.get()); | ||
Optional<FollowNum> targetFollowNum = followNumRedisDao.findById(userId); | ||
if(targetFollowNum.isPresent()) followNumRedisService.followerDown(userId, targetFollowNum.get()); | ||
} | ||
} |
Oops, something went wrong.