Skip to content

Commit

Permalink
chore(aristeus): lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yo-main committed Sep 26, 2023
1 parent 96e329b commit e073473
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@


# revision identifiers, used by Alembic.
revision = '7d2caa82eeff'
down_revision = 'f998571c548b'
revision = "7d2caa82eeff"
down_revision = "f998571c548b"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('harvest', sa.Column('date_harvest', sa.DateTime(), nullable=False))
op.add_column("harvest", sa.Column("date_harvest", sa.DateTime(), nullable=False))
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('harvest', 'date_harvest')
op.drop_column("harvest", "date_harvest")
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions aristaeus/src/aristaeus/controllers/api/dtos/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class HarvestOut(BaseModel):
class Config:
allow_population_by_field_name = True


class HiveOut(BaseModel):
name: str
condition: str
Expand Down
2 changes: 1 addition & 1 deletion aristaeus/src/aristaeus/infrastructure/db/orm/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
properties={
"apiary": relationship(Apiary, lazy="joined"),
"swarm": relationship(Swarm, lazy="joined"),
"harvests": relationship(Harvest, lazy="joined")
"harvests": relationship(Harvest, lazy="joined"),
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ async def get(self, hive_id: UUID) -> Harvest:
@error_handler()
async def save(self, harvest: Harvest) -> None:
data = {
"hive_id": select(orm.hive_table.c.id).where(orm.hive_table.c.public_id == harvest.hive_id).scalar_subquery(),
"hive_id": select(orm.hive_table.c.id)
.where(orm.hive_table.c.public_id == harvest.hive_id)
.scalar_subquery(),
"quantity": harvest.quantity,
"date_harvest": harvest.date_harvest,
"apiary_name": harvest.apiary_name,
Expand Down
1 change: 1 addition & 0 deletions aristaeus/src/aristaeus/infrastructure/db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async def wrapper(*args, **kwargs):
if mapping and type(exc) in mapping:
raise mapping[type(exc)] from exc
raise

return wrapper

return decorator
8 changes: 7 additions & 1 deletion aristaeus/tests/integration/api/test_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ async def test_hive_harvest(async_app):
swarm_id = response.json()["public_id"]

# create hive
data = {"name": "hive name", "condition": "condition", "owner": "owner", "apiary_id": apiary_id, "swarm_id": swarm_id}
data = {
"name": "hive name",
"condition": "condition",
"owner": "owner",
"apiary_id": apiary_id,
"swarm_id": swarm_id,
}
response = await async_app.post("/hive", json=data)
assert response.status_code == 201, response.text
hive_id = response.json()["public_id"]
Expand Down
1 change: 0 additions & 1 deletion aristaeus/tests/unit/api/test_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,3 @@ async def test_harvest(async_app):
payload = {"quantity_in_grams": 100, "date_harvest": "2023-01-01"}
response = await async_app.post(f"/hive/{hive.public_id}/harvest", json=payload)
assert response.status_code == 204, response.text

0 comments on commit e073473

Please sign in to comment.