{"id":18452917,"url":"https://github.com/reubenmathew/eecs4413-backend","last_synced_at":"2025-10-10T17:12:22.760Z","repository":{"id":42009415,"uuid":"446626382","full_name":"ReubenMathew/EECS4413-Backend","owner":"ReubenMathew","description":"Course Project for EECS4413","archived":false,"fork":false,"pushed_at":"2022-04-18T20:38:59.000Z","size":284,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T12:19:13.141Z","etag":null,"topics":[],"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/ReubenMathew.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}},"created_at":"2022-01-11T00:32:01.000Z","updated_at":"2022-03-17T18:13:38.000Z","dependencies_parsed_at":"2022-08-12T02:11:10.517Z","dependency_job_id":null,"html_url":"https://github.com/ReubenMathew/EECS4413-Backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ReubenMathew/EECS4413-Backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenMathew%2FEECS4413-Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenMathew%2FEECS4413-Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenMathew%2FEECS4413-Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenMathew%2FEECS4413-Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReubenMathew","download_url":"https://codeload.github.com/ReubenMathew/EECS4413-Backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReubenMathew%2FEECS4413-Backend/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266936386,"owners_count":24009409,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-06T07:34:51.600Z","updated_at":"2025-10-10T17:12:17.725Z","avatar_url":"https://github.com/ReubenMathew.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EECS4413-Backend\nCourse Project for EECS4413\n\n## Run Locally\n1. Navigate to the Java project `shopcart-backend`\n2. Build the docker image `docker build -t .`\n3. Create a `.env` file with the following values to connect the backend service to the database\n```env\nPSCALE_DB_NAME=\u003cMySQL_DB_NAME\u003e\nPSCALE_USERNAME=\u003cMySQL_DB_USERNAME\u003e\nPSCALE_DB_URL=\u003cMySQL_DB_CONNECTION_URL\u003e\nPSCALE_PASSWORD=\u003cMySQL_DB_PASSWORD\u003e\n```\n4. Run the previously built docker image `docker run -p 8080:8080 --env-file .env shopcart-backend`\n5. The backend is successfully deployed\n\n## API Endpoints\n### Analytics\nAll analytics endpoints are prefixed with `/api/analytics`\n\n- `GET /monthly/items`\n  - returns JSON object mapping months to items sold\n- `GET /website/usage`\n  - returns JSON object containing page view Analytics\n- `POST /website/usage`\n  - accepts JSON object about where the page visit happened\n- `DELETE /website/usage`\n  - deletes website visit event\n\n### Orders\nAll ordering endpoints are prefixed with `/api/orders`\n\n- `GET`\n  - returns all orders regardless of status in a JSON payload\n- `GET /{order_id}`\n  - returns order as JSON object\n- `DELETE /{order_id}`\n  - deletes order object from database from a request parameter order-id\n- `POST /process`\n  - accepts JSON payload of an order and adds that order to database\n- `PUT /submit`\n  - accepts JSON payload of an order and changes its status based on payment status to `/DummyPaymentService`\n\n### Products\nAll products endpoints are prefixed with `/api/products`\n\n- `GET`\n  - returns JSON list of all product objects in database\n- `GET /{product_id}`\n  - returns product object details from a given product-id\n- `POST`\n  - accepts JSON object of a product and adds it to database\n- `PUT /{product_id}`\n  - accepts JSON object to update existing product objects\n- `DELETE /{product_id}`\n  - deletes product object from database by product-id\n\n### Reviews\nAll reviews endpoints are prefixed with `/api/reviews`\n\n- `GET /product/{product_id}`\n  - gets reviews for a given product-id\n- `GET /{review_id}`\n  - gets review object for a given review-id\n- `POST`\n  - accepts a review JSON object and persists it to the database\n- `PUT /{review_id}`\n  - updates review based on a given review-id\n- `DELETE /{review_id}`\n  - deletes the review object based on a given review-id\n\n### Users\nAll authentication and user controller endpoints are prefixed with `/api`\n\n- `POST /authenticate`\n  - accepts an AuthRequest object containing username and password, returns a JWT token on successful authentication\n- `GET /users`\n  - returns a JSON list of all user objects in database\n- `POST /register`\n  - accepts a `RegistrationRequest` object which persists the to-be registered user in the database\n\n## Populate Database with Dummy Data\n```sql\n-- Drop Tables To Start Fresh\nDROP TABLE order_product_ids;\nDROP TABLE product_review_ids;\nDROP TABLE orders;\nDROP TABLE products;\nDROP TABLE reviews;\nDROP TABLE users;\nDROP TABLE visit_event;\n\n-- Recreate All Of The Tables Needed\nCREATE TABLE `products` (\n  `id` bigint NOT NULL AUTO_INCREMENT,\n  `brand` varchar(255) DEFAULT NULL,\n  `category` varchar(255) DEFAULT NULL,\n  `color` varchar(255) DEFAULT NULL,\n  `description` varchar(255) DEFAULT NULL,\n  `image_url` varchar(255) DEFAULT NULL,\n  `price` float DEFAULT NULL,\n  `product_name` varchar(255) DEFAULT NULL,\n  `size` varchar(255) DEFAULT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\n\nCREATE TABLE `reviews` (\n  `id` bigint NOT NULL AUTO_INCREMENT,\n  `description` varchar(255) DEFAULT NULL,\n  `product_id` bigint DEFAULT NULL,\n  `rating` int DEFAULT NULL,\n  `title` varchar(255) DEFAULT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\n\nCREATE TABLE `orders` (\n  `id` bigint NOT NULL AUTO_INCREMENT,\n  `country` varchar(255) DEFAULT NULL,\n  `date` date NOT NULL,\n  `first_name` varchar(255) DEFAULT NULL,\n  `last_name` varchar(255) DEFAULT NULL,\n  `status` varchar(255) DEFAULT NULL,\n  `total` float DEFAULT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\n\nCREATE TABLE `product_review_ids` (\n  `product_id` bigint NOT NULL,\n  `review_ids` bigint NOT NULL,\n  PRIMARY KEY (`product_id`,`review_ids`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\n\nCREATE TABLE `order_product_ids` (\n  `order_id` bigint NOT NULL,\n  `product_ids` bigint NOT NULL,\n  PRIMARY KEY (`order_id`,`product_ids`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\n\nCREATE TABLE `users` (\n  `id` int NOT NULL AUTO_INCREMENT,\n  `email` varchar(255) NOT NULL,\n  `password` varchar(255) NOT NULL,\n  `role_code` varchar(255) NOT NULL,\n  `username` varchar(255) NOT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\n\nCREATE TABLE `visit_event` (\n  `id` bigint NOT NULL AUTO_INCREMENT,\n  `date` date NOT NULL,\n  `event` varchar(255) DEFAULT NULL,\n  `ip_address` varchar(255) DEFAULT NULL,\n  PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;\n\nINSERT INTO products (brand, category, color, description, image_url, price, product_name, size) VALUES (\"nike\", \"top\", \"blue\", \"Ultra thin shirt\", \"\", 56.99, \"Nike Shirt\", \"XXS\");\nINSERT INTO products (brand, category, color, description, image_url, price, product_name, size) VALUES (\"nike\", \"top\", \"black\", \"Ultra thin oversized shirt\", \"\", 56.99, \"Nike Oversized Shirt\", \"XS\");\nINSERT INTO products (brand, category, color, description, image_url, price, product_name, size) VALUES (\"nike\", \"top\", \"green\", \"Ultra thin tank top\", \"\", 56.99, \"Nike TankTop\", \"S\");\nINSERT INTO products (brand, category, color, description, image_url, price, product_name, size) VALUES (\"nike\", \"bottom\", \"grey\", \"Thick pants\", \"\", 79.99, \"Nike Pants\", \"XXS\");\nINSERT INTO products (brand, category, color, description, image_url, price, product_name, size) VALUES (\"nike\", \"bottom\", \"black\", \"Thick tech pants\", \"\", 79.99, \"Nike Tech Pants\", \"XS\");\nINSERT INTO products (brand, category, color, description, image_url, price, product_name, size) VALUES (\"nike\", \"bottom\", \"white\", \"Thick cargo pants\", \"\", 79.99, \"Nike Cargo Pants\", \"S\");\nINSERT INTO products (brand, category, color, description, image_url, price, product_name, size) VALUES (\"adidas\", \"accessories\", \"white\", \"Elastic\", \"\", 19.99, \"Adidas Headband\", \"XS\");\n\nINSERT INTO reviews (description, product_id, rating, title) VALUES (\"kinda liked it\", 1, 3, \"Okay product\");\nINSERT INTO reviews (description, product_id, rating, title) VALUES (\"liked it\", 1, 4, \"Good product\");\nINSERT INTO reviews (description, product_id, rating, title) VALUES (\"didnt like it\", 3, 1, \"Bad product\");\nINSERT INTO reviews (description, product_id, rating, title) VALUES (\"really liked it\", 4, 5, \"Amazing product\");\n\nINSERT INTO product_review_ids (product_id, review_ids) VALUES (1, 1);\nINSERT INTO product_review_ids (product_id, review_ids) VALUES (1, 2);\nINSERT INTO product_review_ids (product_id, review_ids) VALUES (3, 3);\nINSERT INTO product_review_ids (product_id, review_ids) VALUES (4, 4);\n\nINSERT INTO orders (country, date, first_name, last_name, status, total) VALUES (\"canada\", \"2022-04-07\", \"eric\", \"kwok\", 2, 56.99);\nINSERT INTO orders (country, date, first_name, last_name, status, total) VALUES (\"canada\", \"2022-06-07\", \"eric\", \"kwok\", 2, 136.98);\nINSERT INTO orders (country, date, first_name, last_name, status, total) VALUES (\"canada\", \"2022-12-07\", \"eric\", \"kwok\", 2, 136.98);\nINSERT INTO orders (country, date, first_name, last_name, status, total) VALUES (\"canada\", \"2022-01-07\", \"eric\", \"kwok\", 2, 136.98);\n\nINSERT INTO order_product_ids (order_id, product_ids) VALUES (1, 1);\nINSERT INTO order_product_ids (order_id, product_ids) VALUES (2, 2);\nINSERT INTO order_product_ids (order_id, product_ids) VALUES (2, 5);\nINSERT INTO order_product_ids (order_id, product_ids) VALUES (3, 2);\nINSERT INTO order_product_ids (order_id, product_ids) VALUES (3, 4);\nINSERT INTO order_product_ids (order_id, product_ids) VALUES (4, 3);\nINSERT INTO order_product_ids (order_id, product_ids) VALUES (4, 6);\n\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 3);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 3);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 3);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 2);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 2);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 2);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 2);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 1);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 1);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 1);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 1);\nINSERT INTO visit_event (date, event, ip_address) VALUES (\"2022-04-07\", \"1.27.0.0.0\", 1);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freubenmathew%2Feecs4413-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freubenmathew%2Feecs4413-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freubenmathew%2Feecs4413-backend/lists"}