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

AdminPayment 엔티티 설계 #80

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Changes from all commits
Commits
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
@@ -0,0 +1,65 @@
package kr.co.fastcampus.yanabada.domain.payment.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import kr.co.fastcampus.yanabada.common.baseentity.BaseEntity;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class AdminPayment extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false)
private Long balance;

@Column(nullable = false)
private Long accumulatedUsers;

@Column(nullable = false)
private Long accumulatedUsageAmount;

@Column(nullable = false)
private Long accumulatedDiscountAmount;

public void deposit(int depositAmount) {
balance += depositAmount;
}

public void withdrawal(int withdrawalAmount) {
balance -= withdrawalAmount;
}

public void incrementAccumulatedUsers(int userCount) {
accumulatedUsers += userCount;
}

public void decrementAccumulatedUsers(int userCount) {
accumulatedUsers -= userCount;
}

public void incrementAccumulatedUsageAmount(int amount) {
accumulatedUsageAmount += amount;
}

public void decrementAccumulatedUsageAmount(int amount) {
accumulatedUsageAmount -= amount;
}

public void incrementAccumulatedDiscountAmount(int amount) {
accumulatedDiscountAmount += amount;
}

public void decrementAccumulatedDiscountAmount(int amount) {
accumulatedDiscountAmount -= amount;
}
}
Loading