feat: create lootbox and rewards entity
This commit is contained in:
parent
4e8530c861
commit
1878ed8fe4
3 changed files with 63 additions and 1 deletions
|
@ -0,0 +1,34 @@
|
|||
package de.szut.casino.lootboxes;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import de.szut.casino.blackjack.CardEntity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LootBoxEntity {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
@Column(precision = 19, scale = 2)
|
||||
private BigDecimal price;
|
||||
|
||||
@OneToMany(mappedBy = "lootBox", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<RewardEntity> rewards = new ArrayList<>();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package de.szut.casino.lootboxes;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import de.szut.casino.blackjack.BlackJackGameEntity;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class RewardEntity {
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Column(precision = 19, scale = 2)
|
||||
private BigDecimal value;
|
||||
|
||||
@Column(precision = 5, scale = 2)
|
||||
private BigDecimal probability;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "lootBox_id", nullable = false)
|
||||
@JsonBackReference
|
||||
private LootBoxEntity lootBox;
|
||||
}
|
|
@ -2,7 +2,7 @@ spring.datasource.url=jdbc:postgresql://${DB_HOST:localhost}:5432/postgresdb
|
|||
spring.datasource.username=postgres_user
|
||||
spring.datasource.password=postgres_pass
|
||||
server.port=8080
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.hibernate.ddl-auto=create-drop
|
||||
stripe.secret.key=${STRIPE_SECRET_KEY:sk_test_51QrePYIvCfqz7ANgqam8rEwWcMeKiLOof3j6SCMgu2sl4sESP45DJxca16mWcYo1sQaiBv32CMR6Z4AAAGQPCJo300ubuZKO8I}
|
||||
stripe.webhook.secret=whsec_746b6a488665f6057118bdb4a2b32f4916f16c277109eeaed5e8f8e8b81b8c15
|
||||
app.frontend-host=http://localhost:4200
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue