(20241218) Can now add tags to SMS messages while sending them, and small 'limit' bug fixed in listing mails where a huge no. of tokens are being sent.

This commit is contained in:
2024-12-18 11:10:18 +05:30
parent c340ebcba5
commit b42da0dacb
8 changed files with 32 additions and 13 deletions
+8 -2
View File
@@ -320,12 +320,14 @@ class CoreAuthTokenController(BaseModel):
self,
mongo_conn: AsyncMongo,
token_ids: List[ObjectId | str] = None,
limit: int = 100
) -> List[CoreAuthTokenModel]:
"""
To retrieve stored tokens from the database. Multiple tokens at a time.
:param mongo_conn: The database connection (MongoDB) to use to perform the action.
:param token_ids: The identifier of the document that holds the token's details.
:param limit: The max. no. of records to pick.
:return: The retrieved record that has the token, and information about the service and client if found, else
None when there is no matching record.
"""
@@ -333,7 +335,8 @@ class CoreAuthTokenController(BaseModel):
# If there is some filtering possible, we fetch the token:
tokens = await mongo_conn.find_many(
collection = self.AUTH_COLLECTION,
filter = {"_id": {"$in": [ObjectId(k) for k in token_ids]}}
filter = {"_id": {"$in": [ObjectId(k) for k in token_ids]}},
limit = limit
)
# Done here:
@@ -343,12 +346,14 @@ class CoreAuthTokenController(BaseModel):
self,
mongo_conn: AsyncMongo,
token_keys: List[ObjectId | str] = None,
limit: int = 100
) -> List[CoreAuthTokenModel]:
"""
To retrieve stored tokens from the database. Multiple tokens at a time.
:param mongo_conn: The database connection (MongoDB) to use to perform the action.
:param token_keys: the identifiers granted by the 'get_token_key' method.
:param limit: The max. no. of records to pick.
:return: The retrieved record that has the token, and information about the service and client if found, else
None when there is no matching record.
"""
@@ -356,7 +361,8 @@ class CoreAuthTokenController(BaseModel):
# If there is some filtering possible, we fetch the token:
tokens = await mongo_conn.find_many(
collection = self.AUTH_COLLECTION,
filter = {"key": {"$in": [ObjectId(k) for k in token_keys]}}
filter = {"key": {"$in": [ObjectId(k) for k in token_keys]}},
limit = limit
)
# Done here: