{"id":15100889,"url":"https://github.com/akash1yadavv/prospecta_backenmd_assignment","last_synced_at":"2026-01-06T12:54:06.335Z","repository":{"id":255827907,"uuid":"853692831","full_name":"Akash1yadavv/Prospecta_Backenmd_Assignment","owner":"Akash1yadavv","description":"The Coding Interview for Graduates project at Prospecta involves developing APIs with JWT authentication and role-based access control, using the Fake Store API.","archived":false,"fork":false,"pushed_at":"2024-09-07T17:28:50.000Z","size":147,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T13:48:34.954Z","etag":null,"topics":["git","hibernate-jpa","java-8","jwt-authentication","mysql-database","resttemplate","spring-boot","spring-security","validation"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Akash1yadavv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-07T09:06:12.000Z","updated_at":"2024-09-07T17:28:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"cd000845-e27f-4ab8-b70c-77ca1d490e7a","html_url":"https://github.com/Akash1yadavv/Prospecta_Backenmd_Assignment","commit_stats":null,"previous_names":["akash1yadavv/prospecta_backenmd_assignment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akash1yadavv%2FProspecta_Backenmd_Assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akash1yadavv%2FProspecta_Backenmd_Assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akash1yadavv%2FProspecta_Backenmd_Assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Akash1yadavv%2FProspecta_Backenmd_Assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Akash1yadavv","download_url":"https://codeload.github.com/Akash1yadavv/Prospecta_Backenmd_Assignment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245858878,"owners_count":20684057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","hibernate-jpa","java-8","jwt-authentication","mysql-database","resttemplate","spring-boot","spring-security","validation"],"created_at":"2024-09-25T18:02:14.560Z","updated_at":"2026-01-06T12:54:06.303Z","avatar_url":"https://github.com/Akash1yadavv.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coding Challenge \u0026 Theoretical Challenge: API for Product CSV File Management\n\nThe Coding Interview for Graduates project at Prospecta involves developing APIs with JWT authentication and role-based access control, using the Fake Store API. The project requires creating two APIs: one for listing product details by category and another for adding new product entries. Additionally, it includes a theoretical challenge where a program processes a CSV file containing values and formulas, calculates results, and generates a CSV output. The tech stack implemented includes Java with Spring Boot for API development, JWT for authentication, role-based access control to secure endpoints, and Java for CSV processing. The implementation also emphasizes robust error handling and validation to manage formulas, cell references, and non-integer values effectively.\n\n\n## Getting Started\n\n### Prerequisites\n\n- Java 17 or later\n- Maven\n- MySQL\n- Postman (for API testing)\n- Swagger\n- STS OR Intellij\n\n### Setup\n\n1. **Clone the Repository:**\n\n    ```bash\n    git clone https://github.com/Akash1yadavv/Prospecta_Backenmd_Assignment\n    cd Prospecta_Assignment\n    ```\n\n2. **Create and Configure MySQL Database:**\n\n    - Create a new MySQL database.\n    - Update the `src/main/resources/application.properties` file with your database credentials:\n\n      ```properties\n      spring.datasource.url=jdbc:mysql://localhost:3306/prospecta\n      spring.datasource.username=your_database_username\n      spring.datasource.password=your_database_password\n      spring.jpa.hibernate.ddl-auto=update\n      \n      ```\n\n3. **Build and Run the Application:**\n\n    ```bash\n    mvn clean install\n    mvn spring-boot:run\n    ```\n\n## API Endpoints\n\n### Authentication\n\n#### 1. Sign Up\n\n- **Endpoint:** `POST http://localhost:8080/api/prospecta/register-user`\n- **Description:** Registers a new user.\n- **Request Body:**\n\n    ```json\n    {\n      \"email\": \"user@example.com\",\n      \"password\": \"your_password\",\n      \"name\": \"John Doe\",\n      \"phone\": \"1234567890\"\n    }\n    ```\n\n#### 2. Log In\n\n- **Endpoint:** `POST http://localhost:8080/api/prospecta/auth/login`\n- **Description:** Authenticates a user and returns a JWT token.\n- **Request Body:**\n\n    ```json\n    {\n      \"email\": \"user@example.com\",\n      \"password\": \"your_password\"\n    }\n    ```\n\n- **Response:**\n\n    ```json\n    {\n      \"token\": \"your_jwt_token\",\n      \"expiresIn\": \"time_in_milli_second\"\n    }\n    ```\n\n### Product Management\n\n#### 1. Get Products by Category\n\n- **Endpoint:** `GET http://localhost:8080/api/prospecta/products/category/{category}`\n- **Description:** Retrieves a list of products based on the specified category.\n- **Parameters:**\n  - `category`: The category of the products (e.g., `jewelery`).\n- **Response:**\n\n    ```json\n    [\n      {\n        \"id\": 1,\n        \"title\": \"Product Title\",\n        \"price\": 29.99,\n        \"description\": \"Product Description\",\n        \"category\": \"jewelery\",\n        \"image\": \"http://example.com/image.jpg\",\n        \"rating\": {\n          \"rate\": 4.5,\n          \"count\": 120\n        }\n      }\n      // More products\n    ]\n    ```\n\n#### 2. Add New Product\n\n- **Endpoint:** `POST http://localhost:8080/api/prospecta/products/`\n- **Description:** Adds a new product to the store.\n- **Request Body:**\n\n    ```json\n      {\n        \"title\": \"Product Title\",\n        \"price\": 29.99,\n        \"description\": \"Product Description\",\n        \"category\": \"jewelery\",\n        \"image\": \"http://example.com/image.jpg\"\n      }\n    ```\n\n- **Response:**\n\n    ```json\n      {\n        \"id\": 21,\n        \"title\": \"Product Title\",\n        \"price\": 29.99,\n        \"description\": \"Product Description\",\n        \"category\": \"jewelery\",\n        \"image\": \"http://example.com/image.jpg\",\n    \n      }\n    ```\n\n### Theoretical Challenge\n\n#### 1. Upload CSV File and get proper result\n- **Description:** upload csv file like `https://github.com/Akash1yadavv/Prospecta_Backenmd_Assignment/blob/main/SampleTestInput.csv`\n- **Request Body:**\n\n    ```\n     Multipart/form-data\n     CSV File\n    ```\n\n- **Response:**\n\n    ```\n      5,3,10\n      7,8,15\n      9,9,24\n    ```\n\n## How to Test\n\n**Open Browser And paste this URL `http://localhost:8080/swagger-ui/index.html`  **\n\n**OR**\n\n1. **Sign Up:**\n\n    Use Postman to send a `POST` request to `http://localhost:8080/api/prospecta/register-user` with the required body parameters.\n\n2. **Log In:**\n\n    Send a `POST` request to `http://localhost:8080/api/prospecta/auth/login` to receive the JWT token.\n\n3. **Get Products:**\n\n    Send a `GET` request to `http://localhost:8080/api/prospecta/products/category/{category}` with the appropriate category and jwt token in headers.\n\n4. **Add Product:**\n\n    Send a `POST` request to `http://localhost:8080/api/prospecta/products/` with the product details in the request body and jwt token in headers.\n\n5. **Theoretical Challenge CSV File :**   \n    Send a `POST` request to `http://localhost:8080/api/prospecta/upload-csv` upload A csv file and with Key= `file` Make sure file should be .CSV file\n   \n## Security and Reliability\n\nTo ensure the security and reliability of the APIs:\n\n- **Authentication:** Use JWT tokens for secure access.\n- **Data Validation:** Validate all input data to prevent invalid or harmful data from being processed.\n- **Error Handling:** Implement proper error handling to provide meaningful error messages.\n- **Logging:** Use logging to track application behavior and debug issues.\n- **Rate Limiting:** Consider implementing rate limiting to prevent abuse of the APIs.\n\n\n## Images\n\n## Screenshots\n\n### All Api Image\n\n![logo](https://github.com/Akash1yadavv/Prospecta_Backenmd_Assignment/blob/main/Swagger-API%20ScreenShot.png)\n\n## Contributing\n\nFeel free to submit issues or pull requests. Please make sure your contributions adhere to the project's coding standards.\n\nReplace placeholders such as `your-username`, `your-repository`, `your_database_name`, `your_database_username`, and `your_database_password` with your actual values.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakash1yadavv%2Fprospecta_backenmd_assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakash1yadavv%2Fprospecta_backenmd_assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakash1yadavv%2Fprospecta_backenmd_assignment/lists"}