Compare commits
2 Commits
c013aed58f
...
0e8515e06e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e8515e06e | ||
|
|
758e71ad5e |
@ -1,7 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.advice;
|
||||
|
||||
import com.dh7789dev.xpeditis.NlsService;
|
||||
import com.dh7789dev.xpeditis.dto.CustomInternalExceptionResponse;
|
||||
import com.dh7789dev.xpeditis.exception.CustomInternalExceptionResponse;
|
||||
import com.dh7789dev.xpeditis.exception.CustomInternalException;
|
||||
import com.dh7789dev.xpeditis.exception.GlobalNotFoundException;
|
||||
import com.dh7789dev.xpeditis.exception.StorageException;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.dh7789dev.xpeditis.controller.api.v1;
|
||||
|
||||
import com.dh7789dev.xpeditis.AuthenticationService;
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.RegisterRequest;
|
||||
import com.dh7789dev.xpeditis.dto.request.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.response.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.request.RegisterRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@ -22,7 +22,7 @@ public class AuthenticationRestController {
|
||||
|
||||
private final AuthenticationService service;
|
||||
|
||||
@PostMapping("/authenticate")
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<AuthenticationResponse> authenticate(
|
||||
@RequestBody @Valid AuthenticationRequest request) {
|
||||
return ResponseEntity.ok(service.authenticate(request));
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.controller.api.v1;
|
||||
|
||||
import com.dh7789dev.xpeditis.UserService;
|
||||
import com.dh7789dev.xpeditis.dto.ChangePasswordRequest;
|
||||
import com.dh7789dev.xpeditis.dto.request.ChangePasswordRequest;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@ -78,8 +78,7 @@ public class GlobalConfiguration {
|
||||
CorsConfiguration configuration = new CorsConfiguration();
|
||||
//configuration.setAllowCredentials(true);
|
||||
configuration.setAllowedOrigins(List.of("http://localhost:8080", "http://localhost:3000",
|
||||
"http://127.0.0.1:8080", "https://leblr.preprod.weworkstudio.fr","https://leblr.fr",
|
||||
"https://api.leblr.preprod.weworkstudio.fr/","https://api.leblr.fr/", "https://www.leblr.fr"));
|
||||
"http://127.0.0.1:8080"));
|
||||
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH"));
|
||||
configuration.setAllowedHeaders(List.of("*"));
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
@ -87,4 +86,10 @@ public class GlobalConfiguration {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public UserDetailsService userDetailsService() {
|
||||
return username -> userDao.findByUsername(username)
|
||||
.orElseThrow(() -> new UsernameNotFoundException(String.format(USER_NOT_FOUND_MSG, username)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
private static final String AUTH_HEADER = "Authorization";
|
||||
private static final String AUTH_TYPE = "Bearer ";
|
||||
|
||||
|
||||
|
||||
private final UserDetailsService userDetailsService;
|
||||
private final JwtUtil jwtUtil;
|
||||
private final TokenDao tokenDao;
|
||||
|
||||
@ -34,6 +34,7 @@ public class SecurityConfiguration {
|
||||
boolean csrfEnabled;
|
||||
|
||||
private static final String ADMIN_ROLE = "ADMIN";
|
||||
private static final String ADMIN_PLATFORM_ROLE = "ADMIN_PLATFORM";
|
||||
|
||||
private static final String API_V1_URI = "/api/v1/**";
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
spring:
|
||||
h2:
|
||||
console:
|
||||
enabled: 'true'
|
||||
enabled: 'false'
|
||||
|
||||
datasource:
|
||||
url: jdbc:h2:mem:xpeditis;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
|
||||
|
||||
@ -38,7 +38,10 @@ spring:
|
||||
logging:
|
||||
level:
|
||||
org:
|
||||
org.hibernate.orm.query.sqm.ast.logTree: OFF
|
||||
springframework:
|
||||
boot:
|
||||
autoconfigure: OFF
|
||||
web:
|
||||
filter:
|
||||
CommonsRequestLoggingFilter: INFO
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
-- === Companies ===
|
||||
INSERT INTO company_entity (id, name, country)
|
||||
VALUES
|
||||
(1, 'Global Logistics', 'France'),
|
||||
(2, 'TransWorld Exports', 'Germany');
|
||||
|
||||
-- === Users ===
|
||||
INSERT INTO user_entity (id, username, first_name, last_name, email, password, role, enabled, company_id)
|
||||
VALUES
|
||||
(1, 'admin1', 'Alice', 'Martin', 'alice@globallogistics.com', '$2a$10$hash1', 'ADMIN', true, 1),
|
||||
(2, 'user1', 'Bob', 'Dupont', 'bob@globallogistics.com', '$2a$10$hash2', 'USER', true, 1),
|
||||
(3, 'admin2', 'Eva', 'Schmidt', 'eva@transworld.com', '$2a$10$hash3', 'ADMIN', true, 2);
|
||||
|
||||
-- === Licenses ===
|
||||
INSERT INTO license_entity (id, license_key, expiration_date, active, user_id)
|
||||
VALUES
|
||||
(1, 'LIC-GL-A', '2025-12-31', true, 1),
|
||||
(2, 'LIC-GL-B', '2025-12-31', true, 2),
|
||||
(3, 'LIC-TW-A', '2025-11-30', true, 3);
|
||||
|
||||
-- === Quotes ===
|
||||
INSERT INTO quote_entity (id, reference, status, estimated_amount, created_at, user_id, company_id)
|
||||
VALUES
|
||||
('550e8400-e29b-41d4-a716-446655440000', 'QT-GL-001', 'PENDING', 1200.50, CURRENT_TIMESTAMP, 1, 1),
|
||||
('550e8400-e29b-41d4-a716-446655440001', 'QT-GL-002', 'VALIDATED', 2300.75, CURRENT_TIMESTAMP, 2, 1),
|
||||
('550e8400-e29b-41d4-a716-446655440002', 'QT-TW-001', 'VALIDATED', 1950.00, CURRENT_TIMESTAMP, 3, 2);
|
||||
|
||||
-- === Export Folders ===
|
||||
INSERT INTO export_folder_entity (id, reference, validation_date, company_id, quote_id)
|
||||
VALUES
|
||||
(1, 'EXP-GL-002', CURRENT_TIMESTAMP, 1, '550e8400-e29b-41d4-a716-446655440001'),
|
||||
(2, 'EXP-TW-001', CURRENT_TIMESTAMP, 2, '550e8400-e29b-41d4-a716-446655440002');
|
||||
|
||||
-- === Tokens ===
|
||||
INSERT INTO token (id, token, token_type, revoked, expired, user_id)
|
||||
VALUES
|
||||
(1, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9-admin1', 'BEARER', false, false, 1),
|
||||
(2, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9-user1', 'BEARER', false, false, 2),
|
||||
(3, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9-admin2', 'BEARER', false, false, 3);
|
||||
@ -0,0 +1,5 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
|
||||
public interface AddressService {
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.RegisterRequest;
|
||||
import com.dh7789dev.xpeditis.dto.request.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.response.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.request.RegisterRequest;
|
||||
|
||||
public interface AuthenticationService {
|
||||
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface CompanyService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface DimensionService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface DocumentService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface ExportFolderService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface LicenseService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface NotificationService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface QuoteDetailsService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface QuoteService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface ShipmentTrackingService {
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.ChangePasswordRequest;
|
||||
import com.dh7789dev.xpeditis.dto.request.ChangePasswordRequest;
|
||||
|
||||
import java.security.Principal;
|
||||
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface VesselScheduleService {
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Quote {
|
||||
private Long id;
|
||||
private String reference;
|
||||
private String status;
|
||||
private BigDecimal estimatedAmount;
|
||||
private LocalDateTime createdAt = LocalDateTime.now();
|
||||
private UserAccount user;
|
||||
private Company company;
|
||||
private ExportFolder exportFile;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Address {
|
||||
private Long id;
|
||||
private String companyName;
|
||||
private String address;
|
||||
private String postalCode;
|
||||
private String country;
|
||||
private String type;
|
||||
private Company company;
|
||||
private LocalDateTime createdAt;
|
||||
private LocalDateTime modifiedAt;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -0,0 +1,13 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Dimension {
|
||||
private Long id;
|
||||
private Double length;
|
||||
private Double width;
|
||||
private Double height;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Document {
|
||||
private Long id;
|
||||
private String fileName;
|
||||
private String contentType;
|
||||
private byte[] data;
|
||||
}
|
||||
@ -1,10 +1,11 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@ -15,5 +16,7 @@ public class ExportFolder {
|
||||
private LocalDateTime validationDate;
|
||||
private Company company;
|
||||
private Quote quote;
|
||||
private List<Document> documents;
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@ -0,0 +1,19 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Notification {
|
||||
private Long id;
|
||||
private String message;
|
||||
private String type; // EMAIL, SMS, WEB
|
||||
private boolean read;
|
||||
private String recipient;
|
||||
private ExportFolder exportFolder;
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Quote {
|
||||
|
||||
private Long id;
|
||||
private String packager;
|
||||
private String customsImportExport;
|
||||
private Boolean eur1;
|
||||
private String packagingType;
|
||||
private List<QuoteDetail> details;
|
||||
private Boolean dangerousGoods;
|
||||
private Boolean tailgate;
|
||||
private Boolean straps;
|
||||
private Boolean thermalCover;
|
||||
private Boolean regulatedProducts;
|
||||
private Boolean appointmentRequired;
|
||||
private Boolean t1;
|
||||
private Boolean customsStop;
|
||||
private Boolean exportAssistance;
|
||||
private Boolean insurance;
|
||||
private String operationType;
|
||||
private String incoterm;
|
||||
private String departurePostalCode;
|
||||
private String departureCity;
|
||||
private LocalDate pickupDate;
|
||||
private String arrivalPostalCode;
|
||||
private String arrivalCity;
|
||||
private LocalDate deliveryDate;
|
||||
private UserAccount user;
|
||||
private Company company;
|
||||
private ExportFolder exportFile;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class QuoteDetail {
|
||||
private Long id;
|
||||
private Integer quantity;
|
||||
private Dimension dimension;
|
||||
private Double weight;
|
||||
private boolean stackable;
|
||||
private Long quoteId;
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ShipmentTracking {
|
||||
private Long id;
|
||||
private String containerNumber;
|
||||
private String imoNumber;
|
||||
private String mmsiNumber;
|
||||
private String vesselName;
|
||||
private Double currentLatitude;
|
||||
private Double currentLongitude;
|
||||
private Double speedKnots;
|
||||
private String status; // e.g. "Underway", "Moored", etc.
|
||||
private LocalDateTime eta;
|
||||
private LocalDateTime lastReported;
|
||||
private ExportFolder exportFolder;
|
||||
private LocalDateTime createdAt;
|
||||
private LocalDateTime modifiedAt;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@ -0,0 +1,43 @@
|
||||
package com.dh7789dev.xpeditis.dto.app;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class VesselSchedule {
|
||||
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("IMO")
|
||||
private String imoNumber;
|
||||
|
||||
@JsonProperty("MMSI")
|
||||
private String mmsiNumber;
|
||||
|
||||
@JsonProperty("SHIPNAME")
|
||||
private String vesselName;
|
||||
|
||||
@JsonProperty("VOYAGE")
|
||||
private String voyageNumber;
|
||||
|
||||
@JsonProperty("DEPARTURE_PORT")
|
||||
private String departurePort;
|
||||
|
||||
@JsonProperty("ARRIVAL_PORT")
|
||||
private String arrivalPort;
|
||||
|
||||
@JsonProperty("DEPARTURE_DATE")
|
||||
private LocalDateTime departureDate;
|
||||
|
||||
@JsonProperty("ARRIVAL_DATE")
|
||||
private LocalDateTime arrivalDate;
|
||||
|
||||
private LocalDateTime lastUpdated;
|
||||
|
||||
private ExportFolder exportFolder;
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.request;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AccessLevel;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.request;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.request;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AccessLevel;
|
||||
@ -31,7 +31,11 @@ public class RegisterRequest {
|
||||
String password;
|
||||
|
||||
@NotBlank
|
||||
String role; // Should be "USER" or "ADMIN"
|
||||
String phone;
|
||||
|
||||
String company_uuid = "";
|
||||
|
||||
String company_name;
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.dto.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -15,6 +16,7 @@ import java.util.Date;
|
||||
@NoArgsConstructor
|
||||
@FieldDefaults(level = AccessLevel.PRIVATE)
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class AuthenticationResponse {
|
||||
|
||||
@JsonProperty("access_token")
|
||||
@ -28,4 +30,7 @@ public class AuthenticationResponse {
|
||||
|
||||
@JsonProperty("expires_at")
|
||||
Date expiresAt;
|
||||
|
||||
@JsonProperty("error_message")
|
||||
String error;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package com.dh7789dev.xpeditis.dto;
|
||||
package com.dh7789dev.xpeditis.exception;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.AccessLevel;
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AddressServiceImpl implements AddressService{
|
||||
}
|
||||
@ -1,10 +1,8 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.RegisterRequest;
|
||||
import com.dh7789dev.xpeditis.dto.UserAccount;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import com.dh7789dev.xpeditis.dto.request.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.response.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.request.RegisterRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@ -23,6 +21,6 @@ public class AuthenticationServiceImpl implements AuthenticationService {
|
||||
|
||||
@Override
|
||||
public AuthenticationResponse register(RegisterRequest request) {
|
||||
return null;
|
||||
return authenticationRepository.register(request);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CompanyServiceImpl implements CompanyService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DimensionServiceImpl implements DimensionService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DocumentServiceImpl implements DocumentService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ExportFolderServiceImpl implements ExportFolderService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class LicenseServiceImpl implements LicenseService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class NotificationServiceImpl implements NotificationService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class QuoteDetailsServiceImpl implements QuoteDetailsService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class QuoteServiceImpl implements QuoteService {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ShipmentTrackingServiceImpl implements ShipmentTrackingService {
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.ChangePasswordRequest;
|
||||
import com.dh7789dev.xpeditis.dto.request.ChangePasswordRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.security.Principal;
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class VesselScheduleServiceImpl implements VesselScheduleService {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface AddressRepository {
|
||||
}
|
||||
@ -1,9 +1,11 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.request.AuthenticationRequest;
|
||||
import com.dh7789dev.xpeditis.dto.response.AuthenticationResponse;
|
||||
import com.dh7789dev.xpeditis.dto.request.RegisterRequest;
|
||||
|
||||
public interface AuthenticationRepository {
|
||||
|
||||
AuthenticationResponse authenticate(AuthenticationRequest request);
|
||||
AuthenticationResponse register(RegisterRequest request);
|
||||
}
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface CompanyRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface DimensionRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface DocumentRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface ExportFolderRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface LicenseRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface NotificationRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface QuoteDetailsRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface QuoteRepository {
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface ShipmentTrackingRepository {
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.ChangePasswordRequest;
|
||||
import com.dh7789dev.xpeditis.dto.request.ChangePasswordRequest;
|
||||
|
||||
import java.security.Principal;
|
||||
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
package com.dh7789dev.xpeditis;
|
||||
|
||||
public interface VesselScheduleRepository {
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.AddressEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface AddressDao extends JpaRepository<AddressEntity, Long> {
|
||||
}
|
||||
@ -3,5 +3,6 @@ package com.dh7789dev.xpeditis.dao;
|
||||
import com.dh7789dev.xpeditis.entity.CompanyEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface CompanyDao extends JpaRepository<CompanyEntity, Long> {
|
||||
}
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.DimensionEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface DimensionDao extends JpaRepository<DimensionEntity, Long> {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.DocumentEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface DocumentDao extends JpaRepository<DocumentEntity, Long> {
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.LicenseEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface LicenseDao extends JpaRepository<LicenseDao, Long> {
|
||||
public interface LicenseDao extends JpaRepository<LicenseEntity, Long> {
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.NotificationEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface NotificationDao extends JpaRepository<NotificationEntity, Long> {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.QuoteDetailEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface QuoteDetailDao extends JpaRepository<QuoteDetailEntity, Long> {
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.ShipmentTrackingEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ShipmentTrackingDao extends JpaRepository<ShipmentTrackingEntity, Long> {
|
||||
}
|
||||
@ -6,13 +6,16 @@ import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
@Repository
|
||||
public interface TokenDao extends JpaRepository<TokenEntity, Integer> {
|
||||
|
||||
Optional<TokenEntity> findByToken(String token);
|
||||
|
||||
@Query(value = """
|
||||
select t from TokenEntity t inner join UserAccountEntity u\s
|
||||
select t from TokenEntity t inner join UserEntity u\s
|
||||
on t.user.id = u.id\s
|
||||
where u.id = :userId and (t.expired = false or t.revoked = false)\s
|
||||
""")
|
||||
|
||||
@ -5,7 +5,13 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
public interface UserDao extends JpaRepository<UserEntity, Long> {
|
||||
|
||||
@Query("SELECT u FROM UserEntity u WHERE u.username = :username")
|
||||
Optional<UserEntity> findByUsername(String username);
|
||||
boolean existsByUsername(String username);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.dh7789dev.xpeditis.dao;
|
||||
|
||||
import com.dh7789dev.xpeditis.entity.VesselScheduleEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface VesselScheduleDao extends JpaRepository<VesselScheduleEntity, Long> {
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "Address")
|
||||
public class AddressEntity extends BaseEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "company_name", length = 100)
|
||||
private String companyName;
|
||||
|
||||
@Column(name = "address", length = 200)
|
||||
private String address;
|
||||
|
||||
@Column(name = "postal_code", length = 10)
|
||||
private String postalCode;
|
||||
|
||||
@Column(name = "country", length = 50)
|
||||
private String country;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "type", length = 20, nullable = false)
|
||||
private AddressType type;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "company_id", nullable = false)
|
||||
private CompanyEntity company;
|
||||
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum AddressType {
|
||||
SHIPPER("Shipper"),
|
||||
CONSIGNEE("Consignee"),
|
||||
NOTIFY("Notify");
|
||||
|
||||
private final String displayName;
|
||||
}
|
||||
@ -1,19 +1,43 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "Company")
|
||||
public class CompanyEntity extends BaseEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "name", length = 50)
|
||||
private String name;
|
||||
|
||||
@Column(name = "country", length = 50)
|
||||
private String country;
|
||||
|
||||
@Column(name = "siren")
|
||||
private String siren;
|
||||
|
||||
@Column(name = "num_eori")
|
||||
private String num_eori;
|
||||
|
||||
@Column(name = "phone", length = 20)
|
||||
private String phone;
|
||||
|
||||
@OneToMany(mappedBy = "company", cascade = CascadeType.ALL)
|
||||
private List<UserEntity> users;
|
||||
|
||||
@ -22,5 +46,22 @@ public class CompanyEntity extends BaseEntity {
|
||||
|
||||
@OneToMany(mappedBy = "company", cascade = CascadeType.ALL)
|
||||
private List<ExportFolderEntity> exports;
|
||||
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "dimension")
|
||||
public class DimensionEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "length")
|
||||
private Double length;
|
||||
|
||||
@Column(name = "width")
|
||||
private Double width;
|
||||
|
||||
@Column(name = "height")
|
||||
private Double height;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "document")
|
||||
public class DocumentEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(unique = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "file_name", nullable = false)
|
||||
private String fileName;
|
||||
|
||||
@Column(name = "content_type")
|
||||
private String contentType;
|
||||
|
||||
@Lob
|
||||
@Column(name = "data", nullable = false)
|
||||
private byte[] data;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "export_folder_id")
|
||||
private ExportFolderEntity exportFolder;
|
||||
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,24 +1,63 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "exportfolder")
|
||||
public class ExportFolderEntity extends BaseEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(unique = true)
|
||||
private String reference;
|
||||
|
||||
@Column(name = "validationDate")
|
||||
private LocalDateTime validationDate;
|
||||
|
||||
@OneToMany(mappedBy = "exportFolder", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<DocumentEntity> documents;
|
||||
|
||||
@OneToMany(mappedBy = "exportFolder", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<ShipmentTrackingEntity> trackingUpdates = new ArrayList<>();
|
||||
|
||||
@ManyToOne
|
||||
private CompanyEntity company;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "quote_id", unique = true)
|
||||
private QuoteEntity quote;
|
||||
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,17 +1,32 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "License")
|
||||
public class LicenseEntity extends BaseEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(unique = true)
|
||||
private String licenseKey;
|
||||
|
||||
@Column(name = "expirationDate")
|
||||
private LocalDate expirationDate;
|
||||
|
||||
private boolean active;
|
||||
@ -19,5 +34,22 @@ public class LicenseEntity extends BaseEntity {
|
||||
@OneToOne
|
||||
@JoinColumn(name = "user_id", unique = true)
|
||||
private UserEntity user;
|
||||
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "notification")
|
||||
public class NotificationEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String message;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private NotificationType type; // EMAIL, SMS, WEB
|
||||
|
||||
@Column(nullable = false)
|
||||
private boolean read = false;
|
||||
|
||||
@Column(name = "recipient")
|
||||
private String recipient; // email ou numéro téléphone
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "export_folder_id")
|
||||
private ExportFolderEntity exportFolder;
|
||||
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
public enum NotificationType {
|
||||
EMAIL,
|
||||
SMS,
|
||||
WEB
|
||||
}
|
||||
|
||||
@ -7,6 +7,10 @@ import lombok.RequiredArgsConstructor;
|
||||
@RequiredArgsConstructor
|
||||
public enum Permission {
|
||||
|
||||
ADMIN_PLATFORM_READ("admin_platform:read"),
|
||||
ADMIN_PLATFORM_UPDATE("admin_platform:update"),
|
||||
ADMIN_PLATFORM_DELETE("admin_platform:create"),
|
||||
ADMIN_PLATFORM_CREATE("admin_platform:delete"),
|
||||
ADMIN_READ("admin:read"),
|
||||
ADMIN_UPDATE("admin:update"),
|
||||
ADMIN_CREATE("admin:create"),
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "quote_details")
|
||||
public class QuoteDetailEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "quantity")
|
||||
private Integer quantity;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "dimension_id", referencedColumnName = "id")
|
||||
private DimensionEntity dimension;
|
||||
|
||||
@Column(name = "weight")
|
||||
private Double weight;
|
||||
|
||||
@Column(name = "gerbable")
|
||||
private boolean gerbable;
|
||||
|
||||
// Relation Many-to-One avec Quote
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "quote_id", nullable = false)
|
||||
private QuoteEntity quote;
|
||||
|
||||
}
|
||||
@ -1,25 +1,110 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "Quote")
|
||||
public class QuoteEntity extends BaseEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(unique = true, nullable = false)
|
||||
// General Information
|
||||
@Column(name = "packager")
|
||||
private String packager;
|
||||
|
||||
@Column(unique = true)
|
||||
private String reference;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String status;
|
||||
//Douane
|
||||
@Column(name = "customs_import_export")
|
||||
private String customsImportExport;
|
||||
|
||||
private BigDecimal estimatedAmount;
|
||||
@Column(name = "eur1")
|
||||
private Boolean eur1;
|
||||
|
||||
private LocalDateTime createdAt = LocalDateTime.now();
|
||||
@Column(name = "packaging_type")
|
||||
private String packagingType;
|
||||
|
||||
@OneToMany(mappedBy = "quote", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
|
||||
private List<QuoteDetailEntity> details = new ArrayList<>();
|
||||
|
||||
@Column(name = "dangerous_goods")
|
||||
private Boolean dangerousGoods;
|
||||
|
||||
@Column(name = "tailgate")
|
||||
private Boolean tailgate;
|
||||
|
||||
@Column(name = "straps")
|
||||
private Boolean straps;
|
||||
|
||||
@Column(name = "thermal_cover")
|
||||
private Boolean thermalCover;
|
||||
|
||||
@Column(name = "regulated_products")
|
||||
private Boolean regulatedProducts;
|
||||
|
||||
@Column(name = "appointment_required")
|
||||
private Boolean appointmentRequired;
|
||||
|
||||
@Column(name = "t1")
|
||||
private Boolean t1;
|
||||
|
||||
@Column(name = "customs_stop")
|
||||
private Boolean customsStop;
|
||||
|
||||
@Column(name = "export_assistance")
|
||||
private Boolean exportAssistance;
|
||||
|
||||
@Column(name = "insurance")
|
||||
private Boolean insurance;
|
||||
|
||||
@Column(name = "operation_type")
|
||||
private String operationType;
|
||||
|
||||
@Column(name = "incoterm")
|
||||
private String incoterm;
|
||||
|
||||
@Column(name = "departure_postal_code")
|
||||
private String departurePostalCode;
|
||||
|
||||
@Column(name = "departure_city")
|
||||
private String departureCity;
|
||||
|
||||
@Column(name = "pickup_date")
|
||||
private LocalDate pickupDate;
|
||||
|
||||
@Column(name = "arrival_postal_code")
|
||||
private String arrivalPostalCode;
|
||||
|
||||
@Column(name = "arrival_city")
|
||||
private String arrivalCity;
|
||||
|
||||
@Column(name = "delivery_date")
|
||||
private LocalDate deliveryDate;
|
||||
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@ManyToOne
|
||||
private UserEntity user;
|
||||
@ -29,5 +114,16 @@ public class QuoteEntity extends BaseEntity {
|
||||
|
||||
@OneToOne(mappedBy = "quote", cascade = CascadeType.ALL)
|
||||
private ExportFolderEntity exportFile;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,21 @@ public enum Role {
|
||||
MANAGER_READ,
|
||||
MANAGER_UPDATE,
|
||||
MANAGER_DELETE,
|
||||
MANAGER_CREATE));
|
||||
MANAGER_CREATE)),
|
||||
ADMIN_PLATFORM(Set.of(
|
||||
ADMIN_PLATFORM_READ,
|
||||
ADMIN_PLATFORM_UPDATE,
|
||||
ADMIN_PLATFORM_DELETE,
|
||||
ADMIN_PLATFORM_CREATE,
|
||||
ADMIN_READ,
|
||||
ADMIN_UPDATE,
|
||||
ADMIN_DELETE,
|
||||
ADMIN_CREATE,
|
||||
MANAGER_READ,
|
||||
MANAGER_UPDATE,
|
||||
MANAGER_DELETE,
|
||||
MANAGER_CREATE)
|
||||
);
|
||||
|
||||
private final Set<Permission> permissions;
|
||||
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "shipment_tracking")
|
||||
public class ShipmentTrackingEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "container_number")
|
||||
private String containerNumber;
|
||||
|
||||
@Column(name = "imo_number")
|
||||
private String imoNumber;
|
||||
|
||||
@Column(name = "mmsi_number")
|
||||
private String mmsiNumber;
|
||||
|
||||
@Column(name = "vessel_name")
|
||||
private String vesselName;
|
||||
|
||||
@Column(name = "current_latitude")
|
||||
private Double currentLatitude;
|
||||
|
||||
@Column(name = "current_longitude")
|
||||
private Double currentLongitude;
|
||||
|
||||
@Column(name = "speed_knots")
|
||||
private Double speedKnots;
|
||||
|
||||
@Column(name = "status")
|
||||
private String status; // e.g. "Underway", "Moored", etc.
|
||||
|
||||
@Column(name = "eta")
|
||||
private LocalDateTime eta;
|
||||
|
||||
@Column(name = "last_reported")
|
||||
private LocalDateTime lastReported;
|
||||
|
||||
// Relation avec ExportFolder
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "export_folder_id", nullable = false)
|
||||
private ExportFolderEntity exportFolder;
|
||||
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
lastReported = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,21 +1,16 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Entity
|
||||
@Table(name = "Token", uniqueConstraints = @UniqueConstraint(columnNames = "token"))
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@Table(name = "token", uniqueConstraints = {
|
||||
@UniqueConstraint(columnNames = {"token"})
|
||||
})
|
||||
public class TokenEntity extends BaseEntity {
|
||||
|
||||
public enum Type {
|
||||
@ -29,7 +24,6 @@ public class TokenEntity extends BaseEntity {
|
||||
private Type tokenType = Type.BEARER;
|
||||
|
||||
private boolean revoked;
|
||||
|
||||
private boolean expired;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
|
||||
@ -1,18 +1,27 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
import org.hibernate.annotations.NaturalId;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "Users")
|
||||
public class UserEntity extends BaseEntity implements UserDetails {
|
||||
|
||||
@NaturalId
|
||||
@ -31,6 +40,9 @@ public class UserEntity extends BaseEntity implements UserDetails {
|
||||
@Column(nullable = false)
|
||||
private String password;
|
||||
|
||||
@Column(name = "phone", length = 20)
|
||||
private String phone;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private Role role;
|
||||
@ -50,14 +62,21 @@ public class UserEntity extends BaseEntity implements UserDetails {
|
||||
@OneToMany(mappedBy = "user")
|
||||
private List<TokenEntity> tokens;
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return password;
|
||||
@Column(name = "created_at", updatable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "modified_at")
|
||||
private LocalDateTime modifiedAt;
|
||||
|
||||
@PrePersist
|
||||
public void onCreate() {
|
||||
createdAt = LocalDateTime.now();
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return username;
|
||||
@PreUpdate
|
||||
public void onUpdate() {
|
||||
modifiedAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,8 +106,9 @@ public class UserEntity extends BaseEntity implements UserDetails {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserEntity(" + super.toString() + String.format("username=%s, firstName=%s, lastName=%s, email=%s, role=%s)",
|
||||
username, firstName, lastName, email, role.name());
|
||||
return "UserEntity(" + super.toString() + String.format(
|
||||
"username=%s, firstName=%s, lastName=%s, email=%s, role=%s)",
|
||||
username, firstName, lastName, email, role.name()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package com.dh7789dev.xpeditis.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@FieldNameConstants
|
||||
@FieldDefaults( level = AccessLevel.PRIVATE)
|
||||
@Table(name = "vessel_schedule")
|
||||
public class VesselScheduleEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "imo_number") // Numéro unique du navire
|
||||
private String imoNumber;
|
||||
|
||||
@Column(name = "mmsi_number") // Maritime Mobile Service Identity
|
||||
private String mmsiNumber;
|
||||
|
||||
@Column(name = "vessel_name")
|
||||
private String vesselName;
|
||||
|
||||
@Column(name = "voyage_number")
|
||||
private String voyageNumber;
|
||||
|
||||
@Column(name = "departure_port")
|
||||
private String departurePort;
|
||||
|
||||
@Column(name = "arrival_port")
|
||||
private String arrivalPort;
|
||||
|
||||
@Column(name = "departure_date")
|
||||
private LocalDateTime departureDate;
|
||||
|
||||
@Column(name = "arrival_date")
|
||||
private LocalDateTime arrivalDate;
|
||||
|
||||
@Column(name = "last_updated")
|
||||
private LocalDateTime lastUpdated;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "export_folder_id", nullable = false)
|
||||
private ExportFolderEntity exportFolder;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.dh7789dev.xpeditis.mapper;
|
||||
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.app.Address;
|
||||
import com.dh7789dev.xpeditis.entity.AddressEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingConstants;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, uses = { CompanyMapper.class })
|
||||
public interface AddressMapper {
|
||||
|
||||
AddressMapper INSTANCE = Mappers.getMapper(AddressMapper.class);
|
||||
|
||||
AddressEntity addressToAddressEntity(Address address);
|
||||
|
||||
Address addressEntityToAddress(AddressEntity addressEntity);
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.mapper;
|
||||
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.Company;
|
||||
import com.dh7789dev.xpeditis.dto.app.Company;
|
||||
import com.dh7789dev.xpeditis.entity.CompanyEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package com.dh7789dev.xpeditis.mapper;
|
||||
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.app.Dimension;
|
||||
import com.dh7789dev.xpeditis.entity.DimensionEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DimensionMapper {
|
||||
DimensionMapper INSTANCE = Mappers.getMapper(DimensionMapper.class);
|
||||
|
||||
DimensionEntity dimensionToDimensionEntity(Dimension dimension);
|
||||
|
||||
Dimension dimensionEntityToDimension(DimensionEntity dimensionEntity);
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.dh7789dev.xpeditis.mapper;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.app.Document;
|
||||
import com.dh7789dev.xpeditis.entity.DocumentEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DocumentMapper {
|
||||
DocumentMapper INSTANCE = Mappers.getMapper(DocumentMapper.class);
|
||||
|
||||
DocumentEntity documentToDocumentEntity(Document document);
|
||||
Document documentEntityToDocument(DocumentEntity documentEntity);
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package com.dh7789dev.xpeditis.mapper;
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.ExportFolder;
|
||||
import com.dh7789dev.xpeditis.dto.app.ExportFolder;
|
||||
import com.dh7789dev.xpeditis.entity.ExportFolderEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingConstants;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING)
|
||||
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, uses = { DocumentMapper.class, CompanyMapper.class })
|
||||
public interface ExportFolderMapper {
|
||||
ExportFolderMapper INSTANCE = Mappers.getMapper(ExportFolderMapper.class);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package com.dh7789dev.xpeditis.mapper;
|
||||
|
||||
|
||||
import com.dh7789dev.xpeditis.dto.License;
|
||||
import com.dh7789dev.xpeditis.dto.app.License;
|
||||
import com.dh7789dev.xpeditis.entity.LicenseEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user