diff --git a/src/config.py b/src/config.py index 120354e..b1874d3 100644 --- a/src/config.py +++ b/src/config.py @@ -1,10 +1,8 @@ """ -Global configurations +Global configurations: import settings, app_configs -Exports: +Classes: - CustomBaseSettings - Base class to be used by all modules for loading configs - - settings: Global configurations object - - app_configs: Dict generated from configs, used in app initialisation """ from typing import Any diff --git a/src/schemas.py b/src/schemas.py index 812b574..52b0f94 100644 --- a/src/schemas.py +++ b/src/schemas.py @@ -1,10 +1,3 @@ -""" -Global Pydantic schemas - -Exports: - - CustomBaseModel: Schema used for all other Pydantic models - - ResourceName -""" from pydantic import BaseModel from typing import Optional diff --git a/src/service/config.py b/src/service/config.py index 5d4fd3b..4be170e 100644 --- a/src/service/config.py +++ b/src/service/config.py @@ -1,3 +1,7 @@ """ -Configurations for the services module +Configurations for + +Configurations: + - List: Description + - Configs: Description """ \ No newline at end of file diff --git a/src/service/constants.py b/src/service/constants.py index 52a8701..e1df957 100644 --- a/src/service/constants.py +++ b/src/service/constants.py @@ -1,3 +1,7 @@ """ -Constants for the services module +Constants and error codes for + +Constants: + - List: Description + - Consts: Description """ \ No newline at end of file diff --git a/src/service/dependencies.py b/src/service/dependencies.py index cda625a..d649b06 100644 --- a/src/service/dependencies.py +++ b/src/service/dependencies.py @@ -1,9 +1,13 @@ """ -Dependencies related to the services module +Router dependencies for -Exports: - - service_model_query_dependency: service_model: Gets service model from db, if it exists. Uses service_id from query param. - - service_model_body_dependency: service_model: Gets service model from db, if it exists. Uses service_id from request body. +Classes: + - List: Description + - Classes: Description + +Functions: + - List: Description + - Functions: Description """ from typing import Annotated from fastapi import Depends, Query diff --git a/src/service/exceptions.py b/src/service/exceptions.py index 8a1a2e3..e2b5232 100644 --- a/src/service/exceptions.py +++ b/src/service/exceptions.py @@ -1,8 +1,9 @@ """ -Exceptions related to the services module +Module specific exceptions for Exceptions: - - ServiceNotFoundException: Takes an optional service_id int + - List: Description + - Exceptions: Description """ from typing import Optional diff --git a/src/service/models.py b/src/service/models.py index 68fd020..3f05e1d 100644 --- a/src/service/models.py +++ b/src/service/models.py @@ -2,8 +2,8 @@ Database models for the services module Models: - - Service: - - id[PK], name[U], api_key[U] + - List: Description + - Models: Description """ from sqlalchemy import Column, Integer, String diff --git a/src/service/router.py b/src/service/router.py index bf01a87..f53d666 100644 --- a/src/service/router.py +++ b/src/service/router.py @@ -1,11 +1,9 @@ """ -Router endpoints for the services module +Router endpoints for Endpoints: - - [GET](/): [root user]: Get a list of all services(id, name) - - [POST](/): [super admin]: Register a new service(name) on the hub, returns the API key for the service to access the hub. - - [PATCH](/key): [super_admin]: Refreshes the API key for a service(id), returning a new one. - - [DELETE](/): [super_admin]: Removes a service(id) from the hub. + - List: Description + - Endpoints: Description """ from fastapi import APIRouter, status from psycopg.errors import UniqueViolation diff --git a/src/service/schemas.py b/src/service/schemas.py index 2d89400..d6f2882 100644 --- a/src/service/schemas.py +++ b/src/service/schemas.py @@ -1,10 +1,9 @@ """ -Pydantic models for service module +Pydantic models for the service module -Models follow the nomenclature of: -- Sub-models: "Schema" -- Mixins: "Mixin" -- Models: "" ie "ServiceGetServiceResponse" +Models: + - List: Description + - Models: Description """ from pydantic import ConfigDict diff --git a/src/service/service.py b/src/service/service.py index 2609565..7365fa9 100644 --- a/src/service/service.py +++ b/src/service/service.py @@ -1,3 +1,11 @@ """ -Business logic for the services module +Module specific business logic for + +Classes: + - List: Description + - Classes: Description + +Functions: + - List: Description + - Functions: Description """ \ No newline at end of file diff --git a/src/service/utils.py b/src/service/utils.py index 8920a5f..ecd41b0 100644 --- a/src/service/utils.py +++ b/src/service/utils.py @@ -1,8 +1,13 @@ """ -Non-business logic reusable functions and classes for the services module +Non-business logic reusable functions and classes for -Exports: - - generate_api_key(): returns a new UUID +Classes: + - List: Description + - Classes: Description + +Functions: + - List: Description + - Functions: Description """ import uuid diff --git a/src/user/config.py b/src/user/config.py index 9bbcbc4..1b9a778 100644 --- a/src/user/config.py +++ b/src/user/config.py @@ -1,3 +1,7 @@ """ -Configurations for the user module +Configurations for user module + +Configurations: + - List: Description + - Configs: Description """ \ No newline at end of file diff --git a/src/user/constants.py b/src/user/constants.py index fc6a780..940b259 100644 --- a/src/user/constants.py +++ b/src/user/constants.py @@ -1,3 +1,7 @@ """ -Constants for the user module +Constants and error codes for user module + +Constants: + - List: Description + - Consts: Description """ \ No newline at end of file diff --git a/src/user/dependencies.py b/src/user/dependencies.py index dc22429..c5314d0 100644 --- a/src/user/dependencies.py +++ b/src/user/dependencies.py @@ -1,10 +1,13 @@ """ -Dependencies related to the user module +Router dependencies for user module -Exports: - - user_model_claims_dependency: user_model: Gets user model from db, if it exists. Uses db_id from user claims. - - user_model_query_dependency: user_model: Gets user model from db, if it exists. Uses user_id from query param - - user_model_body_dependency: user_model: Gets user model from db, if it exists. Uses user_id from request body. +Classes: + - List: Description + - Classes: Description + +Functions: + - List: Description + - Functions: Description """ from typing import Annotated from fastapi import Depends, Query diff --git a/src/user/exceptions.py b/src/user/exceptions.py index 2e03b05..6f2a669 100644 --- a/src/user/exceptions.py +++ b/src/user/exceptions.py @@ -1,8 +1,9 @@ """ -Exceptions related to the user module +Module specific exceptions for user module Exceptions: - - UserNotFoundException: Takes an optional user_id int + - List: Description + - Exceptions: Description """ from typing import Optional diff --git a/src/user/models.py b/src/user/models.py index 92350ed..964bed6 100644 --- a/src/user/models.py +++ b/src/user/models.py @@ -2,12 +2,7 @@ Database models for user module Models: - - User: - - id[PK], email, first_name, last_name, oidc_id - - organisation_rel: ORM relationship to Organisation via OrgUsers table - - group_rel: ORM relationship to Group via UserGroups table - - organisations: Calc property list of organisation_rel.name - - groups: Calc property dict of {group_rel.org_rel.name: group_rel.name} + - User - id[pk], email, first_name, last_name, oidc_id """ from collections import defaultdict diff --git a/src/user/router.py b/src/user/router.py index 90c133f..c7dbb12 100644 --- a/src/user/router.py +++ b/src/user/router.py @@ -1,11 +1,15 @@ """ -Router endpoints for the user module +Router endpoints for user module Endpoints: - - [GET](/user/self/claims): [OIDC claims]: Returns all OIDC claims associated with the currently logged-in user. - - [GET](/user/self/db): [OIDC claims]: Returns details about the currently logged-in user from the hub db. - - [GET](/user/): [super admin]: Returns user(id) details. - - [DELETE](/user/): [super admin]: Removes a User(id) from the hub database. + - [get]/self/claims - Retrieves user's OIDC claims + - [get]/self/db - Retrieves the user data from the db that corresponds to the current OIDC user + - [get]/self/orgs - Retrieves all organisations associated with the current user + - [get]/self/orgs/admin - Retrieves only admin organisations for the current user + - [get]/{user_id} - Retrieves a specific user by their ID + - [get]/{user_id}/orgs - Retrieves all organisations associated with a specific user + - [get]/{user_id}/orgs/admin - Retrieves only admin organisations for a specific user + - [delete]/{user_id} - Deletes a user from the db by their db ID """ from fastapi import APIRouter from starlette import status diff --git a/src/user/schemas.py b/src/user/schemas.py index 27d455e..285f510 100644 --- a/src/user/schemas.py +++ b/src/user/schemas.py @@ -1,5 +1,9 @@ """ -Pydantic models for the user module +Pydantic models for user module + +Models: + - List: Description + - Models: Description """ from typing import Optional from src.schemas import CustomBaseModel diff --git a/src/user/service.py b/src/user/service.py index f65e045..378d837 100644 --- a/src/user/service.py +++ b/src/user/service.py @@ -1,8 +1,11 @@ """ Module specific business logic for user module +Functions: + - add_user_to_db + Exports: - - add_user_to_db: Creates a User record from OIDC claims, or updates user details + - add_user_to_db """ from typing import Any diff --git a/src/user/utils.py b/src/user/utils.py index 35fcc1a..658daa1 100644 --- a/src/user/utils.py +++ b/src/user/utils.py @@ -1,3 +1,11 @@ """ -Non-business logic reusable functions and classes for the user module +Non-business logic reusable functions and classes for user module + +Classes: + - List: Description + - Classes: Description + +Functions: + - List: Description + - Functions: Description """ \ No newline at end of file