1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-28 23:44:19 +00:00

Database fixes

Damn typos. Nuke'm.
This commit is contained in:
Lorenzo Balugani 2021-04-22 16:54:27 +02:00
parent 20803316ee
commit 28bb5ed4e6
5 changed files with 11 additions and 10 deletions

View file

@ -5,7 +5,7 @@ from flask import Flask
import os
import werkzeug.middleware.proxy_fix
from .routes import *
from database import Base, tables
from .database import Base, tables
import psycopg2
@ -19,7 +19,7 @@ app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:password@localhos
Base.app = app
Base.init_app(app)
# Routes setup
app.add_url_rule("/doa", view_func=page_doa, methods=["GET"])
app.add_url_rule("/doa", view_func=page_doa, methods=["GET", "POST"])
if __name__ == "__main__":
Base.create_all()

View file

@ -15,5 +15,5 @@ class Alert(Base.Model):
repository_id = Base.Column(Base.Integer, Base.ForeignKey("repository.id"), nullable=False)
# Relationships
repository = Base.relationship("Repository", back_populates="alerts")
notifications = Base.relationship("Notifications", back_populates="alerts")
notifications = Base.relationship("Notification", back_populates="alert")
operations = Base.relationship("BoolOperation", back_populates="alert")

View file

@ -19,7 +19,7 @@ class BoolOperation(Base.Model):
# Relationships
condition = Base.relationship("Condition", back_populates="operations")
node_1 = Base.relationship("BoolOperation", primaryjoin=("bool_operation.c.node_1_id==bool_operation.c.id"),
remote_side="BoolOperation.id", backref=backref("father", uselist=False))
remote_side="BoolOperation.id", backref=backref("father_1", uselist=False))
node_2 = Base.relationship("BoolOperation", primaryjoin=("bool_operation.c.node_2_id==bool_operation.c.id"),
remote_side="BoolOperation.id", backref=backref("father", uselist=False))
remote_side="BoolOperation.id", backref=backref("father_2", uselist=False))
alert = Base.relationship("Alert", back_populates="operations")

View file

@ -18,3 +18,4 @@ class Repository(Base.Model):
authorizations = Base.relationship("Authorization", back_populates="repository")
tweets = Base.relationship("Composed", back_populates="repository")
alerts = Base.relationship("Alert", back_populates="repository")
uses = Base.relationship("Uses", back_populates="repository")

View file

@ -2,12 +2,12 @@
Page that displays a message if the server is on
"""
from flask import render_template, abort
from flask import render_template, abort, jsonify, request
from ..database import *
def page_doa():
utente = Utente()
utente = User()
if request.method == "GET":
return "Get"
return "If you see this, the server is fine."