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

[BE/FEAT] be merge to main #198

Merged
merged 69 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
5d854ab
fix : api uri ๋ณ€๊ฒฝ
kssumin Jan 8, 2024
225f203
fix : ํ”„๋กœ๊ทธ๋žจ ๋‹น์ผ๋„ active ์ƒํƒœ ๊ฐ–๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 8, 2024
084efe1
refactor : deprecated๋œ ๋ฉ”์„œ๋“œ ์ œ๊ฑฐ
kssumin Jan 8, 2024
8c39430
Merge pull request #43 from kssumin/feat/#178/bug-fix
kssumin Jan 8, 2024
bc5e8c7
refactor : activeStatus ์กฐ๊ฑด ์ถ”๊ฐ€
kssumin Jan 8, 2024
c01f1d6
fix : ์ด๋ฆ„ ํ˜•์‹ ์•ˆ ๋งž์„ ๋•Œ ์—๋Ÿฌ ์ฝ”๋“œ ๋ณ€๊ฒฝ
kssumin Jan 8, 2024
8d846fd
fix : ์ด๋ฆ„ ํ˜•์‹ ์•ˆ ๋งž์„ ๋•Œ ์—๋Ÿฌ ์ฝ”๋“œ ๋ณ€๊ฒฝ
kssumin Jan 8, 2024
2dc66f3
fix : program ๋‚ด์šฉ ์—…๋ฐ์ดํŠธ
kssumin Jan 8, 2024
cffdd14
fix : secure none์œผ๋กœ ์„ค์ •
kssumin Jan 8, 2024
d64c199
feat : cookie_key .env๋กœ ์ถ”๊ฐ€
kssumin Jan 8, 2024
c4fd747
Merge pull request #44 from kssumin/fix/#191/cookie
kssumin Jan 8, 2024
a2876c4
fix : ํ”„๋กœ๊ทธ๋žจ ์ˆ˜์ • ์‹œ ํ”„๋กœ๊ทธ๋žจ ๊ธฐํ•œ์ด ์ง€๋‚˜๋„ ์ˆ˜์ •๊ฐ€๋Šฅํ•˜๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
c42eead
refactor : ํ”„๋กœ๊ทธ๋žจ ์ƒ์„ฑ ์‹œ ๋‚ ์งœ validation ์ถ”๊ฐ€
kssumin Jan 9, 2024
8b4b834
fix : local-token๋„ env์—์„œ ์‚ฌ์šฉํ•˜๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
8ae3d24
refactor : RT, CT ํ† ํฐ ์ƒ์„ฑ, ํ•ด๋… ๋ถ„๋ฆฌ
kssumin Jan 9, 2024
0561b14
refactor : ๋ฉ”์„œ๋“œ๋ช… ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
d9f2cd2
fix : ์ฐธ์„ ์ƒํƒœ๋ฅผ ํ™œ๋™ ์ƒํƒœ ๊ธฐ์ค€์œผ๋กœ ์กฐํšŒ ์‹œ ํ”„๋กœ๊ทธ๋žจ ์ฐธ์—ฌ ์ •๋ณด ๋ฐ˜ํ™˜ํ•  ๋•Œ ํ™œ๋™ ์ƒํƒœ๋„ ์ „๋‹ฌํ•˜๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
7ee806a
test(fix) : ํ…Œ์ŠคํŠธ ์ฝ”๋“œ์—์„œ๋„ ํ† ํฐ ํ•ด๋… ๋ฉ”์„œ๋“œ ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
a05c112
test : fakeAttend ์ถ”๊ฐ€
kssumin Jan 9, 2024
c262983
refactor : ์ฐธ์„ ์ •๋ณด ๊ด€๋ จ service ๋ฉ”์„œ๋“œ๋ช… ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
03809b9
fix : ํ”„๋กœ๊ทธ๋žจ ์ƒ์„ฑ ์š”์ฒญ ์‹œ ใ…‡ใ„น๋ฉ
kssumin Jan 9, 2024
8719a17
refactor : ๋ฉค๋ฒ„์˜ ์ƒํƒœ ๋ฐ˜ํ™˜ String์œผ๋กœ ๋ฐ˜ํ™˜
kssumin Jan 9, 2024
5c65d8e
refactor : String ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
a29ada1
refactor : ํ”„๋กœ๊ทธ๋žจ ์ƒ์„ฑ ๋กœ์ง ๋ฆฌํŒฉํ„ฐ๋ง
kssumin Jan 9, 2024
3fafb0b
refactor : ์ฟ ํ‚ค ๋„๋ฉ”์ธ ์„ค์ •
kssumin Jan 9, 2024
7eccdf0
Merge pull request #45 from kssumin/fix/#191/cookie
kssumin Jan 9, 2024
49997b5
fix : sameSite None์œผ๋กœ ์„ค์ •
kssumin Jan 9, 2024
33b1826
Merge pull request #46 from kssumin/fix/#191/cookie
kssumin Jan 9, 2024
5ac585b
Merge pull request #192 from kssumin/main
kssumin Jan 9, 2024
326eeb6
fix : ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋ฉค๋ฒ„์ผ ๋•Œ ์˜ฌ๋ฐ”๋ฅธ custom code ๋ฐ˜ํ™˜
kssumin Jan 9, 2024
a07ee44
refactor : memberId๊ฐ€ ์žˆ์Œ์„ ๋‚˜ํƒ€๋‚ด๋Š” MeberIdModel๋กœ ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
ea6cc24
fix : memberid๋ฅผ ๋น„๊ตํ•˜๋„๋ก ์ฟผ๋ฆฌ ์ˆ˜์ •
kssumin Jan 9, 2024
244b0d3
refactor : this ์ง€์‹œ์ž ์ œ๊ฑฐ
kssumin Jan 9, 2024
bed4e03
feat : ํ”„๋กœ๊ทธ๋žจ์˜ ์ฐธ์—ฌ ์ •๋ณด ์ˆ˜์ •์ด ๊ฐ€๋Šฅํ•œ์ง€ ๊ฒ€์ฆ
kssumin Jan 9, 2024
e8f4800
fix : ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ ์ดํ›„ ์ฐธ์—ฌ ์ •๋ณด ์ˆ˜์ •ํ•  ๋•Œ ์ด์ „ ์ฐธ์—ฌ ์ •๋ณด๊ฐ€ ์—†์–ด๋„ ๊ฐ€๋Šฅํ•˜๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
2aa3afd
refactor : cookie key env์—์„œ ์ฃผ์ž…๋ฐ›๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
3807ec4
fix : cookie valie time ์„ค์ •
kssumin Jan 9, 2024
b1ef6b8
Merge pull request #47 from kssumin/fix/#193/end-program-attend-update
kssumin Jan 9, 2024
1b29456
refactor : ๋ฉ”์„œ๋“œ๋ช… ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
3e16290
fix : ์กด์žฌํ•˜์ง€ ์•Š๋Š” ์ฐธ์„ ์ •๋ณด ์‹œ programId ์ง์ ‘ ๋„ฃ์–ด์ฃผ๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
9a0c6d2
refactor : ์ฐธ์—ฌ ๋Œ€์ƒ์ž ์„ ํƒํ•˜๋Š” ํด๋ž˜์Šค๋ช… ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
a4829ea
refactor : ์ฐธ์—ฌ ๋Œ€์ƒ์ž ์ €์žฅ ๋ฐ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฉ”์„œ๋“œ๋ช… ๋ณ€๊ฒฝ
kssumin Jan 9, 2024
9954ca9
Merge pull request #48 from kssumin/fix/#193/end-program-attend-update
kssumin Jan 9, 2024
f7dae84
Merge pull request #195 from kssumin/main
kssumin Jan 9, 2024
020dd44
feat : soft delete ์ถ”๊ฐ€ ๋ฐ ์กฐํšŒ ์‹œ ์‚ญ์ œ ์š”์ฒญ๋œ ์—”ํ‹ฐํ‹ฐ ์ œ์™ธํ•˜๋„๋ก ์ถ”๊ฐ€
kssumin Jan 10, 2024
83e92e2
fix : ์ฐธ์„ ์ƒํƒœ ์—…๋ฐ์ดํŠธ ์‹œ ์ด์ „ ์ฐธ์„ ์ƒํƒœ ๊ฒ€์ฆํ•˜๋„๋ก
kssumin Jan 10, 2024
88f6ca7
refactor : ํ”„๋กœ๊ทธ๋žจ ์‚ญ์ œ ์‹œ message ์‚ญ์ œ ์„ฑ๊ณต ์‘๋‹ต๋ณด๋‚ด๋„๋ก ๋ณ€๊ฒฝ
kssumin Jan 10, 2024
f1cc1b0
refactor : entity์—์„œ MemberIdModel implements ์ œ๊ฑฐ
kssumin Jan 10, 2024
1da9158
refactor : MemberIdModel ์ธํ„ฐํŽ˜์ด์Šค์˜ ๋ฉ”์„œ๋“œ๋ช… ๋ณ€๊ฒฝ
kssumin Jan 10, 2024
c9f4c78
refactor : isDeleted=false ์œ„์น˜ ํ†ต์ผ
kssumin Jan 10, 2024
cdb5dd0
refactor : ์กฐํšŒ ์‹œ ์„ฑ๊ณต ์‹œ response message ๋ณ€๊ฒฝ
kssumin Jan 10, 2024
af2a391
fix : ์ž‘์„ฑ์ž๊ฐ€ ์ฐธ์„ ์ •๋ณด ์ˆ˜์ •ํ•  ๋•Œ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์กฐ๊ฑด ๊ฒ€์ฆ
kssumin Jan 10, 2024
a70169f
Merge pull request #49 from kssumin/fix/#193/end-program-attend-update
kssumin Jan 10, 2024
b0b7d68
Merge pull request #196 from kssumin/main
kssumin Jan 10, 2024
69aab80
feat : sql log ์ œ๊ฑฐ
kssumin Jan 10, 2024
ae2d38f
refactor : local log level info๋ถ€ํ„ฐ ์„ค์ •
kssumin Jan 11, 2024
c8b1a7f
refactor : exception log level ์žฌ์„ค์ •
kssumin Jan 11, 2024
803a3f2
refactor : ํ”„๋กœ๊ทธ๋žจ ์‚ญ์ œ ์ด๋ฒคํŠธ ์™„๋ฃŒ ์‹œ ๋กœ๊ทธ ์ถœ๋ ฅ
kssumin Jan 11, 2024
39afbe9
feat : logback ์„ค์ •
kssumin Jan 11, 2024
7cfa025
Merge pull request #50 from kssumin/feat/#204/log
kssumin Jan 11, 2024
d2c5549
Merge pull request #205 from kssumin/main
kssumin Jan 11, 2024
74b9d32
feat : flyway ์˜์กด์„ฑ ์ถ”๊ฐ€
kssumin Jan 11, 2024
87cca21
feat : flyway docker-compose ์‹คํ–‰ ์ถ”๊ฐ€
kssumin Jan 11, 2024
407eb8f
feat : index ์„ค์ •
kssumin Jan 11, 2024
ecb6852
feat : local ํ™˜๊ฒฝ์—์„œ flyway ์‹คํ–‰์‹œํ‚ค์ง€ ์•Š๋„๋ก ์„ค์ •
kssumin Jan 11, 2024
21a5163
feat : dev, prod ํ™˜๊ฒฝ์—์„œ flyway ์‹คํ–‰์‹œํ‚ค๋„๋ก ์„ค์ •
kssumin Jan 11, 2024
09c84d1
feat : flyway schema๋ฅผ ์œ„ํ•œ sql
kssumin Jan 11, 2024
451b12b
Merge pull request #51 from kssumin/feat/#173/flyway
kssumin Jan 11, 2024
e3ad406
Merge pull request #206 from kssumin/main
kssumin Jan 11, 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
5 changes: 5 additions & 0 deletions BE/eeos/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ plugins {
id 'org.asciidoctor.jvm.convert' version "${asciidoctorVersion}"
id 'com.epages.restdocs-api-spec' version "${epagesRestDocsApiSpecVersion}"
id 'org.hidetake.swagger.generator' version '2.18.2'

// flyway
id 'org.flywaydb.flyway' version '8.5.13'
}

group = 'com.econovation'
Expand Down Expand Up @@ -68,6 +71,8 @@ dependencies {
// database
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'mysql:mysql-connector-java'
implementation 'org.flywaydb:flyway-core'
implementation 'org.flywaydb:flyway-mysql'

// openfeign
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
Expand Down
5 changes: 4 additions & 1 deletion BE/eeos/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ services:
SPRING_DATASOURCE_URL: jdbc:mysql://eeos-mysql:3306/eeos?useSSL=false&serverTimezone=Asia/Seoul&useLegacyDatetimeCode=false&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: root
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES}
SPRING_FLYWAY_URL: jdbc:mysql://eeos-mysql:3306/eeos?useSSL=false&serverTimezone=Asia/Seoul&useLegacyDatetimeCode=false&allowPublicKeyRetrieval=true
SPRING_FLWYAY_USERNAME: root
SPRING_FLYWAY_PASSWORD: root
SPRING_PROFILES_ACTIVE: dev
networks: #์‚ฌ์šฉํ•  ๋„คํŠธ์›Œํฌ ์ง€์ •
- eeos-network
networks:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.blackcompany.eeos.attend.application.dto;

import com.blackcompany.eeos.common.support.dto.AbstractResponseDto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder(toBuilder = true)
public class AttendInfoActiveStatusResponse implements AbstractResponseDto {
private Long memberId;
private String name;
private String activeStatus;
private String attendStatus;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.blackcompany.eeos.attend.application.dto;

import com.blackcompany.eeos.common.support.dto.AbstractResponseDto;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder(toBuilder = true)
public class QueryAttendActiveStatusResponse implements AbstractResponseDto {
private List<AttendInfoActiveStatusResponse> members;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.blackcompany.eeos.attend.application.dto.converter;

import com.blackcompany.eeos.attend.application.dto.AttendInfoActiveStatusResponse;
import com.blackcompany.eeos.member.application.model.MemberModel;
import org.springframework.stereotype.Component;

@Component
public class AttendInfoActiveStatusConverter {
public AttendInfoActiveStatusResponse from(
MemberModel source, String attendStatus, String activeStatus) {
return AttendInfoActiveStatusResponse.builder()
.memberId(source.getId())
.name(source.getName())
.activeStatus(activeStatus)
.attendStatus(attendStatus)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.blackcompany.eeos.attend.application.dto.converter;

import com.blackcompany.eeos.attend.application.dto.AttendInfoActiveStatusResponse;
import com.blackcompany.eeos.attend.application.dto.QueryAttendActiveStatusResponse;
import java.util.List;
import org.springframework.stereotype.Component;

@Component
public class QueryAttendActiveStatusConverter {
public QueryAttendActiveStatusResponse of(List<AttendInfoActiveStatusResponse> response) {
return QueryAttendActiveStatusResponse.builder().members(response).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import com.blackcompany.eeos.attend.application.exception.DeniedSaveAttendException;
import com.blackcompany.eeos.attend.application.exception.NotSameBeforeAttendStatusException;
import com.blackcompany.eeos.common.application.model.MemberIdModel;
import com.blackcompany.eeos.common.support.AbstractModel;
import java.util.List;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -14,15 +17,24 @@
@AllArgsConstructor
@NoArgsConstructor
@Builder(toBuilder = true)
public class AttendModel implements AbstractModel {
public class AttendModel implements AbstractModel, MemberIdModel {
private Long id;
private Long memberId;
private Long programId;
private AttendStatus status;

public void changeStatus(String beforeStatus, String afterStatus) {
public AttendModel changeStatus(String beforeStatus, String afterStatus) {
validateChange(beforeStatus);
this.status = AttendStatus.find(afterStatus);

return this;
}

public AttendModel changeStatusByManager(String beforeStatus, String afterStatus) {
validateChangeByManager(beforeStatus);
this.status = AttendStatus.find(afterStatus);

return this;
}

public String getStatus() {
Expand All @@ -33,18 +45,34 @@ public static AttendModel of() {
return AttendModel.builder().status(AttendStatus.NONRELATED).build();
}

public static List<AttendModel> of(List<Long> memberIds, Long programId) {
return memberIds.stream().map(memberId -> of(memberId, programId)).collect(Collectors.toList());
}

public static AttendModel of(Long memberId, Long programId) {
return AttendModel.builder()
.memberId(memberId)
.programId(programId)
.status(AttendStatus.NONRELATED)
.build();
}

private void validateChange(String beforeStatus) {
validateCanChange(beforeStatus);
validateSame(beforeStatus);
canChange(beforeStatus);
isSameBeforeStatus(beforeStatus);
}

private void validateChangeByManager(String beforeStatus) {
isSameBeforeStatus(beforeStatus);
}

private void validateCanChange(String beforeStatus) {
private void canChange(String beforeStatus) {
if (AttendStatus.isSame(beforeStatus, AttendStatus.NONRELATED)) {
throw new DeniedSaveAttendException();
}
}

private void validateSame(String status) {
private void isSameBeforeStatus(String status) {
if (AttendStatus.isSame(status, this.status)) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.blackcompany.eeos.attend.application.service;

import com.blackcompany.eeos.attend.application.dto.AttendInfoActiveStatusResponse;
import com.blackcompany.eeos.attend.application.dto.AttendInfoResponse;
import com.blackcompany.eeos.attend.application.dto.ChangeAttendStatusRequest;
import com.blackcompany.eeos.attend.application.dto.ChangeAttendStatusResponse;
import com.blackcompany.eeos.attend.application.dto.QueryAttendActiveStatusResponse;
import com.blackcompany.eeos.attend.application.dto.QueryAttendStatusResponse;
import com.blackcompany.eeos.attend.application.dto.converter.AttendInfoActiveStatusConverter;
import com.blackcompany.eeos.attend.application.dto.converter.AttendInfoConverter;
import com.blackcompany.eeos.attend.application.dto.converter.ChangeAttendStatusConverter;
import com.blackcompany.eeos.attend.application.dto.converter.QueryAttendActiveStatusConverter;
import com.blackcompany.eeos.attend.application.dto.converter.QueryAttendStatusResponseConverter;
import com.blackcompany.eeos.attend.application.exception.NotFoundAttendException;
import com.blackcompany.eeos.attend.application.model.AttendModel;
Expand Down Expand Up @@ -48,6 +52,8 @@ public class AttendService
private final MemberEntityConverter memberEntityConverter;
private final AttendInfoConverter attendInfoConverter;
private final QueryAttendStatusResponseConverter attendStatusResponseConverter;
private final AttendInfoActiveStatusConverter attendInfoActiveStatusConverter;
private final QueryAttendActiveStatusConverter queryAttendActiveStatusConverter;

@Override
public List<AttendInfoResponse> findAttendInfo(final Long programId) {
Expand Down Expand Up @@ -79,36 +85,37 @@ public ChangeAttendStatusResponse changeStatus(
final Long memberId, final ChangeAttendStatusRequest request, final Long programId) {
AttendModel model = getAttend(memberId, programId);

model.changeStatus(request.getBeforeAttendStatus(), request.getAfterAttendStatus());
AttendEntity updated = attendRepository.save(attendEntityConverter.toEntity(model));
AttendModel changedModel =
model.changeStatus(request.getBeforeAttendStatus(), request.getAfterAttendStatus());
AttendEntity updated = attendRepository.save(attendEntityConverter.toEntity(changedModel));

String name = queryMemberService.getName(memberId);
return changeAttendStatusConverter.from(name, updated.getStatus().getStatus());
}

@Override
public ChangeAttendStatusResponse getStatus(Long memberId, Long programId) {
boolean isAttend = getAttendDefault(memberId, programId);
boolean isAttend = isExistAttend(memberId, programId);
String name = queryMemberService.getName(memberId);

if (isAttend) {
AttendModel model = getAttend(memberId, programId);
return changeAttendStatusConverter.from(name, model.getStatus());
AttendModel existModel = getAttend(memberId, programId);
return changeAttendStatusConverter.from(name, existModel.getStatus());
}

return changeAttendStatusConverter.from(name, AttendStatus.NONRELATED.getStatus());
}

@Override
public QueryAttendStatusResponse execute(Long programId, String activeStatus) {
List<MemberModel> members = findMembers(activeStatus);
public QueryAttendActiveStatusResponse getAttendInfo(Long programId, String activeStatus) {
List<MemberModel> members = findMembersByActiveStatus(activeStatus);

List<AttendInfoResponse> response =
List<AttendInfoActiveStatusResponse> response =
members.stream()
.map(member -> combine(member, findAttend(programId)))
.map(member -> combine(member, findAttend(programId), member.getActiveStatus()))
.collect(Collectors.toList());

return attendStatusResponseConverter.of(response);
return queryAttendActiveStatusConverter.of(response);
}

private AttendModel getAttend(final Long memberId, final Long programId) {
Expand All @@ -118,7 +125,7 @@ private AttendModel getAttend(final Long memberId, final Long programId) {
.orElseThrow(() -> new NotFoundAttendException(programId));
}

private boolean getAttendDefault(final Long memberId, final Long programId) {
private boolean isExistAttend(final Long memberId, final Long programId) {
return attendRepository.findByProgramIdAndMemberId(programId, memberId).isPresent();
}

Expand All @@ -138,15 +145,16 @@ private AttendInfoResponse combine(
return attendInfoConverter.from(member, model.getStatus());
}

private AttendInfoResponse combine(MemberModel member, List<AttendModel> attends) {
private AttendInfoActiveStatusResponse combine(
MemberModel member, List<AttendModel> attends, String activeStatus) {

AttendModel model =
attends.stream()
.filter(attend -> member.validateSame(attend.getMemberId()))
.findAny()
.orElse(AttendModel.of());

return attendInfoConverter.from(member, model.getStatus());
return attendInfoActiveStatusConverter.from(member, model.getStatus(), activeStatus);
}

private List<MemberModel> findMembers(List<AttendModel> attends) {
Expand All @@ -171,7 +179,7 @@ private List<AttendModel> findAttend(final Long programId) {
.collect(Collectors.toList());
}

private List<MemberModel> findMembers(final String activeStatus) {
private List<MemberModel> findMembersByActiveStatus(final String activeStatus) {
if (ActiveStatus.isSame(activeStatus, ActiveStatus.ALL)) {
return memberRepository.findMembers().stream()
.map(memberEntityConverter::from)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import java.util.List;

/** ๊ด€๋ จ ์žˆ๋Š” ๋Œ€์ƒ์ž๋ฅผ ์„ ํƒํ•œ๋‹ค. */
public interface CandidateService {
void saveCandidate(final Long programId, final List<ProgramMembers> members);
public interface AttendTargetService {
void save(final Long programId, final List<ProgramMembers> members);

void updateCandidate(final Long programId, final List<ChangeAllAttendStatusRequest> requests);
void update(final Long programId, final List<ChangeAllAttendStatusRequest> requests);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@

import com.blackcompany.eeos.attend.persistence.AttendRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
@Slf4j
public class CommandAttendService {
private final AttendRepository attendRepository;

@Transactional
public void deleteByProgram(Long programId) {
log.info("ํ”„๋กœ๊ทธ๋žจ ์‚ญ์ œ๋กœ ์ธํ•œ ํ•ด๋‹น ํ”„๋กœ๊ทธ๋žจ์˜ ์ฐธ์„ ์ •๋ณด ์‚ญ์ œ");
attendRepository.deleteAllByProgramId(programId);
}
}
Loading