Added 30 limit on all tables.
This commit is contained in:
parent
8e825a90c6
commit
01d8093e72
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,6 +4,8 @@
|
|||||||
.backup*
|
.backup*
|
||||||
docs
|
docs
|
||||||
snek.d*
|
snek.d*
|
||||||
|
.rcontext.txt
|
||||||
|
*.zip
|
||||||
*.db*
|
*.db*
|
||||||
*.png
|
*.png
|
||||||
# ---> Python
|
# ---> Python
|
||||||
|
@ -12,3 +12,5 @@ class ChannelMessageService(BaseService):
|
|||||||
if await self.save(model):
|
if await self.save(model):
|
||||||
return model
|
return model
|
||||||
raise Exception(f"Failed to create channel message: {model.errors}.")
|
raise Exception(f"Failed to create channel message: {model.errors}.")
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ class BaseService:
|
|||||||
raise Exception(f"Couldn't save model. Errors: f{errors}")
|
raise Exception(f"Couldn't save model. Errors: f{errors}")
|
||||||
|
|
||||||
async def find(self, **kwargs):
|
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):
|
async for model in self.mapper.find(**kwargs):
|
||||||
yield model
|
yield model
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user