Skip to content

Commit

Permalink
๐Ÿ”€Merge: Main Merge 37์ฐจ (#167)
Browse files Browse the repository at this point in the history
* ๐Ÿ› Hotfix: ๋Œ“๊ธ€ ์ˆ˜์ • request dto ์ถ”๊ฐ€ (#149)

* Hotfix : ๋Œ“๊ธ€ ์‚ญ์ œ ์‹œ ๊ฒŒ์‹œ๋ฌผ์˜ ๋Œ“๊ธ€ ์ˆ˜ ์ฐจ๊ฐ ๋กœ์ง ์ˆ˜์ • (#151)

* ๐Ÿ› Hotfix: ๋Œ“๊ธ€ ์ˆ˜์ • request dto ์ถ”๊ฐ€

* ๐Ÿ› Hotfix: ๋Œ“๊ธ€ ์‚ญ์ œ ์‹œ ๊ฒŒ์‹œ๋ฌผ์˜ ๋Œ“๊ธ€ ์ˆ˜ ์ฐจ๊ฐ ๋กœ์ง ์ˆ˜์ •

* Feat: ํ”„๋กœํ•„ ์ด๋ชจ์ง€ ์„ค์ • ๋กœ์ง ๊ตฌํ˜„ (#153)

* ๐Ÿ—ƒ๏ธ profile ์†์„ฑ์˜ Enum value ProfileEmoji ์ƒ์„ฑ

* ๐Ÿ—ƒ๏ธ profile ์†์„ฑ ProfileEmoji ์„ค์ •

* โœจ Feat: ํšŒ์› ๊ฐ€์ž… ๋ฐ ์ •๋ณด ์ˆ˜์ •์— ํ”„๋กœํ•„ ์ด๋ชจ์ง€ ์„ค์ • ๋กœ์ง ์ถ”๊ฐ€

* Refactor : ๋ชจ๋ธ ์‚ญ์ œ ์‹œ soft delete ๊ตฌํ˜„ (#155)

* ๐Ÿ—ƒ๏ธ versionStatus ์†์„ฑ์˜ Enum value VersionStatus ์ƒ์„ฑ

* ๐Ÿ—ƒ๏ธ versionStatus ์†์„ฑ ์ถ”๊ฐ€

* ๐Ÿ‘” ๋ชจ๋ธ ์‚ญ์ œ ์‹œ sofe delete ๊ตฌํ˜„

* ๐Ÿ‘” ๋ชจ๋ธ ์‚ญ์ œ ์‹œ sofe delete ๊ตฌํ˜„

* Fix: ํƒ€ ์‚ฌ์šฉ์ž ์ž์†Œ์„œ ์กฐํšŒ ์‹œ ํฌ์ธํŠธ ์‚ฌ์šฉ ๋กœ์ง ์ˆ˜์ • (#157)

* ๐Ÿ—ƒ๏ธ coverletter ์™ธ๋ž˜ํ‚ค ์ถ”๊ฐ€

* ๐Ÿ‘” ์ž์†Œ์„œ ์กฐํšŒ ํฌ์ธํŠธ ์‚ฌ์šฉ ์‹œ, point ๋ฐ์ดํ„ฐ์— coverletter ์‚ฝ์ž… ๋กœ์ง ์ถ”๊ฐ€

* ๐Ÿ‘” ์ž์†Œ์„œ ์ƒ์„ธ ์กฐํšŒ ์‹œ ํฌ์ธํŠธ๋ฅผ ์‚ฌ์šฉํ•œ ์ž์†Œ์„œ์ธ์ง€ ๋‚˜ํƒ€๋‚ด๋Š” ๋ณ€์ˆ˜ ์ถ”๊ฐ€

* Refactor: ๋Œ“๊ธ€ ๋Œ€๋Œ“๊ธ€ ๊ณ„์ธต ๊ตฌ์กฐ ์ ์šฉ (#158)

* ๐Ÿ—ƒ๏ธ ๋Œ“๊ธ€ ๊ณ„์ธต ๊ตฌ์กฐ ๋‚˜ํƒ€๋‚ด๋Š” ์†์„ฑ ์ถ”๊ฐ€

* ๐Ÿ—ƒ๏ธ db ๋ณ€๊ฒฝ ์‚ฌํ•ญ์— ๋”ฐ๋ฅธ ๋Œ“๊ธ€ ์ž‘์„ฑ ๋กœ์ง ์ˆ˜์ •

* ๐Ÿ‘” db ๋ณ€๊ฒฝ ์‚ฌํ•ญ์— ๋”ฐ๋ฅธ ๋Œ“๊ธ€ ๋ชฉ๋ก ์กฐํšŒ ๋กœ์ง ์ˆ˜์ •

* ๐Ÿ”ฅ ํ•„์š” ์—†๋Š” ๋ฉ”์†Œ๋“œ ์‚ญ์ œ

* ๐Ÿ‘” ๋น„ํ™œ์„ฑ/ํƒˆํ‡ด ํšŒ์› ์ œ๊ฑฐ ๋กœ์ง ์ถ”๊ฐ€

* ๐Ÿ› ๊ฒŒ์‹œ๋ฌผ ์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์ถ”๊ฐ€

* ๐Ÿ› ์ž๊ธฐ์†Œ๊ฐœ์„œ ์ž‘์„ฑ์ž ์ •๋ณด ์ถ”๊ฐ€

* ๐Ÿ› ๊ฒฝํ—˜์นด๋“œ ์ž‘์„ฑ์ž ์ •๋ณด ์ถ”๊ฐ€

* ๐Ÿ› ๊ฒŒ์‹œ๋ฌผ ์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์ถ”๊ฐ€

* ๐Ÿ› ๋Œ“๊ธ€ ์ฆ๊ฐ€ ์ค‘๋ณต ์˜ค๋ฅ˜ ์ˆ˜์ •

* ๐Ÿ”ฅ ์‚ฌ์šฉ ์•ˆํ•˜๋Š” import๋ฌธ ์‚ญ์ œ

* ๐Ÿ› ๊ฒŒ์‹œ๋ฌผ ์ž‘์„ฑ์ž ํ”„๋กœํ•„ ์ถ”๊ฐ€

* Feat: ํƒ€ ์‚ฌ์šฉ์ž ์กฐํšŒ ์‹œ, ๊ณต์œ ํ•œ ์‚ฌ์šฉ์ž์—๊ฒŒ ํฌ์ธํŠธ ์ „๋‹ฌ (#166)

* feat: ํฌ์ธํŠธ ์™ธ๋ž˜ํ‚ค ์ˆ˜์ • ๋ฐ PointType ์ถ”๊ฐ€

Related: #165

* feat: ํƒ€ ์‚ฌ์šฉ์ž ํฌ์ธํŠธ ์กฐํšŒ ์‹œ, ๊ณต์œ ํ•œ ์‚ฌ์šฉ์ž์—๊ฒŒ ํฌ์ธํŠธ ์ฆ๊ฐ€ ๊ตฌํ˜„

Related: #165

* fix: ๋งˆ์ดํŒŒ์—์ง€ ํฌ์ธํŠธ ์‚ฌ์šฉ๋‚ด์—ญ์—์„œ ์ถฉ์ „ ๋‚ด์—ญ ๋ณด์ด๋Š” ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

Related: #165

---------

Co-authored-by: kylo <[email protected]>
  • Loading branch information
joowojr and kylo-dev authored May 24, 2024
1 parent 022840f commit 1028ad0
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@RequiredArgsConstructor
public enum PointType {
USE_COVER_LETTER("์ž์†Œ์„œ ์กฐํšŒ"),
SHARE_COVER_LETTER("์ž์†Œ์„œ ๊ณต์œ "),
USE_AI_ANALYSIS("AI ์ง๋ฌด ์—ญ๋Ÿ‰ ๋ถ„์„"),
CHARGE("์ถฉ์ „");
private final String description;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/codez4/meetfolio/domain/point/Point.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class Point extends BaseTimeEntity {
@Enumerated(EnumType.STRING)
private PointType pointType;

@OneToOne(fetch = FetchType.LAZY)
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "coverletter_id", nullable = true)
private CoverLetter coverLetter;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import lombok.Getter;

public class PointRequest {

@Schema(description = "ํฌ์ธํŠธ ์‚ฌ์šฉ ์š”์ฒญ dto")
@Getter
public static class PointUseRequest{
public static class PointUseRequest {

@Schema(description = "ํฌ์ธํŠธ ์‚ฌ์šฉ ํƒ€์ž…, USE_COVER_LETTER/USE_AI_ANALYSIS")
@EnumValid(enumClass = PointType.class)
Expand All @@ -31,7 +32,8 @@ public static class PointUseRequest{
@Getter
@AllArgsConstructor
@Builder
public static class Post{
public static class Post {

int point;
PointType pointType;
int totalPoint;
Expand All @@ -40,7 +42,7 @@ public static class Post{
CoverLetter coverLetter;
}

public static Point toEntity(Post post){
public static Point toEntity(Post post) {
return Point.builder()
.point(post.getPoint())
.pointType(post.getPointType())
Expand All @@ -50,4 +52,16 @@ public static Point toEntity(Post post){
.coverLetter(post.coverLetter)
.build();
}

public static Point toSharePoint(int point, PointType pointType, int totalPoint, Member member,
CoverLetter coverLetter) {

return Point.builder()
.point(point)
.pointType(pointType)
.totalPoint(totalPoint)
.member(member)
.coverLetter(coverLetter)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public interface PointRepository extends JpaRepository<Point, Long> {

Page<Point> findByMemberAndPointType(Member member, PointType pointType, Pageable pageable);

@Query("SELECT p FROM Point p WHERE p.member = :member AND p.pointType <> 'CHARGE'")
Page<Point> getPointByMember(Member member, Pageable pageable);

Optional<Point> getPointByPayment(Payment payment);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package com.codez4.meetfolio.domain.point.service;

import static com.codez4.meetfolio.domain.point.dto.PointRequest.toEntity;
import static com.codez4.meetfolio.domain.point.dto.PointRequest.toSharePoint;
import static com.codez4.meetfolio.domain.point.dto.PointResponse.toPointProc;

import com.codez4.meetfolio.domain.coverLetter.CoverLetter;
import com.codez4.meetfolio.domain.enums.PointType;
import com.codez4.meetfolio.domain.member.Member;
import com.codez4.meetfolio.domain.point.Point;
import com.codez4.meetfolio.domain.point.dto.PointRequest;
Expand All @@ -9,9 +15,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static com.codez4.meetfolio.domain.point.dto.PointRequest.toEntity;
import static com.codez4.meetfolio.domain.point.dto.PointResponse.toPointProc;

@Service
@RequiredArgsConstructor
@Transactional
Expand All @@ -30,8 +33,25 @@ public Point post(PointRequest.Post post) {
public PointResponse.PointProc usePoint(PointRequest.Post post, Member member) {
Point point = post(post);
member.setPoint(post.getTotalPoint());

if (post.getPointType() == PointType.USE_COVER_LETTER) {
shareCoverLetter(post);
}
return toPointProc(point);
}

public void shareCoverLetter(PointRequest.Post post) {

CoverLetter coverLetter = post.getCoverLetter();
Member owner = coverLetter.getMember();
PointType pointType = PointType.SHARE_COVER_LETTER;
int point = 100;
int totalPoint = owner.getPoint() + point;

Point sharePoint = toSharePoint(point, pointType, totalPoint, owner, coverLetter);
save(sharePoint);
owner.setPoint(totalPoint);
}


}

0 comments on commit 1028ad0

Please sign in to comment.