Skip to content

Commit

Permalink
feat: login field to UserEntity and created UserMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
wallanpsantos committed Nov 28, 2023
1 parent ca02a54 commit 8c5973a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/com/jwtauthcruddemo/entities/UserEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class UserEntity {
@Email(message = "Email deve ser válido")
private String email;

@NotBlank
private String login;

@NotBlank
private String password;
}
13 changes: 13 additions & 0 deletions src/main/java/com/jwtauthcruddemo/mappers/UserMapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.jwtauthcruddemo.mappers;

import com.jwtauthcruddemo.dtos.output.UserDto;
import com.jwtauthcruddemo.entities.UserEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring")
public interface UserMapper {

@Mapping(target = "token", ignore = true)
UserDto toUserDto(UserEntity userEntity);
}
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ spring:
database-platform: org.hibernate.dialect.PostgreSQLDialect
hibernate:
# ddl-auto: create-drop # Deletar e criar uma nova Tabela
ddl-auto: update # Apenas atualizar uma existente com a(as) entity(ies)
ddl-auto: update # Apenas atualizar a tabela existente com a entity, e adiciona novos campos, caso nao exista

0 comments on commit 8c5973a

Please sign in to comment.