Compare commits
3 Commits
3e2af36bfb
...
05797d47d4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05797d47d4 | ||
|
|
0561541bec | ||
|
|
a800606bb2 |
@@ -0,0 +1,22 @@
|
||||
package com.example.demo.app.domain.model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class TransactionModel {
|
||||
|
||||
private Long transactionId;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Long categoryId;
|
||||
|
||||
private Integer amount;
|
||||
|
||||
private LocalDate transactionDate;
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class TransactionEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "transaction_id")
|
||||
private Integer transactionId;
|
||||
private Long transactionId;
|
||||
|
||||
@Column(name = "amount", nullable = false)
|
||||
private Integer amount;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.example.demo.app.presentation.form;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import com.example.demo.app.domain.model.TransactionModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -9,6 +14,27 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor
|
||||
public class TransactionForm {
|
||||
|
||||
private Long transactionId;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Long categoryId;
|
||||
|
||||
private Integer amount;
|
||||
|
||||
private LocalDate transactionDate;
|
||||
|
||||
public static TransactionForm convertFrom(TransactionModel transactionModel) {
|
||||
return new TransactionForm(
|
||||
transactionModel.getTransactionId(),
|
||||
transactionModel.getUserId(),
|
||||
transactionModel.getCategoryId(),
|
||||
transactionModel.getAmount(),
|
||||
transactionModel.getTransactionDate());
|
||||
}
|
||||
|
||||
public static List<TransactionForm> convertFrom(List<TransactionModel> transactionModelList) {
|
||||
return transactionModelList.stream().map(TransactionForm::convertFrom).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user