Skip to content

Commit

Permalink
Clean code and some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisClone committed Apr 3, 2020
1 parent 461d082 commit b11fdd9
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,5 @@ protected void configure(HttpSecurity http) throws Exception {
.and()
.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); // Add our custom JWT security filter

//@formatter:on

//http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);


}
}
4 changes: 2 additions & 2 deletions src/main/java/fr/kungfunantes/backend/model/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ public class Profile {
@ApiModelProperty(notes = "Firstname must be at most 30.")
@NotBlank
@Size(max = 30, message = "Firstname must be at most 30 characters")
private String firstname;
private String firstName;

@ApiModelProperty(notes = "Lastname should be between 2 characters and 20.")
@NotBlank
@Size(max = 30, message = "Lastname must be at most 30 characters")
private String lastname;
private String lastName;

@ApiModelProperty(notes = "Username must be at most 15 characters.")
@NotBlank
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import fr.kungfunantes.backend.utils.RestPreconditions;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ResponseEntity<?> authenticateUser(@Valid @RequestBody LoginRequest login

Authentication authentication = authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(
loginRequest.getEmail(),
loginRequest.getUsername(),
loginRequest.getPassword()
)
);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/fr/kungfunantes/backend/security/LoginRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

public class LoginRequest {
@NotBlank
private String email;
private String username;

@NotBlank
private String password;

public String getEmail() {
return email;
public String getUsername() {
return username;
}

public void setEmail(String email) {
this.email = email;
public void setUsername(String username) {
this.username = username;
}

public String getPassword() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
public class SignUpRequest {
@NotBlank
@Size(max = 30)
private String firstname;
private String firstName;

@NotBlank
@Size(max = 30)
private String lastname;
private String lastName;

@NotBlank
@Size(max = 15)
Expand Down
14 changes: 7 additions & 7 deletions src/main/resources/import.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ INSERT INTO CATEGORY (id, name) VALUES (1, 'Catégorie 1');
INSERT INTO CATEGORY (id, name) VALUES (2, 'Catégorie 2');


INSERT INTO EXERCICE (id, type, categoryId, name, description, measurementUnit, objective, image) VALUES (1, 'PHYSICAL', 1, 'Exercice Physique 1', 'Description exercice physique n°1', 'METER', 'MAXIMUM', 'http://de1.iconarchive.com/download/i61348/majdi-khawaja/kung-fu-panda/Po-3.ico');
INSERT INTO EXERCICE (id, type, categoryId, name, description, measurementUnit, objective, image) VALUES (2, 'PHYSICAL', 1, 'Exo Physique 2', 'La description du physique 2', 'SECOND', 'MINIMUM', 'https://freepngimg.com/download/kung_fu_panda/1-2-kung-fu-panda-fighting-png.png');
INSERT INTO EXERCICE (id, type, categoryId, name, description, image) VALUES (3, 'TAOLU', 2, 'Exercice Taolu 1', 'Voici la description de l exercice Taolu n°1', 'http://www.iconarchive.com/download/i61351/majdi-khawaja/kung-fu-panda/Po.ico');
INSERT INTO EXERCICE (id, type, categoryId, name, description, image) VALUES (4, 'TAOLU', 2, 'Exercice Taolu 2', 'Une description pour l exercice taolu 2', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTSt5xTFwgOJ16PwdkVPNmlRvegjsA2hxFLAwSozFuvnm5uQY7C');
INSERT INTO EXERCICE (id, type, categoryId, name, description, image) VALUES (5, 'FIGHT', 2, 'Exercice Fight 1', 'Description exercice combat 1', 'http://aux4.iconspalace.com/uploads/7798440781491586594.png');
INSERT INTO EXERCICE (id, type, categoryId, name, description, image) VALUES (6, 'FIGHT', 2, 'Exercice Fight 2', 'La description du combat 2', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRW__xUrkOYSKT_Ys07Op6PeaeCdSVAoNCy1P2J8QpxCNbF3VTS');
INSERT INTO EXERCICE (id, type, categoryId, name, description, question, image) VALUES (7, 'THEORETICAL', 2, 'Exercice Theorique', 'La description de l exo','Quelle est la capitale de la Chine ?', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRW__xUrkOYSKT_Ys07Op6PeaeCdSVAoNCy1P2J8QpxCNbF3VTS');
INSERT INTO EXERCISE (id, type, categoryId, name, description, measurementUnit, objective, image) VALUES (1, 'PHYSICAL', 1, 'Exercice Physique 1', 'Description exercice physique n°1', 'METER', 'MAXIMUM', 'http://de1.iconarchive.com/download/i61348/majdi-khawaja/kung-fu-panda/Po-3.ico');
INSERT INTO EXERCISE (id, type, categoryId, name, description, measurementUnit, objective, image) VALUES (2, 'PHYSICAL', 1, 'Exo Physique 2', 'La description du physique 2', 'SECOND', 'MINIMUM', 'https://freepngimg.com/download/kung_fu_panda/1-2-kung-fu-panda-fighting-png.png');
INSERT INTO EXERCISE (id, type, categoryId, name, description, image) VALUES (3, 'TAOLU', 2, 'Exercice Taolu 1', 'Voici la description de l exercice Taolu n°1', 'http://www.iconarchive.com/download/i61351/majdi-khawaja/kung-fu-panda/Po.ico');
INSERT INTO EXERCISE (id, type, categoryId, name, description, image) VALUES (4, 'TAOLU', 2, 'Exercice Taolu 2', 'Une description pour l exercice taolu 2', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTSt5xTFwgOJ16PwdkVPNmlRvegjsA2hxFLAwSozFuvnm5uQY7C');
INSERT INTO EXERCISE (id, type, categoryId, name, description, image) VALUES (5, 'FIGHT', 2, 'Exercice Fight 1', 'Description exercice combat 1', 'http://aux4.iconspalace.com/uploads/7798440781491586594.png');
INSERT INTO EXERCISE (id, type, categoryId, name, description, image) VALUES (6, 'FIGHT', 2, 'Exercice Fight 2', 'La description du combat 2', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRW__xUrkOYSKT_Ys07Op6PeaeCdSVAoNCy1P2J8QpxCNbF3VTS');
INSERT INTO EXERCISE (id, type, categoryId, name, description, question, image) VALUES (7, 'THEORETICAL', 2, 'Exercice Theorique', 'La description de l exo','Quelle est la capitale de la Chine ?', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRW__xUrkOYSKT_Ys07Op6PeaeCdSVAoNCy1P2J8QpxCNbF3VTS');


INSERT INTO CRITERIA (id, name) VALUES (1, 'critère 1');
Expand Down

0 comments on commit b11fdd9

Please sign in to comment.