Add JWT authorization

This commit is contained in:
DmitriiCravcenco
2023-10-02 08:18:57 +03:00
parent 4775911e50
commit 35fb05ac01
13 changed files with 423 additions and 70 deletions

View File

@@ -1,18 +1,29 @@
package com.faf223.expensetrackerfaf.model;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "User")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
private String firstName;
private String lastName;
private String email;
private String password;
@Enumerated(EnumType.STRING)
private Role role;
@@ -22,71 +33,4 @@ public class User {
@OneToMany(mappedBy = "user")
private 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.password = password;
this.role = role;
this.expenses = expenses;
this.incomes = incomes;
}
public User() {}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
public List<Expense> getExpenses() {
return expenses;
}
public void setExpenses(List<Expense> expenses) {
this.expenses = expenses;
}
public List<Income> getIncomes() {
return incomes;
}
public void setIncomes(List<Income> incomes) {
this.incomes = incomes;
}
}