Add repositories

This commit is contained in:
Dmitrii Cravcenco
2023-09-21 14:49:49 +03:00
parent 53ae0d502c
commit c0f3a7f7a7
5 changed files with 24 additions and 12 deletions

View File

@@ -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")

View File

@@ -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;
}

View File

@@ -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> {
}

View File

@@ -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> {
}

View File

@@ -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> {
}