add GET/POST rest endpoints for whitelist

GET /<service_id>/whitelist
    returns all whitelisted contacts for a service, separated into two lists

POST /<service_id>/whitelist
    removes all existing whitelisted contacts, and replaces them with the
    provided new entries

(todo: dao work + tests)
This commit is contained in:
Leo Hemsted
2016-09-20 17:35:15 +01:00
parent 3d0df9b5a7
commit 203936fa84
2 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
from sqlalchemy import or_
from app import db
from app.models import ServiceWhitelist
def dao_fetch_service_whitelist(service_id):
return ServiceWhitelist.query().filter(ServiceWhitelist.service_id == service_id).all()
def dao_add_whitelisted_contact(obj):
db.session.add(obj)