def job_detail(job_id): if method_is('GET'): return detail_job(job_id) if method_is('DELETE'): return detail_job(job_id, mode='delete') data = parser.ValueChecker(request.json) data.parse('name', str, nullable=True, length=100) data.parse('description', str, nullable=True, length=300) data.parse('start_time', date, nullable=True, length=100) data.parse('deadline', date, nullable=True, length=100) data.parse('category_id', int, nullable=True, length=3) data.parse('done', bool, nullable=True, length=100) data.parse('accept', bool, nullable=True, length=100) return detail_job(job_id, data.get_parsed(), mode='edit')
def index(): if method_is('POST'): from apps.job.models import Job data = parser.ValueChecker(request.json) data.parse('name', str, length=100) data.parse('description', str, nullable=True, length=300) data.parse('start_time', date, length=100) data.parse('deadline', date, nullable=True, length=100) data.parse('done', bool, nullable=True, length=100) data.parse('nilai_material', str, nullable=True, length=255) data.parse('nilai_jasa', str, nullable=True, length=255) data.parse('job_location', str, nullable=True, length=255) data.parse('no_spk', str, nullable=True, length=255, unique_from_model={ 'model': Job, 'field': 'no_spk' }) data.parse('given_by', str, length=255) data.parse('category_id', int, length=11) data.parse('users', list, nullable=True) return create_job(data.get_parsed()) return job_list()
def auth(): data = parser.ValueChecker(request.json) data.parse('username', field_type=str, length=30) data.parse('password', field_type=str, length=30) if method_is('POST'): return login(data.get_parsed()) return {"message": "waw"}, 200
def index(): data = parser.ValueChecker(request.json) data.parse('username', field_type=str, length=30) data.parse('email', field_type=str, length=30) data.parse('password', field_type=str, length=30) if method_is('POST'): return register(data.parse()) return result(data.get_parsed(), 210)
def social_media(): if method_is('GET'): return get_my_social_media() data = parser.ValueChecker(request.json) data.parse('uid', field_type=str, length=30) data.parse('image', field_type=str, nullable=True, length=30) data.parse('provider', field_type=str, nullable=True, length=30) data.parse('link', field_type=str, length=30) return post_my_social_media(data.get_parsed())
def do_update(username): data = parser.ValueChecker(request.json) data.parse('username', field_type=str, nullable=True, length=30) data.parse('email', field_type=str, nullable=True, length=30) data.parse('fullname', field_type=str, nullable=True, length=30) data.parse('address', field_type=str, nullable=True, length=30) data.parse('phone_number', field_type=int, nullable=True, length=30) data.parse('work_start_time', field_type=date, nullable=True, length=30) data.parse('activate', field_type=bool, nullable=True, length=30) data.parse('password', field_type=str, nullable=True, length=30) if method_is('PUT'): return update(username, data.get_parsed()) elif method_is('GET'): return show_user_detail(username) elif method_is('DELETE'): return delete_user(username) return {"message": "waw"}, 200
def index(): if method_is("GET"): return my_store() data = parser.ValueChecker(request.json) data.parse('name', str, length=90) data.parse('description', str, length=300) data.parse('lat', float, length=15) data.parse('lang', float, length=15) return create_store(data.get_parsed())
def address(): if method_is('GET'): return get_my_address() data = parser.ValueChecker(request.json) data.parse('name', field_type=str, length=30) data.parse('latitude', field_type=str, nullable=True, length=30) data.parse('longitude', field_type=str, nullable=True, length=30) data.parse('address', field_type=str, length=30) data.parse('note', field_type=str, nullable=True, length=30) return post_my_address(data.get_parsed())
def index(): if method_is('GET'): return show_user_detail() data = parser.ValueChecker(request.json) data.parse('username', field_type=str, length=30) data.parse('email', field_type=str, length=30) data.parse('fullname', field_type=str, length=30) data.parse('address', field_type=str, length=30) data.parse('phone_number', field_type=int, length=30) data.parse('work_start_time', field_type=date, length=30) data.parse('activate', field_type=bool, length=30) data.parse('category_access_id', field_type=int, length=30) data.parse('password', field_type=str, length=30) return register(data.get_parsed())
def ca(): if method_is('GET'): return get_list_ca() data = parser.ValueChecker(request.json) data.parse('name', field_type=str, length=30) data.parse('add_user', field_type=bool, length=10) data.parse('delete_user', field_type=bool, length=10) data.parse('edit_user', field_type=bool, length=10) data.parse('add_job', field_type=bool, length=10) data.parse('delete_job', field_type=bool, length=10) data.parse('update_job', field_type=bool, length=10) data.parse('show_job', field_type=bool, length=10) data.parse('print_job', field_type=bool, length=10) data.parse('check_job', field_type=bool, length=10) data.parse('service_job', field_type=bool, length=10) return set_ca(data.get_parsed())
def job_cat_handler(): if method_is('GET'): return job_cat_list(request.args.get('page')) data = parser.ValueChecker(request.json) data.parse('name', str, length=200) return job_cat(data.get_parsed()['name'])