Add the business plans in.
This commit is contained in:
parent
1cd4fa8d9b
commit
b11ab44285
6 changed files with 145 additions and 46 deletions
|
@ -16,7 +16,7 @@ import storage
|
|||
from data import model
|
||||
from data.userfiles import UserRequestFiles
|
||||
from data.queue import dockerfile_build_queue
|
||||
from data.plans import USER_PLANS, getPlan, isPlanActive
|
||||
from data.plans import USER_PLANS, BUSINESS_PLANS, get_plan
|
||||
from app import app
|
||||
from util.email import send_confirmation_email, send_recovery_email
|
||||
from util.names import parse_repository_name
|
||||
|
@ -50,13 +50,19 @@ def api_login_required(f):
|
|||
def handle_dme(ex):
|
||||
return make_response(ex.message, 400)
|
||||
|
||||
|
||||
@app.route('/api/')
|
||||
def welcome():
|
||||
return make_response('welcome', 200)
|
||||
|
||||
|
||||
@app.route('/api/plans/')
|
||||
def plans_list():
|
||||
return jsonify({ 'plans': USER_PLANS })
|
||||
return jsonify({
|
||||
'user': USER_PLANS,
|
||||
'business': BUSINESS_PLANS,
|
||||
})
|
||||
|
||||
|
||||
@app.route('/api/user/', methods=['GET'])
|
||||
def get_logged_in_user():
|
||||
|
@ -112,6 +118,7 @@ def change_user_details():
|
|||
'askForPassword': user.password_hash is None,
|
||||
})
|
||||
|
||||
|
||||
@app.route('/api/user/', methods=['POST'])
|
||||
def create_user_api():
|
||||
user_data = request.get_json()
|
||||
|
@ -251,6 +258,7 @@ def team_view(orgname, t):
|
|||
'role': role
|
||||
}
|
||||
|
||||
|
||||
@app.route('/api/organization/<orgname>', methods=['GET'])
|
||||
def get_organization(orgname):
|
||||
user = current_user.db_user()
|
||||
|
@ -292,8 +300,8 @@ def get_organization_private_allowed(orgname):
|
|||
if organization.stripe_id:
|
||||
cus = stripe.Customer.retrieve(organization.stripe_id)
|
||||
|
||||
if cus.subscription and isPlanActive(cus.subscription):
|
||||
repos_allowed = getPlan(cus.subscription.plan.id)
|
||||
if cus.subscription:
|
||||
repos_allowed = get_plan(cus.subscription.plan.id)
|
||||
return jsonify({
|
||||
'privateAllowed': (private_repos < repos_allowed)
|
||||
})
|
||||
|
|
Reference in a new issue