Esempio n. 1
0
class Secuencia(db.Model):

    __tablename__ = 'secuencias'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    customer_id = db.Column(db.Integer, db.ForeignKey('customers.id'), nullable=False)
    radar_id = db.Column(db.Integer, db.ForeignKey('radares.id'), nullable=False) # ID de radar
    web_path = db.Column(db.String(255), unique=True, nullable=False)
    fs_path = db.Column(db.String(255), unique=True, nullable=False)
    vel_max = db.Column(db.Integer, nullable=False)
    vel = db.Column(db.Integer, nullable=False)
    secuencia = db.Column(db.String(255), unique=True, nullable=False)
    registered_on = db.Column(db.DateTime, nullable=False)
    processed = db.Column(db.Boolean, nullable=False, default=False)
    reprocess = db.Column(db.Boolean, nullable=False, default=False)

    def __init__(self, customer_id,radar_id,web_path,fs_path,vel_max,vel,secuencia,registered_on,processed=False,reprocess=False):
        self.customer_id = customer_id
	self.radar_id = radar_id
	self.web_path = web_path
	self.fs_path = fs_path
	self.vel_max = vel_max
	self.vel = vel
	self.secuencia = secuencia
        self.registered_on = registered_on # datetime.datetime.now()
	self.processed = processed
	self.reprocess = reprocess

    def get_id(self):
        return self.id

    def __repr__(self):
        return '<Secuencia {0}>'.format(self.web_path)
Esempio n. 2
0
class Transaction(db.Model):
    __bind_key__ = 'agwallet'
    __tablename__ = 'transactions'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    creditor_account_id = db.Column(db.Integer,
                                    db.ForeignKey('accounts.id'),
                                    nullable=False)
    debitor_account_id = db.Column(db.Integer,
                                   db.ForeignKey('accounts.id'),
                                   nullable=False)
    amount = db.Column(db.Integer, nullable=False)
    exchange_rate = db.Column(db.Integer, nullable=False)
    date = db.Column(db.DateTime, nullable=False)
    notes = db.Column(db.String(255))
    created_on = db.Column(db.DateTime, nullable=False)

    def __init__(self, user_id, creditor_account_id, debitor_account_id,
                 amount, exchange_rate, date, notes):
        self.user_id = user_id
        self.creditor_account_id = creditor_account_id
        self.debitor_account_id = debitor_account_id
        self.amount = amount
        self.exchange_rate = exchange_rate
        self.date = date
        self.notes = notes
        self.created_on = datetime.datetime.now()
Esempio n. 3
0
class Donation(db.Model):

    __tablename__ = "donations"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    hospital_id = db.Column(db.Integer,
                            db.ForeignKey('hospitals.id'),
                            nullable=False)
    donor_id = db.Column(db.Integer,
                         db.ForeignKey('donors.id'),
                         nullable=False)

    volume_of_blood = db.Column(db.Integer)
    onset_time = db.Column(db.DateTime())
    termination_time = db.Column(db.DateTime())
    torfru = db.Column(db.DateTime())

    created_at = db.Column(db.DateTime, default=db.func.now())
    updated_at = db.Column(db.DateTime, default=db.func.now())

    def _asdict(self):
        return {
            c.key: getattr(self, c.key)
            for c in db.inspect(self).mapper.column_attrs
        }

    @hybrid_method
    def update_donor_dolbd(self):
        if self.donor:
            self.donor.update_dolbd(self.created_at)
Esempio n. 4
0
class Itinerary(db.Model):

    __tablename__ = "itineraries"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255), nullable=False)
    events = db.relationship("Event",
                             secondary=itinerary_events,
                             back_populates="itineraries")
    trip = db.relationship("Trip", back_populates="itineraries")
    trip_id = db.Column(db.Integer, db.ForeignKey("trips.id"))
    user_id = db.Column(db.Integer, db.ForeignKey("users.id"))
    user = db.relationship("User", foreign_keys=[user_id])
    app_user_id = db.Column(db.Integer, db.ForeignKey("users.id"))
    approved_user = db.relationship("User", foreign_keys=[app_user_id])
    req_user_id = db.Column(db.Integer, db.ForeignKey("users.id"))
    requesting_user = db.relationship("User", foreign_keys=[req_user_id])
    last_edited = db.Column(db.DateTime)

    def __init__(self, name, trip, user):
        self.name = name
        self.trip = trip
        self.user = user
        self.last_login = datetime.datetime.now()
        self.approved_user = None
        self.requesting_user = None

    def update_edited(self):
        self.last_edited = datetime.datetime.now()
Esempio n. 5
0
class Answer(db.Model):

    __tablename__ = 'answer'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    question_id = db.Column(db.Integer,
                            db.ForeignKey('question.id'),
                            nullable=False)
    section_id = db.Column(db.Integer,
                           db.ForeignKey('section.id'),
                           nullable=False)
    answer_sel = db.Column(db.String(255), nullable=True)
    comments = db.Column(db.String(255), nullable=False)
    created_date = db.Column(db.DateTime, nullable=False)
    modified_date = db.Column(db.DateTime, nullable=True)

    # attachment = db.relationship('Attachments', backref='answer', lazy=True)

    def __init__(self, question_id, section_id, answer_sel, comments):
        self.question_id = question_id
        self.section_id = section_id
        self.answer_sel = answer_sel
        self.comments = comments
        self.created_date = datetime.datetime.now()

    def __repr__(self):
        return '<Answer %r>' % (self.comments)

    def to_dict(self):
        return {
            c.key: getattr(self, c.key)
            for c in inspect(self).mapper.column_attrs
        }
Esempio n. 6
0
class DpiAudit(db.Model):

    __tablename__ = 'Dpiaudit'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    question_id = db.Column(db.Integer,
                            db.ForeignKey('question.id'),
                            nullable=False)
    section_id = db.Column(db.Integer,
                           db.ForeignKey('section.id'),
                           nullable=False)
    description = db.Column(db.String(255), nullable=False)
    owner_id = db.Column(db.String(255), nullable=False)
    created_date = db.Column(db.DateTime, nullable=False)
    modified_date = db.Column(db.DateTime, nullable=True)

    def __init__(self, question_id, section_id, owner_id, description):
        self.question_id = question_id
        self.section_id = section_id
        self.owner_id = owner_id
        self.description = description
        self.created_date = datetime.datetime.now()

    def __repr__(self):
        return '<Action %r>' % (self.owner_id)

    def to_dict(self):
        return {
            c.key: getattr(self, c.key)
            for c in inspect(self).mapper.column_attrs
        }
Esempio n. 7
0
class UserModule(db.Model):
    __tablename__ = 'user_modules'
    id = db.Column(db.Integer(), primary_key=True)
    user_id = db.Column(db.Integer(),
                        db.ForeignKey('users.id', ondelete='CASCADE'))
    module_id = db.Column(db.Integer(),
                          db.ForeignKey('modules.id', ondelete='CASCADE'))
Esempio n. 8
0
class Transfusion(db.Model):

    __tablename__ = "transfusions"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    hospital_id = db.Column(db.Integer,
                            db.ForeignKey('hospitals.id'),
                            nullable=False)
    subscriber_id = db.Column(db.Integer,
                              db.ForeignKey('subscribers.id'),
                              nullable=False)
    diagnosis = db.Column(db.String(100))
    hosp_unit = db.Column(db.String(100))
    medical_conditions = db.Column(db.String(100))
    hem_level = db.Column(db.String(100))
    bp_requested = db.Column(db.String(100))
    bp_received = db.Column(db.String(100))
    ubpt = db.Column(db.String(100))
    id_ut = db.Column(db.String(100))
    onset_time = db.Column(db.Time())
    termination_time = db.Column(db.Time())
    effect_of_transfusion = db.Column(db.String(100))
    date_requested = db.Column(db.String(100))
    date_delivered = db.Column(db.String(100))
    patient_end_status = db.Column(db.String(100))
    created_at = db.Column(db.DateTime, default=db.func.now())
    updated_at = db.Column(db.DateTime, default=db.func.now())

    # def __init__(self, diagnosis, hosp_unit, medical_condition, hem_level, bp_requested,
    #             bp_received, id_ut, onset_time, eo_transfusion, tt, eot, date_requested, date_delivered,
    #             pe_status):
    # self.email = email
    # self.first_name = first_name
    # self.middle_name = middle_name
    # self.last_name = last_name
    # self.home_address = home_address
    # self.city = city
    # self.phone1 = phone1
    # self.phone2 = phone2
    # self.cni = cni
    # self.cni_doi = cni_doi
    # self.cni_poi = cni_poi
    # self.dob = dob
    # self.pob = pob
    # self.gender = gender
    # self.blood_group = blood_group
    # self.active = active

    def _asdict(self):
        return {
            c.key: getattr(self, c.key)
            for c in db.inspect(self).mapper.column_attrs
        }

    def _return_data(self):
        data = self._asdict()
        data['hospital'] = self.hospital._asdict()
        data['subscriber'] = self.subscriber._asdict()

        return data
Esempio n. 9
0
class User_Symptom_Treatment(BaseModel, Base):
    """"""
    __tablename__ = 'user_symptom_treatment'
    user_symptom_id = db.Column(db.Integer, db.ForeignKey('user_symptom.id'))
    treatment_id = db.Column(db.Integer, db.ForeignKey('treatment.id'))
    appointment_id = db.Column(db.Integer, db.ForeignKey('appointment.id'))
    date = db.Column(db.DateTime, nullable=False)
    notes = db.Column(db.Text, nullable=True)
Esempio n. 10
0
class Sar(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    assignedTo = db.Column(db.Integer, db.ForeignKey(Users.id), nullable=False)
    otherInfo = db.Column(db.String(255))
    sarDescription = db.Column(db.String(255))
    externalUser = db.Column(db.String(255))
    representative = db.Column(db.String(255))
    user_confirmed = db.Column(db.String(255))
    rep_confirmed = db.Column(db.String(255))
    priority = db.Column(db.String(255))
    completionTime = db.Column(db.DateTime)
    #completionTime = db.Column(db.String(255))
    status = db.Column(db.String(255))
    ticketinfo = db.relationship('TicketInfo',
                                 lazy='dynamic',
                                 backref=db.backref('sar', lazy='joined'))
    ticket = db.relationship('Ticket',
                             lazy='dynamic',
                             cascade='all,delete',
                             innerjoin=True,
                             primaryjoin="Sar.id == Ticket.sar_id",
                             backref=db.backref('sar', lazy='joined'))
    sar_response = db.relationship('SARResponse',
                                   lazy='dynamic',
                                   cascade='all,delete',
                                   backref=db.backref('sar', lazy='joined'))
    user_id = db.Column(db.Integer, db.ForeignKey(Users.id), nullable=False)
    creation_time = db.Column(db.DateTime, nullable=False)
    modification_time = db.Column(db.DateTime, default=datetime.datetime.now())
    created_by = db.Column(db.String(255))
    modified_by = db.Column(db.String(255))
    isEscalated = db.Column(db.Boolean)

    assigned_user = db.relationship('Users', foreign_keys='Sar.assignedTo')
    created_user = db.relationship('Users', foreign_keys='Sar.user_id')

    def __init__(self, data, user_id=None):
        self.assignedTo = data['assignedTo']
        self.otherInfo = data['otherInfo']
        self.sarDescription = data['sarDescription']
        self.externalUser = data['externalUser']
        self.representative = data['representative']
        self.completionTime = datetime.datetime.now()
        self.status = data['status']
        self.creation_time = datetime.datetime.now()
        # self.modification_time = data["modification_time"]
        self.created_by = data["created_by"]
        self.modified_by = data["modified_by"]
        self.isEscalated = data['isEscalated']
        self.priority = data['priority']
        self.user_id = data['user_id']

    def to_dict(self):
        return {
            c.key: getattr(self, c.key)
            for c in inspect(self).mapper.column_attrs
        }
Esempio n. 11
0
class Score(db.Model):
    """
    A user's score on a candidate.feature
    """
    __tablename__ = 'scores'

    user_id = db.Column(pg.UUID, db.ForeignKey('users.id', **fk_cascade), primary_key=True)
    candidate_id = db.Column(pg.UUID, db.ForeignKey('candidates.id', **fk_cascade), primary_key=True)
    feature_id = db.Column(pg.UUID, db.ForeignKey('features.id', **fk_cascade), primary_key=True)
    score = db.Column(db.Integer, nullable=False)  # TODO min: 0, max: 5
Esempio n. 12
0
class User_Symptom(BaseModel, Base):
    """"""
    __tablename__ = 'user_symptom'
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
    symptom_id = db.Column(db.Integer, db.ForeignKey('symptom.id'))
    start_date = db.Column(db.DateTime, nullable=False)
    end_date = db.Column(db.DateTime, nullable=False)
    notes = db.Column(db.Text, nullable=True)
    treatments = db.relationship('Treatment',
                                 secondary='user_symptom_treatment')
Esempio n. 13
0
class OrderRepairAssociation(db.Model, CRUDMixin):
    __tablename__ = 'order_repair_association'
    order_id = db.Column(db.Integer,
                         db.ForeignKey('order.id'),
                         primary_key=True)
    repair_id = db.Column(db.Integer,
                          db.ForeignKey('repair.id'),
                          primary_key=True)

    order = db.relationship("Order", back_populates="_repairs")
    repair = db.relationship("Repair", back_populates="orders")
Esempio n. 14
0
class UserComparison(db.Model):
    """
    Join table of users & comparisons, with any meta (eg permissions)
    """
    __tablename__ = 'users_comparisons'

    user_id = db.Column(pg.UUID, db.ForeignKey('users.id', **fk_cascade), primary_key=True)
    comparison_id = db.Column(pg.UUID, db.ForeignKey('comparisons.id', **fk_cascade), primary_key=True)
    comparison = relationship('Comparison', backref='user_comparison')

    permission = db.Column(db.Enum(PermissionEnum), default=PermissionEnum.owner)
    weight = db.Column(db.Float)  # how much this user's vote counts (keep?)
Esempio n. 15
0
class OrderItem(db.Model):
    __tablename__ = "order_items"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    product_id = db.Column(db.Integer, db.ForeignKey('products.id'))
    quantity = db.Column(db.Integer, nullable=False)
    order_id = db.Column(db.Integer, db.ForeignKey('orders.id'))

    product = db.relationship("Product")

    def total(self):
        return self.product.price * self.quantity
Esempio n. 16
0
class Hunch(db.Model):
    """
    A hunch is a user's score-of-the-moment. Can be done many times per day; unlike a score, which is singleton.
    Hunches are used in a machine-learning algo to _learn_ the feature weights of the user
    """
    __tablename__ = 'hunches'

    # id = db.Column(pg.UUID, primary_key=True, default=uuid_default)
    user_id = db.Column(pg.UUID, db.ForeignKey('users.id', **fk_cascade), primary_key=True)
    candidate_id = db.Column(pg.UUID, db.ForeignKey('candidates.id', **fk_cascade), primary_key=True)
    comparison_id = db.Column(pg.UUID, db.ForeignKey('comparisons.id', **fk_cascade), primary_key=True)

    score = db.Column(db.Integer, nullable=False)  # TODO min: 0, max: 5
    timestamp = db.Column(db.DateTime, nullable=False, primary_key=True, default=datetime.datetime.utcnow)
Esempio n. 17
0
class Rating(db.Model):

    __tablename__ = 'ratings'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    bathroom_id = db.Column(db.Integer,
                            db.ForeignKey('bathrooms.id'),
                            nullable=False)
    rating = db.Column(db.Integer, nullable=False)

    def __init__(self, user_id, bathroom_id, rating):
        self.user_id = user_id
        self.bathroom_id = bathroom_id
        self.rating = rating
Esempio n. 18
0
class Likes(db.Model):
    """ Model for storing likes """
    __tablename__ = "likes"
    user_id = db.Column(db.Integer,
                        db.ForeignKey('users.id'),
                        primary_key=True)
    post_id = db.Column(db.Integer,
                        db.ForeignKey('posts.id'),
                        primary_key=True)
    date = db.Column(db.DateTime, index=True, default=dtm.now)

    def __init__(self, user_id, post_id, **kwargs):
        super(Likes, self).__init__(**kwargs)
        self.user_id = user_id
        self.post_id = post_id
Esempio n. 19
0
class Attachments(db.Model):

    __tablename__ = 'attachments'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    fileName = db.Column(db.String(255), nullable=False)
    documentLink = db.Column(db.String(255), nullable=False)
    question_id = db.Column(db.Integer,
                            db.ForeignKey('question.id'),
                            nullable=False)
    created_date = db.Column(db.DateTime, nullable=False)
    modified_date = db.Column(db.DateTime, nullable=True)

    def __init__(self, fileName, documentLink, question_id):
        self.fileName = fileName
        self.documentLink = documentLink
        self.question_id = question_id
        self.created_date = datetime.datetime.now()

    def __repr__(self):
        return '<Attachments %r>' % (self.fileName)

    def to_dict(self):
        return {
            c.key: getattr(self, c.key)
            for c in inspect(self).mapper.column_attrs
        }
Esempio n. 20
0
class Order(db.Model):

    __tablename__ = "orders"

    class STATUS(Enum):
        PENDING = 'pending'
        COMPLETED = 'completed'
        CANCELLED = 'cancelled'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    number = db.Column(db.String(255), nullable=False, unique=True)
    status = db.Column(db.Enum(STATUS), nullable=False, default=STATUS.PENDING)
    date_created_gmt = db.Column(db.DateTime,
                                 nullable=False,
                                 default=datetime.utcnow)
    modification_date_gmt = db.Column(db.DateTime,
                                      nullable=False,
                                      default=datetime.utcnow)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)

    order_items = db.relationship("OrderItem")

    def get_id(self):
        return self.id

    def total(self):
        return sum(oi.total() for oi in self.order_items)

    def get_status(self):
        return self.status

    def __repr__(self):
        return "<Order {0}>".format(self.number)
Esempio n. 21
0
class Entry(db.Model):
    """
    Entry model for storing selected user text
    """
    __tablename__ = 'entries'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
    text = db.Column(db.Text, nullable=False)
    created_on = db.Column(db.DateTime, nullable=False)
    keywords = db.Column(db.String(500), nullable=True)
    url = db.Column(db.String(500), nullable=False)
    title = db.Column(db.String(500), nullable=False)

    def __init__(self,
                 user_id,
                 text,
                 url,
                 title,
                 created_on=None,
                 keywords=None):
        self.user_id = user_id
        self.text = text
        self.url = url
        self.title = title
        self.created_on = datetime.datetime.now(
        ) if not created_on else created_on
        self.keywords = keywords
Esempio n. 22
0
class Racer(db.Model):

    __tablename__ = 'racers'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    email = db.Column(db.String(255), unique=True)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=True)
    name = db.Column(db.String(255), nullable=False)
    city = db.Column(db.String(255))
    state = db.Column(db.String(255))
    points = db.Column(db.Integer)
    cars = db.relationship('Car', secondary=CarRacer, back_populates='racers')
    sponsors = db.relationship('Sponsor',
                               secondary=RacerSponsor,
                               backref='racers')
    laps = db.relationship('BestLap', backref='racer')
    created_date = db.Column(db.DateTime,
                             default=datetime.datetime.utcnow(),
                             nullable=False)
    updated_date = db.Column(db.DateTime, nullable=True)

    #Picture

    def __init__(self, email, name, city, state, points):
        self.email = email
        self.name = name
        self.city = city
        self.state = state
        self.points = points
        self.created_date = datetime.datetime.now()

    def __repr__(self):
        return '<Racer {0}>'.format(self.name)
Esempio n. 23
0
class SARResponse(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    sarattachment = db.relationship('sar_attachment',
                                    lazy='dynamic',
                                    cascade='all,delete',
                                    backref=db.backref('sarresponse',
                                                       lazy='joined'))
    sar_id = db.Column(db.Integer, db.ForeignKey('sar.id'), nullable=False)
    fromUser = db.Column(db.String(255))
    toUser = db.Column(db.String(255))
    responseText = db.Column(db.String(255))
    user_id = db.Column(db.Integer)
    user_name = db.Column(db.String(255))

    def __init__(self, data, sar_id=None):
        self.fromUser = data['fromUser']
        self.toUser = data['toUser']
        self.responseText = data['responseText']
        # self.user_name = data['user_name']
        # self.user_id = data['user_id']
        self.sar_id = sar_id

    #
    def to_dict(self):
        return {
            c.key: getattr(self, c.key)
            for c in inspect(self).mapper.column_attrs
        }
Esempio n. 24
0
class Radar(db.Model):

    __tablename__ = 'radares'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    customer_id = db.Column(db.Integer, db.ForeignKey('customers.id'), nullable=False)
    pub_id = db.Column(db.String(50), unique=True, nullable=False) # ID de radar para Evial/barrio
    configuration = db.Column(db.String(2048), unique=False, nullable=True)
    registered_on = db.Column(db.DateTime, nullable=False)
    online = db.Column(db.Boolean, nullable=False, default=False)
    conn_port = db.Column(db.String(3), unique=False, nullable=True)

    def __init__(self, customer_id,pub_id,configuration,registered_on,online,conn_port='000'):
        self.customer_id = customer_id
	self.pub_id = pub_id
	self.configuration = configuration
        self.registered_on = registered_on # datetime.datetime.now()
	self.online = online
	self.conn_port = conn_port

    def get_id(self):
        return self.id

    def __repr__(self):
        return '<Radar {0}>'.format(self.pub_id)
class ActionNote(db.Model):

    __tablename__ = 'action_note'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    question_id = db.Column(db.Integer,
                            db.ForeignKey('question.id'),
                            nullable=False)
    owner_id = db.Column(db.Integer, nullable=False)
    type = db.Column(db.String(255), nullable=False)
    notes = db.Column(db.String(999), nullable=False)
    created_date = db.Column(db.DateTime, nullable=False)
    modified_date = db.Column(db.DateTime, nullable=True)

    def __init__(self, data):
        self.question_id = data['question_id']
        self.owner_id = data['owner_id']
        self.type = data['type']
        self.notes = data['notes']
        self.created_date = datetime.datetime.now()

    def __repr__(self):
        return '<ActionNote %r>' % (self.owner_id)

    def to_dict(self):
        return {
            c.key: getattr(self, c.key)
            for c in inspect(self).mapper.column_attrs
        }
Esempio n. 26
0
class UserPost(db.Model):
    """ User Post Model for storing posts made by users """
    __tablename__ = "user_posts"

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    title = db.Column(db.String(255), unique=False, nullable=False)
    body = db.Column(db.String(2000), nullable=True)
    link = db.Column(db.String(1000), nullable=True)
    image = db.Column(db.String(1000), nullable=True)
    created_on = db.Column(db.DateTime, nullable=False, index=True)
    visibility = db.Column(db.Boolean, nullable=False, default=True)
    delete_flag = db.Column(db.Boolean, nullable=False, default=False)

    def __init__(self,
                 title="Empty Post Title",
                 body="empty post body",
                 link="",
                 image="",
                 visibility=True,
                 delete_flag=False,
                 user_id=None,
                 **kwargs):
        self.user_id = user_id
        self.title = title
        self.body = body
        self.link = link
        self.image = image
        self.created_on = datetime.datetime.now()
        self.visibility = visibility
        self.delete_flag = delete_flag
Esempio n. 27
0
class Course(db.Model):

    __tablename__ = 'courses'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255), unique=True, nullable=False)
    description = db.Column(db.Text(), nullable=False)
    subject = db.Column(db.String(255), nullable=False)
    start_date = db.Column(db.DateTime, nullable=False)
    end_date = db.Column(db.DateTime, nullable=False)
    active = db.Column(db.Boolean, nullable=False, default=True)
    teacher_id = db.Column(db.Integer,
                           db.ForeignKey('teachers.id'),
                           nullable=False)
    teacher = db.relationship('Teacher', backref='courses')
    students = db.relationship('Student',
                               secondary=course_student_association_table,
                               backref='courses')

    def __init__(self, name, description, subject, start_date, end_date,
                 teacher_id):
        self.name = name
        self.description = description
        self.subject = subject
        self.start_date = start_date
        self.end_date = end_date
        self.teacher_id = teacher_id

    def __repr__(self):
        return '<Class {0}>'.format(self.name)
class Attachments(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    fileName = db.Column(db.String(255))
    documentLink = db.Column(db.String(500))
    answer_id = db.Column(db.Integer,
                          db.ForeignKey('answer.id'),
                          nullable=False)
Esempio n. 29
0
class Section(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    owner_id = db.Column(db.Integer)
    assignedTo = db.Column(db.String(255))
    assessment_id = db.Column(db.Integer,
                              db.ForeignKey('assessment.id'),
                              nullable=False)
Esempio n. 30
0
class Appointment(BaseModel, Base):
    """"""
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
    date = db.Column(db.DateTime, nullable=False)
    notes = db.Column(db.Text, nullable=False)
    treatments = db.relationship('Treatment',
                                 secondary='user_symptom_treatment')