1 | package mk.ukim.finki.wp.bankappfinal.model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 |
|
---|
5 | import java.math.BigDecimal;
|
---|
6 | import java.time.LocalDateTime;
|
---|
7 |
|
---|
8 |
|
---|
9 | @Entity
|
---|
10 | public class Transaction {
|
---|
11 |
|
---|
12 |
|
---|
13 | @Id
|
---|
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
15 | private Long id;
|
---|
16 | private BigDecimal amount;
|
---|
17 | private String currency;
|
---|
18 | private String type;
|
---|
19 | private LocalDateTime timestamp;
|
---|
20 |
|
---|
21 | @ManyToOne
|
---|
22 | @JoinColumn(name = "account_id")
|
---|
23 | private Account account;
|
---|
24 |
|
---|
25 | public Transaction() {}
|
---|
26 |
|
---|
27 | public Transaction(BigDecimal amount,String currency, String type, LocalDateTime timestamp, Account account) {
|
---|
28 | this.amount = amount;
|
---|
29 | this.currency = currency;
|
---|
30 | this.type = type;
|
---|
31 | this.timestamp = timestamp;
|
---|
32 | this.account = account;
|
---|
33 | }
|
---|
34 |
|
---|
35 | public Long getId() {
|
---|
36 | return id;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public void setId(Long id) {
|
---|
40 | this.id = id;
|
---|
41 | }
|
---|
42 |
|
---|
43 | public BigDecimal getAmount() {
|
---|
44 | return amount;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public void setAmount(BigDecimal amount) {
|
---|
48 | this.amount = amount;
|
---|
49 | }
|
---|
50 |
|
---|
51 | public String getType() {
|
---|
52 | return type;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public void setType(String type) {
|
---|
56 | this.type = type;
|
---|
57 | }
|
---|
58 |
|
---|
59 | public LocalDateTime getTimestamp() {
|
---|
60 | return timestamp;
|
---|
61 | }
|
---|
62 |
|
---|
63 | public void setTimestamp(LocalDateTime timestamp) {
|
---|
64 | this.timestamp = timestamp;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public Account getAccount() {
|
---|
68 | return account;
|
---|
69 | }
|
---|
70 |
|
---|
71 | public void setAccount(Account account) {
|
---|
72 | this.account = account;
|
---|
73 | }
|
---|
74 |
|
---|
75 | public String getCurrency() {
|
---|
76 | return currency;
|
---|
77 | }
|
---|
78 |
|
---|
79 | public void setCurrency(String currency) {
|
---|
80 | this.currency = currency;
|
---|
81 | }
|
---|
82 | }
|
---|