diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..a3dff5a5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.py] +charset = utf-8 +indent_style = space +indent_size = 4 + +[*.{vue,html,css,js,json,yml}] +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/README.md b/README.md index dc24c70e..49fb8434 100755 --- a/README.md +++ b/README.md @@ -14,7 +14,13 @@ cd appointment docker-compose up -d --build ``` -A Mysql database will be accessible via `localhost:3306` with username and password set to: `tba` +A MySQL database will be accessible via `localhost:3306` with username and password set to: `tba` + +To init database or run migrations, the backend offers a cimple CLI interface: + +```bash +run-command update-db +``` ### Manual Setup @@ -40,7 +46,7 @@ Run application for development with hot reloading backend and frontend: pip install -r backend/requirements.txt touch backend/src/appointment.db # when using sqlite cp backend/.env.example backend/.env # add your own configuration here - uvicorn backend.src.main:app --reload --port 5000 + uvicorn --factory backend.src.appointment.main:server --host 0.0.0.0 --port 5000 ``` You can now access the backend at [localhost:5000](http://localhost:5000). @@ -58,7 +64,7 @@ Run application for development with hot reloading backend and frontend: 4. (optional) Run database migrations ```bash - cd backend/src + cd backend cp alembic.ini.example alembic.ini # add your own configuration here alembic init migrations # init migrations once alembic current # check database state diff --git a/backend/.env.example b/backend/.env.example index 43e91451..8439fc47 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -3,6 +3,7 @@ # -- GENERAL -- # Logging level: DEBUG|INFO|WARNING|ERROR|CRITICAL LOG_LEVEL=ERROR +LOG_USE_STREAM=1 # -- FRONTEND -- FRONTEND_URL=http://localhost:8080 diff --git a/backend/src/appointment/migrations/versions/2023_06_27_1108-f9660871710e_add_general_availability_tables.py b/backend/src/appointment/migrations/versions/2023_06_27_1108-f9660871710e_add_general_availability_tables.py index cd11f66f..287ea597 100644 --- a/backend/src/appointment/migrations/versions/2023_06_27_1108-f9660871710e_add_general_availability_tables.py +++ b/backend/src/appointment/migrations/versions/2023_06_27_1108-f9660871710e_add_general_availability_tables.py @@ -66,17 +66,8 @@ def upgrade() -> None: sa.Column("time_created", DateTime()), sa.Column("time_updated", DateTime()), ) - # op.add_column( - # "appointments", - # sa.Column( - # "appointment_type", - # sa.Enum(AppointmentType), - # default=AppointmentType.schedule, - # ), - # ) def downgrade() -> None: op.drop_table("schedules") op.drop_table("availabilities") - # op.drop_column("appointments", "appointment_type") diff --git a/backend/src/appointment/migrations/versions/2023_07_27_1102-f9c5471478d0_modify_schedules_table.py b/backend/src/appointment/migrations/versions/2023_07_27_1102-f9c5471478d0_modify_schedules_table.py index 63233ad5..5db3e001 100644 --- a/backend/src/appointment/migrations/versions/2023_07_27_1102-f9c5471478d0_modify_schedules_table.py +++ b/backend/src/appointment/migrations/versions/2023_07_27_1102-f9c5471478d0_modify_schedules_table.py @@ -26,8 +26,6 @@ def secret(): def upgrade() -> None: - # op.drop_column("appointments", "appointment_type") - #op.drop_constraint("schedules_ibfk_1", "schedules", type_="foreignkey") op.drop_column("schedules", "appointment_id") op.add_column("schedules", sa.Column("calendar_id", sa.Integer, sa.ForeignKey("calendars.id"))) op.add_column("schedules", sa.Column("location_type", sa.Enum(LocationType), default=LocationType.online))