Skip to content

Commit

Permalink
Merge pull request #1654 from jadmsaadaot/TRACK-task#1331-B
Browse files Browse the repository at this point in the history
Add None ministry row
  • Loading branch information
jadmsaadaot authored Jan 12, 2024
2 parents f663ca5 + 3355e0f commit 0aead41
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Add None ministry in ministries table
Revision ID: 09a79ca8e8fd
Revises: 65cb91595d6a
Create Date: 2024-01-11 13:19:49.744798
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '09a79ca8e8fd'
down_revision = '65cb91595d6a'
branch_labels = None
depends_on = None

NoneMinistryName = 'None'
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###

ministries = sa.table(
'ministries',
sa.Column('name', sa.String),
sa.column('abbreviation', sa.String),
sa.Column('is_active', sa.Boolean),
sa.Column('is_deleted', sa.Boolean),
sa.Column('sort_order', sa.Integer),
)

op.execute(
ministries.insert().values(
name=NoneMinistryName,
abbreviation=NoneMinistryName,
is_active=True,
is_deleted=False,
sort_order=-1,
)
)

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###

op.execute(f"delete from ministries where name='{NoneMinistryName}'")

# ### end Alembic commands ###
3 changes: 2 additions & 1 deletion epictrack-web/src/components/work/WorkForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const schema = yup.object<Work>().shape({
work_type_id: yup.number().required("Work type is required"),
start_date: yup.date().required("Start date is required"),
project_id: yup.number().required("Project is required"),
ministry_id: yup.number().required("Responsible Ministry is required"),
federal_involvement_id: yup
.number()
.required("Federal Involvement is required"),
Expand Down Expand Up @@ -279,7 +280,7 @@ export default function WorkForm({ ...props }) {
></ControlledSelectV2>
</Grid>
<Grid item xs={6}>
<ETFormLabel>Responsible Ministry</ETFormLabel>
<ETFormLabel required>Responsible Ministry</ETFormLabel>
<ControlledSelectV2
placeholder="Select"
helperText={errors?.ministry_id?.message?.toString()}
Expand Down

0 comments on commit 0aead41

Please sign in to comment.