Add repositories
This commit is contained in:
@@ -18,7 +18,7 @@ public class MainController {
|
||||
|
||||
@GetMapping("/users/get/{id}")
|
||||
public User getUser(@PathVariable int id) {
|
||||
return new User(id, "Test", null, null, null, null, null, null);
|
||||
return new User(id, "Test", null, null, null, null, null);
|
||||
}
|
||||
|
||||
@PostMapping("/users/set/{id}/name")
|
||||
|
||||
@@ -12,8 +12,8 @@ public class User {
|
||||
private long id;
|
||||
private String name;
|
||||
private String email;
|
||||
private String login;
|
||||
private String password;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Role role;
|
||||
|
||||
@OneToMany(mappedBy = "user")
|
||||
@@ -22,11 +22,10 @@ public class User {
|
||||
@OneToMany(mappedBy = "user")
|
||||
private List<Income> incomes;
|
||||
|
||||
public User(long id, String name, String email, String login, String password, Role role, List<Expense> expenses, List<Income> incomes) {
|
||||
public User(long id, String name, String email, String password, Role role, List<Expense> expenses, List<Income> incomes) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.email = email;
|
||||
this.login = login;
|
||||
this.password = password;
|
||||
this.role = role;
|
||||
this.expenses = expenses;
|
||||
@@ -59,14 +58,6 @@ public class User {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public void setLogin(String login) {
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.faf223.expensetrackerfaf.repository;
|
||||
|
||||
import com.faf223.expensetrackerfaf.model.Expense;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ExpenseRepository extends JpaRepository<Expense, Long> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.faf223.expensetrackerfaf.repository;
|
||||
|
||||
import com.faf223.expensetrackerfaf.model.Income;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface IncomeRepository extends JpaRepository<Income, Long> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.faf223.expensetrackerfaf.repository;
|
||||
|
||||
import com.faf223.expensetrackerfaf.model.User;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
}
|
||||
Reference in New Issue
Block a user