Added new API endpoints
This commit is contained in:
parent
a70b4f2eae
commit
7fb5c47e4d
4 changed files with 101 additions and 8 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue