Skip to content
This repository has been archived by the owner on Dec 7, 2024. It is now read-only.

Commit

Permalink
feat: light improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexZ7000 committed Oct 10, 2024
1 parent abd810c commit 4750309
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package com.example.comerce.core.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/category")
public class CategoryController {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package com.example.comerce.core.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/product")
public class ProductController {

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.comerce.core.controller;

import com.example.comerce.core.dtos.UserDTO;
import com.example.comerce.core.dto.UserDTO;
import com.example.comerce.core.entities.User;
import com.example.comerce.core.services.UserService;
import jakarta.validation.Valid;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/example/comerce/core/dto/AddressDTO.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.comerce.core.dtos;
package com.example.comerce.core.dto;

import com.example.comerce.core.entities.Address;
import jakarta.validation.constraints.NotBlank;
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/example/comerce/core/dto/CategoryDTO.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package com.example.comerce.core.dtos;
package com.example.comerce.core.dto;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class CategoryDTO {

}
8 changes: 7 additions & 1 deletion src/main/java/com/example/comerce/core/dto/OrderDTO.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package com.example.comerce.core.dtos;
package com.example.comerce.core.dto;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class OrderDTO {

}
8 changes: 7 additions & 1 deletion src/main/java/com/example/comerce/core/dto/ProductDTO.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package com.example.comerce.core.dtos;
package com.example.comerce.core.dto;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ProductDTO {

}
2 changes: 1 addition & 1 deletion src/main/java/com/example/comerce/core/dto/UserDTO.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.comerce.core.dtos;
package com.example.comerce.core.dto;

import com.example.comerce.core.entities.User;
import jakarta.validation.constraints.Email;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/example/comerce/core/entities/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class User {
private String cpf;

@Column(length = 100, nullable = false, unique = true)
@Email(message = "E-mail inválido")
private String email;

@OneToOne(cascade = CascadeType.ALL)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.example.comerce.core.services;

import org.springframework.stereotype.Service;

@Service
public class CategoryService {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.example.comerce.core.services;

import org.springframework.stereotype.Service;

@Service
public class ProductService {

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.comerce.core.services;

import com.example.comerce.core.dtos.UserDTO;
import com.example.comerce.core.dto.UserDTO;
import com.example.comerce.core.entities.User;
import com.example.comerce.core.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.example.comerce.shared.security;

public class CustomUserDetailsService {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.example.comerce.shared.security;

public class JWTAuthenticationFilter {

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.example.comerce.shared.security;

public class JWTService {

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public class SecurityConfig {
@Autowired
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf(AbstractHttpConfigurer::disable) // Desabilitar CSRF, caso você não precise (API REST, por exemplo)
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(authorize -> authorize
.requestMatchers("/api/users").permitAll() // Liberando o endpoint /users
.anyRequest().permitAll() // Todas as outras requisições precisam de autenticação
.requestMatchers("/api/users").permitAll()
.anyRequest().permitAll()
);

return http.build(); // Retorna o SecurityFilterChain configurado
return http.build();
}
}

0 comments on commit 4750309

Please sign in to comment.