mirror of
https://git.wownero.com/wownero/wownero-funding-system.git
synced 2024-08-15 00:53:45 +00:00
Initial commit
This commit is contained in:
commit
edb3d8f57b
55 changed files with 15544 additions and 0 deletions
25
wowfunding/api.py
Normal file
25
wowfunding/api.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from datetime import datetime
|
||||
from flask import request, redirect, Response, abort, render_template, url_for, flash, make_response, send_from_directory, jsonify
|
||||
from flask.ext.login import login_user , logout_user , current_user , login_required, current_user
|
||||
from flask_yoloapi import endpoint, parameter
|
||||
|
||||
import settings
|
||||
from wowfunding.factory import app, db_session
|
||||
from wowfunding.orm.orm import Proposal, User
|
||||
|
||||
|
||||
@app.route('/api/1/proposals')
|
||||
@endpoint.api(
|
||||
parameter('status', type=int, location='args', default=0),
|
||||
parameter('cat', type=str, location='args'),
|
||||
parameter('limit', type=int, location='args', default=20),
|
||||
parameter('offset', type=int, location='args', default=0)
|
||||
)
|
||||
def api_proposals_get(status, cat, limit, offset):
|
||||
try:
|
||||
proposals = Proposal.find_by_args(status=status, cat=cat, limit=limit, offset=offset)
|
||||
except Exception as ex:
|
||||
print(ex)
|
||||
return 'error', 500
|
||||
|
||||
return [p.json for p in proposals]
|
Loading…
Add table
Add a link
Reference in a new issue