Config for URLS prod
This commit is contained in:
@@ -59,3 +59,29 @@ class Signup(db.Model):
|
||||
return signup_data
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_all_start_signup(cls, email=None, firstname=None, lastname=None, page=1, limit=20):
|
||||
|
||||
query = cls.query
|
||||
logger.info(f"Get all customer back")
|
||||
|
||||
if firstname:
|
||||
query = query.filter(cls.firstname == firstname)
|
||||
|
||||
if lastname:
|
||||
query = query.filter(cls.lastname == lastname)
|
||||
|
||||
if email:
|
||||
query = query.filter(cls.email == email)
|
||||
|
||||
# Order by created_at descending (newest first)
|
||||
query = query.order_by(cls.added.desc())
|
||||
|
||||
# Get total count before pagination
|
||||
total_count = query.count()
|
||||
|
||||
# Apply pagination
|
||||
offset = (page - 1) * limit
|
||||
query = query.limit(limit).offset(offset)
|
||||
|
||||
return query.all(), total_count
|
||||
|
||||
Reference in New Issue
Block a user