├── .gradle ├── 8.2.1 │ ├── gc.properties │ ├── fileChanges │ │ └── last-build.bin │ ├── dependencies-accessors │ │ ├── gc.properties │ │ └── dependencies-accessors.lock │ ├── checksums │ │ ├── checksums.lock │ │ ├── md5-checksums.bin │ │ └── sha1-checksums.bin │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ └── executionHistory │ │ ├── executionHistory.bin │ │ └── executionHistory.lock ├── vcs-1 │ └── gc.properties ├── buildOutputCleanup │ ├── cache.properties │ ├── outputFiles.bin │ └── buildOutputCleanup.lock └── file-system.probe ├── README.md ├── settings.gradle ├── .gitattributes ├── .vscode └── settings.json ├── src ├── main │ ├── java │ │ └── com │ │ │ └── ecommerce │ │ │ └── shopping │ │ │ └── ecommerceuserpannelapi │ │ │ ├── controllers │ │ │ ├── CartController.java │ │ │ ├── OrderController.java │ │ │ ├── CustomerController.java │ │ │ ├── PaymentsController.java │ │ │ ├── ProductController.java │ │ │ ├── InformationController.java │ │ │ ├── controller.java │ │ │ ├── UserController.java │ │ │ ├── AuthController.java │ │ │ └── ThymeleafController.java │ │ │ ├── Authentication │ │ │ ├── AuthResponseDto.java │ │ │ ├── LoginRequest.java │ │ │ ├── UserDetailsServicesImpl.java │ │ │ └── AuthServiceImpl.java │ │ │ ├── imples │ │ │ ├── ProductImpl.java │ │ │ ├── ContactUsImpl.java │ │ │ ├── HelpUsImpl.java │ │ │ ├── TermsAndConditionsImpl.java │ │ │ ├── HomeImageSliderImpl.java │ │ │ ├── AboutUsImpl.java │ │ │ └── UserImpl.java │ │ │ ├── repositories │ │ │ ├── AuthService.java │ │ │ ├── HelpUsDao.java │ │ │ ├── ContactUsDao.java │ │ │ ├── HomeImageSliderDao.java │ │ │ ├── TermsAndConditionsDao.java │ │ │ ├── ProductDao.java │ │ │ ├── UserDao.java │ │ │ └── AboutUsDao.java │ │ │ ├── services │ │ │ ├── ProductService.java │ │ │ ├── ContactUsServices.java │ │ │ ├── HelpUs_Services.java │ │ │ ├── HomeImageSliderService.java │ │ │ ├── TermsAndConditions_Services.java │ │ │ ├── AuthenticationService.java │ │ │ ├── AboutUsService.java │ │ │ └── UserServices.java │ │ │ ├── payloads │ │ │ ├── ApiResponse.java │ │ │ └── ApiResponseObject.java │ │ │ ├── EcommerceApiApplication.java │ │ │ ├── entities │ │ │ ├── AboutUs.java │ │ │ ├── ContactUs.java │ │ │ ├── HomeImageSlider.java │ │ │ ├── LoginData.java │ │ │ ├── TermsAndConditions.java │ │ │ ├── HelpUs.java │ │ │ ├── Product │ │ │ │ ├── ProductLog.java │ │ │ │ ├── ProductImage.java │ │ │ │ ├── ProductTags.java │ │ │ │ └── ProductEntity.java │ │ │ └── UserEntities.java │ │ │ ├── config │ │ │ ├── CustomAuthenticationEntryPoints.java │ │ │ ├── AuthenticationConfig.java │ │ │ ├── SecurityFilterChainConfig.java │ │ │ └── JWTAuthenticationFilter.java │ │ │ ├── utils │ │ │ └── JWTUtils.java │ │ │ └── exception │ │ │ └── GlobalExceptionHandler.java │ └── resources │ │ ├── templates │ │ ├── iterate.html │ │ ├── condition.html │ │ ├── error.html │ │ ├── footer.html │ │ ├── services.html │ │ ├── success.html │ │ ├── contact.html │ │ ├── loginForm.html │ │ ├── about.html │ │ └── base.html │ │ ├── application.properties │ │ └── static │ │ └── style │ │ └── style.css └── test │ └── java │ └── com │ └── ecommerce │ └── shopping │ └── ecommerceuserpannelapi │ └── EcommerceUserPannelApiApplicationTests.java ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── local.properties ├── .gitignore ├── LICENSE ├── HELP.md ├── gradlew.bat └── gradlew /.gradle/8.2.1/gc.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ecommerce-api 2 | 3 | -------------------------------------------------------------------------------- /.gradle/8.2.1/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/8.2.1/dependencies-accessors/gc.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ecommerce-api' 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Sun Aug 27 19:22:52 IST 2023 2 | gradle.version=8.2.1 3 | -------------------------------------------------------------------------------- /.gradle/file-system.probe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/file-system.probe -------------------------------------------------------------------------------- /.gradle/8.2.1/checksums/checksums.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/checksums/checksums.lock -------------------------------------------------------------------------------- /.gradle/8.2.1/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/8.2.1/checksums/md5-checksums.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/checksums/md5-checksums.bin -------------------------------------------------------------------------------- /.gradle/8.2.1/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.compile.nullAnalysis.mode": "automatic", 3 | "java.debug.settings.onBuildFailureProceed": true 4 | } -------------------------------------------------------------------------------- /.gradle/8.2.1/checksums/sha1-checksums.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/checksums/sha1-checksums.bin -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /.gradle/8.2.1/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /.gradle/8.2.1/executionHistory/executionHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/executionHistory/executionHistory.bin -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /.gradle/8.2.1/executionHistory/executionHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/executionHistory/executionHistory.lock -------------------------------------------------------------------------------- /.gradle/8.2.1/dependencies-accessors/dependencies-accessors.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamapuneet/ecommerce-api/HEAD/.gradle/8.2.1/dependencies-accessors/dependencies-accessors.lock -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/CartController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | public class CartController { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | public class OrderController { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/CustomerController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | public class CustomerController { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/PaymentsController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | public class PaymentsController { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/Authentication/AuthResponseDto.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.Authentication; 2 | 3 | 4 | public record AuthResponseDto(String token, String email,String mobile) { 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/imples/ProductImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.imples; 2 | 3 | import org.springframework.stereotype.Service; 4 | 5 | @Service 6 | public class ProductImpl { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | import org.springframework.web.bind.annotation.RestController; 4 | 5 | @RestController 6 | public class ProductController { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/AuthService.java: -------------------------------------------------------------------------------- 1 | //package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | // 3 | //public interface AuthService { 4 | // String login(String s, String password); 5 | // 6 | // String signUp(String name,String userName, String password, String mobile) ; 7 | //} 8 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/HelpUsDao.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.HelpUs; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface HelpUsDao extends JpaRepository { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/ProductService.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | import org.springframework.stereotype.Service; 3 | 4 | @Service 5 | interface ProductService { 6 | default void addProduct(){} 7 | default void removeProduct(){} 8 | default void showProduct(){} 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/Authentication/LoginRequest.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.Authentication; 2 | 3 | import lombok.*; 4 | 5 | @Setter 6 | @Getter 7 | @AllArgsConstructor 8 | @NoArgsConstructor 9 | @ToString 10 | public class LoginRequest { 11 | private String email; 12 | private String password; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/ContactUsDao.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.ContactUs; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface ContactUsDao extends JpaRepository { 7 | } 8 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file must *NOT* be checked into Version Control Systems, 2 | # as it contains information specific to your local configuration. 3 | # 4 | # Location of the SDK. This is only used by Gradle. 5 | # For customization when using a Version Control System, please read the 6 | # header note. 7 | #Sat Sep 30 10:01:46 IST 2023 8 | sdk.dir=C\:\\Users\\DELL\\AppData\\Local\\Android\\Sdk 9 | -------------------------------------------------------------------------------- /src/test/java/com/ecommerce/shopping/ecommerceuserpannelapi/EcommerceUserPannelApiApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class EcommerceApiApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/HomeImageSliderDao.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.HomeImageSlider; 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface HomeImageSliderDao extends JpaRepository { 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | replay_pid* 25 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/ContactUsServices.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.ContactUs; 4 | import org.springframework.stereotype.Service; 5 | 6 | @Service 7 | public interface ContactUsServices { 8 | ContactUs postContactUs(ContactUs contactUs); 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/TermsAndConditionsDao.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.TermsAndConditions; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface TermsAndConditionsDao extends JpaRepository { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/HelpUs_Services.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.HelpUs; 4 | import org.springframework.stereotype.Service; 5 | 6 | @Service 7 | public interface HelpUs_Services { 8 | HelpUs getHelUs(); 9 | HelpUs postHelUs(HelpUs helpUs); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/payloads/ApiResponse.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.payloads; 2 | import lombok.*; 3 | import org.springframework.http.HttpStatus; 4 | 5 | @Getter 6 | @Setter 7 | @NoArgsConstructor 8 | @ToString 9 | @AllArgsConstructor 10 | public class ApiResponse{ 11 | private HttpStatus err_code; 12 | private String status; 13 | private String message; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/ProductDao.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.Product.ProductEntity; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | @Repository 8 | public interface ProductDao extends JpaRepository { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/EcommerceApiApplication.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi; 2 | import org.springframework.boot.SpringApplication; 3 | import org.springframework.boot.autoconfigure.SpringBootApplication; 4 | @SpringBootApplication 5 | public class EcommerceApiApplication { 6 | public static void main(String[] args) { 7 | SpringApplication.run(EcommerceApiApplication.class, args); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/HomeImageSliderService.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.HomeImageSlider; 4 | import org.springframework.stereotype.Service; 5 | 6 | import java.util.List; 7 | @Service 8 | public interface HomeImageSliderService{ 9 | List getImageSlider(); 10 | HomeImageSlider postImageSlider(HomeImageSlider homeImageSlider); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/TermsAndConditions_Services.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.TermsAndConditions; 4 | import org.springframework.stereotype.Service; 5 | 6 | @Service 7 | public interface TermsAndConditions_Services { 8 | TermsAndConditions getTermsAndConditions(); 9 | TermsAndConditions postTermsAndConditions(TermsAndConditions termsAndConditions); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/AboutUs.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities; 2 | import jakarta.persistence.*; 3 | import lombok.*; 4 | 5 | @Entity 6 | @Table(name = "about_us") 7 | @Setter 8 | @Getter 9 | @AllArgsConstructor 10 | @NoArgsConstructor 11 | public class AboutUs { 12 | @Id 13 | @Column(name = "title") 14 | private String title; 15 | @Column(name = "description", columnDefinition = "TEXT") 16 | private String desc; 17 | 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.UserEntities; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.Optional; 8 | 9 | @Repository 10 | public interface UserDao extends JpaRepository { 11 | Optional findByEmail(String email); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/ContactUs.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities; 2 | import jakarta.persistence.Entity; 3 | import jakarta.persistence.Id; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | 9 | @Entity 10 | @Setter 11 | @Getter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | public class ContactUs { 15 | @Id 16 | private String id; 17 | private String title; 18 | private String des; 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/imples/ContactUsImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.imples; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.ContactUs; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.ContactUsServices; 5 | 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class ContactUsImpl implements ContactUsServices { 10 | @Override 11 | public ContactUs postContactUs(ContactUs contactUs) { 12 | return null; 13 | } 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/imples/HelpUsImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.imples; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.HelpUs; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.HelpUs_Services; 5 | 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class HelpUsImpl implements HelpUs_Services{ 10 | @Override 11 | public HelpUs getHelUs() { 12 | return null; 13 | } 14 | 15 | @Override 16 | public HelpUs postHelUs(HelpUs helpUs) { 17 | return null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/HomeImageSlider.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities; 2 | import jakarta.persistence.Entity; 3 | import jakarta.persistence.Id; 4 | import jakarta.persistence.Table; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Getter; 7 | import lombok.NoArgsConstructor; 8 | import lombok.Setter; 9 | 10 | @Entity 11 | @Setter 12 | @Getter 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @Table(name = "HomeImageSlider") 16 | public class HomeImageSlider { 17 | @Id 18 | private long id; 19 | private String name; 20 | private String url; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/LoginData.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities; 2 | import jakarta.persistence.Table; 3 | import jakarta.validation.constraints.*; 4 | import lombok.*; 5 | 6 | @Getter 7 | @Setter 8 | @ToString 9 | public class LoginData { 10 | @NotBlank(message = "Username is required!") 11 | @Size(min = 3, max = 12, message = "Username must be between 3 and 12 characters") 12 | private String username; 13 | 14 | @NotBlank(message = "Email is required!") 15 | @Email(message = "Please enter a valid email address") 16 | private String email; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/AuthenticationService.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponseObject; 4 | import jakarta.annotation.Nullable; 5 | import jakarta.validation.constraints.NotBlank; 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public interface AuthenticationService { 10 | 11 | ApiResponseObject login(String emailAndMobile, String password); 12 | 13 | ApiResponseObject signUp(String userName, String password,@Nullable String mobile,@Nullable String email) ; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/AboutUsService.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.AboutUs; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponse; 5 | import org.springframework.http.ResponseEntity; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.Optional; 9 | 10 | @Service 11 | public interface AboutUsService { 12 | Optional getAboutUs(); 13 | ResponseEntity updateAboutUs(AboutUs aboutUs, boolean create); 14 | ResponseEntity deleteAboutUs(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/services/UserServices.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.services; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.UserEntities; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponseObject; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.List; 8 | 9 | @Service 10 | public interface UserServices { 11 | ApiResponseObject getUser(Long id); 12 | ApiResponseObject> getAllUser(); 13 | ApiResponseObject addUser(UserEntities profile); 14 | ApiResponseObject deleteUser(Long id); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/payloads/ApiResponseObject.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.payloads; 2 | import lombok.*; 3 | import org.springframework.http.HttpStatus; 4 | 5 | @Getter 6 | @Setter 7 | @NoArgsConstructor 8 | @ToString 9 | public class ApiResponseObject { 10 | private HttpStatus err_code; 11 | private String message; 12 | private String status; 13 | private T data; 14 | public ApiResponseObject(HttpStatus errCode, String message, String status, T data ) { 15 | this.err_code = errCode; 16 | this.message = message; 17 | this.status = status; 18 | if (data != null) { 19 | this.data = data; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/TermsAndConditions.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.Id; 6 | import jakarta.persistence.Table; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Getter; 9 | import lombok.NoArgsConstructor; 10 | import lombok.Setter; 11 | 12 | @Entity 13 | @Setter 14 | @Getter 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @Table(name = "TermsAndConditions") 18 | public class TermsAndConditions { 19 | @Id 20 | private long id; 21 | private String title; 22 | @Column(name = "description", length = 10000) 23 | private String desc; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/imples/TermsAndConditionsImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.imples; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.TermsAndConditions; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.TermsAndConditions_Services; 5 | 6 | import org.springframework.stereotype.Service; 7 | 8 | @Service 9 | public class TermsAndConditionsImpl implements TermsAndConditions_Services { 10 | @Override 11 | public TermsAndConditions getTermsAndConditions() { 12 | return null; 13 | } 14 | 15 | @Override 16 | public TermsAndConditions postTermsAndConditions(TermsAndConditions termsAndConditions) { 17 | return null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/templates/iterate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | Iterate 10 | 11 | 12 | 13 | 14 |

Iterate

15 |
    16 |
  • 17 | 19 |
  • 20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/HelpUs.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities; 2 | import jakarta.persistence.Column; 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.Id; 5 | import jakarta.persistence.Table; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | import lombok.Setter; 10 | 11 | @Entity 12 | @Setter 13 | @Getter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Table(name = "Help_us") 17 | public class HelpUs { 18 | @Id 19 | @Column(nullable = false) 20 | private long id; 21 | @Column(name = "title") 22 | private String title; 23 | 24 | @Column(name = "Url", length = 2000) 25 | private String Url; 26 | @Column(name = "description", length = 10000) 27 | private String desc; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/repositories/AboutUsDao.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.repositories; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.AboutUs; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Modifying; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.data.repository.query.Param; 8 | 9 | import java.util.Optional; 10 | 11 | public interface AboutUsDao extends JpaRepository { 12 | @Query("SELECT a FROM AboutUs a ORDER BY a.title ASC") 13 | Optional findFirstAboutUs(); 14 | @Modifying 15 | @Query("INSERT INTO AboutUs ( desc, title) VALUES ( :desc, :title)") 16 | void insertAboutUs( @Param("desc") String desc, @Param("title") String title); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/config/CustomAuthenticationEntryPoints.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.config; 2 | 3 | import jakarta.servlet.ServletException; 4 | import jakarta.servlet.http.HttpServletRequest; 5 | import jakarta.servlet.http.HttpServletResponse; 6 | import org.springframework.http.HttpStatus; 7 | import org.springframework.security.core.AuthenticationException; 8 | import org.springframework.security.web.AuthenticationEntryPoint; 9 | import org.springframework.stereotype.Component; 10 | 11 | import java.io.IOException; 12 | @Component 13 | public class CustomAuthenticationEntryPoints implements AuthenticationEntryPoint { 14 | @Override 15 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException { 16 | response.sendError(HttpStatus.UNAUTHORIZED.value(), authException.getMessage()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/templates/condition.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Condition 7 | 8 | 9 | 10 |

user is

12 |
13 | 14 |
15 |
16 |

Show Box is

17 |
18 | 19 |
20 |

No fruits

21 |

Apple

22 |

Banana (2 fruits)

23 |

Orange

24 |

Papaya

25 |

Many fruits (more than 4)

26 |
27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 404 Error - Page Not Found 7 | 8 | 9 | 10 | 11 |
12 |
13 |

404 - Page Not Found

14 |

The page you requested seems to be lost in space!

15 | Go Back to Home 16 |
17 |
18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/imples/HomeImageSliderImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.imples; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.HomeImageSlider; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.repositories.HomeImageSliderDao; 5 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.HomeImageSliderService; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class HomeImageSliderImpl implements HomeImageSliderService { 14 | @Autowired 15 | HomeImageSliderDao homeImageSliderDao; 16 | @Override 17 | public List getImageSlider() { 18 | return homeImageSliderDao.findAll(); 19 | } 20 | @Override 21 | public HomeImageSlider postImageSlider(HomeImageSlider homeImageSlider) { 22 | homeImageSliderDao.save(homeImageSlider); 23 | return homeImageSlider; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/templates/footer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Footer Template 7 | 8 | 9 | 10 |
11 |
12 |
13 | Featured 14 |
15 |
16 |
Special title treatment
17 |

my Name is

19 |

Date Time :

20 |

With supporting text below as a natural lead-in to additional content.

21 | Go somewhere 22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/Authentication/UserDetailsServicesImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.Authentication; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.repositories.UserDao; 4 | import lombok.RequiredArgsConstructor; 5 | import org.springframework.security.core.userdetails.User; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 9 | import org.springframework.stereotype.Component; 10 | 11 | @Component 12 | @RequiredArgsConstructor 13 | public class UserDetailsServicesImpl implements UserDetailsService { 14 | private final UserDao userDao; 15 | @Override 16 | public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { 17 | var user = userDao.findByEmail(email).orElseThrow(()->new UsernameNotFoundException("Username Not Found")); 18 | return new User(user.getEmail(),user.getPassWord(),user.getAuthorities()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/Product/ProductLog.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities.Product; 2 | 3 | import jakarta.persistence.*; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | 9 | import java.time.LocalDateTime; 10 | 11 | @Entity 12 | @Setter 13 | @Getter 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @Table(name = "ProductLogs") 17 | public class ProductLog { 18 | 19 | @Id 20 | @GeneratedValue(strategy = GenerationType.AUTO) 21 | private Long productLogId; 22 | 23 | private Long productId; 24 | 25 | private String logMessage; 26 | 27 | private String createdAt; 28 | 29 | private String updatedAt; 30 | 31 | @PrePersist 32 | public void prePersist() { 33 | String current = LocalDateTime.now().toString(); 34 | this.createdAt = current; 35 | this.updatedAt = current; 36 | } 37 | 38 | @PreUpdate 39 | public void preUpdate() { 40 | this.updatedAt = LocalDateTime.now().toString(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Puneet Sharma 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/main/resources/templates/services.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | services 10 | 12 | 13 | 14 | 15 |

This is Services By Puneet Sharma.

16 | 17 |
18 | 19 |
20 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/Product/ProductImage.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities.Product; 2 | 3 | import jakarta.persistence.*; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | 9 | import java.time.LocalDateTime; 10 | 11 | @Entity 12 | @Setter 13 | @Getter 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @Table(name = "ProductImage") 17 | public class ProductImage { 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.AUTO) 20 | private Long productImageId; 21 | private String image; 22 | private String title; 23 | private String description; 24 | private String createdAt; 25 | private String updatedAt; 26 | @ManyToOne(fetch = FetchType.LAZY) 27 | @JoinColumn(name = "product_id") 28 | private ProductEntity product; 29 | 30 | @PrePersist 31 | public void prePersist() { 32 | String current = LocalDateTime.now().toString(); 33 | this.createdAt = current; 34 | this.updatedAt = current; 35 | } 36 | 37 | @PreUpdate 38 | public void preUpdate() { 39 | this.updatedAt = LocalDateTime.now().toString(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/Product/ProductTags.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities.Product; 2 | 3 | import jakarta.persistence.*; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | import lombok.NoArgsConstructor; 7 | import lombok.Setter; 8 | 9 | import java.time.LocalDateTime; 10 | 11 | @Entity 12 | @Setter 13 | @Getter 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @Table(name = "ProductTags") 17 | public class ProductTags { 18 | 19 | @Id 20 | @GeneratedValue(strategy = GenerationType.AUTO) 21 | private Long productTagsId; 22 | 23 | private String tagName; 24 | 25 | private String tagDescription; 26 | @ManyToOne(fetch = FetchType.LAZY) 27 | @JoinColumn(name = "product_id") 28 | private ProductEntity product; 29 | 30 | private String createdAt; 31 | 32 | private String updatedAt; 33 | 34 | @PrePersist 35 | public void prePersist() { 36 | String current = LocalDateTime.now().toString(); 37 | this.createdAt = current; 38 | this.updatedAt = current; 39 | } 40 | 41 | @PreUpdate 42 | public void preUpdate() { 43 | this.updatedAt = LocalDateTime.now().toString(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/resources/templates/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Success Page 7 | 31 | 32 | 33 |
34 |

Success!

35 |

Your request has been successfully processed.

36 |

Your Name is

37 |

Your Password is

38 | 39 |
40 | 41 | 42 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=9070 2 | 3 | # Multipart configuration 4 | spring.servlet.multipart.enabled=true 5 | spring.servlet.multipart.max-file-size=200MB 6 | spring.servlet.multipart.file-size-threshold=1KB 7 | 8 | # Database Configuration 9 | spring.datasource.url=jdbc:mysql://localhost:3306/ecommerce_db 10 | spring.datasource.username=root 11 | spring.datasource.password=India@12345 12 | 13 | # Hibernate Configuration 14 | # type of ddl-auto in spring boot 15 | # none, validate, update, create, and create-drop 16 | spring.jpa.hibernate.ddl-auto=update 17 | spring.jpa.show-sql=true 18 | spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl 19 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect 20 | 21 | # ThymeleafController Configuration 22 | spring.thymeleaf.enabled=true 23 | spring.thymeleaf.prefix=classpath:/templates/ 24 | spring.thymeleaf.suffix=.html 25 | spring.thymeleaf.cache=false 26 | spring.thymeleaf.template-resolver-order=1 27 | 28 | # Remove Whitelabel Error 29 | server.error.whitelabel.enabled=false 30 | spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration 31 | 32 | #for Spring Boot 2.0 33 | #spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/InformationController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.AboutUs; 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.imples.AboutUsImpl; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponse; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.web.bind.annotation.*; 8 | import java.util.Optional; 9 | 10 | @RestController 11 | @RequestMapping("api") 12 | public class InformationController { 13 | 14 | @Autowired 15 | public AboutUsImpl aboutUs; 16 | @GetMapping("/AboutUs") 17 | public Optional getAboutUs() { 18 | return aboutUs.getAboutUs(); 19 | } 20 | 21 | @PostMapping("/AboutUs") 22 | public ResponseEntity createAboutUs(@RequestBody AboutUs aboutUs) { 23 | return this.aboutUs.updateAboutUs(aboutUs,true); 24 | } 25 | 26 | @PutMapping("/AboutUs") 27 | public ResponseEntity updateAboutUs(@RequestBody AboutUs aboutUs) { 28 | return this.aboutUs.updateAboutUs(aboutUs,false); 29 | } 30 | 31 | @DeleteMapping("/AboutUs") 32 | public ResponseEntity deleteAboutUs() { 33 | return this.aboutUs.deleteAboutUs(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/controller.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.HomeImageSlider; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.HomeImageSliderService; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.util.List; 10 | 11 | @RestController 12 | @RequestMapping("api") 13 | public class controller { 14 | @Autowired 15 | public HomeImageSliderService homeImageSliderService; 16 | 17 | @GetMapping("/HomeImageSlider") 18 | public List getHomeImageSlider() { 19 | return homeImageSliderService.getImageSlider(); 20 | } 21 | 22 | @PostMapping(path = "/ImageSlider") 23 | public HomeImageSlider addHomeImageSlider(@RequestBody HomeImageSlider homeImageSlider) { 24 | return this.homeImageSliderService.postImageSlider(homeImageSlider); 25 | } 26 | 27 | @RequestMapping(value = "/welcome",method = RequestMethod.GET) 28 | public String welcome(){ 29 | String text = "this is private page "; 30 | text+="this page is not allowed to unauthenticated users"; 31 | return text; 32 | } 33 | @RequestMapping(value = "/go",method = RequestMethod.GET) 34 | public String go(){ 35 | String text = "this is private page"; 36 | text+="this page is not allowed to unauthenticated users"; 37 | return text; 38 | } 39 | 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/templates/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Contact Us 6 | 7 | 8 |
9 |
10 |
11 |
12 |

Contact Us

13 |
14 |
Hello Friends My Name is , Current Time is
15 |
16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 | 29 |
30 |
31 |
32 |
33 |
34 | 35 | -------------------------------------------------------------------------------- /HELP.md: -------------------------------------------------------------------------------- 1 | # Read Me First 2 | The following was discovered as part of building this project: 3 | 4 | * The original package name 'com.ecommerce.shopping .ecommerce-user-pannel-api' is invalid and this project uses 'com.ecommerce.shopping.ecommerceuserpannelapi' instead. 5 | 6 | # Getting Started 7 | 8 | ### Reference Documentation 9 | For further reference, please consider the following sections: 10 | 11 | * [Official Gradle documentation](https://docs.gradle.org) 12 | * [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.1.2/gradle-plugin/reference/html/) 13 | * [Create an OCI url](https://docs.spring.io/spring-boot/docs/3.1.2/gradle-plugin/reference/html/#build-image) 14 | * [Spring Web](https://docs.spring.io/spring-boot/docs/3.1.2/reference/htmlsinge/index.html#web) 15 | * [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/3.1.2/reference/htmlsinge/index.html#using.devtools) 16 | * [Spring Data JPA](https://docs.spring.io/spring-boot/docs/3.1.2/reference/htmlsinge/index.html#data.sql.jpa-and-spring-data) 17 | 18 | ### Guides 19 | The following guides illustrate how to use some features concretely: 20 | 21 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 22 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 23 | * [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) 24 | * [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/) 25 | 26 | ### Additional Links 27 | These additional references should also help you: 28 | 29 | * [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/config/AuthenticationConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.security.authentication.AuthenticationManager; 6 | import org.springframework.security.authentication.AuthenticationProvider; 7 | import org.springframework.security.authentication.dao.DaoAuthenticationProvider; 8 | import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; 9 | import org.springframework.security.core.userdetails.UserDetailsService; 10 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 11 | import org.springframework.security.crypto.password.PasswordEncoder; 12 | 13 | @Configuration 14 | public class AuthenticationConfig { 15 | @Bean 16 | public AuthenticationManager authenticationManager(AuthenticationConfiguration configuration) throws Exception { 17 | return configuration.getAuthenticationManager(); 18 | } 19 | 20 | @Bean 21 | public AuthenticationProvider authenticationProvider(UserDetailsService userDetailsService, PasswordEncoder passwordEncoder) { 22 | var authenticationProvider = new DaoAuthenticationProvider(); 23 | authenticationProvider.setUserDetailsService(userDetailsService); 24 | authenticationProvider.setPasswordEncoder(passwordEncoder); 25 | return authenticationProvider; 26 | } 27 | @Bean 28 | public PasswordEncoder bCryptPasswordEncoder(){ 29 | return new BCryptPasswordEncoder(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/utils/JWTUtils.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.utils; 2 | 3 | import io.jsonwebtoken.Claims; 4 | import io.jsonwebtoken.JwtException; 5 | import io.jsonwebtoken.Jwts; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.apache.commons.lang3.time.DateUtils; 8 | 9 | import javax.crypto.SecretKey; 10 | import java.util.Date; 11 | import java.util.Optional; 12 | import java.util.UUID; 13 | 14 | @Slf4j 15 | public class JWTUtils { 16 | private static final SecretKey secretKey = Jwts.SIG.HS256.key().build(); 17 | private static final String ISSUER = "coding_streams_auth_server"; 18 | private JWTUtils(){} 19 | public static boolean validateToken(String jwtToken) { 20 | return parseToken(jwtToken).isPresent(); 21 | } 22 | 23 | private static Optional parseToken(String jwtToken) { 24 | var jwtParser = Jwts.parser().verifyWith(secretKey).build(); 25 | try { 26 | return Optional.of(jwtParser.parseSignedClaims(jwtToken).getPayload()); 27 | }catch (JwtException | IllegalArgumentException e){ 28 | log.error("JWT Exception occurred"); 29 | } 30 | return Optional.empty(); 31 | 32 | } 33 | 34 | public static Optional getUsernameFromToken(String jwtToken) { 35 | var claimsOptional = parseToken(jwtToken); 36 | return claimsOptional.map(Claims::getSubject); 37 | } 38 | 39 | public static String generatedToken(String userName) { 40 | var currentDate = new Date(); 41 | var jwtExpirationInMinutes = 10; 42 | var expiration = DateUtils.addMinutes(currentDate, jwtExpirationInMinutes); 43 | return Jwts.builder().id(UUID.randomUUID().toString()).issuer(ISSUER).subject(userName).signWith(secretKey).issuedAt(currentDate).expiration(expiration).compact(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/Product/ProductEntity.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities.Product; 2 | import jakarta.persistence.*; 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | import lombok.Setter; 7 | 8 | import java.time.LocalDateTime; 9 | import java.util.Set; 10 | 11 | @Entity 12 | @Setter 13 | @Getter 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | @Table(name = "product") 17 | public class ProductEntity { 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.AUTO) 20 | @Column(name = "product_id") 21 | private Long productId; 22 | private String productName; 23 | private String productCreatedAt; 24 | private String description; 25 | private Double price; 26 | private String category; 27 | private Long quantityAvailable; 28 | private String brand; 29 | @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product") 30 | private Set images; 31 | private Boolean isAvailable; 32 | private Boolean isFeatured; 33 | @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "product") 34 | private Set tags; 35 | private String quantity; 36 | private String isPaid; 37 | private String isActive; 38 | private String discountAmount; 39 | private String modelNumber; 40 | private String more; 41 | private String productType; 42 | private String manufacturerPartNumber; 43 | private String reviews; 44 | private String totalReviews; 45 | private String createdAt; 46 | private String updatedAt; 47 | @PrePersist 48 | public void prePersist() { 49 | String current = LocalDateTime.now().toString(); 50 | this.createdAt = current; 51 | this.updatedAt = current; 52 | } 53 | @PreUpdate 54 | public void preUpdate() { 55 | this.updatedAt = LocalDateTime.now().toString(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/resources/templates/loginForm.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Login Form 7 | 9 | 15 | 16 | 17 |
18 |
19 |
20 |

Login Form

21 |
22 |
23 | 24 | 29 | 30 |
31 |
32 | 33 | 38 | 39 |
40 | 41 |
42 |
43 |
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/UserController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.UserEntities; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.imples.UserImpl; 5 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponseObject; 6 | import jakarta.validation.Valid; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.HttpStatus; 9 | import org.springframework.validation.BindingResult; 10 | import org.springframework.validation.FieldError; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | @RestController 16 | @RequestMapping("/api/") 17 | public class UserController { 18 | @Autowired 19 | UserImpl userService; 20 | @GetMapping("user/{id}") 21 | public ApiResponseObject getUser(@PathVariable Long id) { 22 | return userService.getUser(id); 23 | } 24 | 25 | @GetMapping("user") 26 | public ApiResponseObject> getAllUsers() { 27 | return userService.getAllUser(); 28 | } 29 | 30 | @PostMapping("user") 31 | public ApiResponseObject addUser(@Valid @RequestBody UserEntities userEntities, BindingResult bindingResult) { 32 | if (bindingResult.hasErrors()) { 33 | StringBuilder errorMessage = new StringBuilder(); 34 | for (FieldError fieldError : bindingResult.getFieldErrors()) { 35 | errorMessage.append(fieldError.getDefaultMessage()).append("; "); 36 | } 37 | return new ApiResponseObject<>(HttpStatus.BAD_REQUEST, errorMessage.toString(), "Invalid", null); 38 | } 39 | return userService.addUser(userEntities); 40 | } 41 | 42 | @DeleteMapping("user/{id}") 43 | public ApiResponseObject deleteUser(@PathVariable Long id) { 44 | return userService.deleteUser(id); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/resources/templates/about.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 8 | 9 | Document 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 | Image 18 |
19 |
20 |

About Us

21 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut gravida nulla. Quisque feugiat eros nec lorem congue bibendum. Nullam fermentum, est ac commodo tristique, libero libero faucibus lectus, eget suscipit sapien felis a tortor. Vestibulum ut ante nunc. Suspendisse vitae ex hendrerit, viverra nulla ut, posuere mi. Ut eget nisi mi. Nam congue, justo nec auctor pulvinar, arcu velit congue purus, non lacinia augue sapien ut leo. Mauris convallis quam libero, nec congue dolor bibendum vitae. Nam laoreet libero sed posuere rhoncus.

22 |

Sed vitae purus sit amet velit semper iaculis a in nulla. Fusce consectetur nec mi ac cursus. Fusce hendrerit sit amet enim in iaculis. Vivamus eu lacinia risus. Integer nec luctus est. Vestibulum fringilla massa in libero accumsan, a pharetra lacus interdum. Vestibulum luctus elit non erat molestie blandit. Aenean et eleifend magna. Cras sed magna pharetra, consequat enim vitae, sodales libero. Aliquam erat volutpat.

23 |
24 |
25 |
26 |
27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/AuthController.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.Authentication.AuthServiceImpl; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.Authentication.LoginRequest; 5 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.UserEntities; 6 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponseObject; 7 | import jakarta.validation.Valid; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.validation.BindingResult; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | @RestController 14 | @RequestMapping("/api/auth/") 15 | public class AuthController { 16 | @Autowired 17 | AuthServiceImpl authServiceImpl; 18 | 19 | @PostMapping("login") 20 | public ApiResponseObject login(@RequestBody LoginRequest loginRequest) { 21 | try { 22 | return authServiceImpl.login(loginRequest.getEmail(), loginRequest.getPassword()); 23 | } catch (Exception e) { 24 | System.out.println("Error Sharma ji"); 25 | return new ApiResponseObject<>(HttpStatus.BAD_REQUEST, e.toString(), "Invalid", null); 26 | } 27 | } 28 | 29 | 30 | @PostMapping("sign-up") 31 | public ApiResponseObject signUp(@Valid @RequestBody UserEntities userEntities, BindingResult bindingResult) { 32 | if (bindingResult.hasErrors()) { 33 | return new ApiResponseObject<>(HttpStatus.BAD_REQUEST, "Validation error: " + bindingResult.getAllErrors(), "Invalid", null); 34 | } 35 | try { 36 | return authServiceImpl.signUp(userEntities.getUsername(), userEntities.getEmail(), userEntities.getPassWord(), userEntities.getMobile()); 37 | 38 | } catch (Exception e) { 39 | System.out.println("Error Sharma ji"); 40 | return new ApiResponseObject<>(HttpStatus.BAD_REQUEST, e.toString(), "Invalid", null); 41 | 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/resources/static/style/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #fcf6c4; 3 | animation: fadeIn 1s ease; 4 | } 5 | 6 | footer { 7 | background-color: #333; 8 | color: white; 9 | padding: 50px 0; 10 | position: relative; 11 | overflow: hidden; 12 | } 13 | 14 | .footer-content { 15 | text-align: center; 16 | position: relative; 17 | z-index: 1; 18 | } 19 | 20 | .footer-social-icons { 21 | list-style: none; 22 | padding: 0; 23 | margin: 20px 0 0 0; 24 | display: flex; 25 | justify-content: center; 26 | } 27 | 28 | .footer-social-icons li { 29 | margin: 0 10px; 30 | font-size: 24px; 31 | } 32 | 33 | .footer-social-icons li a { 34 | color: white; 35 | transition: all 0.3s ease; 36 | } 37 | 38 | .footer-social-icons li a:hover { 39 | color: #007bff; 40 | } 41 | 42 | .footer-wave { 43 | position: absolute; 44 | bottom: 0; 45 | left: 0; 46 | width: 100%; 47 | height: 150px; 48 | background: url('https://cdn.pixabay.com/photo/2017/03/31/16/57/wave-2191393_960_720.png') repeat-x; 49 | animation: wave-animation 10s infinite linear; 50 | transform: translate3d(0, 0, 0); 51 | } 52 | 53 | @keyframes wave-animation { 54 | 0% { 55 | background-position-x: 0; 56 | } 57 | 58 | 100% { 59 | background-position-x: 1000px; 60 | } 61 | } 62 | 63 | /* Custom CSS for animations */ 64 | @keyframes slideInLeft { 65 | from { 66 | transform: translateX(-100%); 67 | opacity: 0; 68 | } 69 | 70 | to { 71 | transform: translateX(0); 72 | opacity: 1; 73 | } 74 | } 75 | 76 | @keyframes slideInRight { 77 | from { 78 | transform: translateX(100%); 79 | opacity: 0; 80 | } 81 | 82 | to { 83 | transform: translateX(0); 84 | opacity: 1; 85 | } 86 | } 87 | 88 | .animated { 89 | animation-duration: 1s; 90 | animation-fill-mode: both; 91 | } 92 | 93 | .slideInLeft { 94 | animation-name: slideInLeft; 95 | } 96 | 97 | .slideInRight { 98 | animation-name: slideInRight; 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/exception/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.exception; 2 | 3 | 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponse; 5 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponseObject; 6 | import org.springframework.http.HttpStatus; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.http.converter.HttpMessageNotReadableException; 9 | import org.springframework.web.bind.annotation.ExceptionHandler; 10 | import org.springframework.web.bind.annotation.RestControllerAdvice; 11 | 12 | import java.nio.file.AccessDeniedException; 13 | import java.sql.SQLIntegrityConstraintViolationException; 14 | 15 | @RestControllerAdvice 16 | public class GlobalExceptionHandler { 17 | 18 | @ExceptionHandler(HttpMessageNotReadableException.class) 19 | public ResponseEntity handleMissingRequestBody(HttpMessageNotReadableException ex) { 20 | ApiResponse response = new ApiResponse(HttpStatus.BAD_REQUEST, "Invalid", "Required request body is missing"); 21 | return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); 22 | } 23 | @ExceptionHandler(Exception.class) 24 | public ResponseEntity> handleException(Exception ex) { 25 | String errorMessage = ex.getMessage() != null ? ex.getMessage() : "Unknown error occurred"; 26 | ApiResponseObject response = new ApiResponseObject<>(HttpStatus.INTERNAL_SERVER_ERROR, errorMessage, "Invalid", null); 27 | return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); 28 | } 29 | 30 | @ExceptionHandler(SQLIntegrityConstraintViolationException.class) 31 | public ResponseEntity> handleSqlIntegrityConstraintViolation(SQLIntegrityConstraintViolationException ex) { 32 | if (ex.getMessage().contains("Duplicate entry")) { 33 | String errorMessage = "Email already exists. Please choose a different email."; 34 | return ResponseEntity.status(HttpStatus.CONFLICT).body(new ApiResponseObject<>(HttpStatus.CONFLICT, errorMessage, "Invalid", null)); 35 | } else { 36 | return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ApiResponseObject<>(HttpStatus.INTERNAL_SERVER_ERROR, "Internal Server Error", "Error", null)); 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/config/SecurityFilterChainConfig.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 6 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 7 | import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; 8 | import org.springframework.security.config.http.SessionCreationPolicy; 9 | import org.springframework.security.web.SecurityFilterChain; 10 | import org.springframework.security.web.AuthenticationEntryPoint; 11 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 12 | 13 | @Configuration 14 | @EnableWebSecurity 15 | public class SecurityFilterChainConfig{ 16 | 17 | private final AuthenticationEntryPoint authenticationEntryPoint; 18 | private final JWTAuthenticationFilter jwtAuthenticationFilter; 19 | 20 | public SecurityFilterChainConfig(AuthenticationEntryPoint authenticationEntryPoint, JWTAuthenticationFilter jwtAuthenticationFilter) { 21 | this.authenticationEntryPoint = authenticationEntryPoint; 22 | this.jwtAuthenticationFilter = jwtAuthenticationFilter; 23 | } 24 | 25 | @Bean 26 | public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity) throws Exception { 27 | // Disable CORS 28 | httpSecurity.cors(AbstractHttpConfigurer::disable); 29 | 30 | // Disable CSRF 31 | httpSecurity.csrf(AbstractHttpConfigurer::disable); 32 | 33 | // Http Request Filter 34 | httpSecurity.authorizeHttpRequests(authorizationManagerRequestMatcherRegistry -> authorizationManagerRequestMatcherRegistry.requestMatchers("/api/auth/**").permitAll().anyRequest().authenticated()); 35 | 36 | // Authentication Entry Point -> Exception Handler 37 | httpSecurity.exceptionHandling(exceptionConfig->exceptionConfig.authenticationEntryPoint(authenticationEntryPoint)); 38 | 39 | // Set Session Policy = STATELESS 40 | httpSecurity.sessionManagement(sessionConfig->sessionConfig.sessionCreationPolicy(SessionCreationPolicy.STATELESS)); 41 | 42 | // Add JWT Authentication Filter 43 | httpSecurity.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); 44 | 45 | return httpSecurity.build(); 46 | } 47 | } -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/entities/UserEntities.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.entities; 2 | import jakarta.persistence.*; 3 | import jakarta.validation.constraints.Email; 4 | import jakarta.validation.constraints.NotBlank; 5 | import jakarta.validation.constraints.Pattern; 6 | import jakarta.validation.constraints.Size; 7 | import lombok.*; 8 | import org.springframework.security.core.GrantedAuthority; 9 | 10 | import java.time.LocalDateTime; 11 | import java.util.List; 12 | 13 | @Entity 14 | @Setter 15 | @Getter 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @Table(name = "user") 19 | @Builder 20 | @Data 21 | public class UserEntities { 22 | @Id 23 | @GeneratedValue(strategy = GenerationType.AUTO) 24 | private long id; 25 | @NotBlank(message = "Username is required!") 26 | @Size(min = 3, max = 12, message = "Username must be between 3 and 12 characters") 27 | private String username; 28 | @NotBlank(message = "Mobile No. is required!") 29 | @Column(unique = true) 30 | private String mobile; 31 | @Email(regexp = "^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(\\.\\w{2,3})+$", message = "Invalid Email !!") 32 | @Column(unique = true) 33 | @NotBlank(message = "Email is required!") 34 | private String email; 35 | private String role; 36 | @NotBlank(message = "Password is required!") 37 | @Pattern(regexp = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).{8,}$", 38 | message = "Password must contain at least one digit, one lowercase letter, one uppercase letter, one special character.") 39 | @Column(length = 1000) 40 | private String passWord; 41 | @Column(length = 1000) 42 | private String accessToken; 43 | private String profilePhoto; 44 | private String walletAmount; 45 | private String latitude; 46 | private String longitude; 47 | private String deviceName; 48 | private String ios_device_id; 49 | private String android_device_id; 50 | private String deviceType; 51 | private String mobileVerification; 52 | private String pushNotification; 53 | private List authorities; 54 | private String status; 55 | private String createAt; 56 | private String updateAt; 57 | @PrePersist 58 | public void prePersist() { 59 | String current = LocalDateTime.now().toString(); 60 | this.createAt = current; 61 | this.updateAt = current; 62 | } 63 | 64 | @PreUpdate 65 | public void preUpdate() { 66 | this.updateAt = LocalDateTime.now().toString(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/imples/AboutUsImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.imples; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.AboutUs; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponse; 5 | import com.ecommerce.shopping.ecommerceuserpannelapi.repositories.AboutUsDao; 6 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.AboutUsService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.HttpStatus; 9 | import org.springframework.http.ResponseEntity; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.Optional; 13 | 14 | @Service 15 | public class AboutUsImpl implements AboutUsService { 16 | @Autowired 17 | AboutUsDao aboutUsDao; 18 | @Override 19 | public Optional getAboutUs() { 20 | return aboutUsDao.findFirstAboutUs(); 21 | } 22 | @Override 23 | public ResponseEntity updateAboutUs(AboutUs aboutUs, boolean create) { 24 | ApiResponse response; 25 | try { 26 | if (aboutUs == null) { 27 | response = new ApiResponse(HttpStatus.BAD_REQUEST, "Failed", "Request body is missing"); 28 | return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); 29 | } 30 | aboutUs.setTitle("AboutUs"); 31 | aboutUsDao.save(aboutUs); 32 | 33 | response = new ApiResponse(HttpStatus.FOUND, "Success", "About Us successfully "+ (create?"Create":"Updated")); 34 | return new ResponseEntity<>(response, HttpStatus.OK); 35 | } catch (Exception ex) { 36 | response = new ApiResponse(HttpStatus.INTERNAL_SERVER_ERROR, "Error", ex.getMessage()); 37 | return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); 38 | } 39 | } 40 | @Override 41 | public ResponseEntity deleteAboutUs() { 42 | ApiResponse response; 43 | try { 44 | Optional aboutUs = aboutUsDao.findFirstAboutUs(); 45 | if (!(aboutUs.isPresent() && !aboutUs.get().getTitle().isEmpty())) { 46 | response = new ApiResponse(HttpStatus.BAD_REQUEST, "Failed", "No About Us information found. Please add information before deleting."); 47 | return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST); 48 | } else { 49 | aboutUsDao.deleteAll(); 50 | response = new ApiResponse(HttpStatus.FOUND, "Success", "About Us successfully deleted."); 51 | return new ResponseEntity<>(response, HttpStatus.FOUND); 52 | } 53 | } catch (Exception ex) { 54 | response = new ApiResponse(HttpStatus.INTERNAL_SERVER_ERROR, "Error", ex.getMessage()); 55 | return new ResponseEntity<>(response, HttpStatus.INTERNAL_SERVER_ERROR); 56 | } 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/config/JWTAuthenticationFilter.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.config; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.utils.JWTUtils; 4 | import jakarta.servlet.FilterChain; 5 | import jakarta.servlet.ServletException; 6 | import jakarta.servlet.http.HttpServletRequest; 7 | import jakarta.servlet.http.HttpServletResponse; 8 | import lombok.RequiredArgsConstructor; 9 | import org.springframework.http.HttpHeaders; 10 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 11 | import org.springframework.security.core.context.SecurityContextHolder; 12 | import org.springframework.security.core.userdetails.UserDetailsService; 13 | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; 14 | import org.springframework.stereotype.Component; 15 | import org.springframework.util.StringUtils; 16 | import org.springframework.web.filter.OncePerRequestFilter; 17 | 18 | import java.io.IOException; 19 | import java.util.Optional; 20 | 21 | @Component 22 | @RequiredArgsConstructor 23 | public class JWTAuthenticationFilter extends OncePerRequestFilter { 24 | private final UserDetailsService userDetailsService; 25 | 26 | @Override 27 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { 28 | // Fetch token from request 29 | var jwtTokenOptional = getTokenFromRequest(request); 30 | 31 | // Validate jwt token -> JWT utils 32 | jwtTokenOptional.ifPresent(jwtToken -> { 33 | if (JWTUtils.validateToken(jwtToken)) { 34 | // Get user from JWT token 35 | var userNameOptional = JWTUtils.getUsernameFromToken(jwtToken); 36 | userNameOptional.ifPresent(userName-> { 37 | // Fetch user Details with the help of userName 38 | var userDetails = userDetailsService.loadUserByUsername(userName); 39 | // Crate Authentication Token 40 | var authenticationToken = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); 41 | authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); 42 | // Set authentication token to Security Context 43 | SecurityContextHolder.getContext().setAuthentication(authenticationToken); 44 | }); 45 | } 46 | }); 47 | 48 | // pass request and response to next filter 49 | filterChain.doFilter(request, response); 50 | } 51 | 52 | public Optional getTokenFromRequest(HttpServletRequest request) { 53 | // Extract authentication header 54 | var authHeader = request.getHeader(HttpHeaders.AUTHORIZATION); 55 | // Bearer 56 | if (StringUtils.hasText(authHeader) && authHeader.startsWith("Bearer ")) { 57 | return Optional.of(authHeader.substring(7)); 58 | } 59 | return Optional.empty(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/imples/UserImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.imples; 2 | 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.UserEntities; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponseObject; 5 | import com.ecommerce.shopping.ecommerceuserpannelapi.repositories.UserDao; 6 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.UserServices; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.http.HttpStatus; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | import java.util.Optional; 13 | 14 | @Service 15 | public class UserImpl implements UserServices { 16 | @Autowired 17 | UserDao userDao; 18 | 19 | @Override 20 | public ApiResponseObject getUser(Long id) { 21 | try { 22 | Optional userOptional = userDao.findById(id); 23 | if (userOptional.isPresent()) { 24 | UserEntities user = userOptional.get(); 25 | return new ApiResponseObject<>(HttpStatus.OK, "User retrieved successfully", "valid", user); 26 | } else { 27 | return new ApiResponseObject<>(HttpStatus.NOT_FOUND, "User not found", "invalid", null); 28 | } 29 | } catch (Exception ex) { 30 | return new ApiResponseObject<>(HttpStatus.INTERNAL_SERVER_ERROR, "Error", ex.getMessage(), null); 31 | } 32 | } 33 | 34 | 35 | @Override 36 | public ApiResponseObject> getAllUser() { 37 | try { 38 | List users = userDao.findAll(); 39 | return new ApiResponseObject<>(HttpStatus.OK, "Users retrieved successfully", "valid", users); 40 | } catch (Exception ex) { 41 | return new ApiResponseObject<>(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage(),"Error", null); 42 | } 43 | } 44 | 45 | 46 | @Override 47 | public ApiResponseObject addUser(UserEntities userEntities) { 48 | try { 49 | Optional userOptional = userDao.findById(userEntities.getId()); 50 | if (userOptional.isPresent()) { 51 | return new ApiResponseObject<>(HttpStatus.CONFLICT, "User is Already Added.", "Invalid", null); 52 | } else { 53 | userDao.save(userEntities); 54 | return new ApiResponseObject<>(HttpStatus.CREATED, "User Added Successfully", "valid", userEntities); 55 | } 56 | } catch (Exception ex) { 57 | return new ApiResponseObject<>(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage(),"Error", null); 58 | } 59 | } 60 | 61 | 62 | @Override 63 | public ApiResponseObject deleteUser(Long id) { 64 | try { 65 | Optional userOptional = userDao.findById(id); 66 | if (userOptional.isPresent()) { 67 | UserEntities user = userOptional.get(); 68 | userDao.delete(user); 69 | return new ApiResponseObject<>(HttpStatus.OK, "User Deleted Successful", "valid", user); 70 | } else { 71 | return new ApiResponseObject<>(HttpStatus.NOT_FOUND, "Invalid User Id.", "Invalid", null); 72 | } 73 | } catch (Exception ex) { 74 | return new ApiResponseObject<>(HttpStatus.INTERNAL_SERVER_ERROR, ex.getMessage(),"Error", null); 75 | 76 | } 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/controllers/ThymeleafController.java: -------------------------------------------------------------------------------- 1 | //package com.ecommerce.shopping.ecommerceuserpannelapi.controllers; 2 | // 3 | //import com.ecommerce.shopping.ecommerceuserpannelapi.entities.LoginData; 4 | //import jakarta.validation.Valid; 5 | //import org.jetbrains.annotations.NotNull; 6 | //import org.springframework.boot.web.servlet.error.ErrorController; 7 | //import org.springframework.stereotype.Controller; 8 | //import org.springframework.ui.Model; 9 | //import org.springframework.web.bind.annotation.*; 10 | //import org.springframework.validation.BindingResult; 11 | //import java.time.LocalDateTime; 12 | //import java.time.format.DateTimeFormatter; 13 | //import java.util.Date; 14 | //import java.util.List; 15 | // 16 | //@Controller 17 | //public class ThymeleafController implements ErrorController { 18 | // @RequestMapping(value = "/about", method = RequestMethod.GET) 19 | // public String about(@NotNull Model model) { 20 | // // putting data in model 21 | // model.addAttribute("name", "Puneet Sharma"); 22 | // model.addAttribute("currentDate ", new Date().toString()); 23 | // System.out.println("inside about handler ......"); 24 | // return "about"; 25 | // } 26 | // 27 | // @GetMapping("/iterate") 28 | // public String iterateHandler(Model model) { 29 | // List list = List.of("Ankit", "Laxmi", "Karan", "John"); 30 | // model.addAttribute("name", list); 31 | // return "iterate"; 32 | // } 33 | // 34 | // @GetMapping("/condition") 35 | // public String conditionHandler(Model model) { 36 | // model.addAttribute("isActive", true); 37 | // model.addAttribute("showBox", false); 38 | // List list = List.of(0, 1, 2, 3, 4, 5, 6, 7); 39 | // model.addAttribute("myList", list); 40 | // return "condition"; 41 | // } 42 | // 43 | // @GetMapping("/services") 44 | // public String servicesHandler(Model m) { 45 | // m.addAttribute("firstName", "Puneet"); 46 | // m.addAttribute("lastName", "Sharma"); 47 | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); 48 | // LocalDateTime now = LocalDateTime.now(); 49 | // m.addAttribute("dateTime", dtf.format(now)); 50 | // return "services"; 51 | // } 52 | // 53 | // @RequestMapping(value = "/contactUs", method = RequestMethod.GET) 54 | // public String contactUs(@NotNull Model model) { 55 | // // putting data in model 56 | // model.addAttribute("metaDescription", " Assuming contact is the name of your Thymeleaf template file"); 57 | // DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss"); 58 | // LocalDateTime now = LocalDateTime.now(); 59 | // model.addAttribute("currentDate ", dtf.format(now)); 60 | // System.out.println("inside about handler ......"); 61 | // return "contact"; 62 | // } 63 | // 64 | // @RequestMapping(value = "/loginForm", method = RequestMethod.GET) 65 | // public String loginForm(Model model) { 66 | // System.out.println("Opening login form"); 67 | // model.addAttribute("loginData", new LoginData()); 68 | // return "loginForm"; 69 | // } 70 | // 71 | // @PostMapping("/process") 72 | // public String processForm(@Valid @ModelAttribute("loginData") LoginData loginData, BindingResult result) { 73 | // if (!result.hasErrors()) { 74 | // System.out.println("Login data is valid:"); 75 | // return "success"; 76 | // } 77 | // System.out.println("Validation errors occurred:"); 78 | // return "loginForm"; 79 | // } 80 | // 81 | // 82 | // @RequestMapping("/error") 83 | // public String handleError() { 84 | // return "error"; 85 | // } 86 | //} 87 | -------------------------------------------------------------------------------- /src/main/resources/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | This is Base 9 | 10 | 11 | 12 | 13 | 14 | 48 |
49 |
50 |
51 | 61 |
62 | 63 |
64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/main/java/com/ecommerce/shopping/ecommerceuserpannelapi/Authentication/AuthServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ecommerce.shopping.ecommerceuserpannelapi.Authentication; 2 | import com.ecommerce.shopping.ecommerceuserpannelapi.entities.UserEntities; 3 | import com.ecommerce.shopping.ecommerceuserpannelapi.payloads.ApiResponseObject; 4 | import com.ecommerce.shopping.ecommerceuserpannelapi.repositories.UserDao; 5 | import com.ecommerce.shopping.ecommerceuserpannelapi.services.AuthenticationService; 6 | import com.ecommerce.shopping.ecommerceuserpannelapi.utils.JWTUtils; 7 | import lombok.RequiredArgsConstructor; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.security.authentication.AuthenticationManager; 11 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 12 | import org.springframework.security.core.GrantedAuthority; 13 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 14 | import org.springframework.security.core.userdetails.UserDetails; 15 | import org.springframework.security.crypto.password.PasswordEncoder; 16 | import org.springframework.stereotype.Service; 17 | 18 | import java.util.ArrayList; 19 | import java.util.Optional; 20 | 21 | @Service 22 | @RequiredArgsConstructor 23 | public class AuthServiceImpl implements AuthenticationService { 24 | @Autowired 25 | private final AuthenticationManager authenticationManager; 26 | @Autowired 27 | private final PasswordEncoder passwordEncoder; 28 | @Autowired 29 | private final UserDao userDao; 30 | @Override 31 | public ApiResponseObject login(String email, String password) { 32 | try { 33 | var authToken = new UsernamePasswordAuthenticationToken(email, password); 34 | System.out.println("Sout 1"); 35 | var authentication = authenticationManager.authenticate(authToken); 36 | System.out.println("Sout 2"); 37 | // Generate Token 38 | var userName = ((UserDetails) (authentication.getPrincipal())).getUsername(); 39 | System.out.println("Sout 3"); 40 | String token = JWTUtils.generatedToken(userName); 41 | System.out.println("Sout 4"); 42 | System.out.println("Sout 5"); 43 | 44 | System.out.println("Sout 6"); 45 | 46 | var authResponseDto = new AuthResponseDto(token, email,null); 47 | 48 | System.out.println("Sout 7"); 49 | return new ApiResponseObject<>(HttpStatus.OK, "Register SuccessFully", "valid", authResponseDto); 50 | }catch (Exception e){ 51 | System.out.println("Error PUneet ji"); 52 | return new ApiResponseObject<>(HttpStatus.BAD_REQUEST, e.toString(), "Invalid", null); 53 | } 54 | } 55 | 56 | @Override 57 | public ApiResponseObject signUp(String userName, String email, String password, String mobile) { 58 | try{ 59 | // Check whether user already exists or not 60 | Optional optionalUserEntities = userDao.findByEmail(email); 61 | if(optionalUserEntities.isPresent()){ 62 | throw new RuntimeException("User already exists"); 63 | } 64 | // authorities 65 | var authorities = new ArrayList(); 66 | authorities.add(new SimpleGrantedAuthority("ROLE_USER")); 67 | 68 | // Encode password 69 | var encodedPassword = passwordEncoder.encode(password); 70 | 71 | // Generate Token 72 | String token = JWTUtils.generatedToken(email); 73 | var userEntities = UserEntities.builder(). 74 | username(userName) 75 | .passWord(encodedPassword) 76 | .email(email) 77 | .mobile(mobile).accessToken(token) 78 | .authorities(authorities) 79 | .build(); 80 | // Save user 81 | userDao.save(userEntities); 82 | 83 | var authResponseDto = new AuthResponseDto(token, email,mobile); 84 | return new ApiResponseObject<>(HttpStatus.OK, "Register SuccessFully", "valid", authResponseDto); 85 | 86 | }catch (Exception e){ 87 | System.out.println("Error PUneet ji"); 88 | return new ApiResponseObject<>(HttpStatus.BAD_REQUEST, e.toString(), "Invalid", null); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Use the maximum available, or set MAX_FD != -1 to use that value. 89 | MAX_FD=maximum 90 | 91 | warn () { 92 | echo "$*" 93 | } >&2 94 | 95 | die () { 96 | echo 97 | echo "$*" 98 | echo 99 | exit 1 100 | } >&2 101 | 102 | # OS specific support (must be 'true' or 'false'). 103 | cygwin=false 104 | msys=false 105 | darwin=false 106 | nonstop=false 107 | case "$( uname )" in #( 108 | CYGWIN* ) cygwin=true ;; #( 109 | Darwin* ) darwin=true ;; #( 110 | MSYS* | MINGW* ) msys=true ;; #( 111 | NONSTOP* ) nonstop=true ;; 112 | esac 113 | 114 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 115 | 116 | 117 | # Determine the Java command to use to start the JVM. 118 | if [ -n "$JAVA_HOME" ] ; then 119 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 120 | # IBM's JDK on AIX uses strange locations for the executables 121 | JAVACMD=$JAVA_HOME/jre/sh/java 122 | else 123 | JAVACMD=$JAVA_HOME/bin/java 124 | fi 125 | if [ ! -x "$JAVACMD" ] ; then 126 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 127 | 128 | Please set the JAVA_HOME variable in your environment to match the 129 | location of your Java installation." 130 | fi 131 | else 132 | JAVACMD=java 133 | if ! command -v java >/dev/null 2>&1 134 | then 135 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 136 | 137 | Please set the JAVA_HOME variable in your environment to match the 138 | location of your Java installation." 139 | fi 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | 201 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 202 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 203 | 204 | # Collect all arguments for the java command; 205 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 206 | # shell script including quotes and variable substitutions, so put them in 207 | # double quotes to make sure that they get re-expanded; and 208 | # * put everything else in single quotes, so that it's not re-expanded. 209 | 210 | set -- \ 211 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 212 | -classpath "$CLASSPATH" \ 213 | org.gradle.wrapper.GradleWrapperMain \ 214 | "$@" 215 | 216 | # Stop when "xargs" is not available. 217 | if ! command -v xargs >/dev/null 2>&1 218 | then 219 | die "xargs is not available" 220 | fi 221 | 222 | # Use "xargs" to parse quoted args. 223 | # 224 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 225 | # 226 | # In Bash we could simply go: 227 | # 228 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 229 | # set -- "${ARGS[@]}" "$@" 230 | # 231 | # but POSIX shell has neither arrays nor command substitution, so instead we 232 | # post-process each arg (as a line of input to sed) to backslash-escape any 233 | # character that might be a shell metacharacter, then use eval to reverse 234 | # that process (while maintaining the separation between arguments), and wrap 235 | # the whole thing up as a single "set" statement. 236 | # 237 | # This will of course break if any of these variables contains a newline or 238 | # an unmatched quote. 239 | # 240 | 241 | eval "set -- $( 242 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 243 | xargs -n1 | 244 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 245 | tr '\n' ' ' 246 | )" '"$@"' 247 | 248 | exec "$JAVACMD" "$@" 249 | --------------------------------------------------------------------------------