{"id":15008043,"url":"https://github.com/raushanraj901/prospecta_assignment","last_synced_at":"2026-04-02T01:58:46.483Z","repository":{"id":256010933,"uuid":"854107533","full_name":"raushanraj901/Prospecta_Assignment","owner":"raushanraj901","description":"Prospecta assignment to develop secure APIs using JWT authentication and role-based access control with the Fake Store API. Includes endpoints for retrieving product details by category and adding new products. Also features a CSV processor for calculating formulas and producing computed outputs.","archived":false,"fork":false,"pushed_at":"2024-09-10T12:09:14.000Z","size":617,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T19:59:52.854Z","etag":null,"topics":["git","hibernate","jwt-authentication","mysql","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/raushanraj901.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-08T12:41:51.000Z","updated_at":"2024-09-10T12:09:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed4c91d3-8e28-411e-a56a-6e38434737c0","html_url":"https://github.com/raushanraj901/Prospecta_Assignment","commit_stats":null,"previous_names":["raushanraj901/prospecta_assignment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raushanraj901%2FProspecta_Assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raushanraj901%2FProspecta_Assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raushanraj901%2FProspecta_Assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raushanraj901%2FProspecta_Assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raushanraj901","download_url":"https://codeload.github.com/raushanraj901/Prospecta_Assignment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243180647,"owners_count":20249326,"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","jwt-authentication","mysql","spring-boot","spring-security","validation"],"created_at":"2024-09-24T19:14:51.833Z","updated_at":"2025-12-26T05:23:59.425Z","avatar_url":"https://github.com/raushanraj901.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API for Product Management And CSV File Management\nThe Coding Interview for Graduates project at Prospecta entails the development of secure APIs using JWT authentication and role-based access control, in conjunction with the Fake Store API. The project encompasses the creation of two primary APIs: one for retrieving product details based on category and another for adding new product entries.\n\nAdditionally, the project includes a theoretical component involving the development of a program that processes a CSV file containing both values and formulas. This program is expected to compute the results of the formulas and produce a corresponding CSV output.\n\nThe technical stack for this project includes Java with Spring Boot for API development, JWT for authentication, and role-based access control for endpoint security. The implementation emphasizes comprehensive error handling and validation mechanisms to effectively manage formulas, cell references, and non-integer values.\n\n\n## Getting Started\n\n### Prerequisites\n\n- Java 17\n- Maven\n- MySQL\n- Postman\n- Swagger\n- STS\n\n**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/product\n      spring.datasource.username=root\n      spring.datasource.password=admin\n      spring.jpa.hibernate.ddl-auto=update\n      \n## Images\n\n## Screenshots\n\n![logo](https://github.com/raushanraj901/Prospecta_Assignment/blob/main/Screenshot%20(2).png)\n\n## How to Test\n#### Open Browser And paste this URL `http://localhost:8888/swagger-ui/index.html` \n\n**OR**\n\n1. **Sign Up:**\n\n    Use Postman to send a `POST` request to `http://localhost:8888/api/register-user` with the required body parameters.\n\n2. **Log In:**\n\n    Send a `POST` request to `http://localhost:8888/api/auth/login` to receive the JWT token.\n\n3. **Get Products:**\n\n    Send a `GET` request to `http://localhost:8888/api/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:8888/api/products/add` with the product details in the request body and jwt token in headers.\n\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## API Endpoints\n\n### Authentication\n\n#### 1. Sign Up\n\n- **Endpoint:** `POST http://localhost:8888/api/register-user`\n- **Description:** Registers a new user.\n- **Request Body:**\n\n    ```json\n    {\n      \"email\": \"user@email.com\",\n      \"password\": \"password\",\n      \"name\": \"name\",\n      \"phone\": \"1234567890\"\n    }\n    ```\n\n#### 2. Log In\n\n- **Endpoint:** `POST http://localhost:8888/api/auth/login`\n- **Description:** Authenticates a user and returns a JWT token.\n- **Request Body:**\n\n    ```json\n    {\n      \"email\": \"user@email.com\",\n      \"password\": \"password\"\n    }\n    ```\n- **Response:**\n\n    ```json\n    {\n      \"token\": \"token\",\n      \"expiresIn\": \"milli_second\"\n    }\n    ```\n\n### Product Management\n\n#### 1. Get Products by Category\n\n- **Endpoint:** `GET http://localhost:8888/api/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    ]\n    ```\n\n#### 2. Add New Product\n\n- **Endpoint:** `POST http://localhost:8888/api/products/add`\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\n\n\n\n# CSV Processing Service\n\nThis project is a Spring Boot application that provides an API to upload and process CSV files. The API reads CSV content, evaluates any formulas within the cells, and returns the processed data as a new CSV file.\n\n## Features\n\n- Upload and process CSV files.\n- Evaluate basic mathematical formulas within CSV cells.\n- Return processed data as CSV file.\n\n## Technologies Used\n\n- Java 17+\n- Spring Boot\n- Maven\n- RESTful API\n\n## Getting Started\n\n### Prerequisites\n\nEnsure you have the following installed:\n\n- Java 17+\n- Maven\n- Git\n\n## Images\n\n## Screenshots\n\n![logo](https://github.com/raushanraj901/Prospecta_Assignment/blob/main/Screenshot%20(4).png)\n\n\n\n### Installation\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/raushanraj901/Prospecta_Assignment.git\n    ```\n\n2. Navigate to the project directory:\n\n    ```bash\n    cd your-repository\n    ```\n\n3. Build the project using Maven:\n\n    ```bash\n    mvn clean install\n    ```\n\n4. Run the application:\n\n    ```bash\n    mvn spring-boot:run\n    ```\n\nThe application will start and be accessible at `http://localhost:8080`.\n\n## API Documentation\n\n### CSV Upload API\n\nThe CSV Upload API allows users to upload CSV files, process them, and return the evaluated data.\n\n#### Endpoint\n\n- **URL:** `/api/csv/upload`\n- **Method:** `POST`\n- **Consumes:** `multipart/form-data`\n- **Produces:** `text/csv`\n\n#### Request Parameters\n\n- **file**: The CSV file to be uploaded. This must be a `.csv` file.\n\n#### Responses\n\n- **200 OK**: Processed CSV content as plain text.\n- **400 Bad Request**: Error message for empty files or processing errors.\n- **415 Unsupported Media Type**: Error message for unsupported file types.\n\n#### Example Request Using Postman\n\n1. **Open Postman** and create a new request.\n2. **Set the request method** to `POST`.\n3. **Enter the request URL**: `http://localhost:8080/api/csv/upload`.\n4. **Set Headers**: Ensure `Content-Type` is set to `multipart/form-data`.\n5. **Add File**:\n   - Go to the `Body` tab.\n   - Select `form-data`.\n   - Enter `file` as the key.\n   - Choose `File` from the dropdown next to the key.\n   - Click `Select Files` and upload a CSV file.\n6. **Click Send** to upload the file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraushanraj901%2Fprospecta_assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraushanraj901%2Fprospecta_assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraushanraj901%2Fprospecta_assignment/lists"}