Skip to content

Commit 43fb4b7

Browse files
committed
updates
1 parent bab8222 commit 43fb4b7

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

core/api/user/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from flask import request
2+
from sqlalchemy import desc
23
from sqlalchemy.exc import IntegrityError
34
from loguru import logger
45
import sys
@@ -122,7 +123,7 @@ def fetch_user(current_user):
122123
def fetch_bookings_for_user(current_user):
123124
""" fetch all bookings made by a user """
124125
bookings = current_user.bookings.order_by(
125-
Booking.date_of_booking
126+
desc(Booking.created_at)
126127
).all()
127128

128129
msg = 'fetched top recent bookings successfully'
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""empty message
2+
3+
Revision ID: 191ed847374e
4+
Revises: 461700103f58
5+
Create Date: 2025-07-14 13:01:58.684724
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
from sqlalchemy.dialects import postgresql
11+
12+
# revision identifiers, used by Alembic.
13+
revision = '191ed847374e'
14+
down_revision = '461700103f58'
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
# ### commands auto generated by Alembic - please adjust! ###
21+
with op.batch_alter_table('booking', schema=None) as batch_op:
22+
batch_op.drop_column('date_of_booking')
23+
24+
# ### end Alembic commands ###
25+
26+
27+
def downgrade():
28+
# ### commands auto generated by Alembic - please adjust! ###
29+
with op.batch_alter_table('booking', schema=None) as batch_op:
30+
batch_op.add_column(sa.Column('date_of_booking', sa.DATE(), autoincrement=False, nullable=True))
31+
# ### end Alembic commands ###

models/bookings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class Booking(TimestampMixin, db.Model):
123123
), nullable=True
124124
)
125125
details_confirmed = db.Column(db.Boolean, default=False)
126-
date_of_booking = db.Column(db.Date, default=dt.utcnow())
127126
payment_method = db.Column(db.Enum(BookingPaymentMethod))
128127
booking_contract = db.relationship(
129128
'BookingContract',

0 commit comments

Comments
 (0)