feat: created user entity

This commit is contained in:
filippo-ferrari 2024-09-06 19:14:26 +02:00
parent f912fab9e6
commit bdcff2461c
2 changed files with 52 additions and 0 deletions

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

View file

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