Reformat Backend
This commit is contained in:
@@ -15,7 +15,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.*;
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.IMAGE_ALL;
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.IMAGE_BASE;
|
||||
import static de.htwsaar.webshop.config.ParameterConfig.*;
|
||||
import static de.htwsaar.webshop.util.LoggerUtil.logRequest;
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ import java.util.List;
|
||||
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.ORDER_BASE;
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.ORDER_GET_ALL;
|
||||
import static de.htwsaar.webshop.config.ParameterConfig.*;
|
||||
import static de.htwsaar.webshop.config.ParameterConfig.PARAM_CUSTOMER_ID;
|
||||
import static de.htwsaar.webshop.config.ParameterConfig.PARAM_ID;
|
||||
import static de.htwsaar.webshop.util.LoggerUtil.logRequest;
|
||||
|
||||
@RestController
|
||||
|
||||
@@ -13,7 +13,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.*;
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.REVIEW_BASE;
|
||||
import static de.htwsaar.webshop.config.ControllerPathConfig.REVIEW_GET_ALL;
|
||||
import static de.htwsaar.webshop.config.ParameterConfig.*;
|
||||
import static de.htwsaar.webshop.util.LoggerUtil.logRequest;
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package de.htwsaar.webshop.model;
|
||||
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Null;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -23,5 +21,4 @@ public class SessionModel {
|
||||
|
||||
@Min(VALID_MIN_MILLIS_TIMESTAMP)
|
||||
long timeout;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package de.htwsaar.webshop.repository;
|
||||
import de.htwsaar.webshop.repository.entities.Article;
|
||||
import lombok.NonNull;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package de.htwsaar.webshop.repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import de.htwsaar.webshop.repository.entities.Review;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Repository
|
||||
public interface ReviewRepository extends JpaRepository<Review, Long> {
|
||||
|
||||
@@ -3,11 +3,7 @@ package de.htwsaar.webshop.repository.entities;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -4,8 +4,12 @@ import de.htwsaar.webshop.repository.entities.Account;
|
||||
|
||||
public interface AccountService {
|
||||
Account saveNew(Account account);
|
||||
|
||||
Account save(Account account);
|
||||
|
||||
boolean deleteIfExists(Account account);
|
||||
|
||||
Account isValidLogin(String email, String password);
|
||||
|
||||
boolean existsWithEmail(String email);
|
||||
}
|
||||
@@ -4,6 +4,8 @@ import de.htwsaar.webshop.repository.entities.Customer;
|
||||
|
||||
public interface CustomerService {
|
||||
Customer save(Customer customer);
|
||||
|
||||
void delete(Customer customer);
|
||||
|
||||
Customer findById(Long id);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ import java.util.List;
|
||||
|
||||
public interface OrderService {
|
||||
Order save(Order order);
|
||||
|
||||
void delete(Long orderId);
|
||||
|
||||
Order getOrderById(Long orderId);
|
||||
|
||||
List<Order> getAllOrders(Long customerId);
|
||||
}
|
||||
|
||||
@@ -2,5 +2,6 @@ package de.htwsaar.webshop.service;
|
||||
|
||||
public interface PasswordService {
|
||||
String hashPassword(String password);
|
||||
|
||||
boolean verifyPassword(String password, String hashedPassword);
|
||||
}
|
||||
@@ -1,16 +1,21 @@
|
||||
package de.htwsaar.webshop.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import de.htwsaar.webshop.model.ReviewModel;
|
||||
import de.htwsaar.webshop.repository.entities.Review;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ReviewService {
|
||||
Review save(Review review);
|
||||
|
||||
Review save(UUID articleUuid, int rating, String content);
|
||||
|
||||
void delete(Long reviewId);
|
||||
|
||||
Review getReviewById(Long id);
|
||||
|
||||
List<Review> getAllByUUID(UUID uuid);
|
||||
|
||||
ReviewModel toModel(Review review);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package de.htwsaar.webshop.service;
|
||||
|
||||
import de.htwsaar.webshop.model.SessionModel;
|
||||
import de.htwsaar.webshop.repository.entities.Account;
|
||||
import de.htwsaar.webshop.repository.entities.Session;
|
||||
|
||||
@@ -8,9 +7,14 @@ import java.util.UUID;
|
||||
|
||||
public interface SessionService {
|
||||
Session create(Account account);
|
||||
|
||||
void delete(Session session);
|
||||
|
||||
Session findByAccount(Account account);
|
||||
|
||||
Session getByToken(UUID token);
|
||||
|
||||
boolean isValid(Session session, String email);
|
||||
|
||||
boolean isValid(UUID token, String email);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package de.htwsaar.webshop.service.impl;
|
||||
|
||||
import de.htwsaar.webshop.model.SessionModel;
|
||||
import de.htwsaar.webshop.repository.AccountRepository;
|
||||
import de.htwsaar.webshop.repository.SessionRepository;
|
||||
import de.htwsaar.webshop.repository.entities.Account;
|
||||
|
||||
Reference in New Issue
Block a user