def create_checklist_category(data): log("User requested create a new checklist category", "LOW", "PASS") checklist_category = ChecklistCategory(data.get('name'), data.get('description')) try: db.session.add(checklist_category) db.session.commit() except: db.rollback() raise return {'message': 'Checklist category successfully created'}
def create_checklist_type(data, category_id): log("User requested create a new checklist type", "LOW", "PASS") checklist_type = ChecklistType(data.get('name'), data.get('description'), data.get('visibility')) checklist_type.checklist_category_id = category_id try: db.session.add(checklist_type) db.session.commit() except: db.rollback() raise return {'message': 'Checklist type successfully created'}
def create_checklist_type(data): log("User requested create a new checklist type", "LOW", "PASS") val_alpha_num_special(data.get('name')) val_alpha_num_special(data.get('description')) checklist_name = data.get('name') checklist_description = data.get('description') visibility = data.get('visibility') checklist_type = ChecklistType(checklist_name, checklist_description, visibility) try: db.session.add(checklist_type) db.session.commit() except: db.rollback() raise return {'message': 'Checklist type successfully created'}