diff --git a/code/backend/nest_backend/routes/repository/alerts/alert.py b/code/backend/nest_backend/routes/repository/alerts/alert.py index de55f54..4b968e3 100644 --- a/code/backend/nest_backend/routes/repository/alerts/alert.py +++ b/code/backend/nest_backend/routes/repository/alerts/alert.py @@ -1,6 +1,6 @@ from flask import render_template, abort, jsonify, request from nest_backend.database import * -from flask_jwt_extended import jwt_required +from flask_jwt_extended import jwt_required, get_jwt_identity from nest_backend.gestione import * from flask_cors import cross_origin import datetime diff --git a/code/backend/nest_backend/routes/repository/alerts/repository_alerts.py b/code/backend/nest_backend/routes/repository/alerts/repository_alerts.py index ebee173..7b6be41 100644 --- a/code/backend/nest_backend/routes/repository/alerts/repository_alerts.py +++ b/code/backend/nest_backend/routes/repository/alerts/repository_alerts.py @@ -1,6 +1,6 @@ from flask import render_template, abort, jsonify, request from nest_backend.database import * -from flask_jwt_extended import jwt_required +from flask_jwt_extended import jwt_required, get_jwt_identity from nest_backend.gestione import * from flask_cors import cross_origin diff --git a/code/backend/nest_backend/routes/repository/conditions/condition.py b/code/backend/nest_backend/routes/repository/conditions/condition.py index b04ccad..41aa68a 100644 --- a/code/backend/nest_backend/routes/repository/conditions/condition.py +++ b/code/backend/nest_backend/routes/repository/conditions/condition.py @@ -1,6 +1,6 @@ from flask import render_template, abort, jsonify, request from nest_backend.database import * -from flask_jwt_extended import jwt_required +from flask_jwt_extended import jwt_required, get_jwt_identity from nest_backend.gestione import * from flask_cors import cross_origin diff --git a/code/backend/nest_backend/routes/repository/conditions/repository_conditions.py b/code/backend/nest_backend/routes/repository/conditions/repository_conditions.py index a7ac435..26382b4 100644 --- a/code/backend/nest_backend/routes/repository/conditions/repository_conditions.py +++ b/code/backend/nest_backend/routes/repository/conditions/repository_conditions.py @@ -4,7 +4,7 @@ from nest_backend.gestione import repository_auth, json_error, json_success, Con find_user, get_jwt_identity from nest_backend.database import ext from flask_cors import cross_origin -from gestione import hashtag_validator +from nest_backend.gestione import hashtag_validator @cross_origin() diff --git a/code/backend/nest_backend/routes/repository/repositories.py b/code/backend/nest_backend/routes/repository/repositories.py index de4ded7..eea48bc 100644 --- a/code/backend/nest_backend/routes/repository/repositories.py +++ b/code/backend/nest_backend/routes/repository/repositories.py @@ -1,6 +1,6 @@ from flask import render_template, abort, jsonify, request from nest_backend.database import * -from flask_jwt_extended import jwt_required +from flask_jwt_extended import jwt_required, get_jwt_identity from nest_backend.gestione import * import datetime from flask_cors import cross_origin diff --git a/code/backend/nest_backend/routes/repository/repository.py b/code/backend/nest_backend/routes/repository/repository.py index 5a97927..7746b41 100644 --- a/code/backend/nest_backend/routes/repository/repository.py +++ b/code/backend/nest_backend/routes/repository/repository.py @@ -1,11 +1,12 @@ from flask import render_template, abort, jsonify, request from nest_backend.database import * -from flask_jwt_extended import jwt_required +from flask_jwt_extended import jwt_required, get_jwt_identity from nest_backend.gestione import * from flask_cors import cross_origin import datetime + @cross_origin() @jwt_required() @repository_auth @@ -210,6 +211,9 @@ def page_repository(rid): type_ = ConditionType(c['type']) except KeyError: return json_error("Unknown `type` specified."), 400 - ext.session.add(Condition(type=type_, content=c['content'], repository_id=rid)) + content = c['content'] + if type_ == ConditionType.hashtag: + content = hashtag_validator(content) + ext.session.add(Condition(type=type_, content=content, repository_id=rid)) ext.session.commit() return json_success(repository.to_json()), 200 diff --git a/code/backend/nest_backend/routes/users/user.py b/code/backend/nest_backend/routes/users/user.py index c8d8ee8..92900fa 100644 --- a/code/backend/nest_backend/routes/users/user.py +++ b/code/backend/nest_backend/routes/users/user.py @@ -1,6 +1,6 @@ from flask import render_template, abort, jsonify, request from nest_backend.database import * -from flask_jwt_extended import jwt_required +from flask_jwt_extended import jwt_required, get_jwt_identity from nest_backend.gestione import * from flask_cors import cross_origin diff --git a/code/backend/nest_backend/routes/users/users.py b/code/backend/nest_backend/routes/users/users.py index 86eff1c..51e66f6 100644 --- a/code/backend/nest_backend/routes/users/users.py +++ b/code/backend/nest_backend/routes/users/users.py @@ -1,6 +1,6 @@ from flask import render_template, abort, jsonify, request from nest_backend.database import * -from flask_jwt_extended import jwt_required +from flask_jwt_extended import jwt_required, get_jwt_identity from nest_backend.gestione import * from flask_cors import cross_origin