Skip to content

Commit 5b06ef7

Browse files
Documentation update
1 parent 868cfdf commit 5b06ef7

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

docs/customization.qmd

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ We also create POST endpoints, which accept form submissions so the user can cre
7171

7272
#### Customizable folders and files
7373

74-
- FastAPI application entry point and GET routes: `main.py`
75-
- FastAPI POST routes: `routers/`
76-
- User authentication endpoints: `authentication.py`
74+
- FastAPI application entry point: `main.py`
75+
- FastAPI routes: `routers/`
76+
- User authentication endpoints: `account.py`
7777
- User profile management endpoints: `user.py`
7878
- Organization management endpoints: `organization.py`
7979
- Role management endpoints: `role.py`
@@ -84,34 +84,31 @@ We also create POST endpoints, which accept form submissions so the user can cre
8484
- Helper functions: `utils/`
8585
- Auth helpers: `auth.py`
8686
- Database helpers: `db.py`
87+
- FastAPI dependencies: `dependencies.py`
88+
- Enums: `enums.py`
8789
- Database models: `models.py`
8890
- Image helpers: `images.py`
91+
- Exceptions: `exceptions/`
92+
- HTTP exceptions: `http_exceptions.py`
93+
- Other custom exceptions: `exceptions.py`
8994
- Environment variables: `.env.example`
9095
- CI/CD configuration: `.github/`
9196
- Project configuration: `pyproject.toml`
9297
- Quarto documentation:
93-
- Source: `index.qmd` + `docs/`
98+
- README source: `index.qmd`
99+
- Website source: `index.qmd` + `docs/`
94100
- Configuration: `_quarto.yml`
95101

102+
96103
Most everything else is auto-generated and should not be manually modified.
97104

98105
## Backend
99106

100107
### Code conventions
101108

102-
GET routes are defined in the main entry point for the application, `main.py`. POST routes are organized into separate modules within the `routers/` directory.
103-
104-
We name our GET routes using the convention `read_<name>`, where `<name>` is the name of the page, to indicate that they are read-only endpoints that do not modify the database.
105-
106-
We divide our GET routes into authenticated and unauthenticated routes, using commented section headers in our code that look like this:
107-
108-
```python
109-
# --- Authenticated Routes ---
110-
```
111-
112-
Some of our routes take request parameters, which we pass as keyword arguments to the route handler. These parameters should be type annotated for validation purposes.
109+
We name our GET routes using the convention `read_<name>`, where `<name>` is the name of the page, to indicate that they are read-only endpoints that do not modify the database. In POST routes that modify the database, you can use the `get_session` dependency as an argument to get a database session.
113110

114-
Some parameters are shared across all authenticated or unauthenticated routes, so we define them in the `common_authenticated_parameters` and `common_unauthenticated_parameters` dependencies defined in `main.py`.
111+
Routes that require authentication generally take the `get_authenticated_account` dependency as an argument. Unauthenticated GET routes generally take the `get_optional_user` dependency as an argument. If a route should *only* be seen by authenticated users (i.e., a login page), you can redirect to the dashboard if `get_optional_user` returns a `User` object.
115112

116113
### Context variables
117114

@@ -244,12 +241,12 @@ SQLModel is an Object-Relational Mapping (ORM) library that allows us to interac
244241

245242
Our database models are defined in `utils/models.py`. Each model is a Python class that inherits from `SQLModel` and represents a database table. The key models are:
246243

244+
- `Account`: Represents a user account with email and password hash
245+
- `User`: Represents a user profile with name, email, and avatar
247246
- `Organization`: Represents a company or team
248-
- `User`: Represents a user account with name, email, and avatar
249247
- `Role`: Represents a set of permissions within an organization
250248
- `Permission`: Represents specific actions a user can perform (defined by ValidPermissions enum)
251249
- `PasswordResetToken`: Manages password reset functionality with expiration
252-
- `UserPassword`: Stores hashed user passwords separately from user data
253250

254251
Two additional models are used by SQLModel to manage many-to-many relationships; you generally will not need to interact with them directly:
255252

0 commit comments

Comments
 (0)