mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-13 08:58:48 +00:00
terminado sign up
This commit is contained in:
@ -57,7 +57,8 @@ public class User {
|
||||
@Column(name = "deleted_by")
|
||||
private Long deletedBy;
|
||||
|
||||
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, orphanRemoval = true)
|
||||
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE,
|
||||
CascadeType.REMOVE }, orphanRemoval = true)
|
||||
@SQLRestriction("deleted = false")
|
||||
@JsonIgnore
|
||||
private Set<UserRole> rolesLink = new HashSet<>();
|
||||
|
||||
@ -29,6 +29,15 @@ public interface UserDao extends JpaRepository<User, Long>, JpaSpecificationExec
|
||||
|
||||
boolean existsByUserNameIgnoreCase(String userName);
|
||||
|
||||
// Para comprobar si existe al hacer signup
|
||||
@Query(value = """
|
||||
SELECT id, deleted, enabled
|
||||
FROM users
|
||||
WHERE LOWER(username) = LOWER(:userName)
|
||||
LIMIT 1
|
||||
""", nativeQuery = true)
|
||||
Optional<UserLite> findLiteByUserNameIgnoreCase(@Param("userName") String userName);
|
||||
|
||||
boolean existsByUserNameIgnoreCaseAndIdNot(String userName, Long id);
|
||||
|
||||
// Nuevo: para login/negocio "activo"
|
||||
|
||||
9
src/main/java/com/imprimelibros/erp/users/UserLite.java
Normal file
9
src/main/java/com/imprimelibros/erp/users/UserLite.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.imprimelibros.erp.users;
|
||||
|
||||
// Proyección para consultas ligeras de usuarios (id, enabled, deleted)
|
||||
public interface UserLite {
|
||||
|
||||
Long getId();
|
||||
Boolean getDeleted();
|
||||
Boolean getEnabled();
|
||||
}
|
||||
Reference in New Issue
Block a user