Skip to content

Commit

Permalink
Fix default
Browse files Browse the repository at this point in the history
  • Loading branch information
tan-z-tan committed Aug 21, 2023
1 parent abab276 commit b6687e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ print(book.publisher_ref.path) # => str (So far, we can't access publisher_ref.
print("==================== where ====================")
print(Book.where("title", "==", "test")) # => Book[] Make sure to create index in firestore for compound queries

print("==================== where & order ====================")
print(Book.where("title", "==", "test").order("name", "ASCENDING")) # => Book[] Make sure to create index in firestore for compound queries

print("==================== has_many ====================")
print(book.tags) # => PyfireCollection[Tag]
print(book.tags.first) # => Tag
Expand Down
6 changes: 3 additions & 3 deletions pyfireconsole/models/pyfire_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ def where(self, field: str, operator: str, value: str) -> 'PyfireCollection[Mode

return coll

def order(self, field: str, direction: str = 'asc') -> 'PyfireCollection[ModelType]':
def order(self, field: str, direction: str = 'ASCENDING') -> 'PyfireCollection[ModelType]':
"""
Order the collection based on the given condition.
Args:
field (str): The field name to apply the order on.
direction (str): The order direction ('asc' or 'desc').
direction (str): The order direction, 'ASCENDING' or 'DESCENDING'. Defaults to 'ASCENDING'.
Returns:
PyfireCollection[ModelType]: A new PyfireCollection instance with the applied order.
Expand Down Expand Up @@ -445,7 +445,7 @@ def order(cls, field: str, direction: OrderDirection = "ASCENDING") -> PyfireCol
Args:
field (str): The field name to apply the order on.
direction (str, optional): The order direction ('asc' or 'desc'). Defaults to 'asc'.
direction (str, optional): The order direction ('ASCENDING' or 'DESCENDING'). Defaults to 'ASCENDING'.
Returns:
PyfireCollection[PyfireDoc]: A PyfireCollection instance with the applied order.
Expand Down

0 comments on commit b6687e1

Please sign in to comment.