1
0
mirror of https://codeberg.org/diginaut/digimarks.git synced 2026-02-04 12:40:27 +01:00

4 Commits

Author SHA1 Message Date
971ede6067 Dependency declarations; moved project to Codeberg 2025-12-11 17:58:21 +01:00
96a8946a9a Small fixes 2025-12-11 17:57:59 +01:00
14f09a2dfb Small fixes 2025-12-11 17:45:25 +01:00
9d813b7ea6 Added type checker 2025-12-11 17:27:31 +01:00
5 changed files with 22 additions and 16 deletions

View File

@@ -32,9 +32,9 @@ dependencies = [
[dependency-groups]
dev = [
{include-group = "lint"},
{include-group = "pub"},
{include-group = "test"}
{ include-group = "lint" },
{ include-group = "pub" },
{ include-group = "test" }
]
test = [
"pytest>=7.0.0",
@@ -42,7 +42,7 @@ test = [
]
lint = [
"ruff>=0.1.0",
"mypy>=1.0.0",
"pyrefly",
]
# Publishing on PyPI
pub = [
@@ -50,7 +50,7 @@ pub = [
"twine"
]
server = [
"gunicorn>=23.0.0",
"uvicorn",
]
# dynamic = ["version"]
@@ -58,8 +58,8 @@ server = [
my-script = "digimarks:app"
[project.urls]
"Homepage" = "https://github.com/aquatix/digimarks"
"Bug Tracker" = "https://github.com/aquatix/digimarks/issues"
"Homepage" = "https://codeberg.org/diginaut/digimarks"
"Bug Tracker" = "https://codeberg.org/diginaut/digimarks/issues"
[tool.black]
line-length = 120

View File

@@ -2,9 +2,12 @@
# Linting and fixing, including isort
ruff
# Typing
pyrefly
# Test suite
pytest
pytest-cov
# Publishing on PyPI
build

View File

@@ -92,7 +92,10 @@ async def list_bookmarks_for_user(
offset: int = 0,
limit: Annotated[int, Query(le=10000)] = 100,
) -> Sequence[Bookmark]:
"""List all bookmarks in the database. By default, 100 items are returned."""
"""List all bookmarks in the database. By default, 100 items are returned.
There is a limit of 10000 items.
"""
result = await session.exec(
select(Bookmark)
.where(Bookmark.user_key == user_key, Bookmark.status != Visibility.DELETED)
@@ -121,7 +124,7 @@ async def autocomplete_bookmark(
user_key: str,
bookmark: Bookmark,
strip_params: bool = False,
):
) -> Bookmark:
"""Autofill some fields for this (new) bookmark for user `user_key`."""
bookmark.user_key = user_key
@@ -149,7 +152,7 @@ async def add_bookmark(
user_key: str,
bookmark: Bookmark,
strip_params: bool = False,
):
) -> Bookmark:
"""Add new bookmark for user `user_key`."""
bookmark.user_key = user_key
@@ -171,7 +174,7 @@ async def update_bookmark(
bookmark: Bookmark,
url_hash: str,
strip_params: bool = False,
):
) -> Bookmark:
"""Update existing bookmark `bookmark_key` for user `user_key`."""
result = await session.exec(
select(Bookmark).where(
@@ -202,7 +205,7 @@ async def delete_bookmark(
session,
user_key: str,
url_hash: str,
):
) -> None:
"""(Soft)Delete bookmark `bookmark_key` for user `user_key`."""
result = await session.get(Bookmark, {'url_hash': url_hash, 'user_key': user_key})
bookmark = result

View File

@@ -202,7 +202,7 @@ async def autocomplete_bookmark(
user_key: str,
bookmark: Bookmark,
strip_params: bool = False,
):
) -> Bookmark:
"""Autofill some fields for this (new) bookmark for user `user_key`."""
logger.info('Autocompleting bookmark %s for user %s', bookmark.url_hash, user_key)
return await bookmarks_service.autocomplete_bookmark(session, request, user_key, bookmark, strip_params)
@@ -248,7 +248,7 @@ async def delete_bookmark(
"""(Soft)Delete bookmark `bookmark_key` for user `user_key`."""
logger.info('Deleting bookmark %s for user %s', url_hash, user_key)
try:
result = await bookmarks_service.delete_bookmark(session, user_key, url_hash)
_ = await bookmarks_service.delete_bookmark(session, user_key, url_hash)
return {'ok': True}
except Exception:
logger.exception('Failed to delete bookmark %s', url_hash)
@@ -310,7 +310,7 @@ async def page_user_landing(
session: SessionDep,
request: Request,
user_key: str,
):
) -> HTMLResponse:
"""HTML page with the main view for the user."""
result = await session.exec(select(User).where(User.key == user_key))
user = result.first()

View File

@@ -16,7 +16,7 @@
.thumbnail {
/*width: 80px;*/
width: 66;
width: 66px;
}
.thumbnail img {