port: recent items for homepage

This commit is contained in:
cwilvx
2024-06-30 23:11:33 +03:00
parent 5759521de0
commit a3c4558d52
9 changed files with 92 additions and 37 deletions
+5
View File
@@ -3,6 +3,7 @@ from typing import Any
from sqlalchemy import (
create_engine,
delete,
func,
insert,
select,
)
@@ -81,6 +82,10 @@ class Base(MappedAsDataclass, DeclarativeBase):
def all(cls):
return cls.execute(select(cls))
@classmethod
def count(cls):
return cls.execute(select(func.count()).select_from(cls)).scalar()
def create_all():
Base().metadata.create_all(engine)