feat: add Card entity and CardStatus enum
This commit is contained in:
75
src/main/java/com/example/bankcards/entity/Card.java
Normal file
75
src/main/java/com/example/bankcards/entity/Card.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.example.bankcards.entity;
|
||||
|
||||
@Entity
|
||||
@Table(name = "cards")
|
||||
public class Card {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "card_number_encrypted", nullable = false)
|
||||
private String cardNumberEncrypted;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "owner_id", nullable = false)
|
||||
private User owner;
|
||||
|
||||
@Column(name = "expiry_date", nullable = false)
|
||||
private LocalDate expiryDate;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private CardStatus status;
|
||||
|
||||
@Column(nullable = false, precision = 19, scale = 2)
|
||||
private BigDecimal balance;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCardNumberEncrypted() {
|
||||
return cardNumberEncrypted;
|
||||
}
|
||||
|
||||
public void setCardNumberEncrypted(String cardNumberEncrypted) {
|
||||
this.cardNumberEncrypted = cardNumberEncrypted;
|
||||
}
|
||||
|
||||
public User getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(User owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public LocalDate getExpiryDate() {
|
||||
return expiryDate;
|
||||
}
|
||||
|
||||
public void setExpiryDate(LocalDate expiryDate) {
|
||||
this.expiryDate = expiryDate;
|
||||
}
|
||||
|
||||
public CardStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(CardStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public BigDecimal getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(BigDecimal balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.example.bankcards.entity;
|
||||
|
||||
public enum CardStatus {
|
||||
ACTIVE, BLOCKED, EXPIRED
|
||||
}
|
||||
Reference in New Issue
Block a user