Commit f6840670 authored by Bogdan's avatar Bogdan

Fixed Schema Mapping

parent 520f4749
...@@ -11,7 +11,7 @@ for modules_path in modules_paths: ...@@ -11,7 +11,7 @@ for modules_path in modules_paths:
# import _add_use_case_scripts.car_sharing.tables.add_user as user # import _add_use_case_scripts.car_sharing.tables.add_user as user
from _add_use_case_scripts.car_sharing.tables import add_user, add_car, add_hash from _add_use_case_scripts.car_sharing.tables import add_car, add_hash, add_offer, add_publication, add_travel, add_user
# import _add_use_case_scripts.car_sharing.tables.add_user as user # import _add_use_case_scripts.car_sharing.tables.add_user as user
# from _add_use_case_scripts.car_sharing.tables import add_car # from _add_use_case_scripts.car_sharing.tables import add_car
...@@ -49,7 +49,9 @@ if __name__ == "__main__": ...@@ -49,7 +49,9 @@ if __name__ == "__main__":
add_use_case(use_case) add_use_case(use_case)
add_user.main(use_case) add_user.main(use_case)
#car.main(use_case) # add_car.main(use_case)
#offer.main(use_case) # add_hash.main(use_case)
#travel.main(use_case) # add_offer.main(use_case)
#add_hash.main(use_case) # add_publication.main(use_case)
\ No newline at end of file # add_travel.main(use_case)
\ No newline at end of file
# def add_car_layers(): from _add_use_case_scripts.car_sharing.tables.requestPost import postLayersToSwagger, postTableToSwagger
# use_case = "car-sharing"
# layers = [
# {
# "use_case": use_case,
# "name": "doctype_layer",
# "properties": [
# "UniqueID",
# "doctype",
# ],
# "cluster_properties": [
# "doctype",
# ]
# },
# {
# "use_case": use_case,
# "name": "brand_layer",a
# "properties": [
# "UniqueID",
# "brand",
# ],
# "cluster_properties": [
# "brand",
# ]
# },
# {
# "use_case": use_case,
# "name": "model_layer",
# "properties": [
# "UniqueID",
# "model",
# ],
# "cluster_properties": [
# "model",
# ]
# },
# {
# "use_case": use_case,
# "name": "colour_layer",
# "properties": [
# "UniqueID",
# "colour",
# ],
# "cluster_properties": [
# "colour",
# ]
# },
# {
# "use_case": use_case,
# "name": "seats_layer",
# "properties": [
# "UniqueID",
# "seats",
# ],
# "cluster_properties": [
# "seats",
# ]
# },
# {
# "use_case": use_case,
# "name": "year_layer",
# "properties": [
# "UniqueID",
# "year",
# ],
# "cluster_properties": [
# "year",
# ]
# },
# ]
# jwt = TokenManager.getInstance().getToken()
# for layer in layers:
# url = f"https://articonf1.itec.aau.at:30420/api/layers"
# response = requests.post(
# url,
# verify=False,
# proxies = { "http":None, "https":None },
# headers = { "Authorization": f"Bearer {jwt}"},
# json = layer
# )
# if response.status_code == 200:
# print(f"Response: {response.status_code}")
# else:
# print(f"Response: {response.status_code}: {response.text}")
import network_constants as nc
from security.token_manager import TokenManager
import requests
def add_table(use_case: str, table_name:str): def add_table(use_case: str, table_name:str):
''' '''
take the columns and add the mappings at the server take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_" replace all "/"'s in the internal representation with a "_"
''' '''
jwt = TokenManager.getInstance().getToken()
use_case = "car-sharing" use_case = "car-sharing"
columns = [ columns = [
...@@ -109,7 +15,7 @@ def add_table(use_case: str, table_name:str): ...@@ -109,7 +15,7 @@ def add_table(use_case: str, table_name:str):
"colour", "colour",
"seats", "seats",
"year", "year",
"ownerId", "ownerID",
"deleted", "deleted",
"state", "state",
"observations" "observations"
...@@ -118,23 +24,13 @@ def add_table(use_case: str, table_name:str): ...@@ -118,23 +24,13 @@ def add_table(use_case: str, table_name:str):
columns = { c : c for c in columns } columns = { c : c for c in columns }
columns["UniqueID"] = "carLicensePlate" columns["UniqueID"] = "carLicensePlate"
url = f"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table = { table = {
"name": table_name, "name": table_name,
"mappings": columns "mappings": columns
} }
response = requests.post( postTableToSwagger(use_case,table)
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = table
)
print(url+": "+str(response.status_code))
def add_layers(use_case:str, table_name: str): def add_layers(use_case:str, table_name: str):
layers = [ layers = [
...@@ -143,13 +39,13 @@ def add_layers(use_case:str, table_name: str): ...@@ -143,13 +39,13 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "GeneralCar_layer", "name": "GeneralCar_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"brand", "brand",
"model", "model",
"colour", "colour",
"seats", "seats",
"year", "year",
"ownerId", "ownerID",
"deleted", "deleted",
"state" "state"
], ],
...@@ -159,7 +55,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -159,7 +55,7 @@ def add_layers(use_case:str, table_name: str):
"model", "model",
"seats", "seats",
"year", "year",
"ownerId", "ownerID",
"state" "state"
] ]
}, },
...@@ -168,19 +64,19 @@ def add_layers(use_case:str, table_name: str): ...@@ -168,19 +64,19 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "Owner_layer", "name": "Owner_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"brand", "brand",
"model", "model",
"colour", "colour",
"seats", "seats",
"year", "year",
"ownerId", "ownerID",
"deleted", "deleted",
"state" "state"
], ],
"cluster_properties": [ "cluster_properties": [
"OwnerId", "OwnerID",
"UniqueId" "UniqueID"
] ]
}, },
{ {
...@@ -188,13 +84,13 @@ def add_layers(use_case:str, table_name: str): ...@@ -188,13 +84,13 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "CarAge_layer", "name": "CarAge_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"brand", "brand",
"model", "model",
"colour", "colour",
"seats", "seats",
"year", "year",
"ownerId", "ownerID",
"deleted", "deleted",
"state" "state"
], ],
...@@ -209,13 +105,13 @@ def add_layers(use_case:str, table_name: str): ...@@ -209,13 +105,13 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "Model_layer", "name": "Model_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"brand", "brand",
"model", "model",
"colour", "colour",
"seats", "seats",
"year", "year",
"ownerId", "ownerID",
"deleted", "deleted",
"state" "state"
], ],
...@@ -231,8 +127,8 @@ def add_layers(use_case:str, table_name: str): ...@@ -231,8 +127,8 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "CarState_layer", "name": "CarState_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"ownerId", "ownerID",
"deleted", "deleted",
"state" "state"
], ],
...@@ -243,20 +139,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -243,20 +139,7 @@ def add_layers(use_case:str, table_name: str):
} }
] ]
jwt = TokenManager.getInstance().getToken() postLayersToSwagger(use_case,layers)
for layer in layers:
url = f"https://articonf1.itec.aau.at:30420/api/layers"
response = requests.post(
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = layer
)
print(url+": "+str(response.status_code))
def main(use_case: str): def main(use_case: str):
print("CAR") print("CAR")
......
import network_constants as nc from _add_use_case_scripts.car_sharing.tables.requestPost import postLayersToSwagger, postTableToSwagger
from security.token_manager import TokenManager
import requests
def add_table(use_case: str, table_name: str): def add_table(use_case: str, table_name: str):
''' '''
take the columns and add the mappings at the server take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_" replace all "/"'s in the internal representation with a "_"
''' '''
jwt = TokenManager.getInstance().getToken()
# TODO Manuel: check back with alex # TODO Manuel: check back with alex
...@@ -33,23 +29,12 @@ def add_table(use_case: str, table_name: str): ...@@ -33,23 +29,12 @@ def add_table(use_case: str, table_name: str):
columns["username"] = "connection//username" columns["username"] = "connection//username"
columns["password"] = "connection//password" columns["password"] = "connection//password"
url = f"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table = { table = {
"name": table_name, "name": table_name,
"mappings": columns "mappings": columns
} }
response = requests.post( postTableToSwagger(use_case,table)
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = table
)
print(url+": "+str(response.status_code))
def add_layers(use_case:str, table_name: str): def add_layers(use_case:str, table_name: str):
layers = [ layers = [
...@@ -58,7 +43,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -58,7 +43,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "document_layer", "name": "document_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"document1id", "document1id",
"document1collection", "document1collection",
"document1hash" "document1hash"
...@@ -76,7 +61,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -76,7 +61,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "connection_layer", "name": "connection_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"database", "database",
"databaseType", "databaseType",
"host", "host",
...@@ -95,7 +80,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -95,7 +80,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "connection_layer", "name": "connection_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"username", "username",
"password" "password"
...@@ -108,20 +93,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -108,20 +93,7 @@ def add_layers(use_case:str, table_name: str):
} }
] ]
jwt = TokenManager.getInstance().getToken() postLayersToSwagger(use_case,layers)
for layer in layers:
url = f"https://articonf1.itec.aau.at:30420/api/layers"
response = requests.post(
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = layer
)
print(url+": "+str(response.status_code))
def main(use_case: str): def main(use_case: str):
print("HASH") print("HASH")
......
import network_constants as nc from _add_use_case_scripts.car_sharing.tables.requestPost import postLayersToSwagger, postTableToSwagger
from security.token_manager import TokenManager
import requests
def add_table(use_case: str, table_name: str): def add_table(use_case: str, table_name: str):
''' '''
take the columns and add the mappings at the server take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_" replace all "/"'s in the internal representation with a "_"
''' '''
jwt = TokenManager.getInstance().getToken()
# TODO check back with alex # TODO check back with alex
...@@ -33,31 +29,21 @@ def add_table(use_case: str, table_name: str): ...@@ -33,31 +29,21 @@ def add_table(use_case: str, table_name: str):
columns = { c : c for c in columns } columns = { c : c for c in columns }
columns["UniqueID"] = "id" columns["UniqueID"] = "id"
columns["carId"] = "car//_id" columns["carID"] = "car//_id"
columns["carOwner"] = "car//ownerID" columns["carOwner"] = "car//ownerID"
##TODO Question: should i get all the data from the car field? or just the car id/owner? ##TODO Question: should i get all the data from the car field? or just the car id/owner?
columns["startLatitude"] = "startPlace//latitude" columns["startLatitude"] = "startPlace//latitude"
columns["startLongitude"] = "startPlace//longitude" columns["startLongitude"] = "startPlace//longitude"
#TODO what if there are more end places? how can i define them? i can only get the first index of the array #TODO what if there are more end places? how can i define them? i can only get the first index of the array
columns["endLatitudeFirst"] = "endPlace[0]//latitude" columns["endFirstLatitude"] = "endPlace[0]//latitude"
columns["endLongitudeFirst"] = "endPlace[0]//longitude" columns["endFirstLongitude"] = "endPlace[0]//longitude"
url = f"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table = { table = {
"name": table_name, "name": table_name,
"mappings": columns "mappings": columns
} }
response = requests.post( postTableToSwagger(use_case,table)
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = table
)
print(url+": "+str(response.status_code))
def add_layers(use_case:str, table_name: str): def add_layers(use_case:str, table_name: str):
layers = [ layers = [
...@@ -67,7 +53,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -67,7 +53,7 @@ def add_layers(use_case:str, table_name: str):
"name": "OfferStartLocation_layer", "name": "OfferStartLocation_layer",
"properties": [ "properties": [
"UniqueID", "UniqueID",
"carId", "carID",
"carOwner", "carOwner",
"startLatitude", "startLatitude",
"startLongitude", "startLongitude",
...@@ -88,7 +74,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -88,7 +74,7 @@ def add_layers(use_case:str, table_name: str):
"name": "OfferEndLocation_layer", "name": "OfferEndLocation_layer",
"properties": [ "properties": [
"UniqueID", "UniqueID",
"carId", "carID",
"carOwner", "carOwner",
"startLatitude", "startLatitude",
"startLongitude", "startLongitude",
...@@ -109,12 +95,12 @@ def add_layers(use_case:str, table_name: str): ...@@ -109,12 +95,12 @@ def add_layers(use_case:str, table_name: str):
"name": "OfferedCar_layer", "name": "OfferedCar_layer",
"properties": [ "properties": [
"UniqueID", "UniqueID",
"carId", "carID",
"carOwner" "carOwner"
], ],
"cluster_properties": [ "cluster_properties": [
"carId", "carID",
"carOwner" "carOwner"
] ]
}, },
...@@ -124,6 +110,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -124,6 +110,7 @@ def add_layers(use_case:str, table_name: str):
"name": "OfferPrice_layer", "name": "OfferPrice_layer",
"properties": [ "properties": [
"UniqueID", "UniqueID",
"carOwner",
"priceForKm", "priceForKm",
"priceForTime", "priceForTime",
"deposit" "deposit"
...@@ -142,6 +129,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -142,6 +129,7 @@ def add_layers(use_case:str, table_name: str):
"name": "OfferTime_layer", "name": "OfferTime_layer",
"properties": [ "properties": [
"UniqueID", "UniqueID",
"carOwner",
"startDate", "startDate",
"endDate" "endDate"
...@@ -158,6 +146,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -158,6 +146,7 @@ def add_layers(use_case:str, table_name: str):
"name": "OfferStatus_layer", "name": "OfferStatus_layer",
"properties": [ "properties": [
"UniqueID", "UniqueID",
"carOwner",
"available", "available",
"deleted" "deleted"
...@@ -170,20 +159,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -170,20 +159,7 @@ def add_layers(use_case:str, table_name: str):
} }
] ]
jwt = TokenManager.getInstance().getToken() postLayersToSwagger(use_case,layers)
for layer in layers:
url = f"https://articonf1.itec.aau.at:30420/api/layers"
response = requests.post(
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = layer
)
print(url+": "+str(response.status_code))
def main(use_case: str): def main(use_case: str):
print("OFFER") print("OFFER")
......
import network_constants as nc from _add_use_case_scripts.car_sharing.tables.requestPost import postLayersToSwagger, postTableToSwagger
from security.token_manager import TokenManager
import requests
def add_table(use_case: str, table_name: str): def add_table(use_case: str, table_name: str):
''' '''
take the columns and add the mappings at the server take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_" replace all "/"'s in the internal representation with a "_"
''' '''
jwt = TokenManager.getInstance().getToken()
use_case = "car-sharing" use_case = "car-sharing"
columns = [ columns = [
# "doctype", # "doctype",
"id" "id",
"text" "text",
#"media" #"media"
#"location" #"location"
"user" "user",
"date" "date",
#"likesUsers" #"likesUsers"
#"reportedBy" #"reportedBy"
"deleted" "deleted",
"answerTo" "answerTo"
] ]
...@@ -34,51 +30,22 @@ def add_table(use_case: str, table_name: str): ...@@ -34,51 +30,22 @@ def add_table(use_case: str, table_name: str):
columns["latitude"] = "location//latitude" columns["latitude"] = "location//latitude"
columns["longitude"] = "location//longitude" columns["longitude"] = "location//longitude"
#TODO get Likes/reportedBy? #TODO get Likes/reportedBy?
url = f"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table = { table = {
"name": table_name, "name": table_name,
"mappings": columns "mappings": columns
} }
response = requests.post( postTableToSwagger(use_case,table)
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = table
)
print(url+": "+str(response.status_code))
def add_layers(use_case:str, table_name: str): def add_layers(use_case:str, table_name: str):
layers = [ layers = [
{
"use_case": use_case,
"table": table_name,
"name": "PublicationGeneral_layer",
"properties": [
"UniqueId",
"text",
"user",
"mediaUrlFirst",
"mediaTypeFirst",
"mediaLabelsFirst",
"latitude",
"longitude"
],
"cluster_properties": [
#TODO What to add?
]
},
{ {
"use_case": use_case, "use_case": use_case,
"table": table_name, "table": table_name,
"name": "PublicationLocation_layer", "name": "PublicationLocation_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"user", "user",
"latitude", "latitude",
"longitude" "longitude"
...@@ -94,7 +61,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -94,7 +61,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "PublicationTime_layer", "name": "PublicationTime_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"user", "user",
"latitude", "latitude",
"longitude" "longitude"
...@@ -109,7 +76,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -109,7 +76,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "PublicationUser_layer", "name": "PublicationUser_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"text", "text",
"user", "user",
"mediaUrlFirst", "mediaUrlFirst",
...@@ -126,34 +93,21 @@ def add_layers(use_case:str, table_name: str): ...@@ -126,34 +93,21 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "PublicationStatus_layer", "name": "PublicationStatus_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"text", "text",
"user", "user",
"status", "deleted",
"answerTo" "answerTo"
], ],
"cluster_properties": [ "cluster_properties": [
"status", "deleted",
"answerTo" "answerTo"
] ]
} }
] ]
jwt = TokenManager.getInstance().getToken() postLayersToSwagger(use_case,layers)
for layer in layers:
url = f"https://articonf1.itec.aau.at:30420/api/layers"
response = requests.post(
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = layer
)
print(url+": "+str(response.status_code))
def main(use_case: str): def main(use_case: str):
print("PUBLICATION") print("PUBLICATION")
......
import network_constants as nc from _add_use_case_scripts.car_sharing.tables.requestPost import postLayersToSwagger, postTableToSwagger
from security.token_manager import TokenManager
import requests
def add_table(use_case: str, table_name: str): def add_table(use_case: str, table_name: str):
''' '''
take the columns and add the mappings at the server take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_" replace all "/"'s in the internal representation with a "_"
''' '''
jwt = TokenManager.getInstance().getToken()
# TODO disscuss with others if it looks ok # TODO disscuss with others if it looks ok
...@@ -42,7 +38,7 @@ def add_table(use_case: str, table_name: str): ...@@ -42,7 +38,7 @@ def add_table(use_case: str, table_name: str):
columns = { c : c for c in columns } columns = { c : c for c in columns }
columns["UniqueID"] = "id" columns["UniqueID"] = "id"
columns["user1Id"] = "users[0]//userId" columns["user1ID"] = "users[0]//userId"
columns["user1PassengersNr"] = "users[0]//passengers" columns["user1PassengersNr"] = "users[0]//passengers"
columns["isDriver"] = "users[0]//isDriver" columns["isDriver"] = "users[0]//isDriver"
columns["startPlaceLatitude"] = "startPlace//Latitude" columns["startPlaceLatitude"] = "startPlace//Latitude"
...@@ -63,40 +59,30 @@ def add_table(use_case: str, table_name: str): ...@@ -63,40 +59,30 @@ def add_table(use_case: str, table_name: str):
columns["startedBy1Moment"] = "startedBy[0]//moment" columns["startedBy1Moment"] = "startedBy[0]//moment"
columns["startedBy1User"] = "startedBy[0]//user" columns["startedBy1User"] = "startedBy[0]//user"
#TODO CheckedBy,CanceledBy usefull? #TODO CheckedBy,CanceledBy usefull?
url = f"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case}/tables"
table = { table = {
"name": table_name, "name": table_name,
"mappings": columns "mappings": columns
} }
response = requests.post( postTableToSwagger(use_case,table)
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = table
)
print(url+": "+str(response.status_code))
def add_layers(use_case:str, table_name: str): def add_layers(use_case:str, table_name: str):
layers = [ layers = [
{ {
"use_case": use_case, "use_case": use_case,
"table": table_name, "table": table_name,
"name": "User_Layer", "name": "TravelUser_Layer",
"properties": [ "properties": [
'UniqueID', 'UniqueID',
'user1Id', 'user1ID',
'isDriver', 'isDriver',
'score1User', 'score1User',
'score1Rating', 'score1Rating',
'startedBy1User' 'startedBy1User'
], ],
"cluster_properties": [ "cluster_properties": [
'user1Id' 'user1ID'
] ]
}, },
{ {
...@@ -104,7 +90,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -104,7 +90,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "StartingPoint_Layer", "name": "StartingPoint_Layer",
"properties": [ "properties": [
'user1Id', 'user1ID',
'UniqueID', 'UniqueID',
'startPlaceLatitude', 'startPlaceLatitude',
'startPlaceLongitude', 'startPlaceLongitude',
...@@ -120,7 +106,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -120,7 +106,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "StartingTime_Layer", "name": "StartingTime_Layer",
"properties": [ "properties": [
'user1Id', 'user1ID',
'UniqueID', 'UniqueID',
'startDate', 'startDate',
'endDate', 'endDate',
...@@ -136,7 +122,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -136,7 +122,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "Destination_Layer", "name": "Destination_Layer",
"properties": [ "properties": [
'user1Id', 'user1ID',
'UniqueID', 'UniqueID',
'endPlace1Latitude', 'endPlace1Latitude',
'endPlace1Longitude', 'endPlace1Longitude',
...@@ -153,7 +139,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -153,7 +139,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "FinishedTime_Layer", "name": "FinishedTime_Layer",
"properties": [ "properties": [
'user1Id', 'user1ID',
'UniqueID', 'UniqueID',
'startDate', 'startDate',
'endDate', 'endDate',
...@@ -169,7 +155,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -169,7 +155,7 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "Price_Layer", "name": "Price_Layer",
"properties": [ "properties": [
'user1Id', 'user1ID',
'UniqueID', 'UniqueID',
'totalPrice', 'totalPrice',
'kmTraveled', 'kmTraveled',
...@@ -191,10 +177,11 @@ def add_layers(use_case:str, table_name: str): ...@@ -191,10 +177,11 @@ def add_layers(use_case:str, table_name: str):
"name": "Status_Layer", "name": "Status_Layer",
"properties": [ "properties": [
'UniqueID', 'UniqueID',
'user1Id', 'user1ID',
'status', 'status',
'score1User', 'score1User',
'score1Rating' 'score1Rating',
'rentForTime'
], ],
"cluster_properties": [ "cluster_properties": [
'status', 'status',
...@@ -204,20 +191,7 @@ def add_layers(use_case:str, table_name: str): ...@@ -204,20 +191,7 @@ def add_layers(use_case:str, table_name: str):
} }
] ]
jwt = TokenManager.getInstance().getToken() postLayersToSwagger(use_case,layers)
for layer in layers:
url = f"https://articonf1.itec.aau.at:30420/api/layers"
response = requests.post(
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = layer
)
print(url+": "+str(response.status_code))
def main(use_case: str): def main(use_case: str):
print("TRAVEL") print("TRAVEL")
......
...@@ -15,12 +15,12 @@ def add_table(use_case: str, table_name: str): ...@@ -15,12 +15,12 @@ def add_table(use_case: str, table_name: str):
"id", # pk "id", # pk
"balance", "balance",
"payerId", "payerId",
"numberOfTrips", "numberOfTripsDone",
"sumOfTripsScores" "sumOfTripsScores"
] ]
columns = { c : c for c in columns } columns = { c : c for c in columns }
columns["UniqueId"] = "id" columns["UniqueID"] = "id"
table = { table = {
"name": table_name, "name": table_name,
...@@ -37,16 +37,16 @@ def add_layers(use_case:str, table_name: str): ...@@ -37,16 +37,16 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "User_layer", "name": "User_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"balance", "balance",
"payerId", "payerId",
"numberOfTrips", "numberOfTripsDone",
"sumOfTripsScores" "sumOfTripsScores"
], ],
"cluster_properties": [ "cluster_properties": [
"balance", "balance",
"numberOfTrips", "numberOfTripsDone",
"sumOfTripsScores" "sumOfTripsScores"
] ]
}, },
...@@ -55,10 +55,10 @@ def add_layers(use_case:str, table_name: str): ...@@ -55,10 +55,10 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "UserBalance_layer", "name": "UserBalance_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"balance", "balance",
"payerId", "payerId",
"numberOfTrips", "numberOfTripsDone",
"sumOfTripsScores" "sumOfTripsScores"
], ],
...@@ -72,15 +72,15 @@ def add_layers(use_case:str, table_name: str): ...@@ -72,15 +72,15 @@ def add_layers(use_case:str, table_name: str):
"table": table_name, "table": table_name,
"name": "UserVeterancy_layer", "name": "UserVeterancy_layer",
"properties": [ "properties": [
"UniqueId", "UniqueID",
"balance", "balance",
"payerId", "payerId",
"numberOfTrips", "numberOfTripsDone",
"sumOfTripsScores" "sumOfTripsScores"
], ],
"cluster_properties": [ "cluster_properties": [
"numberOfTrips", "numberOfTripsDone",
"sumOfTripsScores" "sumOfTripsScores"
] ]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment