def updateHex(x=None, y=None): data, columns = getDataAndColumns(request) hex = db.get("hex", query=f"xcoord={x} AND ycoord={y}") if len(hex) > 0: id = db.post("hex", data, columns, query=f"xcoord={x} AND ycoord={y}") else: id = db.put("hex", data, columns) return {"id": id, "name": "hex"}
def updateSettlement(id=None): data, columns = getDataAndColumns(request) db.post("settlement", data, columns, f"id='{id}'") return f'{{"id":{id}, "name":"settlements"}}'
def insertSettlement(): data, columns = getDataAndColumns(request) outId = db.put("settlement", data, columns) return json.dumps({"id": outId, "name": "settlements"})
def updateKingdom(id=None): data, columns = getDataAndColumns(request) db.post("kingdoms", data, columns, f"id='{id}'") return f'{{"id":{id}, "name":"kingdom"}}'
def insertKingdom(): data, columns = getDataAndColumns(request) out=db.put("kingdoms", data, columns) return json.dumps({"id":out, "name": "kingdom"})
def insertHex(): data, columns = getDataAndColumns(request) id = db.put("hex", data, columns) return json.dumps({"id": id, "name": "hex"})
def insertDistrictBuilding(): data, columns = getDataAndColumns(request) outId = db.put("district_buildings", data, columns) return json.dumps({"id": outId, "name": "districtBuildings"})
def updateDistrictBuilding(id, xcoord, ycoord): data, columns = getDataAndColumns(request) outId = db.post("district_buildings", data, columns, f"xcoord={xcoord} AND ycoord={ycoord} AND district={id}") return f'{{"id": {id}, "name":"districtBuildings"}}'
def addHexImprovement(): data, columns=getDataAndColumns(request) outId=db.put("hex_improvement", data, columns) return json.dumps({"id":outId, "name":"hexImprovements"})
def updateDistrict(id=None): data, columns = getDataAndColumns(request) db.post("district", data, columns, f"id='{id}'") return f'{{"id":{id}, "name":"district"}}'
def insertSettlementImprovement(): data, columns = getDataAndColumns(request) outId = db.put("settlement_improvements", data, columns) return f'{{"id": {outId}, "name": "settlementImprovements"}}'
def insertBuildingDiscount(): data, columns = getDataAndColumns(request) print("TEST") outId=db.put("building_discount", data, columns) print(f'{{"id":{outId}, "name":"buildingDiscount"}}') return f'{{"id":{outId}, "name":"buildingDiscount"}}'
def addMarker(): data, columns = getDataAndColumns(request) outId = db.put("markers", data, columns) return f'{{"id":{outId}, "name":"markers"}}'