mirror of
https://github.com/aquatix/digimarks.git
synced 2025-12-07 06:05:10 +01:00
Renamed key properties
This commit is contained in:
@@ -162,7 +162,7 @@ async def list_bookmarks(
|
||||
"""List all bookmarks in the database. By default 100 items are returned."""
|
||||
result = await session.exec(
|
||||
select(Bookmark)
|
||||
.where(Bookmark.userkey == user_key, Bookmark.status != Visibility.DELETED)
|
||||
.where(Bookmark.user_key == user_key, Bookmark.status != Visibility.DELETED)
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
)
|
||||
@@ -179,7 +179,7 @@ async def get_bookmark(
|
||||
"""Show bookmark details."""
|
||||
result = await session.exec(
|
||||
select(Bookmark).where(
|
||||
Bookmark.userkey == user_key, Bookmark.url_hash == url_hash, Bookmark.status != Visibility.DELETED
|
||||
Bookmark.user_key == user_key, Bookmark.url_hash == url_hash, Bookmark.status != Visibility.DELETED
|
||||
)
|
||||
)
|
||||
bookmark = result.first()
|
||||
@@ -196,7 +196,7 @@ async def autocomplete_bookmark(
|
||||
strip_params: bool = False,
|
||||
):
|
||||
"""Autofill some fields for this (new) bookmark for user `user_key`."""
|
||||
bookmark.userkey = user_key
|
||||
bookmark.user_key = user_key
|
||||
|
||||
# Auto-fill title, fix tags etc.
|
||||
bookmarks_helpers.update_bookmark_with_info(bookmark, request, strip_params)
|
||||
@@ -204,7 +204,7 @@ async def autocomplete_bookmark(
|
||||
url_hash = utils.generate_hash(str(bookmark.url))
|
||||
result = await session.exec(
|
||||
select(Bookmark).where(
|
||||
Bookmark.userkey == user_key, Bookmark.url_hash == url_hash, Bookmark.status != Visibility.DELETED
|
||||
Bookmark.user_key == user_key, Bookmark.url_hash == url_hash, Bookmark.status != Visibility.DELETED
|
||||
)
|
||||
)
|
||||
bookmark_db = result.first()
|
||||
@@ -225,7 +225,7 @@ async def add_bookmark(
|
||||
strip_params: bool = False,
|
||||
):
|
||||
"""Add new bookmark for user `user_key`."""
|
||||
bookmark.userkey = user_key
|
||||
bookmark.user_key = user_key
|
||||
|
||||
# Auto-fill title, fix tags etc.
|
||||
bookmarks_helpers.update_bookmark_with_info(bookmark, request, strip_params)
|
||||
@@ -249,7 +249,7 @@ async def update_bookmark(
|
||||
"""Update existing bookmark `bookmark_key` for user `user_key`."""
|
||||
result = await session.exec(
|
||||
select(Bookmark).where(
|
||||
Bookmark.userkey == user_key, Bookmark.url_hash == url_hash, Bookmark.status != Visibility.DELETED
|
||||
Bookmark.user_key == user_key, Bookmark.url_hash == url_hash, Bookmark.status != Visibility.DELETED
|
||||
)
|
||||
)
|
||||
bookmark_db = result.first()
|
||||
@@ -298,13 +298,13 @@ async def bookmarks_changed_since(
|
||||
"""Last update on server, so the (browser) client knows whether to fetch an update."""
|
||||
result = await session.exec(
|
||||
select(Bookmark)
|
||||
.where(Bookmark.userkey == user_key, Bookmark.status != Visibility.DELETED)
|
||||
.where(Bookmark.user_key == user_key, Bookmark.status != Visibility.DELETED)
|
||||
.order_by(desc(Bookmark.modified_date))
|
||||
)
|
||||
latest_modified_bookmark = result.first()
|
||||
result = await session.exec(
|
||||
select(Bookmark)
|
||||
.where(Bookmark.userkey == user_key, Bookmark.status != Visibility.DELETED)
|
||||
.where(Bookmark.user_key == user_key, Bookmark.status != Visibility.DELETED)
|
||||
.order_by(desc(Bookmark.created_date))
|
||||
)
|
||||
latest_created_bookmark = result.first()
|
||||
@@ -326,7 +326,7 @@ async def list_tags_for_user(
|
||||
) -> list[str]:
|
||||
"""List all tags in use by the user."""
|
||||
result = await session.exec(
|
||||
select(Bookmark).where(Bookmark.userkey == user_key, Bookmark.status != Visibility.DELETED)
|
||||
select(Bookmark).where(Bookmark.user_key == user_key, Bookmark.status != Visibility.DELETED)
|
||||
)
|
||||
bookmarks = result.all()
|
||||
tags = []
|
||||
@@ -341,7 +341,7 @@ async def list_tags_for_user(
|
||||
user_key: str,
|
||||
) -> list[str]:
|
||||
"""List all tags in use by the user."""
|
||||
result = await session.exec(select(Bookmark).where(Bookmark.userkey == user_key))
|
||||
result = await session.exec(select(Bookmark).where(Bookmark.user_key == user_key))
|
||||
bookmarks = result.all()
|
||||
return tags_helpers.list_tags_for_bookmarks(bookmarks)
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class Bookmark(SQLModel, table=True):
|
||||
__tablename__ = 'bookmark'
|
||||
|
||||
id: int = Field(primary_key=True)
|
||||
userkey: str = Field(foreign_key='user.key')
|
||||
user_key: str = Field(foreign_key='user.key')
|
||||
title: str = Field(default='')
|
||||
url: AnyUrl = Field(default='', sa_type=build_custom_type(AnyUrl))
|
||||
note: str = Field(default='', nullable=True)
|
||||
@@ -107,7 +107,7 @@ class PublicTag(SQLModel, table=True):
|
||||
__tablename__ = 'publictag'
|
||||
|
||||
id: int = Field(primary_key=True)
|
||||
tagkey: str
|
||||
userkey: str = Field(foreign_key='user.key')
|
||||
tag_key: str
|
||||
user_key: str = Field(foreign_key='user.key')
|
||||
tag: str
|
||||
created_date: datetime = Field(default=datetime.now(UTC))
|
||||
|
||||
Reference in New Issue
Block a user