def _post(self, what, transaction, changed_by, change_type): if change_type not in ["insert", "update", "delete"]: return problem(400, "Bad Request", "Invalid or missing change_type") if is_when_present_and_in_past_validator(what): return problem(400, "Bad Request", "Changes may not be scheduled in the past") sc_id = self.sc_table.insert(changed_by, transaction, **what) return jsonify(sc_id=sc_id)
def _post(self, what, transaction, changed_by, change_type): if change_type not in ["insert", "update", "delete"]: return problem(400, "Bad Request", "Invalid or missing change_type") if is_when_present_and_in_past_validator(what): return problem(400, "Bad Request", "Changes may not be scheduled in the past") sc_id = self.sc_table.insert(changed_by, transaction, **what) return jsonify(sc_id=sc_id)
def _post(self, sc_id, what, transaction, changed_by, old_sc_data_version): if is_when_present_and_in_past_validator(what): return problem(400, "Bad Request", "Changes may not be scheduled in the past") if what.get("data_version", None): what["data_version"] = int(what["data_version"]) where = {"sc_id": sc_id} self.sc_table.update(where, what, changed_by, int(old_sc_data_version), transaction) sc = self.sc_table.select(where=where, transaction=transaction, columns=["data_version"])[0] return jsonify(new_data_version=sc["data_version"])
def _post(self, what, transaction, changed_by, change_type): if change_type not in ["insert", "update", "delete"]: return problem(400, "Bad Request", "Invalid or missing change_type") if is_when_present_and_in_past_validator(what): return problem(400, "Bad Request", "Changes may not be scheduled in the past") sc_id = self.sc_table.insert(changed_by, transaction, **what) signoffs = {} for signoff in self.sc_table.signoffs.select(where={"sc_id": sc_id}, transaction=transaction): signoffs[signoff["username"]] = signoff["role"] return jsonify(sc_id=sc_id, signoffs=signoffs)
def _post(self, what, transaction, changed_by, change_type): if change_type not in ["insert", "update", "delete"]: return problem(400, "Bad Request", "Invalid or missing change_type") if is_when_present_and_in_past_validator(what): return problem(400, "Bad Request", "Changes may not be scheduled in the past") sc_id = self.sc_table.insert(changed_by, transaction, **what) signoffs = {} for signoff in self.sc_table.signoffs.select(where={"sc_id": sc_id}, transaction=transaction): signoffs[signoff["username"]] = signoff["role"] return jsonify(sc_id=sc_id, signoffs=signoffs)
def _post(self, sc_id, what, transaction, changed_by, old_sc_data_version): if is_when_present_and_in_past_validator(what): return problem(400, "Bad Request", "Changes may not be scheduled in the past") if what.get("data_version", None): what["data_version"] = int(what["data_version"]) where = {"sc_id": sc_id} self.sc_table.update(where, what, changed_by, int(old_sc_data_version), transaction) sc = self.sc_table.select(where=where, transaction=transaction, columns=["data_version"])[0] signoffs = {} for signoff in self.sc_table.signoffs.select(where={"sc_id": sc_id}, transaction=transaction): signoffs[signoff["username"]] = signoff["role"] return jsonify(new_data_version=sc["data_version"], signoffs=signoffs)