Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feat/#399
Browse files Browse the repository at this point in the history
  • Loading branch information
seokjin8678 committed Aug 31, 2023
2 parents cf063d5 + a8f541b commit 39fcd0f
Show file tree
Hide file tree
Showing 16 changed files with 226 additions and 140 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/assign-reviewer.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Assign Reviewer By Label
on:
pull_request:
types: [ opened, edited, labeled, unlabeled ]

types:
- opened
- edited
- labeled
- unlabeled
jobs:
assign-reviewer:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-back.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- dev
- main
paths: 'backend/**'

defaults:
Expand Down
66 changes: 34 additions & 32 deletions .github/workflows/ci-user-aos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
push:
branches:
- dev
paths: ['android/festago/**']
- main
paths: [ 'android/festago/**' ]
pull_request:
branches:
- dev
- main
paths: 'android/festago/**'

defaults:
Expand All @@ -20,35 +22,35 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: zulu
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: add google-services.json
run: echo '${{ secrets.ANDROID_USER_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json
- name: add local.properties
run: |
echo kakao_native_app_key=\"${{ secrets.ANDROID_USER_KAKAO_NATIVE_APP_KEY }}\" >> ./local.properties
echo kakao_redirection_scheme=\"${{ secrets.ANDROID_USER_KAKAO_REDIRECTION_SCHEME }}\" >> ./local.properties
echo base_url=\"$${{ secrets.ANDROID_USER_BASE_URL }}\" >> ./local.properties
- name: Build with Gradle
run: ./gradlew build

- name: Run ktlint
run: ./gradlew ktlintCheck

- name: Run unit tests
run: ./gradlew testDebugUnitTest
- name: Build assemble release apk
run: ./gradlew assembleRelease
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: zulu
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: add google-services.json
run: echo '${{ secrets.ANDROID_USER_GOOGLE_SERVICES_JSON }}' > ./app/google-services.json

- name: add local.properties
run: |
echo kakao_native_app_key=\"${{ secrets.ANDROID_USER_KAKAO_NATIVE_APP_KEY }}\" >> ./local.properties
echo kakao_redirection_scheme=\"${{ secrets.ANDROID_USER_KAKAO_REDIRECTION_SCHEME }}\" >> ./local.properties
echo base_url=\"$${{ secrets.ANDROID_USER_BASE_URL }}\" >> ./local.properties
- name: Build with Gradle
run: ./gradlew build

- name: Run ktlint
run: ./gradlew ktlintCheck

- name: Run unit tests
run: ./gradlew testDebugUnitTest

- name: Build assemble release apk
run: ./gradlew assembleRelease

69 changes: 35 additions & 34 deletions .github/workflows/closed-issue-notification.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
name: Closed Issue Notification
on:
issues:
types: [closed]

issues:
types:
- closed

jobs:
create-issue:
create-issue:
name: Send closed issue notification to slack
runs-on: ubuntu-latest
steps:
- name: Send Issue
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
text: "*이슈가 닫혔습니다!*",
attachments: [{
fallback: 'fallback',
color: '#7539DE',
title: 'Title',
text: '<${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>',
fields: [{
title: 'Issue number',
value: '#${{ github.event.issue.number }}',
short: true
},
{
title: 'Author',
value: '${{ github.event.issue.user.login }}',
short: true
}],
actions: [{
runs-on: ubuntu-latest
steps:
- name: Send Issue
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
text: "*이슈가 닫혔습니다!*",
attachments: [{
fallback: 'fallback',
color: '#7539DE',
title: 'Title',
text: '<${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>',
fields: [{
title: 'Issue number',
value: '#${{ github.event.issue.number }}',
short: true
},
{
title: 'Author',
value: '${{ github.event.issue.user.login }}',
short: true
}],
actions: [{
}]
}]
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_WEBHOOK_URL }}
if: always()
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_WEBHOOK_URL }}
if: always()
7 changes: 5 additions & 2 deletions .github/workflows/closed-pr-notification.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Closed PR Notification
on:
pull_request:
branches: [ dev ]
types: [ closed ]
branches:
- dev
- main
types:
- closed

jobs:
create-issue:
Expand Down
69 changes: 35 additions & 34 deletions .github/workflows/opend-issue-notification.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
name: Opend Issue Notification
on:
issues:
types: [opened]

issues:
types:
- opened

jobs:
create-issue:
create-issue:
name: Send opend issue notification to slack
runs-on: ubuntu-latest
steps:
- name: Send Issue
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
text: "*새로운 이슈가 생성되었습니다!*",
attachments: [{
fallback: 'fallback',
color: '#1F7629',
title: 'Title',
text: '<${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>',
fields: [{
title: 'Issue number',
value: '#${{ github.event.issue.number }}',
short: true
},
{
title: 'Author',
value: '${{ github.event.issue.user.login }}',
short: true
}],
actions: [{
runs-on: ubuntu-latest
steps:
- name: Send Issue
uses: 8398a7/action-slack@v3
with:
status: custom
custom_payload: |
{
text: "*새로운 이슈가 생성되었습니다!*",
attachments: [{
fallback: 'fallback',
color: '#1F7629',
title: 'Title',
text: '<${{ github.event.issue.html_url }}|${{ github.event.issue.title }}>',
fields: [{
title: 'Issue number',
value: '#${{ github.event.issue.number }}',
short: true
},
{
title: 'Author',
value: '${{ github.event.issue.user.login }}',
short: true
}],
actions: [{
}]
}]
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_WEBHOOK_URL }}
if: always()
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ISSUE_WEBHOOK_URL }}
if: always()
7 changes: 5 additions & 2 deletions .github/workflows/opened-pr-notification.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Opened PR Notification
on:
pull_request:
branches: [ dev ]
types: [ opened ]
branches:
- dev
- main
types:
- opened

jobs:
create-issue:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.festago.exception.BadRequestException;
import com.festago.exception.ErrorCode;
import com.festago.exception.NotFoundException;
import java.time.Clock;
import java.time.LocalDateTime;
import java.util.Date;
import org.springframework.stereotype.Service;
Expand All @@ -25,20 +26,22 @@ public class EntryService {
private final EntryCodeProvider entryCodeProvider;
private final EntryCodeExtractor entryCodeExtractor;
private final MemberTicketRepository memberTicketRepository;
private final Clock clock;

public EntryService(EntryCodeProvider entryCodeProvider, EntryCodeExtractor entryCodeExtractor,
MemberTicketRepository memberTicketRepository) {
MemberTicketRepository memberTicketRepository, Clock clock) {
this.entryCodeProvider = entryCodeProvider;
this.entryCodeExtractor = entryCodeExtractor;
this.memberTicketRepository = memberTicketRepository;
this.clock = clock;
}

public EntryCodeResponse createEntryCode(Long memberId, Long memberTicketId) {
MemberTicket memberTicket = findMemberTicket(memberTicketId);
if (!memberTicket.isOwner(memberId)) {
throw new BadRequestException(ErrorCode.NOT_MEMBER_TICKET_OWNER);
}
if (!memberTicket.canEntry(LocalDateTime.now())) {
if (!memberTicket.canEntry(LocalDateTime.now(clock))) {
throw new BadRequestException(ErrorCode.NOT_ENTRY_TIME);
}
EntryCodeTime entryCodeTime = EntryCodeTime.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.festago.exception.BadRequestException;
import com.festago.exception.ErrorCode;
import com.festago.exception.NotFoundException;
import java.time.Clock;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
Expand All @@ -25,11 +26,13 @@ public class MemberTicketService {

private final MemberTicketRepository memberTicketRepository;
private final MemberRepository memberRepository;
private final Clock clock;

public MemberTicketService(MemberTicketRepository memberTicketRepository,
MemberRepository memberRepository) {
MemberRepository memberRepository, Clock clock) {
this.memberTicketRepository = memberTicketRepository;
this.memberRepository = memberRepository;
this.clock = clock;
}

@Transactional(readOnly = true)
Expand Down Expand Up @@ -59,7 +62,7 @@ public MemberTicketsResponse findCurrent(Long memberId, Pageable pageable) {
}

private List<MemberTicket> filterCurrentMemberTickets(List<MemberTicket> memberTickets) {
LocalDateTime currentTime = LocalDateTime.now();
LocalDateTime currentTime = LocalDateTime.now(clock);
return memberTickets.stream()
.filter(memberTicket -> memberTicket.isBeforeEntry(currentTime) || memberTicket.canEntry(currentTime))
.sorted(comparing((MemberTicket memberTicket) -> memberTicket.isBeforeEntry(currentTime))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public void addInterceptors(InterceptorRegistry registry) {
.addPathPatterns("/admin/**", "/js/admin/**")
.excludePathPatterns("/admin/login", "/admin/initialize");
registry.addInterceptor(memberAuthInterceptor())
.addPathPatterns("/member-tickets/**", "/members/**");
.addPathPatterns("/member-tickets/**", "/members/**", "/auth/**")
.excludePathPatterns("/auth/oauth2");
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public class AuthPayload {
private final Role role;

public AuthPayload(Long memberId, Role role) {
validate(memberId, role);
validate(role);
this.memberId = memberId;
this.role = role;
}

private void validate(Long memberId, Role role) {
if (memberId == null || role == null) {
private void validate(Role role) {
if (role == null) {
throw new InternalServerException(ErrorCode.INVALID_AUTH_TOKEN_PAYLOAD);
}
}
Expand Down
Loading

0 comments on commit 39fcd0f

Please sign in to comment.