refac
This commit is contained in:
@@ -244,9 +244,14 @@ class NoteTable:
|
|||||||
return [NoteModel.model_validate(note) for note in notes]
|
return [NoteModel.model_validate(note) for note in notes]
|
||||||
|
|
||||||
def search_notes(
|
def search_notes(
|
||||||
self, user_id: str, filter: dict = {}, skip: int = 0, limit: int = 30
|
self,
|
||||||
|
user_id: str,
|
||||||
|
filter: dict = {},
|
||||||
|
skip: int = 0,
|
||||||
|
limit: int = 30,
|
||||||
|
db: Optional[Session] = None,
|
||||||
) -> NoteListResponse:
|
) -> NoteListResponse:
|
||||||
with get_db() as db:
|
with get_db_context(db) as db:
|
||||||
query = db.query(Note, User).outerjoin(User, User.id == Note.user_id)
|
query = db.query(Note, User).outerjoin(User, User.id == Note.user_id)
|
||||||
if filter:
|
if filter:
|
||||||
query_key = filter.get("query")
|
query_key = filter.get("query")
|
||||||
|
|||||||
Reference in New Issue
Block a user