-
Notifications
You must be signed in to change notification settings - Fork 1
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 #9 from BbeumbungE/feat/BACK-123
Feat: Point 도메인 추가
- Loading branch information
Showing
16 changed files
with
149 additions
and
38 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/main/java/com/siliconvalley/domain/canvas/domain/Canvas.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
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/siliconvalley/domain/point/application/PointManagementService.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,28 @@ | ||
package com.siliconvalley.domain.point.application; | ||
|
||
import com.siliconvalley.domain.point.domain.Point; | ||
import com.siliconvalley.domain.point.dto.PointResponse; | ||
import com.siliconvalley.domain.profile.dao.ProfileFindDao; | ||
import com.siliconvalley.domain.profile.domain.Profile; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class PointManagementService { | ||
|
||
private final ProfileFindDao profileFindDao; | ||
|
||
public PointResponse getPoint(Long profileId) { | ||
Profile profile = profileFindDao.findById(profileId); | ||
return new PointResponse(profile.getPoint()); | ||
} | ||
|
||
public void updatePoint(Long profileId, Long newPointValue) { | ||
Profile profile = profileFindDao.findById(profileId); | ||
Point point = profile.getPoint(); | ||
point.updatePoint(newPointValue); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/siliconvalley/domain/point/domain/Point.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,43 @@ | ||
package com.siliconvalley.domain.point.domain; | ||
|
||
import com.siliconvalley.domain.profile.domain.Profile; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
@Table(name = "point") | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Point { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "point") | ||
private Long point; | ||
|
||
@OneToOne | ||
@JoinColumn(name = "profile_id") | ||
private Profile profile; | ||
|
||
@Builder | ||
public Point(Long point, Profile profile) { | ||
this.point = point; | ||
this.profile = profile; | ||
} | ||
|
||
public void setProfile(Profile profile) { | ||
this.profile = profile; | ||
} | ||
|
||
public void updatePoint(Long newPointValue) { | ||
if (newPointValue != null) { | ||
this.point = newPointValue; | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/siliconvalley/domain/point/dto/PointResponse.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 com.siliconvalley.domain.point.dto; | ||
|
||
import com.siliconvalley.domain.point.domain.Point; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class PointResponse { | ||
|
||
private Long id; | ||
private Long point; | ||
|
||
public PointResponse(Point point) { | ||
this.id = point.getId(); | ||
this.point = point.getPoint(); | ||
} | ||
} |
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
28 changes: 0 additions & 28 deletions
28
src/main/java/com/siliconvalley/domain/subject/domain/Subject.java
This file was deleted.
Oops, something went wrong.
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
3 changes: 1 addition & 2 deletions
3
...bal/common/dto/Page/PageInfoResponse.java → ...bal/common/dto/page/PageInfoResponse.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
.../global/common/dto/Page/PageResponse.java → .../global/common/dto/page/PageResponse.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