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

[feat #23] : 답변 채택 API #24

Merged
merged 33 commits into from
Aug 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0c43f32
[feat] : 크레딧 증감 로직 추가
hyun2371 Aug 7, 2024
3733887
[feat] : 답변 에러코드 추가
hyun2371 Aug 7, 2024
b064d2b
[feat] : 질문글 에러코드 추가
hyun2371 Aug 7, 2024
6cc5e2c
[refactor] : 질문자 여부 확인 함수 엔티티로 이동
hyun2371 Aug 7, 2024
eda20ce
[feat] : 답변 채택에 따른 상태변경 메서드 엔티티에 추가
hyun2371 Aug 7, 2024
dacabb9
[feat] : 답변 채택 비즈니스 로직 작성
hyun2371 Aug 7, 2024
8d892df
[test] : Member 파라미터 있는 질문글 fixture 추가
hyun2371 Aug 7, 2024
5a72cab
[test] : 답변 채택 비즈니스 로직 테스트
hyun2371 Aug 7, 2024
097add0
[test] : assertAll 검증함수들 통합
hyun2371 Aug 7, 2024
e4f2133
[feat] : 답변 채택 API 함수 작성
hyun2371 Aug 7, 2024
6261ab3
[test] : 답변 채택 API 통합 테스트
hyun2371 Aug 7, 2024
36ae9ea
[chore] : swagger 명세
hyun2371 Aug 7, 2024
63a553e
[style] : 코드 리포멧팅
hyun2371 Aug 7, 2024
8d32fa2
[style] : 메서드 네이밍 변경
hyun2371 Aug 9, 2024
92b338a
[feat] : 엔티티명 및 detail 타입 변경
hyun2371 Aug 9, 2024
c143c53
[feat] : CreditType enum에 detail 필드 추가
hyun2371 Aug 9, 2024
a74b8d3
[remove] : creditDetail enum 삭
hyun2371 Aug 9, 2024
b426e1c
[feat] : 크레딧 에러 코드 member 영역으로 이동
hyun2371 Aug 9, 2024
8baaed9
[feat] : 답변 채택 시 필드 변경 메서드 책임분리
hyun2371 Aug 9, 2024
d7492ab
[feat] : 크레딧 내역 repository 추가
hyun2371 Aug 9, 2024
e281619
[feat] : 크레딧 내역 Mapper 추가
hyun2371 Aug 9, 2024
72b739a
[feat] : 크레딧 내역 저장하는 비즈니스 로직 추가
hyun2371 Aug 9, 2024
d1acbd1
[feat] : errorCode 클래스 이동 반영
hyun2371 Aug 9, 2024
5b3b5e8
[feat] : 크레딧 증감 로직 서비스로 이동 및 크레딧 저장 로직 호출
hyun2371 Aug 9, 2024
2be9fb6
[test] : 크레딧 저장 로직 호출 반영
hyun2371 Aug 9, 2024
3edb800
[test] : 에러 코드 변경 반영
hyun2371 Aug 9, 2024
ef5ef62
[test] : 외래키 제약 조건에 따라 creditRepository 먼저 초기화
hyun2371 Aug 9, 2024
f01fa06
[feat] : 필요한 파라미터만 넘기도록 mapper 수정
hyun2371 Aug 9, 2024
15d2cda
[test] : 크레딧 내역 저장 단위 테스트 작성
hyun2371 Aug 9, 2024
c968ca3
[refactor] : DTO 내 팩토리 메서드 삭제
hyun2371 Aug 9, 2024
678ce5f
[fix] : valid 어노테이션 위치 수정
hyun2371 Aug 9, 2024
e3b45b7
[style] : 코드 리포멧팅
hyun2371 Aug 9, 2024
35a7f7b
[fix] : request에 대한 spring bean validation 반영
hyun2371 Aug 9, 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dnd.gongmuin.credit;
package com.dnd.gongmuin.credit_history;

import static jakarta.persistence.FetchType.*;

Expand All @@ -15,27 +15,25 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Credit extends TimeBaseEntity {
public class CreditHistory extends TimeBaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "credit_id", nullable = false)
@Column(name = "credit_history_id", nullable = false)
private Long id;

@Enumerated(EnumType.STRING)
@Column(name = "type", nullable = false)
private CreditType type;

@Enumerated(EnumType.STRING)
@Column(name = "detail", nullable = false)
private CreditDetail detail;
private String detail;
hyun2371 marked this conversation as resolved.
Show resolved Hide resolved

@Column(name = "amount", nullable = false)
private int amount;
Expand All @@ -44,11 +42,14 @@ public class Credit extends TimeBaseEntity {
@JoinColumn(name = "member_id", nullable = false) // 정합성 중요
private Member member;

@Builder
public Credit(CreditType type, CreditDetail detail, int amount, Member member) {
private CreditHistory(CreditType type, String detail, int amount, Member member) {
this.type = type;
this.detail = detail;
this.amount = amount;
this.member = member;
}

public static CreditHistory of(CreditType type, String detail, int amount, Member member) {
return new CreditHistory(type, detail, amount, member);
}
}