Skip to content

Commit

Permalink
Temporal commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-aranda committed Dec 17, 2024
1 parent b85e26a commit ea1ab2c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def upgrade(log: logging.Logger, table_names: set[str]) -> None:
if JIRA_FIELDS_TABLE_NAME not in table_names:
log.info(f"No {JIRA_FIELDS_TABLE_NAME} table; nothing to do")
return
log.info("Add 'columns_json'")
log.info("Add 'components_json'")

op.add_column(
JIRA_FIELDS_TABLE_NAME,
sa.Column("columns_json", sa.JSON(), nullable=True),
sa.Column("components_json", sa.JSON(), nullable=True),
)


Expand All @@ -37,5 +37,5 @@ def downgrade(log: logging.Logger, table_names: set[str]) -> None:
log.info(f"No {JIRA_FIELDS_TABLE_NAME} table; nothing to do")
return

log.info("Drop 'columns_json'")
op.drop_column(JIRA_FIELDS_TABLE_NAME, "columns_json")
log.info("Drop 'components_json'")
op.drop_column(JIRA_FIELDS_TABLE_NAME, "components_json")
6 changes: 6 additions & 0 deletions src/narrativelog/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class Message(BaseModel):
time_lost_type: None | str = Field(
title="Type of time lost.",
)
# Added 2024-12-16
components_json: None | dict = Field(
default_factory=dict,
title="JSON representation of systems and subsystems on the OBS jira project.",
)

class Config:
orm_mode = True
Expand All @@ -88,6 +93,7 @@ class Config:
"components",
"primary_software_components",
"primary_hardware_components",
"components_json",
)
MESSAGE_FIELDS = tuple(
set(Message.schema()["properties"].keys()) - set(JIRA_FIELDS)
Expand Down
8 changes: 8 additions & 0 deletions src/narrativelog/routers/add_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ async def add_message(
description="Primary hardware components to which the message applies. "
"Each entry should be a valid component name entry on the OBS jira project.",
),
components_json: None
| dict = fastapi.Body(
default={},
description="JSON representation of systems and subsystems"
" on the OBS jira project.",
),
urls: list[str] = fastapi.Body(
default=[],
description="URLs of associated JIRA tickets, screen shots, etc.: "
Expand Down Expand Up @@ -169,6 +175,7 @@ async def add_message(
components,
primary_software_components,
primary_hardware_components,
components_json,
)
):
result_jira_fields = await connection.execute(
Expand All @@ -177,6 +184,7 @@ async def add_message(
components=components,
primary_software_components=primary_software_components,
primary_hardware_components=primary_hardware_components,
components_json=components_json,
message_id=row_message.id,
)
.returning(sa.literal_column("*"))
Expand Down

0 comments on commit ea1ab2c

Please sign in to comment.