forked from sr2/cloud-api
minor: ruff formatter
All changes are either: - Correcting tabs - Adding/removing line breaks - Adding trailing commas
This commit is contained in:
parent
b2e5dd2ebb
commit
c689ac1e10
91 changed files with 1710 additions and 689 deletions
|
|
@ -1,3 +1,3 @@
|
|||
"""
|
||||
Configurations for the contact module
|
||||
"""
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
"""
|
||||
Constants for the contact module
|
||||
"""
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
"""
|
||||
Dependencies for the contact module
|
||||
"""
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ Exceptions related to the contact module
|
|||
Exports:
|
||||
- ContactNotFoundException: Takes an optional contact ID int
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
|
|
@ -11,7 +12,11 @@ from fastapi import HTTPException, status
|
|||
|
||||
class ContactNotFoundException(HTTPException):
|
||||
def __init__(self, contact_id: Optional[int] = None) -> None:
|
||||
detail = "Contact not found" if contact_id is None else f"Contact with ID '{contact_id}' was not found."
|
||||
detail = (
|
||||
"Contact not found"
|
||||
if contact_id is None
|
||||
else f"Contact with ID '{contact_id}' was not found."
|
||||
)
|
||||
super().__init__(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail=detail,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ Models:
|
|||
- Contact: id[pk], email, first_name, last_name, phonenumber, vat_number
|
||||
street_address, street_address_line_2, post_office_box_number, address_locality, country_code, address_region, postal_code
|
||||
"""
|
||||
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey
|
||||
|
||||
from src.database import Base
|
||||
|
|
@ -23,9 +24,11 @@ class Contact(Base):
|
|||
street_address = Column(String)
|
||||
street_address_line_2 = Column(String)
|
||||
post_office_box_number = Column(String, default=None, nullable=True)
|
||||
locality = Column(String) # Ie City
|
||||
country_code = Column(String) # Eg GB
|
||||
locality = Column(String) # Ie City
|
||||
country_code = Column(String) # Eg GB
|
||||
address_region = Column(String, default=None, nullable=True)
|
||||
postal_code = Column(String)
|
||||
|
||||
org_id = Column(Integer, ForeignKey("organisation.id", ondelete="CASCADE"), nullable=False)
|
||||
org_id = Column(
|
||||
Integer, ForeignKey("organisation.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
"""
|
||||
Router endpoints for the contact module
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/contact",
|
||||
tags=["contact"],
|
||||
)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ Models:
|
|||
- ContactAddress
|
||||
- ContactModel: Contains ContactAddress as a property
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import EmailStr, ConfigDict
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
"""
|
||||
Module specific business logic for the contact module
|
||||
"""
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
"""
|
||||
Non-business logic reusable functions and classes for the contact module
|
||||
"""
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue