Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SBCQ-307: Add new fields to offices table #1044

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions api/app/admin/office.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ def get_query(self):
'appointments_days_limit', 'appointment_duration', 'soonest_appointment', 'max_person_appointment_per_day',\
'civic_address', 'telephone', 'online_status', 'check_in_notification', 'check_in_reminder_msg',\
'automatic_reminder_at', 'currently_waiting', 'digital_signage_message', 'digital_signage_message_1',\
'digital_signage_message_2', 'digital_signage_message_3', 'show_currently_waiting_bottom', 'optout_status' )
'digital_signage_message_2', 'digital_signage_message_3', 'show_currently_waiting_bottom', 'optout_status',\
'core_service_partners', 'service_model')
form_edit_rules = ('office_name', 'office_number', 'sb', 'services', 'deleted', 'exams_enabled_ind',
'appointments_enabled_ind', 'timezone', 'latitude', 'longitude', 'office_appointment_message',
'appointments_days_limit', 'appointment_duration', 'soonest_appointment', 'max_person_appointment_per_day',\
'civic_address', 'telephone', 'online_status', 'check_in_notification', 'check_in_reminder_msg', \
'automatic_reminder_at', 'currently_waiting', 'digital_signage_message', 'digital_signage_message_1',\
'digital_signage_message_2', 'digital_signage_message_3', 'show_currently_waiting_bottom', 'optout_status' )
'digital_signage_message_2', 'digital_signage_message_3', 'show_currently_waiting_bottom', 'optout_status',\
'core_service_partners', 'service_model' )
form_choices = {
'exams_enabled_ind': [
("0", 'No - Exams are not enabled for this office'), \
Expand Down Expand Up @@ -110,6 +112,10 @@ def get_query(self):
("0", 'Off - Open tickets automatically closed at end of day'), \
("1", 'On - Tickets must be closed manually')
],
'service_model':[
("Reception",'Reception'),\
("Non-Reception","Non-Reception")
]
}
# Defining String constants to appease SonarQube
timezone_name_const = 'timezone.timezone_name'
Expand Down Expand Up @@ -145,6 +151,8 @@ def get_query(self):
'digital_signage_message_3',
'show_currently_waiting_bottom',
'optout_status',
'core_service_partners',
'service_model',
]

column_list_support = ['office_name',
Expand Down Expand Up @@ -176,6 +184,8 @@ def get_query(self):
'digital_signage_message_3',
'show_currently_waiting_bottom',
'optout_status',
'core_service_partners',
'service_model',
]

form_excluded_columns = ('citizens',
Expand Down Expand Up @@ -220,6 +230,8 @@ def get_query(self):
'timeslots',
'deleted',
'optout_status',
'core_service_partners',
'service_model',
)

form_edit_rules = ('office_name',
Expand Down Expand Up @@ -257,6 +269,8 @@ def get_query(self):
'timeslots',
'deleted',
'optout_status',
'core_service_partners',
'service_model',
)

form_args = {
Expand Down Expand Up @@ -397,7 +411,9 @@ class OfficeConfigGA(OfficeConfig):
'soonest_appointment',
'max_person_appointment_per_day',
'number_of_dlkt',
'optout_status' ,
'optout_status' ,
'core_service_partners',
'service_model',
)

form_excluded_columns = (
Expand Down
2 changes: 2 additions & 0 deletions api/app/models/theq/office.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class Office(Base):
office_email_paragraph = db.Column(db.String(2000), nullable=True)
external_map_link = db.Column(db.String(500), nullable=True)
soonest_appointment = db.Column(db.Integer, default=0)
core_service_partners = db.Column(db.String(), nullable=True)
service_model = db.Column(db.String(), default="Reception", server_default='Reception', nullable=False)

counters = db.relationship("Counter", secondary='office_counter')
services = db.relationship("Service", secondary='office_service')
Expand Down
2 changes: 2 additions & 0 deletions api/app/schemas/theq/office_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Meta(BaseSchema.Meta):
online_status = fields.Str()
optout_status = fields.Int()
external_map_link = fields.Str()
core_service_partners = fields.Str()
service_model = fields.Str()

# for walk-in notifications
check_in_notification = fields.Int()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""SBCQ-307 Add new columns to Office

Revision ID: 297f8e37fee4
Revises: 8b6c67545310
Create Date: 2024-12-16 19:33:04.875950

"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utc


# revision identifiers, used by Alembic.
revision = '297f8e37fee4'
down_revision = '8b6c67545310'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('office', sa.Column('core_service_partners', sa.String(), nullable=True))
op.add_column('office', sa.Column('service_model', sa.String(), server_default='Reception', nullable=False))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('office', 'service_model')
op.drop_column('office', 'core_service_partners')
# ### end Alembic commands ###