Skip to content

Commit cdd5ac1

Browse files
authored
Merge pull request #312 from dinesh-aot/COMP-471
Modified the attedance option in the backend
2 parents ee5ac1e + 43a0aa0 commit cdd5ac1

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""inspection_attendance_option_changes
2+
3+
Revision ID: ef5bf004ac09
4+
Revises: 764aa8ef55f8
5+
Create Date: 2025-04-29 10:25:23.470088
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
from compliance_api.models.inspection.inspection_enum import InspectionAttendanceOptionEnum
11+
12+
13+
# revision identifiers, used by Alembic.
14+
revision = 'ef5bf004ac09'
15+
down_revision = '764aa8ef55f8'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
# Update the attendance id 5 with Certificate Holder / Regulated Party Representative
23+
op.execute("UPDATE inspection_attendance_options SET name = 'Certificate Holder / Regulated Party Representative' WHERE id = 5")
24+
# Update the inspection_attendance_attendance_mapping with all the attendance option id 6 to 5
25+
op.execute("UPDATE inspection_attendance_mappings SET attendance_option_id = 5 WHERE attendance_option_id = 6")
26+
# Delete the attendance option with id 6 which is Regulated Party Representative
27+
op.execute("DELETE FROM inspection_attendance_options WHERE id = 6")
28+
# ### end Alembic commands ###
29+
30+
31+
def downgrade():
32+
# ### commands auto generated by Alembic - please adjust! ###
33+
# Insert the options with their specific IDs
34+
op.execute(
35+
"INSERT INTO inspection_attendance_options (id, name) VALUES (5, 'Certificate Holder Representative')"
36+
)
37+
op.execute(
38+
"INSERT INTO inspection_attendance_options (id, name) VALUES (6, 'Regulated Party Representative')"
39+
)
40+
# ### end Alembic commands ###

compliance-api/src/compliance_api/models/inspection/inspection_enum.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ class InspectionAttendanceOptionEnum(enum.Enum):
1010
FIRSTNATIONS = 2
1111
MUNICIPAL = 3
1212
INDEPENDENT_ENVIRONMENTAL_MOINITOR = 4
13-
CERTIFICATE_HOLDER_REPRESENTATIVE = 5
14-
REGULATED_PARTY_REPRESENTATIVE = 6
13+
CERTIFICATE_HOLDER_OR_REGULATED_PARTY_REPRESENTATIVE = 5
1514
ATTENDING_OFFICERS = 8
1615
OTHER = 7
1716

0 commit comments

Comments
 (0)