docs: service docstrings

Issue: #13
This commit is contained in:
Chris Milne 2026-05-28 14:41:11 +01:00
parent 71f26a4c9b
commit d852bda091
9 changed files with 24 additions and 47 deletions

View file

@ -1,7 +1,3 @@
"""
Configurations for <this module>
Configurations:
- List: Description
- Configs: Description
Configurations for the services module
"""

View file

@ -1,7 +1,3 @@
"""
Constants and error codes for <this module>
Constants:
- List: Description
- Consts: Description
Constants for the services module
"""

View file

@ -1,13 +1,9 @@
"""
Router dependencies for <this module>
Dependencies related to the services module
Classes:
- List: Description
- Classes: Description
Functions:
- List: Description
- Functions: Description
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.
"""
from typing import Annotated
from fastapi import Depends, Query

View file

@ -1,9 +1,8 @@
"""
Module specific exceptions for <this module>
Exceptions related to the services module
Exceptions:
- List: Description
- Exceptions: Description
- ServiceNotFoundException: Takes an optional service_id int
"""
from typing import Optional

View file

@ -2,8 +2,8 @@
Database models for the services module
Models:
- List: Description
- Models: Description
- Service:
- id[PK], name[U], api_key[U]
"""
from sqlalchemy import Column, Integer, String

View file

@ -1,9 +1,11 @@
"""
Router endpoints for <this module>
Router endpoints for the services module
Endpoints:
- List: Description
- Endpoints: Description
- [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.
"""
from fastapi import APIRouter, status
from psycopg.errors import UniqueViolation

View file

@ -1,9 +1,10 @@
"""
Pydantic models for the service module
Pydantic models for service module
Models:
- List: Description
- Models: Description
Models follow the nomenclature of:
- Sub-models: "<Resource><Opt:>Schema"
- Mixins: "<Attribute>Mixin"
- Models: "<Module><Method><Resource><Opt:Resource><Direction>" ie "ServiceGetServiceResponse"
"""
from pydantic import ConfigDict

View file

@ -1,11 +1,3 @@
"""
Module specific business logic for <this module>
Classes:
- List: Description
- Classes: Description
Functions:
- List: Description
- Functions: Description
Business logic for the services module
"""

View file

@ -1,13 +1,8 @@
"""
Non-business logic reusable functions and classes for <this module>
Non-business logic reusable functions and classes for the services module
Classes:
- List: Description
- Classes: Description
Functions:
- List: Description
- Functions: Description
Exports:
- generate_api_key(): returns a new UUID
"""
import uuid