diff --git a/src/organisation/config.py b/src/organisation/config.py index 51f5dd9..e24ca5b 100644 --- a/src/organisation/config.py +++ b/src/organisation/config.py @@ -1,7 +1,3 @@ """ -Configurations for organisation module - -Configurations: - - List: Description - - Configs: Description +Configurations for the organisation module """ \ No newline at end of file diff --git a/src/organisation/constants.py b/src/organisation/constants.py index 6cae1fd..ced0682 100644 --- a/src/organisation/constants.py +++ b/src/organisation/constants.py @@ -1,5 +1,5 @@ """ -Constants and error codes for organisation module +Constants for the organisation module Classes: - Status(StrEnum): PARTIAL, SUBMITTED, REMEDIATION, APPROVED, REJECTED, REMOVED diff --git a/src/organisation/dependencies.py b/src/organisation/dependencies.py index b73629b..51ee569 100644 --- a/src/organisation/dependencies.py +++ b/src/organisation/dependencies.py @@ -1,13 +1,9 @@ """ -Router dependencies for organisation module +Dependencies related to the organisation module -Classes: - - List: Description - - Classes: Description - -Functions: - - List: Description - - Functions: Description +Exports: + - org_model_query_dependency: org_model: Gets org model from db, if it exists. Uses org_id from query param. Also verifies if the org has been approved. + - org_model_body_dependency: org_model: Gets org model from db, if it exists. Uses org_id from request body. Also verifies if the org has been approved. """ from typing import Annotated, Optional diff --git a/src/organisation/exceptions.py b/src/organisation/exceptions.py index c7d6a0c..8fe61cc 100644 --- a/src/organisation/exceptions.py +++ b/src/organisation/exceptions.py @@ -1,9 +1,9 @@ """ -Module specific exceptions for organisation module +Exceptions related to the organisation module Exceptions: - - List: Description - - Exceptions: Description + - OrgNotFoundException: Takes an optional org_id int + - AwaitingApprovalException: Takes an optional org_id int """ from typing import Optional diff --git a/src/organisation/models.py b/src/organisation/models.py index f696824..3663f2c 100644 --- a/src/organisation/models.py +++ b/src/organisation/models.py @@ -2,9 +2,16 @@ Database models for organisation module Models: - - Organisation: id[pk], name, status, intake_questionnaire, - billing_contact_id[fk], security_contact_id[fk], owner_contact_id[fk] - - OrgUsers: org_id[fk][cpk], user_id[fk][cpk], is_admin + - Organisation: + - id[PK], name, status, intake_questionnaire, root_user_id[FK], billing_contact_id[FK], security_contact_id[FK], owner_contact_id[FK] + - user_rel: ORM relationship to User via OrgUsers relationship table + - group_rel: ORM relationship to Group, backprops Group.org_rel + - root_user_rel: ORM relationship to User with root_user_id FK + - root_user_email: Calc property root_user_rel.email + - billing_contact_rel: ORM relationship to Contact with billing_contact FK + - security_contact_rel: ORM relationship to Contact with security_contact FK + - owner_contact_rel: ORM relationship to Contact with owner_contact FK + - OrgUsers: org_id[FK][PK], user_id[FK][PK] """ from sqlalchemy import Column, Integer, String, ForeignKey, JSON from sqlalchemy.orm import relationship diff --git a/src/organisation/router.py b/src/organisation/router.py index c26bc2f..2e71fba 100644 --- a/src/organisation/router.py +++ b/src/organisation/router.py @@ -2,15 +2,18 @@ Router endpoints for organisation module Endpoints: - - [get]/id/{org_id} - Retrieves an organisation by its ID - - [post]/ - Creates a new organisation - - [patch]/{org_id}/questionnaire - Updates the questionnaire data for an organisation (can be partial or final submission) - - [patch]/{org_id}/status - Updates the status of an organisation - - [patch]/{org_id}/contact - Assigns a contact to an organisation (as billing, security, or owner) - - [get]/{org_id}/users - Retrieves all users associated with an organisation - - [post]/{org_id}/users - Adds a new user to an organisation - - [delete]/{org_id} - Deletes an organisation by ID - - [get]/{org_id}/contact/{contact_type} - Retrieves the contact of a specific type (owner, billing, security) for an organisation + - [GET](/org/id): [root user]: Get details about an organisation(id) + - [POST](/org/): [oidc claim]: Creates an organisation, adds the current user as a user and sets them to be the root user + - [PATCH](/org/questionnaire): [root user]: Updates the org's intake questionnaire and optionally be submitted for review + - [PATCH](/org/status): [super admin]: Allows a super admin to update an org(id) status(Status enum) + - [GET](/org/users): [root user]: Gets a list of the org(id) users(email) + - [POST](/org/users): [root user]: Adds a new user(id) to the org(id) + - [DELETE](/org/): [super admin]: Deletes an organisation(id) + - [PATCH](/org/root_user): [super admin]: Updates an org(id) root user(id) + - [GET](/org/groups): [root user]: Gets a list of the org(id) groups(name) + - [DELETE](/org/user): [root user]: Removes a user(id) from an org(id) + - [GET](/org/contact): [root user]: Gets the (contact_type) contact for an org(id) + - [PATCH](/org/contact): [root user]: Updates the (contact_type) contact for an org(id). Any number of details can be changed. """ from typing import Annotated, Optional diff --git a/src/organisation/schemas.py b/src/organisation/schemas.py index 299f48f..0fb13c5 100644 --- a/src/organisation/schemas.py +++ b/src/organisation/schemas.py @@ -1,9 +1,10 @@ """ Pydantic models for organisation module -Models: - - List: Description - - Models: Description +Models follow the nomenclature of: +- Sub-models: "Schema" +- Mixins: "Mixin" +- Models: "" ie "OrgPostOrgRequest" """ from typing import Optional diff --git a/src/organisation/service.py b/src/organisation/service.py index b401681..6d73399 100644 --- a/src/organisation/service.py +++ b/src/organisation/service.py @@ -1,11 +1,3 @@ """ -Module specific business logic for organisation module - -Classes: - - List: Description - - Classes: Description - -Functions: - - List: Description - - Functions: Description +Reusable business logic functions for the organisation module """ \ No newline at end of file diff --git a/src/organisation/utils.py b/src/organisation/utils.py index 32b2842..ead22ca 100644 --- a/src/organisation/utils.py +++ b/src/organisation/utils.py @@ -1,11 +1,3 @@ """ -Non-business logic reusable functions and classes for organisation module - -Classes: - - List: Description - - Classes: Description - -Functions: - - List: Description - - Functions: Description +Non-business logic reusable functions and classes for the organisation module """ \ No newline at end of file