Skip to content

Commit 427f0df

Browse files
committed
renammed"last_ordering_date" to"last_order_date" for consistency
1 parent 68adc06 commit 427f0df

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

app/modules/amap/cruds_amap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ async def update_last_ordering_date(db: AsyncSession, user_id: str, date: dateti
378378
await db.execute(
379379
update(models_amap.Cash)
380380
.where(models_amap.Cash.user_id == user_id)
381-
.values(last_ordering_date=date),
381+
.values(last_order_date=date),
382382
)
383383
await db.flush()
384384

app/modules/amap/endpoints_amap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ async def add_order_to_delievery(
459459
balance = models_amap.Cash(
460460
balance=0,
461461
user_id=order.user_id,
462-
last_ordering_date=ordering_date,
462+
last_order_date=ordering_date,
463463
)
464464
await cruds_amap.create_cash_of_user(
465465
cash=balance,
@@ -857,7 +857,7 @@ async def get_cash_by_id(
857857
balance=0,
858858
user_id=user_id,
859859
user=schemas_users.CoreUserSimple(**user_db.__dict__),
860-
last_ordering_date=datetime.now(UTC),
860+
last_order_date=datetime.now(UTC),
861861
)
862862

863863
return cash
@@ -894,7 +894,7 @@ async def create_cash_of_user(
894894
)
895895

896896
cash_db = models_amap.Cash(
897-
user_id=user_id, balance=cash.balance, last_ordering_date=datetime.now(UTC)
897+
user_id=user_id, balance=cash.balance, last_order_date=datetime.now(UTC)
898898
)
899899

900900
await cruds_amap.create_cash_of_user(

app/modules/amap/models_amap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class Cash(Base):
107107
primary_key=True,
108108
)
109109
balance: Mapped[float]
110-
last_ordering_date: Mapped[datetime]
110+
last_order_date: Mapped[datetime]
111111
user: Mapped[CoreUser] = relationship("CoreUser", init=False)
112112

113113

app/modules/amap/schemas_amap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class CashBase(BaseModel):
124124

125125
class CashComplete(CashBase):
126126
user: CoreUserSimple
127-
last_ordering_date: datetime
127+
last_order_date: datetime
128128

129129

130130
class CashEdit(BaseModel):

migrations/versions/42-amap_add_last_ordering_date.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import sqlalchemy as sa
1414
from alembic import op
1515

16+
from app.types.sqlalchemy import TZDateTime
17+
1618
# revision identifiers, used by Alembic.
1719
revision: str = "5351256b1bfc"
1820
down_revision: str | None = "b72df3765853"
@@ -23,16 +25,16 @@
2325
def upgrade() -> None:
2426
# ### commands auto generated by Alembic - please adjust! ###
2527
op.add_column(
26-
"amap_cash", sa.Column("last_ordering_date", TZDateTime(), nullable=True)
28+
"amap_cash", sa.Column("last_order_date", TZDateTime(), nullable=True)
2729
)
2830
default_time = datetime(2025, 1, 1)
29-
op.execute("UPDATE amap_cash SET last_ordering_date = (?)", (default_time,))
30-
op.alter_column("amap_cash", "last_ordering_date", nullable=False)
31+
op.execute("UPDATE amap_cash SET last_order_date = (?)", (default_time,))
32+
op.alter_column("amap_cash", "last_order_date", nullable=False)
3133

3234

3335
def downgrade() -> None:
3436
# ### commands auto generated by Alembic - please adjust! ###
35-
op.drop_column("amap_cash", "last_ordering_date")
37+
op.drop_column("amap_cash", "last_order_date")
3638

3739

3840
def pre_test_upgrade(

0 commit comments

Comments
 (0)