Skip to content

Commit

Permalink
feat: add room bookings list endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtemSBulgakov committed Sep 21, 2024
1 parent 4c55d41 commit fc3cecb
Show file tree
Hide file tree
Showing 51 changed files with 676 additions and 2,630 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# Except code
!/src/
!/deploy/
!/alembic/
!/alembic.ini
!/pyproject.toml
!/poetry.lock
!logging.yaml
Expand Down
3 changes: 2 additions & 1 deletion .example.env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
POSTGRES_PASSWORD=postgres
MONGO_INITDB_ROOT_USERNAME=mongoadmin
MONGO_INITDB_ROOT_PASSWORD=secret
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ __pycache__
### Environment ###
.env
settings.yaml
static

### Sensible ###
/private.pem
/public.pem
*.pem
14 changes: 2 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ default_stages:
repos:
# Fix some errors with Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.6.7
hooks:
- id: ruff
args: [ --fix, --exit-zero ]
Expand All @@ -23,7 +23,7 @@ repos:

# Lint Python files with Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.1
rev: v0.6.7
hooks:
- id: ruff
name: "ruff: linting"
Expand All @@ -33,9 +33,7 @@ repos:
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: alembic/
- id: end-of-file-fixer
exclude: alembic/
- id: check-added-large-files

# Generate settings.schema.yaml
Expand All @@ -47,11 +45,3 @@ repos:
entry: poetry run python ./scripts/generate_settings_schema.py
pass_filenames: false
files: ^src/config_schema.py$
- id: alembic-auto-migrations
name: generate alembic auto migrations files
language: system
entry: poetry run python ./scripts/alembic_auto_migrations.py
pass_filenames: false
files: storages/
stages:
- commit-msg
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 one-zero-eight
Copyright (c) 2024 one-zero-eight

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
49 changes: 6 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FastAPI Template
# Room booking

## Table of contents

Expand All @@ -7,14 +7,12 @@ contents [by default](https://github.blog/changelog/2021-04-13-table-of-contents

## About

This is the FastAPI ASGI application.
This is the API for viewing the booking status of rooms.

### Technologies

- [Python 3.11](https://www.python.org/downloads/release/python-3117/) & [Poetry](https://python-poetry.org/docs/)
- [Python 3.12](https://www.python.org/downloads/) & [Poetry](https://python-poetry.org/docs/)
- [FastAPI](https://fastapi.tiangolo.com/) & [Pydantic](https://docs.pydantic.dev/latest/)
- Database and ORM: [PostgreSQL](https://www.postgresql.org/), [SQLAlchemy](https://www.sqlalchemy.org/),
[Alembic](https://alembic.sqlalchemy.org/en/latest/)
- Formatting and linting: [Ruff](https://docs.astral.sh/ruff/), [pre-commit](https://pre-commit.com/)
- Deployment: [Docker](https://www.docker.com/), [Docker Compose](https://docs.docker.com/compose/),
[GitHub Actions](https://github.com/features/actions)
Expand All @@ -23,11 +21,11 @@ This is the FastAPI ASGI application.

### Getting started

1. Install [Python 3.11+](https://www.python.org/downloads/release/python-3117/)
1. Install [Python 3.12+](https://www.python.org/downloads/)
2. Install [Poetry](https://python-poetry.org/docs/)
3. Install project dependencies with [Poetry](https://python-poetry.org/docs/cli/#options-2).
```bash
poetry install --no-root --with dev
poetry install --with dev
```
4. Set up [pre-commit](https://pre-commit.com/) hooks:

Expand All @@ -39,37 +37,6 @@ This is the FastAPI ASGI application.
cp settings.example.yaml settings.yaml
```
Edit `settings.yaml` according to your needs.
6. Set up a [PostgreSQL](https://www.postgresql.org/) database instance.
<details>
<summary>Using docker container</summary>

- Set up database settings for [docker-compose](https://docs.docker.com/compose/) container
in `.env` file:х
```bash
cp .example.env .env
```
- Run the database instance:
```bash
docker compose up -d db
```
- Make sure to set up the actual database connection in `settings.yaml`, for example:
```yaml
database:
uri: postgresql+asyncpg://postgres:postgres@localhost:5432/postgres
```

</details>
<details>
<summary>Using pgAdmin</summary>

- Connect to the PostgreSQL server using pgAdmin
- Set up a new database in the server: `Edit > New Object > New database`
- Use the database name in `settings.yaml` file, for example `db_name`:
```yaml
database:
uri: postgresql+asyncpg://postgres:your_password@localhost:5432/db_name
```
</details>

**Set up PyCharm integrations**

Expand All @@ -83,11 +50,7 @@ This is the FastAPI ASGI application.
### Run for development

1. Run the database if you have not done it yet
2. Upgrade the database schema using [alembic](https://alembic.sqlalchemy.org/en/latest/):
```bash
poetry run alembic upgrade head
```
3. Run the ASGI server
2. Run the ASGI server
```bash
poetry run python -m src.api
```
Expand Down
113 changes: 0 additions & 113 deletions alembic.ini

This file was deleted.

24 changes: 0 additions & 24 deletions alembic/README.md

This file was deleted.

Loading

0 comments on commit fc3cecb

Please sign in to comment.