diff --git a/.env-sample b/.env-sample index a7b9f50..94e094f 100644 --- a/.env-sample +++ b/.env-sample @@ -43,4 +43,23 @@ SECURITY_TWO_FACTOR_AUTHENTICATOR_VALIDITY=90 # Can be switched off in dev envs SECURE_COOKIES=True -TESSERACT_CMD="/opt/homebrew/bin/tesseract" +# Logging +LOG_LEVEL=ERROR +LOG_DIR=logs +LOG_FILE=bayanat.log +LOG_BACKUP_COUNT=10 + +# Backups +# Backups of Bayanat's database can be taken on a +# specific interval set below. Backups can be stored +# locally or uploaded to an S3 bucket +BACKUPS=0 +# set interval of backups every x days +BACKUP_INTERVAL=1 +# local directory to store backups, default backups/ +BACKUPS_LOCAL_PATH='' +# S3 settings, if active backups will be uploaded to S3 bucket +BACKUPS_S3_BUCKET='' +BACKUPS_AWS_ACCESS_KEY_ID='' +BACKUPS_AWS_SECRET_ACCESS_KEY='' +BACKUPS_AWS_REGION='' diff --git a/.gitignore b/.gitignore index d37d24a..5e41fa0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,9 @@ enferno/media/* *.xlsx .aws config.json +build +docs/source +!docs/source/index.rst +!docs/source/conf.py +!docs/source/intro.rst +backups/* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 66b7974..d3e576a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,4 +104,17 @@ After creating the test db, you can run the existing tests with pytest ``` -Tests define `pydantic` models to ensure the backend responses and frontend requests conform to expected database schema. \ No newline at end of file +Tests define `pydantic` models to ensure the backend responses and frontend requests conform to expected database schema. + +# Auto-Docs + +Bayanat backend code is documented in ReStructured Text format (loosely following Google's guidelines). + +To generate automatic documentation in html format, you can follow the following steps: + +1. Make sure `sphinx` is installed on your system +2. Navigate to bayanat directory on terminal +3. Run `sphinx-apidoc -f -o docs/source enferno && sphinx-apidoc -f -o docs/source tests` +4. Run `sphinx-build -M html docs/source/ docs/build/`, you will see multiple warning messages on your terminal. Ignore them. + +Following these steps, the html files generated will be available under `docs/build/html` \ No newline at end of file diff --git a/backups/.gitignore b/backups/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/backups/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt index 029ce16..2566fce 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,5 @@ -r requirements.txt pytest==7.4.4 -pydantic==1.10.13 flask_pydantic==0.11.0 SQLAlchemy-Utils==0.41.1 pre-commit==3.5.0 diff --git a/docker-compose-test.yml b/docker-compose-test.yml index de01f5e..5031249 100644 --- a/docker-compose-test.yml +++ b/docker-compose-test.yml @@ -55,10 +55,12 @@ services: - '${PWD}/${ENV_FILE:-.env.test}:/app/.env:ro' - 'bayanat_test_media:/app/enferno/media:rw' - 'bayanat_test_imports:/app/enferno/imports:rw' + - 'bayanat_test_logs:/app/logs:rw' command: [ "pytest" ] volumes: redis_test_data: postgres_test_data: bayanat_test_media: - bayanat_test_imports: \ No newline at end of file + bayanat_test_imports: + bayanat_test_logs: \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/api.yaml b/docs/api.yaml new file mode 100644 index 0000000..9146a27 --- /dev/null +++ b/docs/api.yaml @@ -0,0 +1,9187 @@ +openapi: 3.0.0 +info: + description: This document outlines the available API endpoints in Bayanat, expected payload structures and response structures. + version: 0.0.1 + title: Bayanat API Documentation + contact: + email: support@bayanat.org + license: + name: AGPLv3 + url: 'https://github.com/sjacorg/bayanat.sjac/blob/master/license.txt' +tags: + - name: Public + description: Operations available to unauthenticated consumers + - name: Protected + description: Operations available to authenticated consumers with a valid session cookie + - name: Authentication + description: Operations related to user authentication + - name: Label Management + description: Operations related to `Label` entity + - name: Eventtype Management + description: Operations related to `Eventtype` entity + - name: PotentialViolation Management + description: Operations related to `PotentialViolation` entity + - name: ClaimedViolation Management + description: Operations related to `ClaimedViolation` entity + - name: Source Management + description: Operations related to `Source` entity + - name: Location Management + description: Operations related to `Location` entity + - name: LocationAdminLevel Management + description: Operations related to `LocationAdminLevel` entity + - name: LocationType Management + description: Operations related to `LocationType` entity + - name: Country Management + description: Operations related to `Country` entity + - name: GeoLocationType Management + description: Operations related to `GeoLocationType` entity + - name: Ethnography Management + description: Operations related to `Ethnography` entity + - name: Dialect Management + description: Operations related to `Dialect` entity + - name: Join Tables Info Management + description: Operations related to `AtoaInfo`, `AtobInfo`, `BtobInfo`, `ItoaInfo`, `ItobInfo`, `ItoiInfo` entities + - name: MediaCategory Management + description: Operations related to `MediaCategory` entity + - name: Bulletin Management + description: Operations related to `Bulletin` entity + - name: Actor Management + description: Operations related to `Actor` entity + - name: Incident Management + description: Operations related to `Incident` entity + - name: Self-Assign Endpoints + description: Self-assign endpoints for `Bulletin`, `Actor`, `Incident` entities + - name: Special Media Endpoints + description: Special media endpoints for uploading and serving media files + - name: Media Management + description: Operations related to `Media` entity + - name: History Helpers + description: Operations related to revision history tracking + - name: User Management + description: Operations related to `User` entity + - name: Role Management + description: Operations related to `Role` entity + - name: Activity Management + description: Operations related to `Activity` entity + - name: Bulk Operations + description: Operations related to bulk update operations + - name: Search Management + description: Operations related to saved searches + - name: Graph Management + description: Operations related to graph data + - name: Configuration Management + description: Operations related to configuration settings +paths: + /login: + post: + tags: + - Public + - Authentication + summary: Log in an existing user + operationId: loginUser + description: | + Authenticates the user. Upon successful authentication, the client is redirected to the dashboard. + If authentication fails, the endpoint will respond with the login page including error details in text/html format. + requestBody: + description: User credentials and security token + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/LoginRequest' + responses: + '200': + description: Successful authentication, redirect to dashboard. + headers: + Set-Cookie: + description: Session cookie + schema: + type: string + example: session=abc123; path=/; HttpOnly; Expires=Tue 26, Mar 2024 09:5:01 GMT; + content: + text/html: + schema: + type: string + example: "Welcome admin, ... " + '401': + description: Authentication failed, login page with errors as text/html. + content: + text/html: + schema: + type: string + example: "Invalid username or password!" + /admin/api/labels: + get: + tags: + - Protected + - Label Management + summary: Get a paginated list of all labels + operationId: getAllLabels + description: | + Returns a paginated list of all labels. + + Accepted roles: + - Admin + - Mod + - DA + parameters: + - $ref: '#/components/parameters/queries_multiple' + - in: query + name: typ + description: Type of labels to be returned + required: false + schema: + type: string + enum: + - for_actor + - for_bulletin + - for_incident + - for_offline + - in: query + name: fltr + description: Filter for verification status of labels + required: false + schema: + type: string + enum: + - verified + - all + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LabelsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/label: + post: + tags: + - Protected + - Label Management + summary: Create a new label + description: | + Create a new label with the passed request parameters + + Accepted roles: + - Admin + - Mod + operationId: createLabel + requestBody: + description: Label properties + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLabelRequest' + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created label #{id}" + '417': + $ref: '#/components/responses/SaveFailedResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + /admin/api/label/{id}: + put: + tags: + - Protected + - Label Management + summary: Update an existing label + description: | + Update the label with `{id}` with the passed parameters. + + Accepted roles: + - Admin + - Mod + operationId: updateLabel + parameters: + - in: path + name: id + required: true + schema: + type: integer + security: + - SessionCookieAuth: [] + requestBody: + required: true + description: Label properties + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLabelRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created label #{id}" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + delete: + tags: + - Protected + - Label Management + summary: Delete an existing label + description: | + Delete the label with `{id}`. + + Accepted roles: + - Admin + operationId: deleteLabel + parameters: + - in: path + name: id + required: true + schema: + type: integer + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted Label #{id}" + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/label/import: + post: + operationId: importLabels + tags: + - Protected + - Label Management + summary: Import labels via CSV + description: | + Import labels from provided CSV + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + description: CSV file containing labels to import + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + description: The CSV file to be imported. + responses: + '200': + description: Successfully imported labels from CSV. + content: + text/plain: + schema: + type: string + example: Success + '400': + $ref: '#/components/responses/MissingCsvResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/eventtypes: + get: + tags: + - Protected + - Eventtype Management + summary: Get a paginated list of all event types + description: | + Returns a paginated list of all event types. + + Accepted roles: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/queries_single' + - in: query + name: typ + description: Type of `eventtype` to filter + schema: + type: string + enum: + - for_actor + - for_bulletin + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/EventtypesResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/eventtype: + post: + operationId: createEventtype + tags: + - Protected + - Eventtype Management + summary: Create a new event type + description: | + Create a new event type with the provided properties. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + requestBody: + required: true + description: Properties of the new event type + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEventtypeRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Event #{id}" + '417': + $ref: '#/components/responses/SaveFailedResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + /admin/api/eventtype/{id}: + put: + tags: + - Protected + - Eventtype Management + summary: Update an existing event type + description: | + Update the event type with `{id}` with the passed parameters. + + Accepted roles: + - Admin + - Mod + operationId: updateEventtype + parameters: + - in: path + name: id + required: true + schema: + type: integer + security: + - SessionCookieAuth: [] + requestBody: + required: true + description: Event type properties + content: + application/json: + schema: + $ref: '#/components/schemas/CreateEventtypeRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Event #{id}" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + delete: + tags: + - Protected + - Eventtype Management + summary: Delete an existing event type + description: | + Delete the event type with `{id}`. + + Accepted roles: + - Admin + operationId: deleteEventtype + parameters: + - in: path + name: id + required: true + schema: + type: integer + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted Event Type #{id}" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/eventtype/import: + post: + operationId: importEventtypes + tags: + - Protected + - Eventtype Management + summary: Import event types via CSV + description: | + Import event types from provided CSV + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + description: CSV file containing event types to import + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + description: The CSV file to be imported. + responses: + '200': + description: Successfully imported event types from CSV. + content: + text/plain: + schema: + type: string + example: Success + '400': + $ref: '#/components/responses/MissingCsvResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/potentialviolations: + get: + operationId: getPotentialViolations + tags: + - Protected + - PotentialViolation Management + summary: Get the first page of all Potential Violation records + description: | + Returns the first page of all Potential Violations (optionally) satisfying search queries. + + Allowed roles: + - Admin + - Mod + - DA + parameters: + - $ref: '#/components/parameters/queries_single' + - $ref: '#/components/parameters/per_page' + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PotentialViolationsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/potentialviolations/{page}: + get: + operationId: getPotentialViolationsPaginated + tags: + - Protected + - PotentialViolation Management + summary: Get a specific page of all Potential Violation records + description: | + Returns a specific page of all Potential Violations (optionally) satisfying search queries. + + Allowed roles: + - Admin + - Mod + - DA + + The `page` path parameter specifies the page number of the Potential Violations to return. + parameters: + - in: path + name: page + required: true + description: The page number to retrieve. + schema: + type: integer + minimum: 1 + - $ref: '#/components/parameters/queries_single' + - $ref: '#/components/parameters/per_page' + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PotentialViolationsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/potentialviolation: + post: + operationId: createPotentialViolation + tags: + - Protected + - PotentialViolation Management + summary: Create a new Potential Violation + description: | + Create a new Potential Violation with the provided properties. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + requestBody: + description: Properties of the Potential Violation to be created + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePotentialViolationRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Potential Violation #{id}" + '417': + $ref: '#/components/responses/SaveFailedResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + /admin/api/potentialviolation/{id}: + put: + operationId: updatePotentialViolation + tags: + - Protected + - PotentialViolation Management + summary: Update an existing Potential Violation + description: | + Update an existing Potential Violation with `{id}` with provided properties + parameters: + - in: path + required: true + name: id + description: Id of the potential violation to be updated + schema: + type: integer + security: + - SessionCookieAuth: [] + requestBody: + description: Properties of the updated Potential Violation + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePotentialViolationRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Potential Violation #{id}" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + delete: + operationId: deletePotentialViolation + tags: + - Protected + - PotentialViolation Management + summary: Delete an existing Potential Violation + description: | + Delete the Potential Violation with `{id}` + + Roles accepted: + - Admin + parameters: + - in: path + required: true + name: id + description: Id of the potential violation to be deleted + schema: + type: integer + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted Potential Violation #{id}" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + /admin/api/potentialviolation/import: + post: + operationId: importPotentialViolations + tags: + - Protected + - PotentialViolation Management + summary: Import Potential Violations via CSV + description: | + Import Potential Violations from provided CSV + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + description: CSV file containing potential violations to import + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + description: The CSV file to be imported. + responses: + '200': + description: Successfully imported potential violations from CSV. + content: + text/plain: + schema: + type: string + example: Success + '400': + $ref: '#/components/responses/MissingCsvResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/claimedviolations: + get: + operationId: getClaimedViolations + tags: + - Protected + - ClaimedViolation Management + summary: Get the first page of all Claimed Violation records + description: | + Returns the first page of all Claimed Violations (optionally) satisfying search queries. + + Allowed roles: + - Admin + - Mod + - DA + parameters: + - $ref: '#/components/parameters/queries_single' + - $ref: '#/components/parameters/per_page' + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ClaimedViolationsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/claimedviolations/{page}: + get: + operationId: getClaimedViolationsPaginated + tags: + - Protected + - ClaimedViolation Management + summary: Get a specific page of all Claimed Violation records + description: | + Returns a specific page of all Claimed Violations (optionally) satisfying search queries. + + Allowed roles: + - Admin + - Mod + - DA + + The `page` path parameter specifies the page number of the Claimed Violations to return. + parameters: + - in: path + name: page + required: true + description: The page number to retrieve. + schema: + type: integer + minimum: 1 + - $ref: '#/components/parameters/queries_single' + - in: query + name: per_page + description: Number of items to display per page + schema: + type: integer + default: 30 + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ClaimedViolationsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/claimedviolation: + post: + operationId: createClaimedViolation + tags: + - Protected + - ClaimedViolation Management + summary: Create a new Claimed Violation + description: | + Create a new Claimed Violation with the provided properties. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + requestBody: + description: Properties of the Claimed Violation to be created + content: + application/json: + schema: + $ref: '#/components/schemas/CreateClaimedViolationRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Claimed Violation #{id}" + '417': + $ref: '#/components/responses/SaveFailedResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + /admin/api/claimedviolation/{id}: + put: + operationId: updateClaimedViolation + tags: + - Protected + - ClaimedViolation Management + summary: Update an existing Claimed Violation + description: | + Update an existing Claimed Violation with `{id}` with provided properties + parameters: + - in: path + required: true + name: id + description: Id of the claimed violation to be updated + schema: + type: integer + security: + - SessionCookieAuth: [] + requestBody: + description: Properties of the updated Claimed Violation + content: + application/json: + schema: + $ref: '#/components/schemas/CreateClaimedViolationRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Claimed Violation #{id}" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + delete: + operationId: deleteClaimedViolation + tags: + - Protected + - ClaimedViolation Management + summary: Delete an existing Claimed Violation + description: | + Delete the Claimed Violation with `{id}` + + Roles accepted: + - Admin + parameters: + - in: path + required: true + name: id + description: Id of the claimed violation to be deleted + schema: + type: integer + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted Claimed Violation #{id}" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + /admin/api/claimedviolation/import: + post: + operationId: importClaimedViolations + tags: + - Protected + - ClaimedViolation Management + summary: Import Claimed Violations via CSV + description: | + Import Claimed Violations from provided CSV + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + description: CSV file containing claimed violations to import + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + description: The CSV file to be imported. + responses: + '200': + description: Successfully imported claimed violations from CSV. + content: + text/plain: + schema: + type: string + example: Success + '400': + $ref: '#/components/responses/MissingCsvResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/sources: + get: + operationId: getSources + tags: + - Protected + - Source Management + summary: Get a paginated list of all sources + description: | + Returns a paginated list of all sources (optionally) satisfying search queries. + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/queries_multiple' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SourcesResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/source: + post: + operationId: newSource + tags: + - Protected + - Source Management + summary: Create a new Source + description: | + Create a new source with the provided properties. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateSourceRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Source #{id}" + '417': + $ref: '#/components/responses/SaveFailedResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + /admin/api/source/{id}: + put: + operationId: updateSource + tags: + - Protected + - Source Management + summary: Update an existing Source + description: | + Update an existing source with `{id}` + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + description: Id of the Source to be updated + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Source #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + delete: + operationId: deleteSource + tags: + - Protected + - Source Management + summary: Delete an existing Source + description: | + Delete the Source with {id} + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the Source to be deleted + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted Source #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/source/import: + post: + operationId: importSources + tags: + - Protected + - Source Management + summary: Import sources via CSV + description: | + Import sources from provided CSV. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + description: CSV file containing sources to import + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + description: The CSV file to be imported. + responses: + '200': + description: Successfully imported sources from CSV. + content: + text/plain: + schema: + type: string + example: Success + '400': + $ref: '#/components/responses/MissingCsvResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/locations: + get: + operationId: getLocations + tags: + - Protected + - Location Management + summary: Get the first page of all Locations + description: | + Returns the first page of Locations + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LocationsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + post: + operationId: getLocationsQuery + tags: + - Protected + - Location Management + summary: Get a paginated list of all Locations + description: | + Returns a paginated list of all locations optionally satisfying advanced query + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: false + content: + application/json: + schema: + type: object + properties: + q: + $ref: '#/components/schemas/QueryLocationObject' + options: + type: object + properties: + page: + type: integer + minimum: 1 + default: 1 + per_page: + type: integer + minimum: 1 + default: 30 + parameters: + - in: query + name: options + schema: + type: object + properties: + page: + type: integer + minimum: 1 + default: 1 + per_page: + type: integer + minimum: 1 + default: 30 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LocationsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/location: + post: + operationId: createLocation + tags: + - Protected + - Location Management + summary: Create a new Location + description: | + Create a new location with the provided properties. + + Roles accepted: + - Admin + - Mod + - DA (with edit_locations permission) + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLocationRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Location #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/location/{id}: + get: + operationId: getLocation + tags: + - Protected + - Location Management + summary: Get a single Location + description: | + Returns the location with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + description: Id of the Location to be retrieved + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LocationItem' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + put: + operationId: updateLocation + tags: + - Protected + - Location Management + summary: Update an existing Location + description: | + Update the location with `{id}` with the provided properties + + Roles accepted: + - Admin + - Mod + - DA (with edit_locations permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the Location to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLocationRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Location #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteLocation + tags: + - Protected + - Location Management + summary: Delete an existing Location + description: | + Delete the location with {id} + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + description: Id of the Location to be deleted. + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted Location #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/location/import: + post: + operationId: importLocations + tags: + - Protected + - Location Management + summary: Import Locations via CSV + description: | + Import locations from the provided CSV file. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + description: CSV file containing locations to import + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + description: The CSV file to be imported. + responses: + '200': + description: Successfully imported locations from CSV. + content: + text/plain: + schema: + type: string + example: Success + '400': + $ref: '#/components/responses/MissingCsvResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/location-admin-levels: + get: + operationId: getLocationAdminLevels + tags: + - Protected + - LocationAdminLevel Management + summary: Get a paginated list of all Location Admin Levels + description: | + Returns a paginated list of all location admin levels. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LocationAdminLevelsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/location-admin-level: + post: + operationId: createLocationAdminLevel + tags: + - Protected + - LocationAdminLevel Management + summary: Create a new Location Admin Level + description: | + Create a new location admin level with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLocationAdminLevelRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/location-admin-level/{id}: + put: + operationId: updateLocationAdminLevel + tags: + - Protected + - LocationAdminLevel Management + summary: Update an existing Location Admin Level + description: | + Update the location admin level with `{id}` with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the location admin level to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLocationAdminLevelRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: 'Updated !' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/location-types: + get: + operationId: getLocationTypes + tags: + - Protected + - LocationType Management + summary: Get a paginated list of all Location Types + description: | + Returns a paginated list of all location types. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/LocationTypesResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/location-type: + post: + operationId: createLocationType + tags: + - Protected + - LocationType Management + summary: Create a new Location Type + description: | + Create a new location type with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLocationTypeRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/location-type/{id}: + put: + operationId: updateLocationType + tags: + - Protected + - LocationType Management + summary: Update an existing Location Type + description: | + Update the locationt type with `{id}` with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the location type to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLocationTypeRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Updated !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteLocationType + tags: + - Protected + - LocationType Management + summary: Delete an existing Location Type + description: | + Delete the location type with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the location type to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Location Type Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Location Type could not be deleted + content: + text/plain: + schema: + type: string + example: "Error deleting location type" + /admin/api/countries: + get: + operationId: getCountries + tags: + - Protected + - Country Management + summary: Get a paginated list of all Countries + description: | + Returns a paginated list, (optionally) satisfying a query. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/queries_single' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ComponentsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/country: + post: + operationId: createCountry + tags: + - Protected + - Country Management + summary: Create a new Country + description: | + Create a new country with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/country/{id}: + put: + operationId: updateCountry + tags: + - Protected + - Country Management + summary: Update an existing Country + description: | + Update the country with `{id}` with the provided properties + + Roles accepted: + - Admin + parameters: + - in: path + name: id + description: Id of the Country to be updated. + required: true + schema: + type: integer + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Updated !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteCountry + tags: + - Protected + - Country Management + summary: Delete an existing Country + description: | + Deletes the country with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + description: Id of the Country to be deleted. + required: true + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Country Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/ethnographies: + get: + operationId: getEthnographies + tags: + - Protected + - Ethnography Management + summary: Get a paginated list of all Ethnographies + description: | + Returns a paginated list of all ethnographies, (optionally) satisfying a search query. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/queries_single' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ComponentsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/ethnography: + post: + operationId: createEthnography + tags: + - Protected + - Ethnography Management + summary: Create a new Ethnography + description: | + Create a new ethnography with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + $ref: "#/components/responses/ItemCreatedResponse" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/ethnography/{id}: + put: + operationId: updateEthnography + tags: + - Protected + - Ethnography Management + summary: Update an existing Ethnography + description: | + Update the ethnography with `{id}` with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + schema: + type: integer + description: Id of the Ethnography to be updated. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Updated !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteEthnography + tags: + - Protected + - Ethnography Management + summary: Delete an existing Ethnography + description: | + Delete the ethnography with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + schema: + type: integer + description: Id of the Ethnography to be deleted. + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Ethnography Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Could not delete ethnography. + content: + text/plain: + schema: + type: string + example: "Error deleting ethnography" + /admin/api/dialects: + get: + operationId: getDialects + tags: + - Protected + - Dialect Management + summary: Get a paginated list of all Dialects + description: | + Returns a paginated list of all dialects, (optionally) satisfying a search query. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/queries_single' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ComponentsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/dialect: + post: + operationId: createDialect + tags: + - Protected + - Dialect Management + summary: Create a new Dialect + description: | + Create a new dialect with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/dialect/{id}: + put: + operationId: updateDialect + tags: + - Protected + - Dialect Management + summary: Update an existing Dialect + description: | + Update the dialect with `{id}` with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + schema: + type: integer + description: Id of the Dialect to be updated. + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Updated !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteDialect + tags: + - Protected + - Dialect Management + summary: Delete an existing Dialect + description: | + Delete the dialect with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + schema: + type: integer + description: Id of the Dialect to be deleted. + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Dialect Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Could not delete dialect. + content: + text/plain: + schema: + type: string + example: "Error deleting dialect" + /admin/api/atoainfos: + get: + operationId: getAtoaInfos + tags: + - Protected + - Join Tables Info Management + summary: Get a paginated list of all AtoaInfos + description: | + Returns a paginated list of all actor-to-actor relation information. + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/JoinTableInfosResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/atoainfo: + post: + operationId: createAtoaInfo + tags: + - Protected + - Join Tables Info Management + summary: Create new AtoaInfo + description: | + Create a new actor-to-actor relation information. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/RelationInfoSaveFailedResponse' + /admin/api/atoainfo/{id}: + put: + operationId: updateAtoaInfo + tags: + - Protected + - Join Tables Info Management + summary: Update an existing AtoaInfo + description: | + Update the actor-to-actor relation info with `{id}` with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the AtoaInfo to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: Updated ! + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteAtoaInfo + tags: + - Protected + - Join Tables Info Management + summary: Delete an existing AtoaInfo + description: | + Delete the actor-to-actor relation info with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the AtoaInfo to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "AtoaInfo Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: AtoaInfo could not be deleted. + content: + text/plain: + schema: + type: string + example: Error deleting AtoaInfo + /admin/api/atobinfos: + get: + operationId: getAtobInfos + tags: + - Protected + - Join Tables Info Management + summary: Get a paginated list of all AtobInfos + description: | + Returns a paginated list of all actor-to-bulletin relation information. + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/JoinTableInfosResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/atobinfo: + post: + operationId: createAtobInfo + tags: + - Protected + - Join Tables Info Management + summary: Create new AtobInfo + description: | + Create a new actor-to-bulletin relation information. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/RelationInfoSaveFailedResponse' + /admin/api/atobinfo/{id}: + put: + operationId: updateAtobInfo + tags: + - Protected + - Join Tables Info Management + summary: Update an existing AtobInfo + description: | + Update the actor-to-bulletin relation info with `{id}` with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the AtobInfo to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: Updated ! + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteAtobInfo + tags: + - Protected + - Join Tables Info Management + summary: Delete an existing AtobInfo + description: | + Delete the actor-to-bulletin relation info with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the AtobInfo to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "AtobInfo Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: AtobInfo could not be deleted. + content: + text/plain: + schema: + type: string + example: Error deleting AtobInfo + /admin/api/btobinfos: + get: + operationId: getBtobInfos + tags: + - Protected + - Join Tables Info Management + summary: Get a paginated list of all BtobInfos + description: | + Returns a paginated list of all bulletin-to-bulletin relation information. + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/JoinTableInfosResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/btobinfo: + post: + operationId: createBtobInfo + tags: + - Protected + - Join Tables Info Management + summary: Create new BtobInfo + description: | + Create a new bulletin-to-bulletin relation information. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/RelationInfoSaveFailedResponse' + /admin/api/btobinfo/{id}: + put: + operationId: updateBtobInfo + tags: + - Protected + - Join Tables Info Management + summary: Update an existing BtobInfo + description: | + Update the bulletin-to-bulletin relation info with `{id}` with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the BtobInfo to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: Updated ! + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteBtobInfo + tags: + - Protected + - Join Tables Info Management + summary: Delete an existing BtobInfo + description: | + Delete the bulletin-to-bulletin relation info with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the BtobInfo to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "BtobInfo Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: BtobInfo could not be deleted. + content: + text/plain: + schema: + type: string + example: Error deleting BtobInfo + /admin/api/itoainfos: + get: + operationId: getItoaInfos + tags: + - Protected + - Join Tables Info Management + summary: Get a paginated list of all ItoaInfos + description: | + Returns a paginated list of all incident-to-actor relation information. + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/JoinTableInfosResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/itoainfo: + post: + operationId: createItoaInfo + tags: + - Protected + - Join Tables Info Management + summary: Create new ItoaInfo + description: | + Create a new incident-to-actor relation information. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/RelationInfoSaveFailedResponse' + /admin/api/itoainfo/{id}: + put: + operationId: updateItoaInfo + tags: + - Protected + - Join Tables Info Management + summary: Update an existing ItoaInfo + description: | + Update the incident-to-actor relation info with `{id}` with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the ItoaInfo to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: Updated ! + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteItoaInfo + tags: + - Protected + - Join Tables Info Management + summary: Delete an existing ItoaInfo + description: | + Delete the incident-to-actor relation info with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the ItoaInfo to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "ItoaInfo Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: ItoaInfo could not be deleted. + content: + text/plain: + schema: + type: string + example: Error deleting ItoaInfo + /admin/api/itobinfos: + get: + operationId: getItobInfos + tags: + - Protected + - Join Tables Info Management + summary: Get a paginated list of all ItobInfos + description: | + Returns a paginated list of all incident-to-bulletin relation information. + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/JoinTableInfosResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/itobinfo: + post: + operationId: createItobInfo + tags: + - Protected + - Join Tables Info Management + summary: Create new ItobInfo + description: | + Create a new incident-to-bulletin relation information. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/RelationInfoSaveFailedResponse' + /admin/api/itobinfo/{id}: + put: + operationId: updateItobInfo + tags: + - Protected + - Join Tables Info Management + summary: Update an existing ItobInfo + description: | + Update the incident-to-bulletin relation info with `{id}` with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the ItobInfo to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: Updated ! + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteItobInfo + tags: + - Protected + - Join Tables Info Management + summary: Delete an existing ItobInfo + description: | + Delete the incident-to-bulletin relation info with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the ItobInfo to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "ItobInfo Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: ItobInfo could not be deleted. + content: + text/plain: + schema: + type: string + example: Error deleting ItobInfo + /admin/api/itoiinfos: + get: + operationId: getItoiInfos + tags: + - Protected + - Join Tables Info Management + summary: Get a paginated list of all ItoiInfos + description: | + Returns a paginated list of all incident-to-incident relation information. + + Roles allowed: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/JoinTableInfosResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/itoiinfo: + post: + operationId: createItoiInfo + tags: + - Protected + - Join Tables Info Management + summary: Create new ItoiInfo + description: | + Create a new incident-to-incident relation information. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/RelationInfoSaveFailedResponse' + /admin/api/itoiinfo/{id}: + put: + operationId: updateItoiInfo + tags: + - Protected + - Join Tables Info Management + summary: Update an existing ItoiInfo + description: | + Update the incident-to-incident relation info with `{id}` with provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the ItoiInfo to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateJoinTableInfoRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: Updated ! + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteItoiInfo + tags: + - Protected + - Join Tables Info Management + summary: Delete an existing ItoiInfo + description: | + Delete the incident-to-incident relation info with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + name: id + required: true + description: Id of the ItoiInfo to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "ItoiInfo Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: ItoiInfo could not be deleted. + content: + text/plain: + schema: + type: string + example: Error deleting ItoiInfo + /admin/api/mediacategories: + get: + operationId: getMediaCategories + tags: + - Protected + - MediaCategory Management + summary: Get a paginated list of all MediaCategories + description: | + Returns a paginated list of all media categories. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ComponentsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/mediacategory: + post: + operationId: createMediaCategory + tags: + - Protected + - MediaCategory Management + summary: Create a new MediaCategory + description: | + Create a new media category with the provided properties. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/mediacategory/{id}: + put: + operationId: updateMediaCategory + tags: + - Protected + - MediaCategory Management + summary: Update an existing MediaCategory + description: | + Update the media category with `{id}` with the provided properties. + + Roles accepted: + - Admin + + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the MediaCategory to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Updated !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteMediaCategory + tags: + - Protected + - MediaCategory Management + summary: Delete an existing MediaCategory + description: | + Delete the media category with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the MediaCategory to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "MediaCategory Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Could not delete media category. + content: + text/plain: + schema: + type: string + example: "Error deleting media category" + /admin/api/geolocationtypes: + get: + operationId: getGeoLocationTypes + tags: + - Protected + - GeoLocationType Management + summary: Get a paginated list of all GeoLocationTypes + description: | + Returns a paginated list of all geo location types. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ComponentsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/geolocationtype: + post: + operationId: createGeoLocationType + tags: + - Protected + - GeoLocationType Management + summary: Create a new GeoLocationType + description: | + Create a new geo location type with the provided properties. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + $ref: '#/components/responses/ItemCreatedResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/geolocationtype/{id}: + put: + operationId: updateGeoLocationType + tags: + - Protected + - GeoLocationType Management + summary: Update an existing GeoLocationType + description: | + Update the geo location type with `{id}` with the provided properties. + + Roles accepted: + - Admin + + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the GeoLocationType to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateComponentRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Updated !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteGeoLocationType + tags: + - Protected + - GeoLocationType Management + summary: Delete an existing GeoLocationType + description: | + Delete the geo location type with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the GeoLocationType to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "GeoLocationType Deleted #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Could not delete geo location type. + content: + text/plain: + schema: + type: string + example: "Error deleting geo location type" + /admin/api/bulletins: + get: + operationId: getBulletins + tags: + - Protected + - Bulletin Management + summary: Get a paginated list of all Bulletins + description: | + Returns a paginated list of all bulletins. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + - in: query + name: mode + required: false + description: JSON encoding type. 1 for min, 2 for compact, 3 for normal (no-relation), other for normal with relations. + schema: + type: integer + default: 1 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BulletinsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + post: + operationId: getBulletinsQuery + tags: + - Protected + - Bulletin Management + summary: Get a paginated list of all Bulletins with optional advanced search + description: | + Returns a paginated list of all bulletins, (optionally) satisfying search queries. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + - in: query + name: mode + description: JSON encoding type. 1 for min, 2 for compact, 3 for normal (no-relation), other for normal with relations. + required: false + schema: + type: integer + default: 1 + requestBody: + required: false + description: Search query object. + content: + application/json: + schema: + type: object + properties: + q: + type: array + items: + $ref: '#/components/schemas/QueryBulletinObject' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BulletinsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/bulletin: + post: + operationId: createBulletin + tags: + - Protected + - Bulletin Management + summary: Create a new Bulletin + description: | + Create a new bulletin with the provided properties. + + Accepted roles: + - Admin + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateBulletinRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Bulletin #{id} !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/bulletin/{id}: + get: + operationId: getBulletin + tags: + - Protected + - Bulletin Management + summary: Get a Bulletin by ID + description: | + Get the bulletin with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Bulletin to be retrieved. + schema: + type: integer + - in: query + name: mode + required: false + description: JSON encoding type. 1 for min, 2 for compact, 3 for normal (no-relation), other for normal with relations. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BulletinItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + put: + operationId: updateBulletin + tags: + - Protected + - Bulletin Management + summary: Update an existing Bulletin + description: | + Update the bulletin with `{id}` with the provided properties. + + Roles accepted: + - Admin + - DA (with access permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Bulletin to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateBulletinRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Bulletin #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/bulletin/review/{id}: + put: + operationId: reviewBulletin + tags: + - Protected + - Bulletin Management + summary: Update the review of an existing Bulletin + description: | + Update review of the bulletin with `{id}`. + + Roles accepted: + - Admin + - DA (with access permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Bulletin to be reviewed. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + type: object + properties: + review: + type: string + description: Review text + review_action: + type: string + description: Review action + revrefs: + type: array + items: + type: integer + description: Review refs + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Bulletin review updated #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/bulletin/bulk: + put: + operationId: bulkUpdateBulletins + tags: + - Protected + - Bulletin Management + - Bulk Operations + summary: Bulk update existing Bulletins + description: | + Bulk update the bulletins with the provided properties. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + ids: + type: array + items: + type: integer + description: Bulletin IDs to be updated + bulk: + type: object + allOf: + - $ref: '#/components/schemas/GenericBulk' + - properties: + ref: + type: array + items: + type: integer + refReplace: + type: boolean + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Bulk update queued successfully" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Bulk update failed. + content: + text/plain: + schema: + type: string + example: "No items selected, or nothing to update" + /admin/api/bulletin/relations/{id}: + get: + operationId: getBulletinRelations + tags: + - Protected + - Bulletin Management + summary: Get relations of a Bulletin + description: | + Get the relations of the bulletin with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Bulletin to get relations. + schema: + type: integer + - in: query + required: true + name: cls + description: Class of the relation + schema: + type: string + enum: + - actor + - bulletin + - incident + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + oneOf: + - $ref: '#/components/schemas/BtobEx' + - $ref: '#/components/schemas/AtobItem' + - $ref: '#/components/schemas/ItobItem' + more: + type: boolean + description: True if there are more items to load, false otherwise. + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/bulletin/assign/{id}: + put: + operationId: selfAssignBulletin + tags: + - Protected + - Bulletin Management + - Self-Assign Endpoints + summary: Assign a Bulletin to current user + description: | + Assign the bulletin with `{id}` to the current user. + + Roles accepted: + - Admin + - DA (with self-assign permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Bulletin to be assigned. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + bulletin: + type: object + required: + - comments + properties: + comments: + type: string + ref: + type: array + items: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Bulletin #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/actor/assign/{id}: + put: + operationId: selfAssignActor + tags: + - Protected + - Actor Management + - Self-Assign Endpoints + summary: Assign an Actor to current user + description: | + Assign the actor with `{id}` to the current user. + + Roles accepted: + - Admin + - DA (with self-assign permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Actor to be assigned. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + actor: + type: object + required: + - comments + properties: + comments: + type: string + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Actor #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/incident/assign/{id}: + put: + operationId: selfAssignIncident + tags: + - Protected + - Incident Management + - Self-Assign Endpoints + summary: Assign an Incident to current user + description: | + Assign the incident with `{id}` to the current user. + + Roles accepted: + - Admin + - DA (with self-assign permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Incident to be assigned. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + incident: + type: object + required: + - comments + properties: + comments: + type: string + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Incident #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/media/chunk: + post: + operationId: chunkUploadMedia + tags: + - Protected + - Special Media Endpoints + summary: Upload a chunked media file + description: | + Upload a chunked media file. + + Roles accepted: + - Admin + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: The file part of the multipart upload. + dzuuid: + type: string + description: Unique identifier for the chunked upload session. + dzchunkindex: + type: integer + format: int32 + description: The index of the current chunk being uploaded. + dztotalchunkcount: + type: integer + format: int32 + description: The total number of chunks for the file. + dztotalfilesize: + type: integer + format: int64 + description: The total size of the file being uploaded in bytes. + required: + - file + responses: + '200': + description: Success. File Saved or Chunk upload successful. + content: + application/json: + schema: + type: object + properties: + etag: + type: string + description: ETag hash of the uploaded file. + filename: + type: string + description: The name of the file saved on the server. + '400': + description: Bad Request. Not all required fields supplied or values provided were not in expected format. + '415': + description: Unsupported Media Type. This file type is not allowed. + '425': + description: Invalid Request. Issues with chunk index or dzuuid validation. + '409': + description: Conflict. Error, file already exists. + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/media/upload: + post: + operationId: uploadMedia + tags: + - Protected + - Special Media Endpoints + summary: Upload a media file + description: | + Upload a media file. + + Roles accepted: + - Admin + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: The file part of the multipart upload. + required: + - file + responses: + '200': + description: Success. File Saved. + content: + application/json: + schema: + type: object + properties: + etag: + type: string + description: ETag hash of the uploaded file. + filename: + type: string + description: The name of the file saved on the server. + '409': + description: Conflict. Error, file already exists. + content: + text/plain: + schema: + type: string + example: "Error: File already exists" + '417': + description: Error. File could not be saved. + content: + text/plain: + schema: + type: string + example: "Invalid request params" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/media/{filename}: + get: + operationId: getMediaLink + tags: + - Protected + - Special Media Endpoints + summary: Get a signed link to a media file + description: | + Get a signed link to the media file with `{filename}`. + + Roles accepted: + - Admin + - Mod + - DA + parameters: + - in: path + required: true + name: filename + description: Name of the media file to get a signed link for. + schema: + type: string + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK. Returns a signed URL for accessing the media file or the local file path. + content: + text/plain: + schema: + type: string + format: url + example: "https://example.com/media/filename" + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '403': + description: Forbidden. Access to the media file is restricted or not allowed. + content: + text/plain: + schema: + type: string + example: "Restricted Access" + '404': + description: Not Found. The specified media file does not exist. + content: + text/plain: + schema: + type: string + example: "File not found" + '425': + description: Too Early. Request for the media file is invalid or not allowed at this time. + content: + text/plain: + schema: + type: string + example: "Invalid Request" + '500': + description: Internal Server Error. A server error occurred while processing the request. + content: + text/plain: + schema: + type: string + example: "Internal server error occurred" + /admin/api/serve/{filename}: + get: + operationId: serveMedia + tags: + - Protected + - Special Media Endpoints + summary: Serve a media file from local storage + description: | + Serve the media file with `{filename}` from local storage. + + Roles accepted: + - Admin + - Mod + - DA + parameters: + - in: path + required: true + name: filename + description: Name of the media file to serve. + schema: + type: string + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK. Returns the media file. + content: + application/octet-stream: + schema: + type: string + format: binary + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '403': + description: Forbidden. Access to the media file is restricted or not allowed. + content: + text/plain: + schema: + type: string + example: "Restricted Access" + /admin/api/inline/upload: + post: + operationId: uploadMediaInline + tags: + - Protected + - Special Media Endpoints + summary: Upload a media file inline + description: | + Upload a media file inline. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + description: The file part of the multipart upload. + required: + - file + responses: + '200': + description: Success. File Saved. + content: + application/json: + schema: + type: object + properties: + location: + type: string + description: The name and path of the file saved on the server. + '417': + description: Error. File could not be saved. + content: + text/plain: + schema: + type: string + example: "Request Failed" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/serve/inline/{filename}: + get: + operationId: serveMediaInline + tags: + - Protected + - Special Media Endpoints + summary: Serve a media file inline + description: | + Serve the media file with `{filename}` inline. + + Roles accepted: + - Admin + - Mod + - DA + parameters: + - in: path + required: true + name: filename + description: Name of the media file to serve inline. + schema: + type: string + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK. Returns the media file inline. + content: + application/octet-stream: + schema: + type: string + format: binary + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/media/{id}: + put: + operationId: updateMedia + tags: + - Protected + - Media Management + summary: Update an existing Media + description: | + Update the media with `{id}` with the provided properties. + + Roles accepted: + - Admin + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Media to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewMedia' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved!" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/actors: + get: + operationId: getActors + tags: + - Protected + - Actor Management + summary: Get a paginated list of all Actors + description: | + Returns a paginated list of all actors. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ActorsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + post: + operationId: getActorsQuery + tags: + - Protected + - Actor Management + summary: Get a paginated list of all Actors with optional advanced search + description: | + Returns a paginated list of all actors, (optionally) satisfying search queries. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + requestBody: + required: false + description: Search query object. + content: + application/json: + schema: + type: object + properties: + q: + type: array + items: + $ref: '#/components/schemas/QueryActorObject' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ActorsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/actor: + post: + operationId: createActor + tags: + - Protected + - Actor Management + summary: Create a new Actor + description: | + Create a new actor with the provided properties. + + Accepted roles: + - Admin + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateActorRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Actor #{id} !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/actor/{id}: + get: + operationId: getActor + tags: + - Protected + - Actor Management + summary: Get an Actor by ID + description: | + Get the actor with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Actor to be retrieved. + schema: + type: integer + - in: query + name: mode + required: false + description: JSON encoding type. 1 for min, 2 for compact, 3 for normal (no-relation), other for normal with relations. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ActorItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + put: + operationId: updateActor + tags: + - Protected + - Actor Management + summary: Update an existing Actor + description: | + Update the actor with `{id}` with the provided properties. + + Roles accepted: + - Admin + - DA (with access permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Actor to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateActorRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Actor #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/actor/review/{id}: + put: + operationId: reviewActor + tags: + - Protected + - Actor Management + summary: Update the review of an existing Actor + description: | + Update review of the actor with `{id}`. + + Roles accepted: + - Admin + - DA (with access permission) + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Actor to be reviewed. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + type: object + properties: + review: + type: string + description: Review text + review_action: + type: string + description: Review action + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Actor review updated #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/actor/bulk: + put: + operationId: bulkUpdateActors + tags: + - Protected + - Actor Management + - Bulk Operations + summary: Bulk update existing Actors + description: | + Bulk update the actors with the provided properties. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + ids: + type: array + items: + type: integer + description: Actor IDs to be updated + bulk: + $ref: '#/components/schemas/GenericBulk' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Bulk update queued successfully" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Bulk update failed. + content: + text/plain: + schema: + type: string + example: "No items selected, or nothing to update" + /admin/api/{actor_id}/profiles: + get: + operationId: getActorProfiles + tags: + - Protected + - Actor Management + summary: Get a list of all Profiles of an Actor + description: | + Returns a list of all profiles of an actor. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: actor_id + description: Id of the Actor to get profiles. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ActorProfileItem' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/actor/relations/{id}: + get: + operationId: getActorRelations + tags: + - Protected + - Actor Management + summary: Get relations of an Actor + description: | + Get the relations of the actor with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Actor to get relations. + schema: + type: integer + - in: query + required: true + name: cls + description: Class of the relation + schema: + type: string + enum: + - actor + - bulletin + - incident + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + oneOf: + - $ref: '#/components/schemas/AtoaEx' + - $ref: '#/components/schemas/AtobItem' + - $ref: '#/components/schemas/ItoaItem' + more: + type: boolean + description: True if there are more items to load, false otherwise. + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/actormp/{id}: + get: + operationId: getActorMp + tags: + - Protected + - Actor Management + summary: Get missing person data for an Actor profile + description: | + Get the missing person data for the actor profile with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Actor Profile to get missing person data. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MissingPerson' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/bulletinhistory/{bulletinid}: + get: + operationId: getBulletinHistory + tags: + - Protected + - Bulletin Management + - History Helpers + summary: Get the revision history of a Bulletin + description: | + Get the revision history of the bulletin with `{bulletinid}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: bulletinid + description: Id of the Bulletin to get revision history. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/HistoryItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/actorhistory/{actorid}: + get: + operationId: getActorHistory + tags: + - Protected + - Actor Management + - History Helpers + summary: Get the revision history of an Actor + description: | + Get the revision history of the actor with `{actorid}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: actorid + description: Id of the Actor to get revision history. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/HistoryItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/incidenthistory/{incidentid}: + get: + operationId: getIncidentHistory + tags: + - Protected + - Incident Management + - History Helpers + summary: Get the revision history of an Incident + description: | + Get the revision history of the incident with `{incidentid}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: incidentid + description: Id of the Incident to get revision history. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/HistoryItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/locationhistory/{locationid}: + get: + operationId: getLocationHistory + tags: + - Protected + - Location Management + - History Helpers + summary: Get the revision history of a Location + description: | + Get the revision history of the location with `{locationid}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: locationid + description: Id of the Location to get revision history. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/HistoryItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/users: + get: + operationId: getUsers + tags: + - Protected + - User Management + summary: Get a paginated list of all Users + description: | + Returns a paginated list of all users (optionally) satisfying search query. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/queries_single' + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UsersResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/user: + post: + operationId: createUser + tags: + - Protected + - User Management + summary: Create a new User + description: | + Create a new user with the provided properties. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "User {username} has been created succeffully" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/checkuser: + post: + operationId: checkUser + tags: + - Protected + - User Management + summary: Check if a user exists + description: | + Check if a user with the provided username exists. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + type: string + description: Username to check for existence. + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Username ok" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Username already exists. + content: + text/plain: + schema: + type: string + example: "Username already exists" + /admin/api/user/{uid}: + put: + operationId: updateUser + tags: + - Protected + - User Management + summary: Update an existing User + description: | + Update the user with `{uid}` with the provided properties. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: uid + description: Id of the User to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateUserRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved user {uid} {name}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteUser + tags: + - Protected + - User Management + summary: Delete an existing User + description: | + Delete the user with `{uid}`. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: uid + description: Id of the User to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted!" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + description: Forbidden - Current user doesn't have permission, or User is active and needs to be marked inactive. + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPErrorResponse' + text/plain: + schema: + type: string + example: "User is active, make inactive before deleting." + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/password: + post: + operationId: checkPasswordStrength + tags: + - Protected + - User Management + summary: Check the strength of a password + description: | + Check the strength of the provided password. + + Accepted roles: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - password + properties: + password: + type: string + description: Password to check for strength. + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Password is ok" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '409': + description: Password is weak. + content: + text/plain: + schema: + type: string + example: "Weak password score" + '400': + description: Bad request. + content: + text/plain: + schema: + type: string + example: "No password provided" + /admin/api/user/force-reset: + post: + operationId: forcePasswordReset + tags: + - Protected + - User Management + summary: Force a password reset for a user + description: | + Force a password reset for the user with the provided uid. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + type: object + properties: + id: + type: integer + description: User ID to force password reset. + responses: + '200': + description: Forced password reset has been set or already exists for user + content: + text/plain: + examples: + resetSet: + summary: Reset has been set + value: "Forced password reset has been set for user {username}" + resetRequested: + summary: Reset already requested + value: "Forced password reset already requested: {reset_key}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/user/force-reset-all: + post: + operationId: forcePasswordResetAll + tags: + - Protected + - User Management + summary: Force a password reset for all users + description: | + Force a password reset for all users. + + Accepted roles: + - Admin + security: + - SessionCookieAuth: [] + responses: + '200': + description: Forced password reset has been set for all users + content: + text/plain: + schema: + type: string + example: "Forced password reset has been set for all users" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/roles: + get: + operationId: getRoles + tags: + - Protected + - Role Management + summary: Get the first page of list of all Roles + description: | + Returns the first page of the list of all roles, (optionally) satisfying a search query. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/queries_single' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/RoleItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/role/{page}: + get: + operationId: getRolesPage + tags: + - Protected + - Role Management + summary: Get a paginated list of all Roles + description: | + Returns a paginated list of all roles, (optionally) satisfying search query. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: page + description: The page number to retrieve. + schema: + type: integer + minimum: 1 + default: 1 + - $ref: '#/components/parameters/queries_single' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/RoleItem' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/role: + post: + operationId: createRole + tags: + - Protected + - Role Management + summary: Create a new Role + description: | + Create a new role with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRoleRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created!" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/role/{id}: + put: + operationId: updateRole + tags: + - Protected + - Role Management + summary: Update an existing Role + description: | + Update the role with `{id}` with the provided properties. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Role to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateRoleRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved!" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + description: Forbidden - Current user doesn't have permission, or Role is system role and can not be deleted. + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPErrorResponse' + text/plain: + schema: + type: string + example: "Cannot edit System Roles" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + delete: + operationId: deleteRole + tags: + - Protected + - Role Management + summary: Delete an existing Role + description: | + Delete the role with `{id}`. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Role to be deleted. + schema: + type: integer + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Deleted!" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + description: Forbidden - Current user doesn't have permission, Role is system role and can not be deleted or Role is assigned to restricted items and can not be deleted. + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPErrorResponse' + text/plain: + examples: + systemRole: + summary: System Role + value: "Cannot delete System Roles" + restrictedRole: + summary: Restricted Role + value: "Role assigned to restricted items" + schema: + type: string + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/role/import: + post: + operationId: importRoles + tags: + - Protected + - Role Management + summary: Import Roles from a CSV file + description: | + Import roles from a CSV file. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Success" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '400': + $ref: '#/components/responses/MissingCsvResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/incidents: + get: + operationId: getIncidents + tags: + - Protected + - Incident Management + summary: Get a paginated list of all Incidents + description: | + Returns a paginated list of all incidents. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + - in: query + name: mode + required: false + description: JSON encoding type. 1 for min, 2 for compact, 3 for normal (no-relation), other for normal with relations. + schema: + type: integer + default: 1 + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + post: + operationId: getIncidentsQuery + tags: + - Protected + - Incident Management + summary: Get a paginated list of all Incidents satisfying a search query + description: | + Returns a paginated list of all incidents satisfying the search query. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + - in: query + name: mode + required: false + description: JSON encoding type. 1 for min, 2 for compact, 3 for normal (no-relation), other for normal with relations. + schema: + type: integer + default: 1 + requestBody: + required: false + content: + application/json: + schema: + type: object + properties: + q: + $ref: '#/components/schemas/QueryIncidentObject' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentsResponse' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/incident: + post: + operationId: createIncident + tags: + - Protected + - Incident Management + summary: Create a new Incident + description: | + Create a new incident with the provided properties. + + Roles accepted: + - Admin + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateIncidentRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Created Incident #{id} !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '500': + $ref: '#/components/responses/InternalServerError' + /admin/api/incident/{id}: + put: + operationId: updateIncident + tags: + - Protected + - Incident Management + summary: Update an existing Incident + description: | + Update the incident with `{id}` with the provided properties. + + Roles accepted: + - Admin + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Incident to be updated. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreateIncidentRequest' + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Saved Incident #{id} !" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + get: + operationId: getIncident + tags: + - Protected + - Incident Management + summary: Get an Incident + description: | + Get the incident with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Incident to get. + schema: + type: integer + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentItem' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '403': + description: Restricted access + content: + text/plain: + schema: + type: string + example: "Restricted access" + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/incident/review/{id}: + put: + operationId: updateIncidentReview + tags: + - Protected + - Incident Management + summary: Update the review status of an Incident + description: | + Update the review status of the incident with `{id}`. + + Roles accepted: + - Admin + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Incident to be reviewed. + schema: + type: integer + requestBody: + required: true + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + type: object + properties: + review: + type: string + review_action: + type: string + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Incident review updated #{id}" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + $ref: '#/components/responses/SaveFailedResponse' + /admin/api/incident/bulk: + put: + operationId: updateIncidents + tags: + - Protected + - Incident Management + - Bulk Operations + summary: Bulk update existing Incidents + description: | + Bulk update the incidents with the provided properties. + + Roles accepted: + - Admin + - Mod + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + type: integer + bulk: + allOf: + - $ref: '#/components/schemas/GenericBulk' + - properties: + assignRelated: + type: boolean + restrictRelated: + type: boolean + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Bulk update queued successfully" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: No items selected, or nothing to update + content: + text/plain: + schema: + type: string + example: "No items selected, or nothing to update" + /admin/api/incident/relations/{id}: + get: + operationId: getIncidentRelations + tags: + - Protected + - Incident Management + summary: Get the relations of an Incident + description: | + Get the relations of the incident with `{id}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: id + description: Id of the Incident to get relations. + schema: + type: integer + - in: query + name: cls + schema: + type: string + description: Class of the relation to get. + enum: + - actor + - bulletin + - incident + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + items: + type: array + items: + oneOf: + - $ref: '#/components/schemas/ItoiEx' + - $ref: '#/components/schemas/ItobItem' + - $ref: '#/components/schemas/ItoaItem' + more: + type: boolean + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/incident/import: + post: + operationId: importIncidents + tags: + - Protected + - Incident Management + summary: Import Incidents from a CSV file + description: | + Import incidents from a CSV file. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + multipart/form-data: + schema: + type: object + properties: + csv: + type: string + format: binary + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Success" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + $ref: '#/components/responses/MissingCsvResponse' + /admin/api/activity: + get: + operationId: getActivity + tags: + - Protected + - Activity Management + summary: Get a paginated list of all Activities + description: | + Returns a paginated list of all activities. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ActivitiesResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + post: + operationId: getActivityQuery + tags: + - Protected + - Activity Management + summary: Get a paginated list of all Activities satisfying a search query + description: | + Returns a paginated list of all activities satisfying the search query. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + requestBody: + required: false + content: + application/json: + schema: + type: object + properties: + tag: + type: string + description: Search query + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ActivitiesResponse' + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/bulk/status: + get: + operationId: getBulkStatus + tags: + - Protected + - Bulk Operations + summary: Get the status of a bulk operation + description: | + Get the status of bulk operations for the current user. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: query + required: true + name: type + description: Type of bulk operation to get status for. + schema: + type: string + enum: + - actor + - bulletin + - incident + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: integer + status: + type: string + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '404': + description: Unsupported `type` parameter. + content: + text/plain: + schema: + type: string + example: "Not found." + /admin/api/queries: + get: + operationId: getQueries + tags: + - Protected + - Search Management + summary: Get a list of all saved Queries + description: | + Returns a list of all saved queries. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: query + name: type + required: true + description: Type of query to get. + schema: + type: string + enum: + - actor + - bulletin + - incident + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/QueryItem' + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '400': + description: Bad request. + content: + text/plain: + schema: + type: string + example: "Invalid query type" + /admin/api/query/{name}/exists: + get: + operationId: queryExists + tags: + - Protected + - Search Management + summary: Check if a query exists + description: | + Check if a query with the provided name exists. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: name + description: Name of the query to check. + schema: + type: string + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Query name is available" + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '409': + description: Query name is already in use. + content: + text/plain: + schema: + type: string + example: "Query name already exists!" + /admin/api/query: + post: + operationId: createQuery + tags: + - Protected + - Search Management + summary: Create a new Query + description: | + Create a new query with the provided properties. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + q: + description: Query object. Structure depends on `type` + type: object + type: + type: string + description: Type of query to create. + enum: + - actor + - bulletin + - incident + name: + type: string + description: Name of the query + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Query successfully saved!" + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '400': + description: Bad request. + content: + text/plain: + schema: + type: string + example: "Invalid Request" + '417': + description: Error parsing query object + content: + text/plain: + schema: + type: string + example: "Error parsing query data" + /admin/api/query/{name}: + put: + operationId: updateQuery + tags: + - Protected + - Search Management + summary: Update an existing Query + description: | + Update the query with `{name}` with the provided properties. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: name + description: Name of the Query to be updated. + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + q: + description: Query object. Structure depends on `type` + type: object + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Query {name} updated!" + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '417': + description: Error parsing query object + content: + text/plain: + schema: + type: string + example: "q parameter not provided" + '409': + description: Query update failed. + content: + text/plain: + schema: + type: string + example: "Query {name} save failed" + delete: + operationId: deleteQuery + tags: + - Protected + - Search Management + summary: Delete an existing Query + description: | + Delete the query with `{name}`. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: path + required: true + name: name + description: Name of the Query to be deleted. + schema: + type: string + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Query {name} deleted!" + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + '409': + description: Query deletion failed. + content: + text/plain: + schema: + type: string + example: "Query {name} delete failed" + /admin/api/relation/info: + get: + operationId: getRelationInfo + tags: + - Protected + - Join Tables Info Management + summary: Get information about all relations. + description: | + Get information about all relations of a type. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: query + name: type + required: false + description: Type of relation to get info for. + schema: + type: string + enum: + - atob + - atoa + - btob + - itoi + - itob + - itoa + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + oneOf: + - $ref: '#/components/schemas/AtoaItem' + - $ref: '#/components/schemas/AtobItem' + - $ref: '#/components/schemas/BtobItem' + - $ref: '#/components/schemas/ItoiItem' + - $ref: '#/components/schemas/ItobItem' + - $ref: '#/components/schemas/ItoaItem' + text/plain: + schema: + type: object + example: + {"error": "Invalid table type"} + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/graph/json: + get: + operationId: getGraphJson + tags: + - Protected + - Graph Management + summary: Get the JSON representation of a graph + description: | + Get the JSON representation of graph data. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: query + name: type + required: true + description: Type of entity graph to get. + schema: + type: string + enum: + - actor + - bulletin + - incident + - in: query + name: id + required: true + description: Id of the entity to get graph for. + schema: + type: integer + - in: query + name: expanded + required: true + description: Whether to expand the graph or not. + schema: + type: boolean + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + nodes: + type: array + items: + type: object + properties: + id: + type: string + _id: + type: integer + title: + type: string + color: + type: string + type: + type: string + collapsed: + type: boolean + childLinks: + type: array + items: {} + links: + type: array + items: + type: object + properties: + source: + type: integer + target: + type: integer + type: + type: string + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + /admin/api/graph/visualize: + post: + operationId: visualizeGraph + tags: + - Protected + - Graph Management + summary: Visualize a graph + description: | + Start a background-running visualization task for the provided data. Returns the `id` of the task. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + parameters: + - in: query + name: type + required: true + description: Type of entity graph to visualize. + schema: + type: string + enum: + - actor + - bulletin + - incident + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + q: + description: Query object. Structure depends on `type` + oneOf: + - $ref: '#/components/schemas/QueryIncidentObject' + - $ref: '#/components/schemas/QueryBulletinObject' + - $ref: '#/components/schemas/QueryActorObject' + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + task_id: + type: integer + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '400': + description: Bad request. + content: + text/plain: + schema: + type: string + example: "Invalid type provided" + /admin/api/graph/data: + get: + operationId: getGraphData + tags: + - Protected + - Graph Management + summary: Get the data of a graph + description: | + Get the data of a graph for the current user. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + description: Graph data in JSON format. + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/graph/status: + get: + operationId: getGraphStatus + tags: + - Protected + - Graph Management + summary: Get the status of a graph task + description: | + Get the status of a graph task for the current user. + + Roles accepted: + - Admin + - Mod + - DA + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + status: + type: string + '401': + $ref: '#/components/responses/UnauthenticatedResponse' + '404': + $ref: '#/components/responses/NotFoundTextResponse' + /admin/api/appconfig: + get: + operationId: getAppConfig + tags: + - Protected + - Configuration Management + summary: Get a paginated list of application configurations + description: | + Get a paginated list of all application configurations. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + parameters: + - $ref: '#/components/parameters/page' + - $ref: '#/components/parameters/per_page' + responses: + '200': + description: OK + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + type: object + description: Application configuration object in JSON. + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + /admin/api/configuration: + get: + operationId: getConfiguration + tags: + - Protected + - Configuration Management + summary: Get serialized app configuration + description: | + Get the serialized application configuration. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + config: + type: object + description: Application configuration object in JSON. + labels: + type: object + description: Labels dictionary for the configuration. + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + put: + operationId: updateConfiguration + tags: + - Protected + - Configuration Management + summary: Update application configuration + description: | + Update the application configuration. + + Roles accepted: + - Admin + security: + - SessionCookieAuth: [] + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + conf: + type: object + description: Application configuration object in JSON. + responses: + '200': + description: OK + content: + text/plain: + schema: + type: string + example: "Configuration Saved Successfully" + '401': + $ref: '#/components/responses/UnauthenticatedJsonResponse' + '403': + $ref: '#/components/responses/UnauthorizedJsonResponse' + '417': + description: Error updating configuration + content: + text/plain: + schema: + type: string + example: "Unable to Save Configuration" +components: + securitySchemes: + SessionCookieAuth: + type: apiKey + in: cookie + name: session + description: Session cookie required for authentication. + parameters: + page: + in: query + name: page + required: false + description: The page number to retrieve. + schema: + type: integer + minimum: 1 + default: 1 + per_page: + in: query + name: per_page + required: false + description: Number of items to display per page. + schema: + type: integer + minimum: 1 + default: 30 + queries_single: + in: query + name: q + required: false + description: Search query. + schema: + type: string + queries_multiple: + in: query + name: q + required: false + description: Search queries separated by a single space character. + schema: + type: string + example: human rights + responses: + UnauthenticatedResponse: + description: Unauthenticated access attempt will return the login page in text/html. + content: + text/html: + schema: + type: string + example: "Login Page..." + SaveFailedResponse: + description: There was an error while saving the entity. + content: + text/plain: + schema: + type: string + example: Save Failed + UnauthenticatedJsonResponse: + description: User must sign in to view this resource. + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPErrorResponse' + example: | + { + "meta": { + "code": 401 + }, + "response": { + "errors": [ + "You must sign in to view this resource" + ] + } + } + UnauthorizedJsonResponse: + description: User doesn't have permission to create this entity. + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPErrorResponse' + NotFoundTextResponse: + description: Resource with `{id}` was not found. + content: + text/plain: + schema: + type: string + example: "Not Found" + MissingCsvResponse: + description: Bad request, possibly due to missing CSV file in the request. + content: + text/plain: + schema: + type: string + example: Error + InternalServerError: + description: Something went wrong, the entity could not be deleted + content: + text/html: + schema: + type: string + example: "... Sorry, something went wrong on our system. Don't panic, we are fixing it! Please try again later. ..." + RelationInfoSaveFailedResponse: + description: | + Failure in creation due to missing required fields or other internal issues. + - "Title and Reverse Title are required." when the title or reverse title is not provided. + - "Creation failed." for other issues preventing item creation. + content: + text/plain: + schema: + type: string + examples: + missingRequiredFields: + summary: Title and Reverse Title missing + value: "Title and Reverse Title are required." + creationFailed: + summary: Other creation failure + value: "Creation failed." + ItemCreatedResponse: + description: OK + content: + text/plain: + schema: + type: string + example: "Item created successfully ID #{id} !" + schemas: + QueryLocationObject: + type: object + properties: + lvl: + type: integer + description: Admin level to restrict parent search with + title: + type: string + description: Search queries separated by a single space character + tsv: + type: string + description: Search queries separated by a single space character + latlng: + type: object + properties: + lat: + type: number + lng: + type: number + radius: + type: number + location_type: + type: object + properties: + id: + type: integer + admin_level: + type: object + description: Admin level + properties: + code: + type: integer + country: + type: object + properties: + id: + type: integer + tags: + type: array + items: + type: string + optags: + type: boolean + default: false + QueryBaseObject: + type: object + properties: + tsv: + type: string + description: Search queries for title separated by a single space character. + extsv: + type: string + description: Search queries to exclude from title separated by a single space character. + labels: + type: array + items: + type: object + properties: + id: + type: integer + oplabels: + type: boolean + description: true for OR, false for AND + default: false + exlabels: + type: array + items: + type: object + properties: + id: + type: integer + opvlabels: + type: boolean + description: Verified labels queries operator. true for OR, false for AND + default: false + vlabels: + type: array + items: + type: object + properties: + id: + type: integer + exvlabels: + type: array + items: + type: object + properties: + id: + type: integer + opsources: + type: boolean + description: Sources queries operator. true for OR, false for AND + default: false + sources: + type: array + items: + type: object + properties: + id: + type: integer + exsources: + type: array + items: + type: object + properties: + id: + type: integer + locations: + type: array + items: + type: object + properties: + id: + type: integer + oplocations: + type: boolean + description: true ot get all children, false to get combined list of locations + default: false + exlocations: + type: array + items: + type: object + properties: + id: + type: integer + created: + type: array + items: + type: string + format: date + updated: + type: array + items: + type: string + format: date + singleEvent: + type: boolean + default: false + edate: + type: array + items: + type: string + format: date + etype: + type: object + properties: + id: + type: integer + elocation: + type: object + properties: + id: + type: integer + roles: + type: array + items: + type: integer + norole: + type: boolean + default: false + assigned: + type: array + items: + type: integer + unassigned: + type: boolean + default: false + reviewer: + type: array + items: + type: integer + statuses: + type: array + items: + type: string + reviewAction: + type: string + rel_to_bulletin: + type: integer + rel_to_actor: + type: integer + rel_to_incident: + type: integer + QueryBulletinObject: + allOf: + - $ref: '#/components/schemas/QueryBaseObject' + - type: object + properties: + op: + type: string + enum: [and, or] + default: or + ids: + type: array + items: + type: integer + ref: + type: array + items: + type: string + inExact: + type: boolean + default: false + opref: + type: boolean + default: false + exref: + type: array + items: + type: string + exExact: + type: boolean + default: false + opexref: + type: boolean + default: false + childlabels: + type: boolean + default: false + childverlabels: + type: boolean + default: false + childsources: + type: boolean + default: false + locTypes: + type: array + items: + type: string + enum: [locations, geomarkers, events] + latlng: + type: object + properties: + lat: + type: number + lng: + type: number + radius: + type: number + QueryActorObject: + allOf: + - $ref: '#/components/schemas/QueryBaseObject' + - type: object + properties: + op: + type: string + enum: [and, or] + default: or + nickname: + type: string + description: Search query for nickname. + first_name: + type: string + description: Search query for first name. + middle_name: + type: string + description: Search query for middle name. + last_name: + type: string + description: Search query for last name. + father_name: + type: string + description: Search query for father name. + mother_name: + type: string + description: Search query for mother name. + opEthno: + type: boolean + description: Ethnography queries operator. true for OR, false for AND + default: false + ethnography: + type: array + items: + type: object + properties: + id: + type: integer + opNat: + type: boolean + description: Nationality queries operator. true for OR, false for AND + default: false + nationality: + type: array + items: + type: object + properties: + id: + type: integer + resLocations: + type: array + items: + type: object + properties: + id: + type: integer + originLocations: + type: array + items: + type: object + properties: + id: + type: integer + exResLocations: + type: array + items: + type: object + properties: + id: + type: integer + exOriginLocations: + type: array + items: + type: object + properties: + id: + type: integer + occupation: + type: string + position: + type: string + opDialects: + type: boolean + description: Dialects queries operator. true for OR, false for AND + default: false + dialects: + type: array + items: + type: object + properties: + id: + type: integer + family_status: + type: string + sex: + type: string + age: + type: string + civilian: + type: string + type: + type: string + id_number: + type: string + locTypes: + type: array + items: + type: string + enum: [originplace, events] + QueryIncidentObject: + allOf: + - $ref: '#/components/schemas/QueryBaseObject' + - type: object + properties: + potentialVCats: + type: array + items: + type: integer + claimedVCats: + type: array + items: + type: integer + ItemWrapper: + type: object + required: + - item + properties: + item: + type: object + description: Entity-specific properties go here + GenericListResponse: + type: object + properties: + items: + type: array + items: {} + description: Entity-specific items will be defined in the actual endpoint. + perPage: + type: integer + description: Number of items per page. + total: + type: integer + description: Total number of items. + LoginRequest: + type: object + required: + - username + - password + - csrf_token + properties: + username: + type: string + example: admin + password: + type: string + example: password + csrf_token: + type: string + example: IjVlYTQ5YjM1ZjFhMjgwMzlhMzUxMThkYTYwNDE5MjFhNWYzOTJmNTQi.ZgJ1GA.Mh6rswADk9tInFmHw2YTQjLn4w0 + CreateLabelRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewLabel' + NewLabel: + type: object + required: + - title + properties: + title_ar: + type: string + comments: + type: string + comments_ar: + type: string + order: + type: integer + verified: + type: boolean + for_bulletin: + type: boolean + for_actor: + type: boolean + for_incident: + type: boolean + for_offline: + type: boolean + parent: + $ref: '#/components/schemas/LabelMinItem' + LabelsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/LabelItem' + LabelItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + title_ar: + type: string + comments: + type: string + comments_ar: + type: string + order: + type: integer + verified: + type: boolean + for_bulletin: + type: boolean + for_actor: + type: boolean + for_incident: + type: boolean + for_offline: + type: boolean + parent: + $ref: '#/components/schemas/LabelMinItem' + updated_at: + type: string + format: date-time + example: '2024-03-26T09:15' + LabelMinItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + EventtypesResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/EventtypeItem' + CreateEventtypeRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewEventtype' + NewEventtype: + type: object + required: + - title + properties: + title: + type: string + title_ar: + type: string + for_actor: + type: boolean + for_bulletin: + type: boolean + comments: + type: string + EventtypeItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + title_ar: + type: string + for_actor: + type: boolean + for_bulletin: + type: boolean + comments: + type: string + updated_at: + type: string + format: date-time + example: "2024-03-26T09:15" + PotentialViolationsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/PotentialViolationItem' + CreatePotentialViolationRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewPotentialViolation' + NewPotentialViolation: + type: object + required: + - title + properties: + title: + type: string + PotentialViolationItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + ClaimedViolationsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/ClaimedViolationItem' + CreateClaimedViolationRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewClaimedViolation' + NewClaimedViolation: + type: object + required: + - title + properties: + title: + type: string + ClaimedViolationItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + SourcesResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/SourceItem' + CreateSourceRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewSource' + NewSource: + type: object + required: + - title + properties: + title: + type: string + title_ar: + type: string + comments: + type: string + comments_ar: + type: string + parent: + $ref: '#/components/schemas/SourceMinItem' + SourceItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + etl_id: + type: string + parent: + $ref: '#/components/schemas/SourceMinItem' + comments: + type: string + updated_at: + type: string + format: date-time + example: "2023-11-10T23:52" + SourceMinItem: + type: object + required: + - id + properties: + id: + type: integer + title: + type: string + LocationAdminLevelsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/LocationAdminLevelItem' + CreateLocationAdminLevelRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewLocationAdminLevel' + NewLocationAdminLevel: + type: object + required: + - title + - code + properties: + title: + type: string + code: + type: integer + LocationAdminLevelItem: + type: object + required: + - id + - code + properties: + id: + type: integer + code: + type: integer + title: + type: string + LocationTypesResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/LocationTypeItem' + CreateLocationTypeRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewLocationType' + NewLocationType: + type: object + required: + - title + - description + properties: + title: + type: string + description: + type: string + LocationTypeItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + description: + type: string + ComponentsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/ComponentDataItem' + CreateComponentRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewComponent' + NewComponent: + type: object + required: + - title + properties: + title: + type: string + title_tr: + type: string + created_at: + type: string + format: date-time + updated_at: + type: string + format: date-time + ComponentDataItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + title_tr: + type: string + created_at: + type: string + format: date-time + example: '2022-12-23T12:02:00' + updated_at: + type: string + format: date-time + example: '2022-12-23T12:02:00' + LocationsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/LocationItem' + CreateLocationRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewLocation' + NewLocation: + type: object + required: + - title + - title_ar + - description + - full_location + - postal_code + properties: + title: + type: string + title_ar: + type: string + description: + type: string + latlng: + type: object + required: + - lat + - lng + properties: + lat: + type: number + lng: + type: number + location_type: + type: object + required: + - title + - id + properties: + title: + type: string + id: + type: integer + admin_level: + type: object + required: + - id + properties: + id: + type: integer + full_location: + type: string + postal_code: + type: string + country: + type: object + properties: + id: + type: integer + tags: + type: array + items: + type: string + parent: + type: object + properties: + id: + type: integer + LocationItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + title_ar: + type: string + description: + type: string + location_type: + $ref: '#/components/schemas/LocationTypeItem' + admin_level: + $ref: '#/components/schemas/LocationAdminLevelItem' + postal_code: + type: string + country: + $ref: '#/components/schemas/ComponentDataItem' + parent: + $ref: '#/components/schemas/LocationMinItem' + tags: + type: array + items: + type: string + lat: + type: number + lng: + type: number + full_location: + type: string + full_string: + type: string + updated_at: + type: string + format: date-time + example: '2022-12-23T12:02:00' + LocationMinItem: + type: object + required: + - id + - title + properties: + id: + type: integer + title: + type: string + full_string: + type: string + admin_level: + $ref: '#/components/schemas/LocationAdminLevelItem' + CreateJoinTableInfoRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewJoinTableInfo' + NewJoinTableInfo: + type: object + required: + - title + - reverse_title + properties: + title: + type: string + reverse_title: + type: string + title_tr: + type: string + reverse_title_tr: + type: string + JoinTableInfosResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/JoinTableInfoItem' + JoinTableInfoItem: + type: object + required: + - id + - title + - reverse_title + properties: + id: + type: integer + title: + type: string + reverse_title: + type: string + title_tr: + type: string + reverse_title_tr: + type: string + CreateUserRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewUser' + NewUser: + type: object + required: + - username + - email + properties: + username: + type: string + password: + type: string + email: + type: string + roles: + type: array + items: + type: object + required: + - id + properties: + id: + type: integer + view_usernames: + type: boolean + view_simple_history: + type: boolean + view_full_history: + type: boolean + can_self_assign: + type: boolean + can_edit_locations: + type: boolean + can_export: + type: boolean + UsersResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/UserItem' + UserItem: + oneOf: + - $ref: '#/components/schemas/UserCompactItem' + - $ref: '#/components/schemas/UserFullItem' + UserFullItem: + allOf: + - $ref: '#/components/schemas/UserCompactItem' + - properties: + email: + type: string + google_id: + type: string + roles: + type: array + items: + $ref: '#/components/schemas/RoleItem' + view_usernames: + type: boolean + view_simple_history: + type: boolean + view_full_history: + type: boolean + can_self_assign: + type: boolean + can_edit_locations: + type: boolean + can_export: + type: boolean + force_reset: + type: number + + UserCompactItem: + type: object + required: + - id + - username + properties: + id: + type: integer + username: + type: string + name: + type: string + active: + type: boolean + default: false + CreateRoleRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewRole' + NewRole: + type: object + required: + - name + - description + - color + properties: + name: + type: string + description: + type: string + color: + type: string + RoleItem: + type: object + required: + - id + properties: + id: + type: integer + name: + type: string + description: + type: string + color: + type: string + LocationCompactItem: + type: object + properties: + id: + type: integer + title: + type: string + full_string: + type: string + lat: + type: number + lng: + type: number + LocationsJson: + type: array + items: + $ref: '#/components/schemas/LocationCompactItem' + GenericJson: + type: object + properties: + id: + type: integer + title: + type: string + SourcesJson: + type: array + items: + $ref: '#/components/schemas/GenericJson' + LabelsJson: + type: array + items: + $ref: '#/components/schemas/GenericJson' + VerLabelsJson: + type: array + items: + $ref: '#/components/schemas/GenericJson' + GeoLocationTypeItem: + $ref: '#/components/schemas/ComponentDataItem' + GeoLocationItem: + type: object + properties: + id: + type: integer + title: + type: string + type: + $ref: '#/components/schemas/GeoLocationTypeItem' + main: + type: boolean + lat: + type: number + lng: + type: number + comment: + type: string + updated_at: + type: string + format: date-time + example: '2022-12-23T12:02:00' + EventItem: + type: object + properties: + id: + type: integer + title: + type: string + title_ar: + type: string + comments: + type: string + comments_ar: + type: string + location: + $ref: '#/components/schemas/LocationItem' + eventtype: + $ref: '#/components/schemas/EventtypeItem' + from_date: + type: string + format: date-time + example: '2022-12-23T12:02:00' + to_date: + type: string + format: date-time + example: '2022-12-23T12:02:00' + estimated: + type: boolean + updated_at: + type: string + format: date-time + example: '2022-12-23T12:02:00' + MediaItem: + type: object + properties: + id: + type: integer + title: + type: string + title_ar: + type: string + fileType: + type: string + filename: + type: string + etag: + type: string + time: + type: number + duration: + type: string + main: + type: boolean + updated_at: + type: string + format: date-time + BtobIn: + type: object + properties: + bulletin_from: + $ref: '#/components/schemas/BulletinCompactItem' + bulletin_to: + $ref: '#/components/schemas/BulletinCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + BtobEx: + type: object + properties: + bulletin: + $ref: '#/components/schemas/BulletinCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + AtoaEx: + type: object + properties: + actor: + $ref: '#/components/schemas/ActorCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + AtoaIn: + type: object + properties: + actor_from: + $ref: '#/components/schemas/ActorCompactItem' + actor_to: + $ref: '#/components/schemas/ActorCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + AtoaItem: + oneOf: + - $ref: '#/components/schemas/AtoaIn' + - $ref: '#/components/schemas/AtoaEx' + AtobItem: + type: object + properties: + actor: + $ref: '#/components/schemas/ActorCompactItem' + bulletin: + $ref: '#/components/schemas/BulletinCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + ItobItem: + type: object + properties: + incident: + $ref: '#/components/schemas/IncidentCompactItem' + bulletin: + $ref: '#/components/schemas/BulletinCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + ItoaItem: + type: object + properties: + incident: + $ref: '#/components/schemas/IncidentCompactItem' + actor: + $ref: '#/components/schemas/ActorCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + ItoiItem: + oneOf: + - $ref: '#/components/schemas/ItoiIn' + - $ref: '#/components/schemas/ItoiEx' + ItoiIn: + type: object + properties: + incident_from: + $ref: '#/components/schemas/IncidentCompactItem' + incident_to: + $ref: '#/components/schemas/IncidentCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + ItoiEx: + type: object + properties: + incident: + $ref: '#/components/schemas/IncidentCompactItem' + related_as: + type: array + items: + type: integer + probability: + type: integer + user_id: + type: integer + comment: + type: string + BtobItem: + oneOf: + - $ref: '#/components/schemas/BtobIn' + - $ref: '#/components/schemas/BtobEx' + ActorCompactItem: + type: object + properties: + id: + type: integer + name: + type: string + IncidentCompactItem: + type: object + properties: + id: + type: integer + title: + type: string + description: + type: string + BulletinCompactItem: + type: object + properties: + id: + type: integer + title: + type: string + title_ar: + type: string + sjac_title: + type: string + sjac_title_ar: + type: string + originid: + type: string + locations: + $ref: '#/components/schemas/LocationsJson' + sources: + $ref: '#/components/schemas/SourcesJson' + description: + type: string + source_link: + type: string + source_link_type: + type: boolean + publish_date: + type: string + format: date-time + documentation_date: + type: string + format: date-time + comments: + type: string + BulletinsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/BulletinItem' + BaseMinItem: + type: object + properties: + id: + type: integer + type: + type: string + title: + type: string + name: + type: string + assigned_to: + $ref: '#/components/schemas/UserCompactItem' + first_peer_reviewer: + $ref: '#/components/schemas/UserCompactItem' + status: + type: string + _status: + type: string + roles: + type: array + items: + $ref: '#/components/schemas/RoleItem' + BulletinMode2Item: + type: object + properties: + class: + type: string + example: Bulletin + id: + type: integer + title: + type: string + title_ar: + type: string + sjac_title: + type: string + sjac_title_ar: + type: string + originid: + type: string + locations: + $ref: '#/components/schemas/LocationsJson' + sources: + $ref: '#/components/schemas/SourcesJson' + description: + type: string + source_link: + type: string + publish_date: + type: string + format: date-time + documentation_date: + type: string + format: date-time + comments: + type: string + + BulletinMode3Item: + type: object + properties: + id: + type: integer + title: + type: string + title_ar: + type: string + sjac_title: + type: string + sjac_title_ar: + type: string + originid: + type: string + assigned_to: + $ref: '#/components/schemas/UserCompactItem' + first_peer_reviewer: + $ref: '#/components/schemas/UserCompactItem' + locations: + $ref: '#/components/schemas/LocationsJson' + geoLocations: + type: array + items: + $ref: '#/components/schemas/GeoLocationItem' + labels: + $ref: '#/components/schemas/LabelsJson' + verLabels: + $ref: '#/components/schemas/VerLabelsJson' + sources: + $ref: '#/components/schemas/SourcesJson' + events: + type: array + items: + $ref: '#/components/schemas/EventItem' + medias: + type: array + items: + $ref: '#/components/schemas/MediaItem' + bulletin_relations: + type: array + items: {} + actor_relations: + type: array + items: {} + incident_relations: + type: array + items: {} + description: + type: string + comments: + type: string + source_link: + type: string + source_link_type: + type: boolean + ref: + type: array + items: + type: string + publish_date: + type: string + format: date-time + documentation_date: + type: string + format: date-time + status: + type: string + review: + type: string + review_action: + type: string + updated_at: + type: string + format: date-time + roles: + type: array + items: + $ref: '#/components/schemas/RoleItem' + BulletinMode4Item: + allOf: + - $ref: '#/components/schemas/BulletinMode3Item' + - properties: + bulletin_relations: + type: array + items: + $ref: '#/components/schemas/BtobEx' + actor_relations: + type: array + items: + $ref: '#/components/schemas/AtobItem' + incident_relations: + type: array + items: + $ref: '#/components/schemas/ItobItem' + CreateBulletinRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewBulletin' + NewBulletin: + type: object + properties: + originid: + type: string + title: + type: string + title_ar: + type: string + sjac_title: + type: string + sjac_title_ar: + type: string + assigned_to: + type: object + properties: + id: + type: integer + first_peer_reviewer: + type: object + properties: + id: + type: integer + description: + type: string + comments: + type: string + source_link: + type: string + source_link_type: + type: boolean + ref: + type: array + items: + type: integer + locations: + type: array + items: + type: object + properties: + id: + type: integer + geoLocations: + type: array + items: + anyOf: + - type: object + properties: + id: + type: integer + - $ref: '#/components/schemas/NewGeoLocation' + sources: + type: array + items: + type: object + properties: + id: + type: integer + labels: + type: array + items: + type: object + properties: + id: + type: integer + verLabels: + type: array + items: + type: object + properties: + id: + type: integer + events: + type: array + items: + anyOf: + - type: object + properties: + id: + type: integer + - $ref: '#/components/schemas/NewEvent' + medias: + type: array + items: + anyOf: + - type: object + properties: + id: + type: integer + - $ref: '#/components/schemas/NewMedia' + bulletin_relations: + type: array + items: + $ref: '#/components/schemas/NewBtob' + actor_relations: + type: array + items: + $ref: '#/components/schemas/NewAtob' + incident_relations: + type: array + items: + $ref: '#/components/schemas/NewItob' + publish_date: + type: string + format: date-time + documentation_date: + type: string + format: date-time + status: + type: string + NewItob: + type: object + properties: + incident: + type: object + properties: + id: + type: integer + related_as: + type: array + items: + type: integer + probability: + type: integer + comment: + type: string + NewAtob: + type: object + properties: + actor: + type: object + properties: + id: + type: integer + related_as: + type: array + items: + type: integer + probability: + type: integer + comment: + type: string + NewBtob: + type: object + properties: + bulletin: + type: object + properties: + id: + type: integer + related_as: + type: array + items: + type: integer + probability: + type: integer + comment: + type: string + NewMedia: + type: object + required: + - filename + - fileType + properties: + title: + type: string + title_ar: + type: string + fileType: + type: string + filename: + type: string + etag: + type: string + time: + type: number + category: + type: object + properties: + id: + type: integer + NewEvent: + type: object + properties: + title: + type: string + title_ar: + type: string + comments: + type: string + comments_ar: + type: string + location: + type: object + properties: + id: + type: integer + eventtype: + type: object + properties: + id: + type: integer + from_date: + type: string + format: date-time + to_date: + type: string + format: date-time + estimated: + type: boolean + NewGeoLocation: + type: object + properties: + title: + type: string + type: + type: object + properties: + id: + type: integer + main: + type: boolean + latlng: + type: object + properties: + lat: + type: number + lng: + type: number + comment: + type: string + BulletinItem: + oneOf: + - $ref: '#/components/schemas/BaseMinItem' + - $ref: '#/components/schemas/BulletinMode2Item' + - $ref: '#/components/schemas/BulletinMode3Item' + - $ref: '#/components/schemas/BulletinMode4Item' + GenericBulk: + type: object + properties: + status: + type: string + example: "Assigned" + assigned_to_id: + type: integer + first_peer_reviewer_id: + type: integer + comments: + type: string + roles: + type: array + items: + type: object + properties: + id: + type: integer + rolesReplace: + type: boolean + CreateActorRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewActor' + NewActor: + type: object + properties: + type: + type: string + enum: + - Entity + - Person + name: + type: string + name_ar: + type: string + nickname: + type: string + nickname_ar: + type: string + first_name: + type: string + first_name_ar: + type: string + middle_name: + type: string + middle_name_ar: + type: string + last_name: + type: string + last_name_ar: + type: string + father_name: + type: string + father_name_ar: + type: string + mother_name: + type: string + mother_name_ar: + type: string + sex: + type: string + age: + type: string + civilian: + type: string + occupation: + type: string + occupation_ar: + type: string + position: + type: string + position_ar: + type: string + family_status: + type: string + no_children: + type: integer + ethnographies: + type: array + items: + type: object + properties: + id: + type: integer + nationalities: + type: array + items: + type: object + properties: + id: + type: integer + dialects: + type: array + items: + type: object + properties: + id: + type: integer + id_number: + type: string + origin_place: + type: object + properties: + id: + type: integer + events: + type: array + items: + anyOf: + - type: object + properties: + id: + type: integer + - $ref: '#/components/schemas/NewEvent' + medias: + type: array + items: + anyOf: + - type: object + properties: + id: + type: integer + - $ref: '#/components/schemas/NewMedia' + actor_relations: + type: array + items: + $ref: '#/components/schemas/NewAtob' + bulletin_relations: + type: array + items: + $ref: '#/components/schemas/NewAtob' + incident_relations: + type: array + items: + $ref: '#/components/schemas/NewItob' + comments: + type: string + status: + type: string + actor_profiles: + type: array + items: + anyOf: + - type: object + properties: + id: + type: integer + - $ref: '#/components/schemas/NewActorProfile' + NewActorProfile: + oneOf: + - $ref: '#/components/schemas/NewActorProfileBase' + - $ref: '#/components/schemas/NewActorProfileMP' + NewActorProfileBase: + type: object + properties: + mode: + type: integer + originid: + type: string + description: + type: string + source_link: + type: string + source_link_type: + type: boolean + publish_date: + type: string + documentation_date: + type: string + sources: + type: array + items: + type: object + properties: + id: + type: integer + labels: + type: array + items: + type: object + properties: + id: + type: integer + ver_labels: + type: array + items: + type: object + properties: + id: + type: integer + + NewActorProfileMP: + allOf: + - $ref: '#/components/schemas/NewActorProfileBase' + - properties: + last_address: + type: string + marriage_history: + type: string + pregnant_at_disappearance: + type: string + months_pregnant: + type: integer + missing_relatives: + type: string + saw_name: + type: string + saw_address: + type: string + saw_phone: + type: string + saw_email: + type: string + seen_in_detention: + type: string + injured: + type: string + known_dead: + type: string + death_details: + type: string + personal_items: + type: string + height: + type: integer + weight: + type: integer + physique: + type: string + hair_loss: + type: string + hair_type: + type: string + hair_length: + type: string + hair_color: + type: string + facial_hair: + type: string + posture: + type: string + skin_markings: + type: string + handedness: + type: string + eye_color: + type: string + glasses: + type: string + dist_char_con: + type: string + dist_char_acq: + type: string + physical_habits: + type: string + other: + type: string + phys_name_contact: + type: string + injuries: + type: string + implants: + type: string + malforms: + type: string + pain: + type: string + other_conditions: + type: string + accidents: + type: string + pres_drugs: + type: string + smoker: + type: string + dental_record: + type: string + dentist_info: + type: string + teeth_features: + type: string + dental_problems: + type: string + dental_treatments: + type: string + dental_habits: + type: string + case_status: + type: string + reporters: + type: string + identified_by: + type: string + family_notified: + type: string + reburial_location: + type: string + hypothesis_based: + type: string + hypothesis_status: + type: string + + + + ActorItem: + oneOf: + - $ref: '#/components/schemas/BaseMinItem' + - $ref: '#/components/schemas/ActorMode2Item' + - $ref: '#/components/schemas/ActorMode3Item' + - $ref: '#/components/schemas/ActorMode4Item' + ActorsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/ActorItem' + ActorMode2Item: + type: object + properties: + class: + type: string + example: "Actor" + id: + type: integer + type: + type: string + name: + type: string + comments: + type: string + status: + type: string + ActorMode3Item: + type: object + properties: + class: + type: string + example: "Actor" + id: + type: integer + name: + type: string + name_ar: + type: string + nickname: + type: string + nickname_ar: + type: string + first_name: + type: string + first_name_ar: + type: string + middle_name: + type: string + middle_name_ar: + type: string + last_name: + type: string + last_name_ar: + type: string + father_name: + type: string + father_name_ar: + type: string + mother_name: + type: string + mother_name_ar: + type: string + sex: + type: string + _sex: + type: string + age: + type: string + _age: + type: string + civilian: + type: string + _civilian: + type: string + type: + type: string + _type: + type: string + occupation: + type: string + occupation_ar: + type: string + position: + type: string + position_ar: + type: string + family_status: + type: string + no_children: + type: integer + ethnographies: + type: array + items: + $ref: '#/components/schemas/ComponentDataItem' + nationalities: + type: array + items: + $ref: '#/components/schemas/ComponentDataItem' + dialects: + type: array + items: + $ref: '#/components/schemas/ComponentDataItem' + id_number: + type: string + assigned_to: + $ref: '#/components/schemas/UserCompactItem' + first_peer_reviewer: + $ref: '#/components/schemas/UserCompactItem' + comments: + type: string + events: + type: array + items: + $ref: '#/components/schemas/EventItem' + medias: + type: array + items: + $ref: '#/components/schemas/MediaItem' + actor_relations: + type: array + items: {} + bulletin_relations: + type: array + items: {} + incident_relations: + type: array + items: {} + origin_place: + $ref: '#/components/schemas/LocationItem' + status: + type: string + review: + type: string + review_action: + type: string + updated_at: + type: string + format: date-time + roles: + type: array + items: + $ref: '#/components/schemas/RoleItem' + actor_profiles: + type: array + items: + anyOf: + - $ref: '#/components/schemas/ActorProfileBase' + - $ref: '#/components/schemas/ActorProfileMP' + ActorMode4Item: + allOf: + - $ref: '#/components/schemas/ActorMode3Item' + - properties: + actor_relations: + type: array + items: + $ref: '#/components/schemas/AtoaItem' + bulletin_relations: + type: array + items: + $ref: '#/components/schemas/AtobItem' + incident_relations: + type: array + items: + $ref: '#/components/schemas/ItobItem' + MissingPerson: + type: object + properties: + MP: + type: boolean + default: true + last_address: + type: string + description: MP + social_networks: + type: object + description: MP + marriage_history: + type: string + description: MP + pregnant_at_disappearance: + type: string + description: MP + months_pregnant: + type: integer + description: MP + missing_relatives: + type: boolean + description: MP + saw_name: + type: string + description: MP + saw_address: + type: string + description: MP + saw_email: + type: string + description: MP + saw_phone: + type: string + description: MP + detained_before: + type: string + description: MP + seen_in_detention: + type: object + description: MP + injured: + type: object + description: MP + known_dead: + type: object + description: MP + death_details: + type: string + description: MP + personal_items: + type: string + description: MP + height: + type: integer + description: MP + weight: + type: integer + description: MP + physique: + type: string + description: MP + hair_loss: + type: string + description: MP + hair_type: + type: string + description: MP + hair_length: + type: string + description: MP + hair_color: + type: string + description: MP + facial_hair: + type: string + description: MP + posture: + type: string + description: MP + skin_markings: + type: object + description: MP + handedness: + type: string + description: MP + glasses: + type: string + description: MP + eye_color: + type: string + description: MP + dist_char_con: + type: string + description: MP + dist_char_acq: + type: string + description: MP + physical_habits: + type: string + description: MP + other: + type: string + description: MP + phys_name_contact: + type: string + description: MP + injuries: + type: string + description: MP + implants: + type: string + description: MP + malforms: + type: string + description: MP + pain: + type: string + description: MP + other_conditions: + type: string + description: MP + accidents: + type: string + description: MP + pres_drugs: + type: string + description: MP + smoker: + type: string + description: MP + dental_record: + type: boolean + description: MP + dentist_info: + type: string + description: MP + teeth_features: + type: string + description: MP + dental_problems: + type: string + description: MP + dental_treatments: + type: string + description: MP + dental_habits: + type: string + description: MP + case_status: + type: string + description: MP + reporters: + type: array + items: + type: object + properties: + name: + type: string + email: + type: string + phone: + type: string + address: + type: string + relationship: + type: string + description: MP + identified_by: + type: string + description: MP + family_notified: + type: boolean + description: MP + hypothesis_based: + type: string + description: MP + hypothesis_status: + type: string + description: MP + reburial_location: + type: string + description: MP + ActorProfileItem: + oneOf: + - $ref: '#/components/schemas/ActorProfileBase' + - $ref: '#/components/schemas/ActorProfileMP' + ActorProfileMP: + allOf: + - $ref: '#/components/schemas/ActorProfileBase' + - properties: + mp: + $ref: '#/components/schemas/MissingPerson' + ActorProfileBase: + type: object + properties: + id: + type: integer + mode: + type: integer + enum: + - 1 + - 2 + - 3 + description: | + 1: Profile + 2: Main + 3: Missing Person + originid: + type: string + description: + type: string + source_link: + type: string + publish_date: + type: string + format: date-time + documentation_date: + type: string + format: date-time + actor_id: + type: integer + sources: + type: array + items: + $ref: '#/components/schemas/SourceItem' + labels: + type: array + items: + $ref: '#/components/schemas/LabelItem' + ver_labels: + type: array + items: + $ref: '#/components/schemas/LabelItem' + HistoryItem: + type: object + properties: + id: + type: integer + data: + type: object + created_at: + type: string + format: date-time + user: + $ref: '#/components/schemas/UserCompactItem' + IncidentMode2Item: + type: object + properties: + class: + type: string + example: "Incident" + id: + type: integer + title: + type: string + description: + type: string + comments: + type: string + status: + type: string + labels: + type: array + items: + $ref: '#/components/schemas/GenericJson' + locations: + type: array + items: + $ref: '#/components/schemas/BaseMinItem' + IncidentMode3Item: + type: object + properties: + class: + type: string + example: "Incident" + id: + type: integer + title: + type: string + title_ar: + type: string + assigned_to: + $ref: '#/components/schemas/UserCompactItem' + first_peer_reviewer: + $ref: '#/components/schemas/UserCompactItem' + labels: + type: array + items: + $ref: '#/components/schemas/GenericJson' + locations: + type: array + items: + $ref: '#/components/schemas/LocationCompactItem' + potential_violations: + type: array + items: + $ref: '#/components/schemas/GenericJson' + claimed_violations: + type: array + items: + $ref: '#/components/schemas/GenericJson' + events: + type: array + items: + $ref: '#/components/schemas/EventItem' + actor_relations: + type: array + items: {} + bulletin_relations: + type: array + items: {} + incident_relations: + type: array + items: {} + description: + type: string + comments: + type: string + status: + type: string + review: + type: string + review_action: + type: string + updated_at: + type: string + format: date-time + roles: + type: array + items: + $ref: '#/components/schemas/RoleItem' + IncidentMode4Item: + allOf: + - $ref: '#/components/schemas/IncidentMode3Item' + - properties: + actor_relations: + type: array + items: + $ref: '#/components/schemas/ItoaItem' + bulletin_relations: + type: array + items: + $ref: '#/components/schemas/ItobItem' + incident_relations: + type: array + items: + $ref: '#/components/schemas/ItoiEx' + NewIncident: + type: object + properties: + title: + type: string + title_ar: + type: string + description: + type: string + comments: + type: string + locations: + type: array + items: + type: object + properties: + id: + type: integer + labels: + type: array + items: + type: object + properties: + id: + type: integer + potential_violations: + type: array + items: + type: object + properties: + id: + type: integer + claimed_violations: + type: array + items: + type: object + properties: + id: + type: integer + events: + type: array + items: + anyOf: + - type: object + properties: + id: + type: integer + - $ref: '#/components/schemas/NewEvent' + actor_relations: + type: array + items: + $ref: '#/components/schemas/ItoaItem' + check_ar: + type: boolean + bulletin_relations: + type: array + items: + $ref: '#/components/schemas/ItobItem' + check_br: + type: boolean + incident_relations: + type: array + items: + $ref: '#/components/schemas/ItoiEx' + check_ir: + type: boolean + publish_date: + type: string + format: date-time + documentation_date: + type: string + format: date-time + status: + type: string + CreateIncidentRequest: + allOf: + - $ref: '#/components/schemas/ItemWrapper' + - properties: + item: + $ref: '#/components/schemas/NewIncident' + IncidentsResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/IncidentItem' + IncidentItem: + oneOf: + - $ref: '#/components/schemas/BaseMinItem' + - $ref: '#/components/schemas/IncidentMode2Item' + - $ref: '#/components/schemas/IncidentMode3Item' + - $ref: '#/components/schemas/IncidentMode4Item' + ActivityItem: + type: object + properties: + id: + type: integer + user_id: + type: integer + action: + type: string + enum: + - UPDATE + - DELETE + - CREATE-REVISION + - BULK-UPDATE + - APPROVE-EXPORT + - REJECT-EXPORT + - DOWNLOAD + - LOGIN + - LOGOUT + subject: + type: object + tag: + type: string + created_at: + type: string + format: date-time + + ActivitiesResponse: + allOf: + - $ref: '#/components/schemas/GenericListResponse' + - properties: + items: + type: array + items: + $ref: '#/components/schemas/ActivityItem' + QueryItem: + type: object + properties: + id: + type: integer + name: + type: string + data: + type: object + query_type: + type: string + HTTPErrorResponse: + type: object + properties: + meta: + type: object + properties: + code: + type: integer + format: int32 + example: 403 + response: + type: object + properties: + errors: + type: array + items: + type: string + example: ['You do not have permission to view this resource.'] \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/enferno/admin/constants.py b/enferno/admin/constants.py new file mode 100644 index 0000000..383c2b9 --- /dev/null +++ b/enferno/admin/constants.py @@ -0,0 +1,19 @@ +class Constants: + CLASSIC_OPTS = ["Yes", "No", "Unknown"] + PHYSIQUE_OPTS = ["Very Thin", "Thin", "Average", "Muscular", "Overweight", "Obese"] + HAIR_LOSS_OPTS = ["Full", "Bald", "Partial hair loss"] + HAIR_TYPE_OPTS = ["Straight", "Wavy", "Curly", "Very curly"] + HAIR_LENGTH_OPTS = ["Very short", "Short", "Medium", "Long", "Very long"] + HAIR_COLOR_OPTS = ["Black", "Brown", "Blonde", "Red", "Grey", "Turning grey", "Red", "Other"] + FACIAL_HAIR_OPTS = ["None", "Beard", "Moustache", "Beard and moustache", "Goatee", "Whiskers"] + HANDEDNESS_OPTS = ["Right", "Left", "Both Hands", "Unknown"] + CASE_STATUS_OPTS = ["Missing", "Identified"] + SMOKER_OPTS = ["Yes", "No", "Unknown", "Question Not Asked"] + SKIN_MARKINGS_OPTS = ["Scar", "Tattoo", "piercing", "Mole", "Birthmarks", "Cuts"] + PREGNANT_AT_DISAPPEARANCE_OPTS = [ + "Pregnant", + "Not Pregnant", + "Unknown", + "Not Applicable", + "The Question Was Not Asked", + ] diff --git a/enferno/admin/models.py b/enferno/admin/models.py index 86238a5..e1aa8ef 100644 --- a/enferno/admin/models.py +++ b/enferno/admin/models.py @@ -4,6 +4,7 @@ from functools import wraps from pathlib import Path from tempfile import NamedTemporaryFile +from typing import Any, Optional, Union import pandas as pd from dateutil.parser import parse @@ -12,8 +13,10 @@ from geoalchemy2 import Geometry, Geography from geoalchemy2.shape import to_shape from sqlalchemy import JSON, ARRAY, text, and_, or_, func +import sqlalchemy from sqlalchemy.dialects.postgresql import TSVECTOR, JSONB from sqlalchemy.orm.attributes import flag_modified +import werkzeug from werkzeug.utils import secure_filename from enferno.extensions import db @@ -23,9 +26,17 @@ from enferno.utils.date_helper import DateHelper from enferno.user.models import User +import enferno.utils.typing as t + ###### Role based Access Control Decorator for Bulletins / Actors / Incidents ###### def check_roles(method): + """ + Decorator to check if the current user has access to the resource. If the + user does not have access, the restricted_json method is called to return + a restricted response. + """ + @wraps(method) def _impl(self, *method_args, **method_kwargs): method_output = method(self, *method_args, **method_kwargs) @@ -38,6 +49,12 @@ def _impl(self, *method_args, **method_kwargs): def check_relation_roles(method): + """ + Decorator to check if the current user has access to the related resource. + If the user does not have access, the restricted_json method is called to + return a restricted related item in response. + """ + @wraps(method) def _impl(self, *method_args, **method_kwargs): method_output = method(self, *method_args, **method_kwargs) @@ -77,8 +94,7 @@ class Source(db.Model, BaseMixin): parent_id = db.Column(db.Integer, db.ForeignKey("source.id"), index=True) parent = db.relationship("Source", remote_side=id, backref="sub_source") - # populate object from json dict - def from_json(self, json): + def from_json(self, json: dict[str, Any]) -> "Source": self.title = json["title"] if "title_ar" in json: self.title_ar = json["title_ar"] @@ -93,8 +109,8 @@ def from_json(self, json): self.parent_id = None return self - # custom serialization method - def to_dict(self): + def to_dict(self) -> dict[str, Any]: + """Return a dictionary representation of the source.""" return { "id": self.id, "title": self.title, @@ -106,17 +122,23 @@ def to_dict(self): else None, } - def __repr__(self): + def __repr__(self) -> str: return "".format(self.id, self.title) - def to_json(self): + def to_json(self) -> str: + """Return a JSON representation of the source.""" return json.dumps(self.to_dict()) @staticmethod - def find_by_ids(ids: list): + def find_by_ids(ids: list[t.id]) -> list[dict[str, Any]]: """ finds all items and subitems of a given list of ids, using raw sql query instead of the orm. - :return: matching records + + Args: + - ids: list of ids to search for. + + Returns: + - matching records """ if not ids: return [] @@ -132,7 +154,17 @@ def find_by_ids(ids: list): return [{"id": x[0], "title": x[2]} for x in result] @staticmethod - def get_children(sources, depth=3): + def get_children(sources: list, depth: int = 3) -> list: + """ + Retrieves the children of the given sources up to a specified depth. + + Args: + - sources: list of sources to retrieve children for. + - depth: the depth of the search. + + Returns: + - list of children sources. + """ all = [] targets = sources while depth != 0: @@ -143,23 +175,49 @@ def get_children(sources, depth=3): return all @staticmethod - def get_direct_children(sources): + def get_direct_children(sources: list) -> list: + """ + Retrieves the direct children of the given sources. + + Args: + - sources: list of sources to retrieve children for. + + Returns: + - list of children sources. + """ children = [] for source in sources: children += source.sub_source return children @staticmethod - def find_by_title(title): + def find_by_title(title: str) -> Optional["Source"]: + """ + Finds a source by its title. + + Args: + - title: the title of the source. + + Returns: + - the source object. + """ ar = Source.query.filter(Source.title_ar.ilike(title)).first() if ar: return ar else: return Source.query.filter(Source.title.ilike(title)).first() - # import csv data into db @staticmethod - def import_csv(file_storage): + def import_csv(file_storage: werkzeug.datastructures.FileStorage) -> str: + """ + Imports Source data from a CSV file. + + Args: + - file_storage: the file storage object containing the CSV data. + + Returns: + - empty string on success. + """ tmp = NamedTemporaryFile().name file_storage.save(tmp) df = pd.read_csv(tmp) @@ -199,7 +257,17 @@ class Label(db.Model, BaseMixin): parent = db.relationship("Label", remote_side=id, backref="sub_label") # custom serialization method - def to_dict(self, mode="1"): + def to_dict(self, mode: str = "1") -> dict[str, Any]: + """ + Return a dictionary representation of the label. + + Args: + - mode: the serialization mode. Default is "1". If "2" is passed, a compact + representation of the label is returned. + + Returns: + - dictionary representation of the label. + """ if mode == "2": return self.to_mode2() return { @@ -221,23 +289,35 @@ def to_dict(self, mode="1"): } # custom compact serialization - def to_mode2(self): + def to_mode2(self) -> dict[str, Any]: + """ + Compact serialization for labels + + Returns: + - dictionary with id and title keys. + """ return { "id": self.id, "title": self.title, } - def to_json(self): + def to_json(self) -> str: + """Return a JSON representation of the label.""" return json.dumps(self.to_dict()) - def __repr__(self): + def __repr__(self) -> str: return "