diff --git a/backend/src/appointment/database/models.py b/backend/src/appointment/database/models.py index d8812167b..fb7f184e0 100644 --- a/backend/src/appointment/database/models.py +++ b/backend/src/appointment/database/models.py @@ -170,6 +170,7 @@ class Attendee(Base): id = Column(Integer, primary_key=True, index=True) email = Column(StringEncryptedType(String, secret, AesEngine, "pkcs5", length=255), index=True) name = Column(StringEncryptedType(String, secret, AesEngine, "pkcs5", length=255), index=True) + timezone = Column(String(255), index=True) slots = relationship("Slot", cascade="all,delete", back_populates="attendee") diff --git a/backend/src/appointment/database/schemas.py b/backend/src/appointment/database/schemas.py index a30bc4371..d1ad20896 100644 --- a/backend/src/appointment/database/schemas.py +++ b/backend/src/appointment/database/schemas.py @@ -30,6 +30,7 @@ class AttendeeBase(BaseModel): email: str name: str | None = None + timezone: str | None = None class Attendee(AttendeeBase): diff --git a/backend/src/appointment/migrations/versions/2024_04_18_0823-89e1197d980d_add_attendee_timezone.py b/backend/src/appointment/migrations/versions/2024_04_18_0823-89e1197d980d_add_attendee_timezone.py new file mode 100644 index 000000000..5d70c2a18 --- /dev/null +++ b/backend/src/appointment/migrations/versions/2024_04_18_0823-89e1197d980d_add_attendee_timezone.py @@ -0,0 +1,24 @@ +"""add attendee timezone + +Revision ID: 89e1197d980d +Revises: fadd0d1ef438 +Create Date: 2024-04-18 08:23:55.660065 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '89e1197d980d' +down_revision = 'fadd0d1ef438' +branch_labels = None +depends_on = None + + +def upgrade() -> None: + op.add_column('attendees', sa.Column('timezone', sa.String(255), index=True)) + + +def downgrade() -> None: + op.drop_column('attendees', 'timezone') diff --git a/backend/src/appointment/routes/schedule.py b/backend/src/appointment/routes/schedule.py index f5e545ef4..ef38c2a43 100644 --- a/backend/src/appointment/routes/schedule.py +++ b/backend/src/appointment/routes/schedule.py @@ -220,7 +220,12 @@ def request_schedule_availability_slot( # human readable date in subscribers timezone # TODO: handle locale date representation date = slot.start.replace(tzinfo=timezone.utc).astimezone(ZoneInfo(subscriber.timezone)).strftime("%c") - date = f"{date}, {slot.duration} minutes" + date = f"{date}, {slot.duration} minutes ({subscriber.timezone})" + + # human readable date in attendee timezone + # TODO: handle locale date representation + attendee_date = slot.start.replace(tzinfo=timezone.utc).astimezone(ZoneInfo(slot.attendee.timezone)).strftime("%c") + attendee_date = f"{attendee_date}, {slot.duration} minutes ({slot.attendee.timezone})" # Create a pending appointment attendee_name = slot.attendee.name if slot.attendee.name is not None else slot.attendee.email @@ -246,7 +251,7 @@ def request_schedule_availability_slot( background_tasks.add_task(send_confirmation_email, url=url, attendee=attendee, date=date, to=subscriber.email) # Sending pending email to attendee - background_tasks.add_task(send_pending_email, owner=subscriber, date=date, to=slot.attendee.email) + background_tasks.add_task(send_pending_email, owner=subscriber, date=attendee_date, to=slot.attendee.email) # Mini version of slot, so we can grab the newly created slot id for tests return schemas.SlotOut( diff --git a/frontend/src/components/BookingModal.vue b/frontend/src/components/BookingModal.vue index 946ce240e..a3121ffca 100644 --- a/frontend/src/components/BookingModal.vue +++ b/frontend/src/components/BookingModal.vue @@ -79,9 +79,7 @@