Skip to content

Commit

Permalink
code updated
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarocosta committed Jun 22, 2020
1 parent dd329a8 commit 632b37c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions frontend/src/app/service/my-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ export class MyServiceService {
}

getAllTitleTypes(): Observable<any> {
return this.http.get<any>(this.baseUrl + 'control_values/type_titles');
return this.http.get<any>(this.baseUrl + 'control_values/title_types');
}

getAllIdentifierTypes(): Observable<any> {
return this.http.get<any>(this.baseUrl + 'control_values/type_identifiers');
return this.http.get<any>(this.baseUrl + 'control_values/identifier_types');
}

constructor(private http: HttpClient) {
Expand Down
26 changes: 14 additions & 12 deletions src/Routes/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_project_root():

from src.Utils.JsonEncoder import search_cidoc, search_specific_cidoc
from src.Utils.Utils import get_node_by_uid, build_next_json, updated_node, make_result, build_information_eva, \
search_type_identifiers, search_type_titles
search_identifier_types, search_title_types

#import src.Utils.ArgParser as ArgParser

Expand Down Expand Up @@ -259,35 +259,37 @@ def get_templates_from_entity(uid):
return make_response(jsonify(message="Node doesn't exists"), 404)


#verificar se é do tipo E24, E18
@app.route("/eva/<uid>", methods=["GET"])
@cross_origin()
def response_eva_view(uid):
node = get_node_by_uid(uid)
if node is not None:
response = build_information_eva(node)
if response:
return make_response(jsonify(response), 201)
if node.__class__.__name__ is not "E24_Physical_Human_Made_ThingSchema" or node.__class__.__name__ is not "E18_Physical_ThingSchema":
if node is not None:
response = build_information_eva(node)
if response:
return make_response(jsonify(response), 201)
else:
make_response(jsonify(message="Node doesn't have information"), 404)
else:
make_response(jsonify(message="Node doesn't have information"), 404)
return make_response(jsonify(message="Node doesn't exists"), 404)
else:
return make_response(jsonify(message="Node doesn't exists"), 404)
return make_response(jsonify(message="Node is not a valid type"), 404)


@app.route("/control_values/type_identifiers", methods=["GET"])
@app.route("/control_values/identifier_types", methods=["GET"])
@cross_origin()
def response_type_identifiers():
response = search_type_identifiers()
response = search_identifier_types()
if response:
return make_response(jsonify(response), 201)
else:
return make_response(jsonify(message="Doesn't have information"), 404)


@app.route("/control_values/type_titles", methods=["GET"])
@app.route("/control_values/title_types", methods=["GET"])
@cross_origin()
def response_type_titles():
response = search_type_titles()
response = search_title_types()
if response:
return make_response(jsonify(response), 201)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def build_information_eva(node):
return result


def search_type_identifiers():
def search_identifier_types():
result = []
identifiers = ARE5_Identifier_Type.nodes.all()
for identifier in identifiers:
Expand All @@ -656,7 +656,7 @@ def search_type_identifiers():
return result


def search_type_titles():
def search_title_types():
result = []
# formals_titles = ARE2_Formal_Title.nodes.all()
# supplied_titles = ARE3_Supplied_Title.nodes.all()
Expand Down

0 comments on commit 632b37c

Please sign in to comment.