Skip to content

Commit

Permalink
Refactor the big decimal settings
Browse files Browse the repository at this point in the history
  • Loading branch information
leung018 committed Dec 13, 2024
1 parent a1e0425 commit 55afbdc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.leungcheng.spring_simple_backend.domain;

public class BigDecimalSettings {
public static final int SCALE = 10;
public static final int PRECISION = 19;
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Builder toBuilder() {

@NotBlank private String name;

@Column(precision = 19, scale = 5)
@Column(precision = BigDecimalSettings.PRECISION, scale = BigDecimalSettings.SCALE)
@Min(0)
private BigDecimal price;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public User.Builder toBuilder() {
@NotBlank private String password;

@Min(0)
@Column(precision = 19, scale = 10)
@Column(precision = BigDecimalSettings.PRECISION, scale = BigDecimalSettings.SCALE)
private BigDecimal balance;

@Override
Expand Down

0 comments on commit 55afbdc

Please sign in to comment.