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:
parent
20803316ee
commit
28bb5ed4e6
5 changed files with 11 additions and 10 deletions
|
@ -5,7 +5,7 @@ from flask import Flask
|
||||||
import os
|
import os
|
||||||
import werkzeug.middleware.proxy_fix
|
import werkzeug.middleware.proxy_fix
|
||||||
from .routes import *
|
from .routes import *
|
||||||
from database import Base, tables
|
from .database import Base, tables
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:password@localhos
|
||||||
Base.app = app
|
Base.app = app
|
||||||
Base.init_app(app)
|
Base.init_app(app)
|
||||||
# Routes setup
|
# 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__":
|
if __name__ == "__main__":
|
||||||
Base.create_all()
|
Base.create_all()
|
||||||
|
|
|
@ -15,5 +15,5 @@ class Alert(Base.Model):
|
||||||
repository_id = Base.Column(Base.Integer, Base.ForeignKey("repository.id"), nullable=False)
|
repository_id = Base.Column(Base.Integer, Base.ForeignKey("repository.id"), nullable=False)
|
||||||
# Relationships
|
# Relationships
|
||||||
repository = Base.relationship("Repository", back_populates="alerts")
|
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")
|
operations = Base.relationship("BoolOperation", back_populates="alert")
|
|
@ -19,7 +19,7 @@ class BoolOperation(Base.Model):
|
||||||
# Relationships
|
# Relationships
|
||||||
condition = Base.relationship("Condition", back_populates="operations")
|
condition = Base.relationship("Condition", back_populates="operations")
|
||||||
node_1 = Base.relationship("BoolOperation", primaryjoin=("bool_operation.c.node_1_id==bool_operation.c.id"),
|
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"),
|
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")
|
alert = Base.relationship("Alert", back_populates="operations")
|
||||||
|
|
|
@ -17,4 +17,5 @@ class Repository(Base.Model):
|
||||||
owner = Base.relationship("User", back_populates="owner_of")
|
owner = Base.relationship("User", back_populates="owner_of")
|
||||||
authorizations = Base.relationship("Authorization", back_populates="repository")
|
authorizations = Base.relationship("Authorization", back_populates="repository")
|
||||||
tweets = Base.relationship("Composed", back_populates="repository")
|
tweets = Base.relationship("Composed", back_populates="repository")
|
||||||
alerts = Base.relationship("Alert", back_populates="repository")
|
alerts = Base.relationship("Alert", back_populates="repository")
|
||||||
|
uses = Base.relationship("Uses", back_populates="repository")
|
|
@ -2,12 +2,12 @@
|
||||||
Page that displays a message if the server is on
|
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 *
|
from ..database import *
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def page_doa():
|
def page_doa():
|
||||||
utente = Utente()
|
utente = User()
|
||||||
|
if request.method == "GET":
|
||||||
|
return "Get"
|
||||||
return "If you see this, the server is fine."
|
return "If you see this, the server is fine."
|
||||||
|
|
Loading…
Reference in a new issue