{"id":15155542,"url":"https://github.com/yousufislam191/onepte","last_synced_at":"2025-09-10T04:35:06.605Z","repository":{"id":253867177,"uuid":"842446213","full_name":"yousufislam191/OnePTE","owner":"yousufislam191","description":"OnePTE is a simplified version of the Quiz Assessment Platform for a language proficiency test","archived":false,"fork":false,"pushed_at":"2024-08-21T20:49:37.000Z","size":720,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T15:18:41.308Z","etag":null,"topics":["express-js","mysql","node-js","pte","pte-exam","pte-exam-api","rest-api","sequilize","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/yousufislam191.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-08-14T11:18:21.000Z","updated_at":"2024-08-21T21:02:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"0cfca5cc-ebe3-4c9e-b98e-43a688da1dab","html_url":"https://github.com/yousufislam191/OnePTE","commit_stats":{"total_commits":38,"total_committers":1,"mean_commits":38.0,"dds":0.0,"last_synced_commit":"109ad4839e1a0f467aa5f4a3d5066d780205c73c"},"previous_names":["yousufislam191/onepte"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousufislam191%2FOnePTE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousufislam191%2FOnePTE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousufislam191%2FOnePTE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yousufislam191%2FOnePTE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yousufislam191","download_url":"https://codeload.github.com/yousufislam191/OnePTE/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247653425,"owners_count":20973827,"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":["express-js","mysql","node-js","pte","pte-exam","pte-exam-api","rest-api","sequilize","typescript"],"created_at":"2024-09-26T18:23:25.628Z","updated_at":"2025-04-07T12:32:58.630Z","avatar_url":"https://github.com/yousufislam191.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OnePTE API Documentation\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Database Design](#database-design)\n- [API Endpoints](#api-endpoints)\n  - [User Endpoints](#user-endpoints)\n    - [Register a new user](#register-a-new-user)\n    - [Get user practice history](#get-user-practice-history)\n  - [Authentication Endpoints](#authentication-endpoints)\n    - [Login a user](#login-a-user)\n    - [Logout a user](#logout-a-user)\n    - [Generate Refresh Token](#generate-refresh-token)\n  - [Question Endpoints](#question-endpoints)\n    - [Create a new question](#create-a-new-question)\n    - [Get all questions with pagination and filtering](#get-all-questions-with-pagination-and-filtering)\n    - [Get a specific question](#get-a-specific-question)\n  - [Answer Endpoints](#answer-endpoints)\n    - [Create a new answer for a specific question](#create-a-new-answer-for-a-specific-question)\n- [Run this project](#run-this-project)\n  - [Running Locally](#running-locally)\n  - [Running with Docker](#running-with-docker)\n- [Test Api's](#test-api's)\n\n## Introduction\n\nOnePTE is a REST API built with Node.js and Express.js framework. It uses Sequelize as ORM to interact with MySQL database. The API is designed to manage questions and answers for a language proficiency test.\n\n### [⬆️ Back to top](#table-of-contents)\n\n## Database Design\n\n![Diagram](./databaseDesign.png 'Diagram of the database architecture')\n\n### [⬆️ Back to top](#table-of-contents)\n\n## API Endpoints\n\n### User Endpoints\n\n#### Register a new user\n\n- **POST `/api/v1/users/register`**\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Body Example (Click here)\u003c/summary\u003e\n\n  ```JSON\n    {\n      \"name\": \"Yousuf Islam\",\n      \"email\": \"yousufislam@gmail.com\",\n      \"password\": \"12345@qQ\"\n    }\n  ```\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse example\u003c/summary\u003e\n\n  ```JSON\n    {\n      \"status\": 201,\n      \"success\": true,\n      \"message\": \"User created successfully\",\n      \"data\": null\n    }\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n#### Get user practice history\n\n- **GET `/api/v1/users/history?type=SST\u0026page=1\u0026pageSize=5`**\n\n  \u003cdetails\u003e\u003csummary\u003eQuery Parameters\u003c/summary\u003e\n\n  | Parameter  | Type   | Description                                                                         |\n  | ---------- | ------ | ----------------------------------------------------------------------------------- |\n  | `type`     | enum   | (optional) Filters history by question type. Possible values: `SST`, `RO`, `RMMCQ`. |\n  | `page`     | string | (optional) Specifies the page number for pagination. Default is `1`.                |\n  | `pageSize` | string | (optional) Specifies the number of items per page. Default is `10`.                 |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Headers\u003c/summary\u003e\n\n  | Header Name | Value Type | Description                                                   |\n  | ----------- | ---------- | ------------------------------------------------------------- |\n  | `Cookie`    | string     | Contains `accessToken` and `refreshToken` for authentication. |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Example\u003c/summary\u003e\n\n  ```http\n  GET /api/v1/users/history?type=SST\u0026page=1\u0026pageSize=5 HTTP/1.1\n  Host: your-api.com\n  Cookie: accessToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsImlhdCI6MTY5MjQwNjAyMCwiZXhwIjoxNzI0MDY5MzIwfQ.wBq6BImUXNUp5SW8ptjY8q_W6oBzzNybjFdEKcICG_A; refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsImlhdCI6MTcyNDA2OTAyMCwiZXhwIjoxNzI0NjczODIwfQ.XbP2M2SCo60_cCszqJKwd_zyoPH7b45aK2LQfY6ikZI\n\n  ```\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example\u003c/summary\u003e\n\n  ```JSON\n  {\n    \"status\": 200,\n    \"success\": true,\n    \"message\": \"User history retrieved successfully\",\n    \"data\": {\n      \"totalItems\": 2,\n      \"totalPages\": 1,\n      \"currentPage\": 1,\n      \"user\": {\n        \"name\": \"Yousuf Islam\"\n      },\n      \"history\": [\n        {\n          \"answer\": {\n            \"id\": 1,\n            \"answer\": [0, 1, 2],\n            \"score\": 0,\n            \"max_score\": 3\n          },\n          \"question\": {\n            \"id\": 6,\n            \"type\": \"RMMCQ\",\n            \"title\": \"RMMCQ Two\",\n            \"sst\": null,\n            \"ro\": null,\n            \"rmmcq\": {\n              \"id\": 2,\n              \"options\": [\n                \"Not for one moment did he doubt the validity...\",\n                \"This research seems to give some validity...\",\n                \"I had no reason to question the validity...\",\n                \"State officials questioned the validity of the report...\",\n                \"The clause has no legal validity...\"\n              ]\n            }\n          }\n        },\n        {\n          \"answer\": {\n            \"id\": 2,\n            \"answer\": [0, 1, 2, 3],\n            \"score\": 3,\n            \"max_score\": 3\n          },\n          \"question\": {\n            \"id\": 5,\n            \"type\": \"RO\",\n            \"title\": \"RO Two\",\n            \"sst\": null,\n            \"ro\": {\n              \"id\": 2,\n              \"paragraphs\": [\n                \"Not for one moment did he doubt the validity...\",\n                \"This research seems to give some validity...\",\n                \"I had no reason to question the validity...\",\n                \"State officials questioned the validity of the report...\"\n              ]\n            },\n            \"rmmcq\": null\n          }\n        },\n      ]\n    }\n  }\n\n\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n### Authentication Endpoints\n\n#### Login a user\n\n- **POST `/api/v1/auth/login`**\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Body Example\u003c/summary\u003e\n\n  ```JSON\n    {\n      \"email\": \"yousufislam@gmail.com\",\n      \"password\": \"12345@qQ\"\n    }\n  ```\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example\u003c/summary\u003e\n\n  ```JSON\n  {\n      \"status\": 200,\n      \"success\": true,\n      \"message\": \"Successfully logged in\",\n      \"data\": {\n          \"id\": 1\n      }\n  }\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n#### Logout a user\n\n- **POST `/api/v1/auth/logout`**\n  \u003cdetails\u003e\u003csummary\u003eRequest Headers\u003c/summary\u003e\n\n  | Header Name | Value Type | Description                                                   |\n  | ----------- | ---------- | ------------------------------------------------------------- |\n  | `Cookie`    | string     | Contains `accessToken` and `refreshToken` for authentication. |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example\u003c/summary\u003e\n\n  ```JSON\n  {\n    \"status\": 200,\n    \"success\": true,\n    \"message\": \"Successfully logged out\",\n    \"data\": null\n  }\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n#### Generate Refresh Token\n\n- **POST `/api/v1/auth/refresh-token`**\n  \u003cdetails\u003e\u003csummary\u003eRequest Headers\u003c/summary\u003e\n\n  | Header Name | Value Type | Description                                                   |\n  | ----------- | ---------- | ------------------------------------------------------------- |\n  | `Cookie`    | string     | Contains `accessToken` and `refreshToken` for authentication. |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example\u003c/summary\u003e\n\n  ```JSON\n  {\n    \"status\": 200,\n    \"success\": true,\n    \"message\": \"New access token generated successfully\",\n    \"data\": null\n  }\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n### Question Endpoints\n\n#### Create a new question\n\n- **POST `/api/v1/questions`**\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Headers\u003c/summary\u003e\n\n  | Header Name    | Type   | Description                                                   |\n  | -------------- | ------ | ------------------------------------------------------------- |\n  | `Cookie`       | string | Contains `accessToken` and `refreshToken` for authentication. |\n  | `Content-Type` | string | Must be `multipart/form-data`                                 |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eForm-Data Parameters\u003c/summary\u003e\n\n  | Parameter Name | Type | Description                                               |\n  | -------------- | ---- | --------------------------------------------------------- |\n  | `audio_files`  | file | `Required for SST`. Audio files (multiple files allowed). |\n  | `jsonData`     | text | `Required`. JSON string containing the question details.  |\n\n  Example for `jsonData` (as text):\n\n  ```TEXT\n  {\n    \"type\": \"SST\",\n    \"title\": \"Title must be a string\",\n    \"time_limit\": 20,\n    \"speakers\": [\"Speaker 1\", \"Speaker 2\"],\n    \"paragraphs\": [\"paragraphs 1\", \"paragraphs 2\", \"paragraphs 3\", \"paragraphs 4\"],\n    \"passage\": \"Executing (default): SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME 'users' AND TABLE_SCHEMA = 'onepte'\",\n    \"options\": [\"options 1\", \"options 2\", \"options 3\", \"options 4\", \"options 5\"],\n    \"correct_options\": [1, 2, 4]\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example for SST Type Question\u003c/summary\u003e\n\n  ```JSON\n    {\n    \"status\": 201,\n    \"success\": true,\n    \"message\": \"Question created successfully\",\n    \"data\": {\n        \"question\": {\n            \"id\": 4,\n            \"type\": \"SST\",\n            \"title\": \"Title must be a string\",\n            \"sst_id\": 1,\n            \"updatedAt\": \"2024-08-20T22:27:17.826Z\",\n            \"createdAt\": \"2024-08-20T22:27:17.826Z\"\n        },\n        \"details\": {\n            \"id\": 1,\n            \"time_limit\": 20,\n            \"audio_files\": [\n                {\n                    \"fileUrl\": \"uploads/audio/1724192835930-AvoidRafa_(cover).mp3\",\n                    \"speaker\": \"Speaker 1\"\n                },\n                {\n                    \"fileUrl\": \"uploads/audio/1724192836022-Music_(_no_copyright_Music_)_01.mp3\",\n                    \"speaker\": \"Speaker 2\"\n                }\n            ],\n            \"updatedAt\": \"2024-08-20T22:27:16.084Z\",\n            \"createdAt\": \"2024-08-20T22:27:16.084Z\"\n        }\n    }\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example for RO Type Question\u003c/summary\u003e\n\n  ```JSON\n    {\n    \"status\": 201,\n    \"success\": true,\n    \"message\": \"Question created successfully\",\n    \"data\": {\n        \"question\": {\n            \"id\": 3,\n            \"type\": \"RO\",\n            \"title\": \"Title must be a string\",\n            \"ro_id\": 1,\n            \"updatedAt\": \"2024-08-20T22:26:43.350Z\",\n            \"createdAt\": \"2024-08-20T22:26:43.350Z\"\n        },\n        \"details\": {\n            \"id\": 1,\n            \"paragraphs\": [\n                \"paragraphs 1\",\n                \"paragraphs 2\",\n                \"paragraphs 3\",\n                \"paragraphs 4\"\n            ],\n            \"updatedAt\": \"2024-08-20T22:26:43.231Z\",\n            \"createdAt\": \"2024-08-20T22:26:43.231Z\"\n        }\n    }\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example for RMMCQ Type Question\u003c/summary\u003e\n\n  ```JSON\n    {\n    \"status\": 201,\n    \"success\": true,\n    \"message\": \"Question created successfully\",\n    \"data\": {\n        \"question\": {\n            \"id\": 2,\n            \"type\": \"RMMCQ\",\n            \"title\": \"Title must be a string\",\n            \"rmmcq_id\": 2,\n            \"updatedAt\": \"2024-08-20T22:25:24.736Z\",\n            \"createdAt\": \"2024-08-20T22:25:24.736Z\"\n        },\n        \"details\": {\n            \"id\": 2,\n            \"passage\": \"Executing (default): SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME 'users' AND TABLE_SCHEMA = 'onepte'\",\n            \"options\": [\n                \"options 1\",\n                \"options 2\",\n                \"options 3\",\n                \"options 4\",\n                \"options 5\"\n            ],\n            \"correct_options\": [\n                1,\n                2,\n                4\n            ],\n            \"updatedAt\": \"2024-08-20T22:25:24.472Z\",\n            \"createdAt\": \"2024-08-20T22:25:24.472Z\"\n        }\n    }\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n#### Get all questions with pagination and filtering\n\n- **GET `/api/v1/questions?page=1\u0026pageSize=5`**\n\n  \u003cdetails\u003e\u003csummary\u003eQuery Parameters\u003c/summary\u003e\n\n  | Parameter  | Type   | Description                                                                           |\n  | ---------- | ------ | ------------------------------------------------------------------------------------- |\n  | `type`     | enum   | (optional) Filters questions by question type. Possible values: `SST`, `RO`, `RMMCQ`. |\n  | `page`     | string | (optional) Specifies the page number for pagination. Default is `1`.                  |\n  | `pageSize` | string | (optional) Specifies the number of items per page. Default is `10`.                   |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Headers\u003c/summary\u003e\n\n  | Header Name | Value Type | Description                                                   |\n  | ----------- | ---------- | ------------------------------------------------------------- |\n  | `Cookie`    | string     | Contains `accessToken` and `refreshToken` for authentication. |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example\u003c/summary\u003e\n\n  ```JSON\n  {\n    \"status\": 200,\n    \"success\": true,\n    \"message\": \"Questions fetched successfully\",\n    \"data\": {\n        \"totalItems\": 41,\n        \"totalPages\": 5,\n        \"currentPage\": 1,\n        \"data\": [\n            {\n                \"id\": 1,\n                \"type\": \"SST\",\n                \"title\": \"SST One\",\n                \"sst_id\": 1,\n                \"ro_id\": null,\n                \"rmmcq_id\": null,\n                \"createdAt\": \"2024-08-15T22:23:46.000Z\",\n                \"updatedAt\": \"2024-08-15T22:23:46.000Z\"\n            },\n            {\n                \"id\": 2,\n                \"type\": \"RO\",\n                \"title\": \"RO One\",\n                \"sst_id\": null,\n                \"ro_id\": 1,\n                \"rmmcq_id\": null,\n                \"createdAt\": \"2024-08-15T22:24:44.000Z\",\n                \"updatedAt\": \"2024-08-15T22:24:44.000Z\"\n            },\n            {\n                \"id\": 3,\n                \"type\": \"RMMCQ\",\n                \"title\": \"RMMCQ One\",\n                \"sst_id\": null,\n                \"ro_id\": null,\n                \"rmmcq_id\": 1,\n                \"createdAt\": \"2024-08-15T22:25:00.000Z\",\n                \"updatedAt\": \"2024-08-15T22:25:00.000Z\"\n            },\n            {\n                \"id\": 4,\n                \"type\": \"SST\",\n                \"title\": \"SST Two\",\n                \"sst_id\": 2,\n                \"ro_id\": null,\n                \"rmmcq_id\": null,\n                \"createdAt\": \"2024-08-15T22:25:17.000Z\",\n                \"updatedAt\": \"2024-08-15T22:25:17.000Z\"\n            },\n            {\n                \"id\": 5,\n                \"type\": \"RO\",\n                \"title\": \"RO Two\",\n                \"sst_id\": null,\n                \"ro_id\": 2,\n                \"rmmcq_id\": null,\n                \"createdAt\": \"2024-08-15T22:25:26.000Z\",\n                \"updatedAt\": \"2024-08-15T22:25:26.000Z\"\n            },\n            {\n                \"id\": 6,\n                \"type\": \"RMMCQ\",\n                \"title\": \"RMMCQ Two\",\n                \"sst_id\": null,\n                \"ro_id\": null,\n                \"rmmcq_id\": 2,\n                \"createdAt\": \"2024-08-15T22:25:34.000Z\",\n                \"updatedAt\": \"2024-08-15T22:25:34.000Z\"\n            },\n            {\n                \"id\": 7,\n                \"type\": \"RMMCQ\",\n                \"title\": \"Fix: Use Dynamic Assignment for questionData\",\n                \"sst_id\": null,\n                \"ro_id\": null,\n                \"rmmcq_id\": 3,\n                \"createdAt\": \"2024-08-17T22:59:26.000Z\",\n                \"updatedAt\": \"2024-08-17T22:59:26.000Z\"\n            },\n            {\n                \"id\": 8,\n                \"type\": \"SST\",\n                \"title\": \"Fix: Use Dynamic Assignment for questionData\",\n                \"sst_id\": 3,\n                \"ro_id\": null,\n                \"rmmcq_id\": null,\n                \"createdAt\": \"2024-08-17T23:01:30.000Z\",\n                \"updatedAt\": \"2024-08-17T23:01:30.000Z\"\n            },\n            {\n                \"id\": 9,\n                \"type\": \"RO\",\n                \"title\": \"Fix: Use Dynamic Assignment for questionData\",\n                \"sst_id\": null,\n                \"ro_id\": 3,\n                \"rmmcq_id\": null,\n                \"createdAt\": \"2024-08-17T23:01:38.000Z\",\n                \"updatedAt\": \"2024-08-17T23:01:38.000Z\"\n            },\n            {\n                \"id\": 10,\n                \"type\": \"RO\",\n                \"title\": \"Fix: Use Dynamic Assignment for questionData\",\n                \"sst_id\": null,\n                \"ro_id\": 4,\n                \"rmmcq_id\": null,\n                \"createdAt\": \"2024-08-17T23:12:18.000Z\",\n                \"updatedAt\": \"2024-08-17T23:12:18.000Z\"\n            }\n        ]\n    }\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n#### Get a specific question\n\n- **GET `/api/v1/questions/:id`**\n\n  \u003cdetails\u003e\u003csummary\u003eQuery Parameters\u003c/summary\u003e\n\n  | Parameter | Type | Description |\n  | --------- | ---- | ----------- |\n  | `id`      | int  | Question ID |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Headers\u003c/summary\u003e\n\n  | Header Name | Value Type | Description                                                   |\n  | ----------- | ---------- | ------------------------------------------------------------- |\n  | `Cookie`    | string     | Contains `accessToken` and `refreshToken` for authentication. |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eResponse Example\u003c/summary\u003e\n\n  ```JSON\n    {\n    \"status\": 200,\n    \"success\": true,\n    \"message\": \"Question fetched successfully\",\n    \"data\": {\n        \"id\": 3,\n        \"type\": \"RO\",\n        \"title\": \"Title must be a string\",\n        \"details\": {\n            \"id\": 1,\n            \"paragraphs\": [\n                {\n                    \"index\": 3,\n                    \"value\": \"paragraphs 4\"\n                },\n                {\n                    \"index\": 2,\n                    \"value\": \"paragraphs 3\"\n                },\n                {\n                    \"index\": 0,\n                    \"value\": \"paragraphs 1\"\n                },\n                {\n                    \"index\": 1,\n                    \"value\": \"paragraphs 2\"\n                }\n            ]\n        }\n    }\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n### Answer Endpoints\n\n#### Create a new answer for a specific question\n\n- **POST `/api/v1/answers`**\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Headers\u003c/summary\u003e\n\n  | Header Name | Value Type | Description                                                   |\n  | ----------- | ---------- | ------------------------------------------------------------- |\n  | `Cookie`    | string     | Contains `accessToken` and `refreshToken` for authentication. |\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Body Example for RO \u0026 RMMQC Type\u003c/summary\u003e\n\n  ```JSON\n  {\n      \"questionId\": 2,\n      \"answerData\": [0, 1, 2, 3]\n  }\n  ```\n\n  `Note:` The `answerData` value is the array of numbers `[0, 1, 2, 3]` which is the index number of the `RO`'s paragraphs \u0026 `RMMCQ`'s options type question.\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eRequest Body Example for SST Type\u003c/summary\u003e\n\n  ```JSON\n  {\n    \"questionId\": 2,\n    \"answerData\": \"Return Object from Scoring Functions: Each scoring function now returns an object with score and maxScore.\"\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  \u003cdetails\u003e\u003csummary\u003eReesponse Example\u003c/summary\u003e\n\n  ```JSON\n  {\n    \"status\": 201,\n    \"success\": true,\n    \"message\": \"Answer submitted successfully\",\n    \"data\": null\n  }\n\n  ```\n\n  \u003c/details\u003e\n\n  [⬆️ Back to top](#table-of-contents)\n\n## Run this project\n\n### Running Locally\n\nTo run the OnePTE API locally, follow these steps:\n\n**1. Clone the Repository:**\n\nFirst, clone the repository to your local machine using the following command:\n\n```bash\ngit clone https://github.com/yousufislam191/OnePTE.git\ncd OnePTE\n```\n\n**2. Install Dependencies:**\n\nMake sure you have Node.js and npm installed on your system. Then, install the required dependencies:\n\n```bash\nnpm install\n```\n\n**3. Set Up Environment Variables:**\n\nAdd the necessary environment variables in `.env.development` file as shown below:\n\n```env\nSERVER_PORT = 3001\nALLOWED_ORIGINS = http://localhost:3000\nNODE_ENV = development\nAPI_PREFIX = /api/v1\nAPPLICATION_NAME = OnePTE\n\nDB_HOST = localhost\nDB_PORT = 3306\nDB_LOGIN_NAME = root\nDB_LOGIN_PASSWORD = root\nDB_NAME = onepte\n\nJWT_ACCESS_SECRET = myaccesssecret\nJWT_ACCESS_EXPIRES_IN = 5m\nJWT_REFRESH_SECRET = myrefreshsecret\nJWT_REFRESH_EXPIRES_IN = 7d\n```\n\nReplace `DB_LOGIN_NAME`, `DB_LOGIN_PASSWORD`, and onepte with your MySQL credentials and database name.\n\n**4. Set Up the Database:**\n\nEnsure MySQL is running on your machine. Then, run the following command to create and migrate the database:\n\n```bash\nnpm run db:migrate\n```\n\nThis will automatically create the database and apply any migrations.\n\n**5. Start the Application:**\n\nStart the server using the following command:\n\n```bash\nnpm run dev\n```\n\nThe server should now be running at http://localhost:3001.\n\n### [⬆️ Back to top](#table-of-contents)\n\n### Running with Docker\n\nTo run this project using Docker, follow these steps:\n\n1. **Install [Docker Desktop](https://www.docker.com/products/docker-desktop/) and [Git](https://git-scm.com/downloads)**\n2. **Open a terminal and Clone this github repository**\n\n   ```bash\n   git clone https://github.com/yousufislam191/OnePTE.git\n   ```\n\n3. **Enter the cloned repository**\n\n   ```bash\n   cd OnePTE\n   ```\n\n4. **Build and Start Containers:**\n\n   Use the provided `docker-up.sh` script to build the Docker images and start the containers. Run the following command:\n\n   ```bash\n   ./docker-up.sh\n   ```\n\n   This will execute the `docker-compose.yml` file, build the necessary Docker images, and start the containers in detached mode.\n\n5. **Stop and Remove Containers:**\n\n   If you need to stop and remove the running containers, use the `docker-down.sh` script. Run the following command:\n\n   ```bash\n   ./docker-down.sh\n   ```\n\n   This will execute the `docker-compose.yml` file, stop and remove the running containers.\n\n6. **Access the Application:**\n\n   Once the containers are up and running,\n\n   - you can access the application at http://localhost:3001 in your browser or Postman.\n   - you can acces the database at http://localhost:8081 in your browser through `phpMyAdmin` with the `username:` `root` and `password:` `root`.\n\n### [⬆️ Back to top](#table-of-contents)\n\n## Test Api's\n\nTo test api endpoint, download the [Postman Collection](./OnePTE.postman_collection.json) file then import it into you postman.\n\n### [⬆️ Back to top](#table-of-contents)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyousufislam191%2Fonepte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyousufislam191%2Fonepte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyousufislam191%2Fonepte/lists"}