Added 30 limit on all tables.

This commit is contained in:
retoor 2025-01-28 15:28:43 +01:00
parent 8e825a90c6
commit 01d8093e72
3 changed files with 6 additions and 0 deletions

2
.gitignore vendored
View File

@ -4,6 +4,8 @@
.backup*
docs
snek.d*
.rcontext.txt
*.zip
*.db*
*.png
# ---> Python

View File

@ -12,3 +12,5 @@ class ChannelMessageService(BaseService):
if await self.save(model):
return model
raise Exception(f"Failed to create channel message: {model.errors}.")

View File

@ -58,6 +58,8 @@ class BaseService:
raise Exception(f"Couldn't save model. Errors: f{errors}")
async def find(self, **kwargs):
if not "_limit" in kwargs or int(kwargs.get("_limit")) > 30:
kwargs["_limit"] = 30
async for model in self.mapper.find(**kwargs):
yield model