-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
696c7ce
commit 01abc25
Showing
8 changed files
with
197 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import logging | ||
|
||
from typing import List, Optional | ||
from fastapi import APIRouter | ||
from fastapi.responses import JSONResponse | ||
|
||
from .response_models import BlobItem, Message | ||
from src.db.base import DBClientBase | ||
|
||
router = APIRouter() | ||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
@router.get("/awsl_pic/list", response_model=List[BlobItem], responses={404: {"model": Message}}, tags=["Awsl Pic"]) | ||
def awsl_pic_list(uid: Optional[str] = "", limit: Optional[int] = 10, offset: Optional[int] = 0): | ||
if limit > 1000: | ||
return JSONResponse( | ||
status_code=404, | ||
content=Message(message="to large limit = {}".format(limit)) | ||
) | ||
return DBClientBase.get_client().awsl_pic_list(uid, limit, offset) | ||
|
||
|
||
@router.get("/awsl_pic/list_count", response_model=int, tags=["Awsl Pic"]) | ||
def awsl_pic_list_count(uid: Optional[str] = "") -> int: | ||
return DBClientBase.get_client().awsl_pic_list_count(uid) | ||
|
||
|
||
@router.get("/awsl_pic/random", response_model=str, tags=["Awsl Pic"]) | ||
def awsl_pic_random() -> str: | ||
return DBClientBase.get_client().awsl_pic_random() | ||
|
||
|
||
@router.get("/awsl_pic/random_json", response_model=BlobItem, tags=["Awsl Pic"]) | ||
def awsl_pic_random_json() -> str: | ||
return DBClientBase.get_client().awsl_pic_random_json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters