Added new API endpoints

This commit is contained in:
Yusur 2019-11-08 16:51:32 +01:00
parent a70b4f2eae
commit 7fb5c47e4d
4 changed files with 101 additions and 8 deletions

View file

@ -11,6 +11,7 @@ The tables are:
* notification - a in-site notification to a user; new in 0.3
'''
from flask import request
from peewee import *
import os
# here should go `from .utils import get_current_user`, but it will cause
@ -188,6 +189,8 @@ class Upload(BaseModel):
# helper to retrieve contents
def filename(self):
return str(self.id) + '.' + self.type
def url(self):
return request.host_url + 'uploads/' + self.filename()
class Notification(BaseModel):
type = TextField()