Closed ajohnsson95 closed 8 months ago
Controller classes will fail due to missing MessageService & UserService, will make a new commit once the service classes have been merged
You might consider adding input validation annotations such as @Valid and @NotNull to ensure that the data sent to the endpoints is valid. @PostMapping @ResponseStatus(HttpStatus.CREATED) public UserDto createUser(@Valid @NotNull @requestbody UserDto userDto) { return userService.createUser(userDto); } That also mean our Dto classes has to be annotated accordingly (Annotations on Entity level only applicable to the database, not our application)
sounds good I belive the easiest way to do this would be to add some anotations in the DTO class for example @NotBlank(message = "First name is required") @Size(max = 255, message = "First name must be less than 256 characters") private String firstName;
but that would probably force us too change the UserDto to a class and not a record if im correct
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
12.5% Coverage on New Code
0.0% Duplication on New Code
@Ebyrdeu @ValentinaSukonina Still not added the @Validated annotation should not be to hard to do but i belive changes have to be done in the Dto records, to set up validations there aswell, and possibly add the
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
to our pom.xml
@Ebyrdeu @ValentinaSukonina Still not added the @validated annotation should not be to hard to do but i belive changes have to be done in the Dto records, to set up validations there as well, and possibly add the
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency>
to our pom.xml
You are right, it should be implemented on Dto level. Check this https://stackoverflow.com/questions/64186922/java-records-validation-anotation
@Ebyrdeu @ValentinaSukonina Still not added the @validated annotation should not be to hard to do but i belive changes have to be done in the Dto records, to set up validations there as well, and possibly add the
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency>
to our pom.xml
You are right, it should be implemented on Dto level. Check this https://stackoverflow.com/questions/64186922/java-records-validation-anotation
New pull request for changes that have been made in the Dto records aswell as added Spring-boot-starter-validation dependency #24
Will create a new issue & pull request regarding validation in the controller class
…f the service classes.
Related Issue(s)
Issue #6
Proposed Changes
Creat Controller class for Message & User
Description
Controller classes created based on current Serviceclass.