Last active
July 14, 2022 21:12
-
-
Save voglster/97ccf8cb7d2e7917522189939dfdc025 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@classmethod | |
async def find_by_loss( | |
cls, name: str, insurance_type: str, org_id: PydanticObjectId | ObjectId | |
): | |
# This is ugly but required to handle case-insensitive queries as beanie doesn't seem to | |
return [ | |
Commission.parse_obj(x) | |
for x in await Commission.get_motor_collection() | |
.find( | |
{ | |
"name": name, | |
"insurance_type": insurance_type, | |
"organization_id": org_id, | |
} | |
) | |
.collation({"locale": "en", "strength": 2}) | |
.to_list(None) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment