feat: created user entity
This commit is contained in:
parent
f912fab9e6
commit
bdcff2461c
2 changed files with 52 additions and 0 deletions
41
src/main/java/com/application/munera/data/User.java
Normal file
41
src/main/java/com/application/munera/data/User.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package com.application.munera.data;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name = "users")
|
||||
public class User {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "Id", unique = true, nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "FirstName", nullable = false)
|
||||
private String firstName;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "LastName", nullable = false)
|
||||
private String lastName;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "username", nullable = false)
|
||||
private String username;
|
||||
|
||||
@Size(max = 100)
|
||||
@Column(name = "password", nullable = false)
|
||||
private String password;
|
||||
|
||||
@Column(name = "roles", nullable = false)
|
||||
private String roles;
|
||||
|
||||
@Email
|
||||
@Size(max = 100)
|
||||
@Column(name = "email")
|
||||
private String email;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.application.munera.repositories;
|
||||
|
||||
import com.application.munera.data.User;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
|
||||
User findByUsername(final String username);
|
||||
}
|
Loading…
Reference in a new issue