model

Creamos el paquete model Aqui vamos a crear la entidades de la base de datos.
Creamos un Enum y lo llamamos Role
 
   
  
 package com.tutosoftware.aloja.model;

public enum Role {
	
	ADMIN,
    USER  

}
          
          
      
   

Creamos la clase Administrador
 
   
  package com.tutosoftware.aloja.model;



import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name="administrador",uniqueConstraints = {@UniqueConstraint(columnNames = {"correo"})})
public class Administrador implements UserDetails {
	 /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	 @GeneratedValue
	 @Column(name = "idadmin")
	 Integer idAdmin;
	 @Column(nullable = false,name = "nombre")
     String nombre;
	 @Column(nullable = false,name = "apellidopaterno")
	 String apellidoPaterno;
	 @Column(name = "apellidomaterno")
	 String apellidoMaterno;
	 @Column(nullable = false,name = "correo")
	 String correo;
	 @Column(nullable = false,name = "celular")
	 String celular;
	 @Column(nullable = false,name = "password")
	 String password;
	 @Column(nullable = false,name = "rol")
	 @Enumerated(EnumType.STRING) 
	 Role rol;
	@Override
	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}
	@Override
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}
	@Override
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}
	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}

	@Override
	public String getPassword() {
		// TODO Auto-generated method stub
		return password;
	}

	@Override
	public String getUsername() {
		// TODO Auto-generated method stub
		return correo;
	}

}
  
    
    
    
     
   

Creamos la clase AdministradorRequest
 
  
     package com.tutosoftware.aloja.model;



import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class AdministradorRequest {
	
	
	String nombre;
	String apellidoPaterno;
	String apellidoMaterno;
	String correo;
	String celular;
	String password;
	String rol;

}