mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 03:05:35 +00:00
19 lines
452 B
Python
19 lines
452 B
Python
from flask_restful import Resource, reqparse
|
|
|
|
from app.lib.home.recents import get_recent_items
|
|
|
|
parser = reqparse.RequestParser()
|
|
|
|
parser.add_argument("limit", type=int, required=False, default=7, location="args")
|
|
|
|
|
|
class RecentlyAdded(Resource):
|
|
def get(self):
|
|
cutoff = 14
|
|
|
|
args = parser.parse_args()
|
|
limit = args["limit"]
|
|
print(limit)
|
|
|
|
return {"items": get_recent_items(cutoff)[:limit], "cutoff": cutoff}
|