from angular_flask.core import api_manager
from angular_flask.models import *

# --------------------------------
# API Routing
# --------------------------------

def post_terms_remove_courses(result=None, search_params=None, **kw):
    """Accepts two arguments, `result`, which is the dictionary
    representation of the JSON response which will be returned to the
    client, and `search_params`, which is a dictionary containing the
    search parameters for the request (that produced the specified
    `result`).
    """
    if 'objects' in result:
        for term in result['objects']:
            term.pop('courses', None)

def post_term_remove_course_sections(result=None, **kw):
    if 'objects' in result:
        term = result['objects']
        for course in term:
            course.pop('sections', None)

# accessible at http://localhost:5000/api/terms
api_manager.create_api(Term,
                       methods=['GET'],
                       postprocessors={'GET_MANY': [post_terms_remove_courses],
                                       'GET_SINGLE': [post_term_remove_course_sections]},
                       collection_name='terms')

# accessible at http://localhost:5000/api/courses
api_manager.create_api(Course,
                       methods=['GET'],
                       collection_name='courses')

@@ -161,514 +161,193 @@
 --%0A%0A
-def post_terms_remove_courses(result=None, search_params=None, **kw):%0A    %22%22%22Accepts two arguments, %60result%60, which is the dictionary%0A    representation of the JSON response which will be returned to the%0A    client, and %60search_params%60, which is a dictionary containing the%0A    search parameters for the request (that produced the specified%0A    %60result%60).%0A    %22%22%22%0A    if 'objects' in result:%0A        for term in result%5B'objects'%5D:%0A            term.pop('courses', None)%0A%0Adef post_term_remove_
+# accessible at http://localhost:5000/api/terms%0Aapi_manager.create_api(Term,%0A                       methods=%5B'GET'%5D,%0A                       exclude_columns=%5B'courses', '
 course
-_
+s.
 sections
 (res
@@ -346,157 +346,58 @@
 ions
-(result=None, **kw):%0A    if 'objects' in result:%0A        term = result%5B'objects'%5D%0A        for course in term:%0A            course.pop('sections', None
+'%5D,%0A                       collection_name='terms'
 )%0A%0A#
@@ -429,36 +429,38 @@
 alhost:5000/api/
-term
+course
 s%0Aapi_manager.cr
@@ -460,36 +460,38 @@
 ager.create_api(
-Term
+Course
 ,%0A              
@@ -543,63 +543,118 @@
     
-postprocessors=%7B'GET_MANY': %5Bpost_terms_remove_c
+exclude_columns=%5B'sections'%5D,%0A                       collection_name='courses')%0A%0Aapi_manager.create_api(C
 ourse
-s%5D
 ,%0A  
@@ -678,203 +678,278 @@
     
-                'GET_SINGLE': %5Bpost_term_remove_course_sections%5D%7D,%0A                       collection_name='terms')%0A%0A# accessible at http://localhost:5000/api/courses%0Aapi_manager.create_api(Course
+methods=%5B'GET'%5D,%0A                       include_columns=%5B'subject',%0A                                        'subjectTitle',%0A                                        'course',%0A                                        'asString'%5D,%0A                       results_per_page=500
 ,%0A  
@@ -966,38 +966,47 @@
            m
-ethods=%5B'GET'%5D
+ax_results_per_page=500
 ,%0A          
@@ -1022,31 +1022,35 @@
     collection_name='courses
+-min
 ')%0A

add concise course data endpoint for faster initial pageload