Open AlexandreKavalerski opened 11 months ago
Hi,
This is by design: if you want the number of items returned you can use the length of data[]
.
You can change this behaviour by overriding _s_count
, eg:
class BaseModel(SAFRSBase, db.Model):
__abstract__ = True
def _s_count():
return 100
class User(BaseModel):
"""
description: My User description
"""
__tablename__ = "Users"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
email = db.Column(db.String)
I added the meta.total
to be compatible with a particular frontend client but it's the same value as meta.count
. I may make this more configurable in the future though because it's not too obvious.
When page limit is applied, the value for
count
property inget
method is wrong. It returns the count of all records instead of the current page length.Refer to methods:
paginate
in safrs/jsonapi_formatting.pyget
in safrs/jsonapi.pycount
is being calculated based on initial length of object_query, but it should consider instances length after applying pagination.