-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Features/341 use calendar specified not primary calendar (#344)
* Add UUID fields to the appointments table. * Remove /schedule/serve/ics. It wasn't actually being used. * Use uuid as the ical's UID, and google's iCalUID. As well as name the remote calendar id as the organizer. * Import the event instead of inserting it. This prevents the event from being duplicated on your primary google calendar.
- Loading branch information
1 parent
bd64f83
commit 3402495
Showing
9 changed files
with
101 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ntment/migrations/versions/2024_03_26_1721-e4c5a32de9fb_add_uuid_to_appointments_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""add uuid to appointments table | ||
Revision ID: e4c5a32de9fb | ||
Revises: bbdfad87a7fb | ||
Create Date: 2024-03-26 17:21:55.528828 | ||
""" | ||
import uuid | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy import func | ||
from sqlalchemy_utils import UUIDType | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'e4c5a32de9fb' | ||
down_revision = 'bbdfad87a7fb' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column('appointments', sa.Column('uuid', UUIDType(native=False), default=uuid.uuid4(), index=True)) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column('appointments', 'uuid') |
32 changes: 32 additions & 0 deletions
32
...tment/migrations/versions/2024_03_26_1722-c5b9fc31b555_fill_uuid_in_appointments_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""[data migration] fill uuid in appointments table | ||
Revision ID: c5b9fc31b555 | ||
Revises: e4c5a32de9fb | ||
Create Date: 2024-03-26 17:22:03.157695 | ||
""" | ||
import uuid | ||
|
||
from alembic import op | ||
from sqlalchemy.orm import Session | ||
|
||
from appointment.database import models | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'c5b9fc31b555' | ||
down_revision = 'e4c5a32de9fb' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
session = Session(op.get_bind()) | ||
appointments: list[models.Appointment] = session.query(models.Appointment).where(models.Appointment.uuid.is_(None)).all() | ||
for appointment in appointments: | ||
appointment.uuid = uuid.uuid4() | ||
session.add(appointment) | ||
session.commit() | ||
|
||
|
||
def downgrade() -> None: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.