From 8882b8a2db59cab0e2547df258598eb800277c5b Mon Sep 17 00:00:00 2001 From: minusunil Date: Sat, 10 Aug 2024 09:12:34 +1000 Subject: [PATCH 1/3] Operations about API units --- astro.config.mjs | 4 + .../docs/backend/API/api-task_definitions.md | 118 ++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 src/content/docs/backend/API/api-task_definitions.md diff --git a/astro.config.mjs b/astro.config.mjs index c8086de..90c0019 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -155,6 +155,10 @@ export default defineConfig({ label: 'Error codes', link: '/backend/api/error_codes', }, + { + label: 'Units Task Definition', + link: '/backend/api/api-task_definitions', + }, ], }, { diff --git a/src/content/docs/backend/API/api-task_definitions.md b/src/content/docs/backend/API/api-task_definitions.md new file mode 100644 index 0000000..7dfcef8 --- /dev/null +++ b/src/content/docs/backend/API/api-task_definitions.md @@ -0,0 +1,118 @@ +--- +title: Doubtfire API +--- + +# API: units + +units : Operations about units +This markdown document provides detailed documentation for the "units" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. + +This "units" API has the following operations. + +- **DELETE**: /api/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id} +- **PUT**: /api/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id} +- **GET**: /api/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments + +## Detail of Operations related to units. + +### GET: Get the group attachments for a given task definition. + +GET /units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments` +- Method: `GET` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |---------------------|-----------------|--------------|----------|---| + |unit_id | Unit ID | path | integer |Yes| + |task_def_id | Task Definition ID | path | integer |Yes| + |Username | User username | header | string |Yes| + |Auth_Token | Authentication token | header | string |Yes| + +- Response: + `200 OK` + +- Example Request: + + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' 'http://localhost:3000/units/1/task_definitions/1/tii_group_attachments' + ``` + +- Response body: + ```json + [ + { + "id": 1, + "name": "Attachment 1", + "status": "uploaded" + }, + { + "id": 2, + "name": "Attachment 2", + "status": "pending" + } + ] + ``` + +### PUT: Trigger an action on the given group attachment. + +PUT /units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id} + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id}` +- Method: `PUT` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |---------------------|-----------------|--------------|----------|---| + |unit_id | Unit ID | path | integer |Yes| + |task_def_id | Task Definition ID | path | integer |Yes| + |id | Group Attachment ID | path | integer |Yes| + |action | The action to perform (e.g., upload) | query | string |Yes| + |Username | User username | header | string |Yes| + |Auth_Token | Authentication token | header | string |Yes| + +- Response: + `200 OK` + +- Example Request: + + ```bash + curl -X PUT --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' -d 'action=upload' 'http://localhost:3000/units/1/task_definitions/1/tii_group_attachments/1' + ``` + +- Response body: + ```json + { + "id": 1, + "name": "Attachment 1", + "status": "has_id" + } + ``` + +### DELETE: Delete a group attachment. + +DELETE /units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id} + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id}` +- Method: `DELETE` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |---------------------|-----------------|--------------|----------|---| + |unit_id | Unit ID | path | integer |Yes| + |task_def_id | Task Definition ID | path | integer |Yes| + |id | Group Attachment ID | path | integer |Yes| + |Username | User username | header | string |Yes| + |Auth_Token | Authentication token | header | string |Yes| + +- Response: + `204` + +- Example Request: + + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' 'http://localhost:3000/units/1/task_definitions/1/tii_group_attachments/1' + ``` + +- Response body: + ``` + true + ``` From 62569a5ff0a661f10db7dfc4109dce16d8a605ec Mon Sep 17 00:00:00 2001 From: minusunil Date: Thu, 22 Aug 2024 19:59:14 +1000 Subject: [PATCH 2/3] formatted content --- .../docs/backend/API/api-task_definitions.md | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/content/docs/backend/API/api-task_definitions.md b/src/content/docs/backend/API/api-task_definitions.md index 7dfcef8..0d24d8f 100644 --- a/src/content/docs/backend/API/api-task_definitions.md +++ b/src/content/docs/backend/API/api-task_definitions.md @@ -2,10 +2,10 @@ title: Doubtfire API --- -# API: units +# API: units - Task Definitions -units : Operations about units -This markdown document provides detailed documentation for the "units" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. +units : Operations about Units +This markdown document provides detailed documentation for the "Task definition" API endpoints, including their URLs, methods, parameters (if any), responses, and example requests using curl. This "units" API has the following operations. @@ -22,12 +22,12 @@ GET /units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments - URL: `/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments` - Method: `GET` - Parameters: - | Parameter | Description |Parameter Type| Data Type|Mandatory| - |---------------------|-----------------|--------------|----------|---| - |unit_id | Unit ID | path | integer |Yes| - |task_def_id | Task Definition ID | path | integer |Yes| - |Username | User username | header | string |Yes| - |Auth_Token | Authentication token | header | string |Yes| + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |---------------------|----------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | - Response: `200 OK` @@ -61,14 +61,14 @@ PUT /units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id} - URL: `/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id}` - Method: `PUT` - Parameters: - | Parameter | Description |Parameter Type| Data Type|Mandatory| - |---------------------|-----------------|--------------|----------|---| - |unit_id | Unit ID | path | integer |Yes| - |task_def_id | Task Definition ID | path | integer |Yes| - |id | Group Attachment ID | path | integer |Yes| - |action | The action to perform (e.g., upload) | query | string |Yes| - |Username | User username | header | string |Yes| - |Auth_Token | Authentication token | header | string |Yes| + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |------------|--------------------------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |id | Group Attachment ID | path | integer |Yes | + |action | The action to perform (e.g., upload) | query | string |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | - Response: `200 OK` @@ -95,13 +95,13 @@ DELETE /units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id - URL: `/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id}` - Method: `DELETE` - Parameters: - | Parameter | Description |Parameter Type| Data Type|Mandatory| - |---------------------|-----------------|--------------|----------|---| - |unit_id | Unit ID | path | integer |Yes| - |task_def_id | Task Definition ID | path | integer |Yes| - |id | Group Attachment ID | path | integer |Yes| - |Username | User username | header | string |Yes| - |Auth_Token | Authentication token | header | string |Yes| + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |------------|----------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |id | Group Attachment ID | path | integer |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | - Response: `204` From 7ab956d9e034bea9668131a5d7692743a5388421 Mon Sep 17 00:00:00 2001 From: minusunil Date: Tue, 27 Aug 2024 17:40:02 +1000 Subject: [PATCH 3/3] new units api's task definition added --- .../docs/backend/API/api-task_definitions.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/src/content/docs/backend/API/api-task_definitions.md b/src/content/docs/backend/API/api-task_definitions.md index 0d24d8f..b8cc240 100644 --- a/src/content/docs/backend/API/api-task_definitions.md +++ b/src/content/docs/backend/API/api-task_definitions.md @@ -12,6 +12,11 @@ This "units" API has the following operations. - **DELETE**: /api/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id} - **PUT**: /api/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id} - **GET**: /api/units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments +- **DELETE**: /api/units/{unit_id}/task_definitions/{task_def_id}/task_resources +- **GET**: /api/units/{unit_id}/task_definitions/{task_def_id}/task_resources +- **POST**: /api/units/{unit_id}/task_definitions/{task_def_id}/task_resources +- **POST**: /api/units/{unit_id}/task_definitions/{task_def_id}/task_sheet +- **POST**: /api/units/{unit_id}/task_definitions/{task_def_id}/test_overseer_assessment ## Detail of Operations related to units. @@ -116,3 +121,149 @@ DELETE /units/{unit_id}/task_definitions/{task_def_id}/tii_group_attachments/{id ``` true ``` + +### DELETE: Remove the task resources for a given task + +DELETE /units/{unit_id}/task_definitions/{task_def_id}/task_resources + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/task_resources` +- Method: `DELETE` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |------------|----------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | + +- Response: + `204` + +- Example Request: + + ```bash + curl -X DELETE --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' 'http://localhost:3000/units/1/task_definitions/1/task_resources' + ``` + +- Response body: + ``` + true + ``` + +### GET: Download the task resources + +GET /units/{unit_id}/task_definitions/{task_def_id}/task_resources + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/task_resources` +- Method: `GET` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |------------|----------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | + +- Response: + `200 OK` + +- Example Request: + + ```bash + curl -X GET --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' 'http://localhost:3000/units/1/task_definitions/1/task_resources' + ``` + +- Response body: + ``` + + ``` + +### POST: Upload the task resources for a given task + +POST /units/{unit_id}/task_definitions/{task_def_id}/task_resources + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/task_resources` +- Method: `POST` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |------------|----------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | + |file | Task resources zip | form-data | file |Yes | + +- Response: + `200 OK` + +- Example Request: + + ```bash + curl -X POST --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' -F "file=@/path/to/resources.zip" 'http://localhost:3000/units/1/task_definitions/1/task_resources' + ``` + +- Response body: + ``` + true + ``` + +### POST: Upload the task sheet for a given task + +POST /units/{unit_id}/task_definitions/{task_def_id}/task_sheet + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/task_sheet` +- Method: `POST` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |------------|----------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | + |file | Task resources zip | form-data | file |Yes | + +- Response: + `200 OK` + +- Example Request: + + ```bash + curl -X POST --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' -F "file=@/path/to/task_sheet.pdf" 'http://localhost:3000/units/1/task_definitions/1/task_sheet' + ``` + +- Response body: + ``` + true + ``` + +### POST: Test overseer assessment for a given task + +POST /units/{unit_id}/task_definitions/{task_def_id}/test_overseer_assessment + +- URL: `/units/{unit_id}/task_definitions/{task_def_id}/test_overseer_assessment` +- Method: `POST` +- Parameters: + | Parameter | Description |Parameter Type| Data Type|Mandatory| + |------------|----------------------|--------------|----------|---------| + |unit_id | Unit ID | path | integer |Yes | + |task_def_id | Task Definition ID | path | integer |Yes | + |Username | User username | header | string |Yes | + |Auth_Token | Authentication token | header | string |Yes | + |file 0 | File 0 (optional) | form-data | file |No | + |file 1 | File 1 (optional) | form-data | file |No | + +- Response: + `200 OK` + +- Example Request: + + ```bash + curl -X POST --header 'Accept: application/json' --header 'Username: aadmin' --header 'Auth_Token: yzRDggcmzbVnYEbszVV1' -F "file0=@/path/to/file0" -F "file1=@/path/to/file1" 'http://localhost:3000/units/1/task_definitions/1/test_overseer_assessment' + ``` + +- Response body: + ```json + { + "status": "Overseer assessment performed successfully" + } + ```