Skip to content

Commit

Permalink
Merge pull request #45 from incidentalhq/eng-91-bug-need-a-multiselec…
Browse files Browse the repository at this point in the history
…t-component

ENG-91: add multi field select
  • Loading branch information
sanjeevan authored Sep 26, 2024
2 parents b4fb39b + 42a06f1 commit 3f25e21
Show file tree
Hide file tree
Showing 16 changed files with 495 additions and 20 deletions.
2 changes: 2 additions & 0 deletions backend/app/models/form_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import typing

from sqlalchemy import Boolean, Enum, ForeignKey, Integer, String, UnicodeText, false
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm import Mapped, mapped_column, relationship

from app.db import Base
Expand Down Expand Up @@ -31,6 +32,7 @@ class FormField(Base, TimestampMixin, SoftDeleteMixin):
rank: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
is_deletable: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
default_value: Mapped[str | None] = mapped_column(UnicodeText, nullable=True)
default_value_multi: Mapped[list[str] | None] = mapped_column(JSONB, nullable=True)
requirement_type: Mapped[RequirementTypeEnum] = mapped_column(
Enum(RequirementTypeEnum, native_enum=False), nullable=False
)
Expand Down
1 change: 1 addition & 0 deletions backend/app/schemas/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class PatchSingleFormFieldSchema(BaseSchema):
id: str
rank: int | None = None
default_value: str | None = None
default_value_multi: list[str] | None = None
requirement_type: RequirementTypeEnum | None = None
description: str | None = None

Expand Down
1 change: 1 addition & 0 deletions backend/app/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class FormFieldSchema(ModelSchema):
requirement_type: str
is_deletable: bool
default_value: str | None
default_value_multi: list[str] | None
field: FieldSchema
can_have_default_value: bool
can_have_description: bool
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""add multi default value
Revision ID: e83f1525f07e
Revises: 8c69704046a5
Create Date: 2024-09-11 20:53:08.899428
"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = "e83f1525f07e"
down_revision: Union[str, None] = "8c69704046a5"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("form_field", sa.Column("default_value_multi", postgresql.JSONB(), nullable=True))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("form_field", "default_value_multi")
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.26.1",
"react-select": "^5.8.0",
"react-toastify": "^9.1.3",
"react-tooltip": "^5.28.0",
"styled-components": "^6.1.12",
Expand Down
Loading

0 comments on commit 3f25e21

Please sign in to comment.