Example #1
0
def put_course(id):
    course = courses.context().update(id, request.get_json())

    if not course:
        return not_found()

    return ok(courses.schema.dump(course))
Example #2
0
def post_course():
    data = courses.schema.load(request.get_json())
    data.owner = get_authenticated_user()

    course = courses.context().create(data)

    return ok(courses.schema.dump(course))
Example #3
0
def get_course(id):
    course = courses.context().get(id)

    if not course:
        return not_found()

    return ok(courses.schema.dump(course))
Example #4
0
def delete_user(id):
    if not courses.context().delete(id):
        return not_found()

    return ok()
Example #5
0
def get_courses():
    courses_list = courses.context().get()

    return ok(courses.schema.dump(courses_list))