Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UserRecord.java #20

Open
wants to merge 1 commit into
base: flow
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions src/main/java/com/jpmc/midascore/entity/UserRecord.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
package com.jpmc.midascore.entity;

import jakarta.persistence.*;
import java.util.List;

@Entity
public class UserRecord {
public class User {

@Id
@GeneratedValue()
private long id;
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false)
private String name;

@Column(nullable = false)
private float balance;

protected UserRecord() {
@OneToMany(mappedBy = "sender")
private List<TransactionRecord> sentTransactions;

@OneToMany(mappedBy = "recipient")
private List<TransactionRecord> receivedTransactions;

protected User() {
}

public UserRecord(String name, float balance) {
public User(String name, float balance) {
this.name = name;
this.balance = balance;
}

@Override
public String toString() {
return String.format("User[id=%d, name='%s', balance='%f'", id, name, balance);
return String.format("User[id=%d, name='%s', balance='%f']", id, name, balance);
}

public Long getId() {
Expand All @@ -43,4 +50,13 @@ public float getBalance() {
public void setBalance(float balance) {
this.balance = balance;
}

// Add getters and setters for transactions if needed
public List<TransactionRecord> getSentTransactions() {
return sentTransactions;
}

public List<TransactionRecord> getReceivedTransactions() {
return receivedTransactions;
}
}