def put_course(id): course = courses.context().update(id, request.get_json()) if not course: return not_found() return ok(courses.schema.dump(course))
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))
def get_course(id): course = courses.context().get(id) if not course: return not_found() return ok(courses.schema.dump(course))
def delete_user(id): if not courses.context().delete(id): return not_found() return ok()
def get_courses(): courses_list = courses.context().get() return ok(courses.schema.dump(courses_list))