def revoke(booking_id): query = """ UPDATE booking SET revoked_date = %s WHERE id = %s RETURNING id """ revoked_date = get_current_time() return execute_post(query, (revoked_date, booking_id))
def create(category, description): query = """ INSERT INTO report (id, category, description, created_date) VALUES (%s, %s, %s, %s) RETURNING id """ id = generate_id() created_date = get_current_time() return execute_post(query, (id, category, description, created_date))
def create(dataset_url, dataset_name, created_by): query = """ INSERT INTO task (id, dataset_url, dataset_name, created_by, created_date) VALUES (%s, %s, %s, %s, %s) RETURNING id """ id = generate_id() created_date = get_current_time() return execute_post(query, (id, dataset_url, dataset_name, created_by, created_date))
def register(username, password): query = """ INSERT INTO users (username, hashed_password, created_date) VALUES (%s, %s, %s) RETURNING username """ created_date = get_current_time() hashed_password = hash_password(password) return execute_post(query, (username, hashed_password, created_date))
def delete(id, deleted_by): query = """ UPDATE task SET deleted_by = %s, deleted_date = %s WHERE id = %s RETURNING id """ deleted_date = get_current_time() return execute_post(query, (deleted_by, deleted_date, id))
def create(task_id, created_by): try: # make booking booking_id = generate_id() created_date = get_current_time() query = """ INSERT INTO booking (id, task_id, created_by, created_date) VALUES (%s, %s, %s, %s) RETURNING id """ return execute_post(query, (booking_id, task_id, created_by, created_date)) except Exception as e: print(e) raise HTTPException(500)