Example #1
0
class PidLog(db.Model):
    """
    Audit log of actions happening to persistent identifiers.

    This model is primarily used through PersistentIdentifier.log and rarely
    created manually.
    """
    __tablename__ = 'pidLOG'
    __table_args__ = (db.Index('idx_action', 'action'), )

    id = db.Column(db.Integer(15, unsigned=True), primary_key=True)
    """ Id of persistent identifier entry """

    id_pid = db.Column(
        db.Integer(15, unsigned=True),
        db.ForeignKey(PersistentIdentifier.id),
        nullable=True,
    )
    """ PID """

    timestamp = db.Column(db.DateTime(), nullable=False, default=datetime.now)
    """ Creation datetime of entry """

    action = db.Column(db.String(10), nullable=False)
    """ Action identifier """

    message = db.Column(db.Text(), nullable=False)
    """ Log message """
Example #2
0
class RnkDOWNLOADS(db.Model):
    """Represents a RnkDOWNLOADS record."""
    __tablename__ = 'rnkDOWNLOADS'
    id = db.Column(db.Integer,
                   primary_key=True,
                   nullable=False,
                   autoincrement=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=True)
    download_time = db.Column(db.DateTime,
                              nullable=True,
                              server_default='1900-01-01 00:00:00')
    client_host = db.Column(db.Integer(10, unsigned=True), nullable=True)
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=True)
    id_bibdoc = db.Column(db.MediumInteger(9, unsigned=True),
                          db.ForeignKey(Bibdoc.id),
                          nullable=True)
    file_version = db.Column(db.SmallInteger(2, unsigned=True), nullable=True)
    file_format = db.Column(db.String(50), nullable=True)
    bibrec = db.relationship(Bibrec, backref='downloads')
    bibdoc = db.relationship(Bibdoc, backref='downloads')
    user = db.relationship(User, backref='downloads')
Example #3
0
class CrcITEM(db.Model):
    """Represents a CrcITEM record."""
    def __init__(self):
        pass

    __tablename__ = 'crcITEM'
    barcode = db.Column(db.String(30),
                        nullable=False,
                        server_default='',
                        primary_key=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          server_default='0')
    id_crcLIBRARY = db.Column(db.Integer(15, unsigned=True),
                              db.ForeignKey(CrcLIBRARY.id),
                              nullable=False,
                              server_default='0')
    collection = db.Column(db.String(60), nullable=True)
    location = db.Column(db.String(60), nullable=True)
    description = db.Column(db.String(60), nullable=True)
    loan_period = db.Column(db.String(30), nullable=False, server_default='')
    status = db.Column(db.String(20), nullable=False, server_default='')
    expected_arrival_date = db.Column(db.String(60),
                                      nullable=False,
                                      server_default='')
    creation_date = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')
    modification_date = db.Column(db.DateTime,
                                  nullable=False,
                                  server_default='1900-01-01 00:00:00')
    number_of_requests = db.Column(db.Integer(3, unsigned=True),
                                   nullable=False,
                                   server_default='0')
class AccAuthorization(db.Model):
    """Represents a AccAssociation record."""
    __tablename__ = 'accROLE_accACTION_accARGUMENT'
    id_accROLE = db.Column(db.Integer(15, unsigned=True),
                           db.ForeignKey(AccROLE.id),
                           nullable=True,
                           autoincrement=False,
                           primary_key=True,
                           index=True)
    id_accACTION = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(AccACTION.id),
                             nullable=True,
                             autoincrement=False,
                             primary_key=True,
                             index=True)
    id_accARGUMENT = db.Column(
        db.Integer(15),  # , unsigned=True),
        db.ForeignKey(AccARGUMENT.id),
        nullable=True,
        primary_key=True,
        autoincrement=False,
        index=True)
    argumentlistid = db.Column(db.MediumInteger(8),
                               nullable=True,
                               autoincrement=False,
                               primary_key=True)
    role = db.relationship(AccROLE, backref='authorizations')
    action = db.relationship(AccACTION, backref='authorizations')
    argument = db.relationship(AccARGUMENT, backref='authorizations')
Example #5
0
class CrcLOANREQUEST(db.Model):
    """Represents a CrcLOANREQUEST record."""
    def __init__(self):
        pass
    __tablename__ = 'crcLOANREQUEST'
    id = db.Column(db.Integer(15, unsigned=True), nullable=False,
                primary_key=True,
                autoincrement=True)
    id_crcBORROWER = db.Column(db.Integer(15, unsigned=True),
                db.ForeignKey(CrcBORROWER.id), nullable=False, server_default='0')
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                db.ForeignKey(Bibrec.id),
                nullable=False, server_default='0')
    barcode = db.Column(db.String(30), db.ForeignKey(CrcITEM.barcode), nullable=False,
                server_default='')
    period_of_interest_from = db.Column(db.DateTime,
                nullable=False,
                server_default='1900-01-01 00:00:00')
    period_of_interest_to = db.Column(db.DateTime,
                nullable=False,
                server_default='1900-01-01 00:00:00')
    status = db.Column(db.String(20), nullable=False,
                server_default='')
    notes = db.Column(db.Text, nullable=True)
    request_date = db.Column(db.DateTime, nullable=False,
                server_default='1900-01-01 00:00:00')
    borrower = db.relationship(CrcBORROWER, backref='loanrequests')
    bibrec = db.relationship(Bibrec, backref='loanrequests')
    item = db.relationship(CrcITEM, backref='loanrequests')
Example #6
0
class CrcPURCHASE(db.Model):
    """Represents a CrcPURCHASE record."""
    def __init__(self):
        pass

    __tablename__ = 'crcPURCHASE'
    id = db.Column(db.Integer(15, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          server_default='0')
    id_crcVENDOR = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(CrcVENDOR.id),
                             nullable=False,
                             server_default='0')
    ordered_date = db.Column(db.DateTime,
                             nullable=False,
                             server_default='1900-01-01 00:00:00')
    expected_date = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')
    price = db.Column(db.String(20), nullable=False, server_default='0')
    status = db.Column(db.String(20), nullable=False, server_default='')
    notes = db.Column(db.Text, nullable=True)
    bibrec = db.relationship(Bibrec, backref='purchases')
    vendor = db.relationship(CrcVENDOR, backref='purchases')
Example #7
0
class CrcBORROWER(db.Model):
    """Represents a CrcBORROWER record."""
    def __init__(self):
        pass

    __tablename__ = 'crcBORROWER'
    id = db.Column(db.Integer(15, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    ccid = db.Column(db.Integer(15, unsigned=True),
                     nullable=True,
                     unique=True,
                     server_default=None)
    name = db.Column(db.String(255),
                     nullable=False,
                     server_default='',
                     index=True)
    email = db.Column(db.String(255),
                      nullable=False,
                      server_default='',
                      index=True)
    phone = db.Column(db.String(60), nullable=True)
    address = db.Column(db.String(60), nullable=True)
    mailbox = db.Column(db.String(30), nullable=True)
    borrower_since = db.Column(db.DateTime,
                               nullable=False,
                               server_default='1900-01-01 00:00:00')
    borrower_until = db.Column(db.DateTime,
                               nullable=False,
                               server_default='1900-01-01 00:00:00')
    notes = db.Column(db.Text, nullable=True)
Example #8
0
class ExpJOBRESULTExpQUERYRESULT(db.Model):
    """Represents a ExpJOBRESULTExpQUERYRESULT record."""
    __tablename__ = 'expJOBRESULT_expQUERYRESULT'
    id_expJOBRESULT = db.Column(db.Integer(15, unsigned=True),
                                db.ForeignKey(ExpJOBRESULT.id),
                                nullable=False,
                                primary_key=True)
    id_expQUERYRESULT = db.Column(db.Integer(15, unsigned=True),
                                  db.ForeignKey(ExpQUERYRESULT.id),
                                  nullable=False,
                                  primary_key=True)
Example #9
0
class UserExpJOB(db.Model):
    """Represents a UserExpJOB record."""
    __tablename__ = 'user_expJOB'
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=False,
                        primary_key=True)
    id_expJOB = db.Column(db.Integer(15, unsigned=True),
                          db.ForeignKey(ExpJOB.id),
                          nullable=False,
                          primary_key=True)
Example #10
0
class CrcILLREQUEST(db.Model):
    """Represents a CrcILLREQUEST record."""
    def __init__(self):
        pass
    __tablename__ = 'crcILLREQUEST'
    id = db.Column(db.Integer(15, unsigned=True), nullable=False,
                primary_key=True,
                autoincrement=True)
    id_crcBORROWER = db.Column(db.Integer(15, unsigned=True),
                db.ForeignKey(CrcBORROWER.id),
                nullable=False,
                server_default='0')
    barcode = db.Column(db.String(30), db.ForeignKey(CrcITEM.barcode),
                nullable=False,
                server_default='')
    period_of_interest_from = db.Column(db.DateTime,
                nullable=False,
                server_default='1900-01-01 00:00:00')
    period_of_interest_to = db.Column(db.DateTime,
                nullable=False,
                server_default='1900-01-01 00:00:00')
    id_crcLIBRARY = db.Column(db.Integer(15, unsigned=True),
                db.ForeignKey(CrcLIBRARY.id), nullable=False,
                server_default='0')
    request_date = db.Column(db.DateTime, nullable=False,
                server_default='1900-01-01 00:00:00')
    expected_date = db.Column(db.DateTime, nullable=False,
                server_default='1900-01-01 00:00:00')
    arrival_date = db.Column(db.DateTime, nullable=False,
                server_default='1900-01-01 00:00:00')
    due_date = db.Column(db.DateTime, nullable=False,
                server_default='1900-01-01 00:00:00')
    return_date = db.Column(db.DateTime, nullable=False,
                server_default='1900-01-01 00:00:00')
    status = db.Column(db.String(20), nullable=False,
                server_default='')
    cost = db.Column(db.String(30), nullable=False,
                server_default='')
    budget_code = db.Column(db.String(60), nullable=False,
                server_default='')
    item_info = db.Column(db.Text, nullable=True)
    request_type = db.Column(db.Text, nullable=True)
    borrower_comments = db.Column(db.Text, nullable=True)
    only_this_edition = db.Column(db.String(10), nullable=False,
                server_default='')
    library_notes = db.Column(db.Text, nullable=True)
    overdue_letter_number = db.Column(db.Integer(3, unsigned=True),
                                      nullable=False, server_default='0')
    overdue_letter_date = db.Column(db.DateTime, nullable=False,
                                    server_default='1900-01-01 00:00:00')
    borrower = db.relationship(CrcBORROWER, backref='illrequests')
    item = db.relationship(CrcITEM, backref='illrequests')
    library = db.relationship(CrcLIBRARY, backref='illrequests')
class LnkADMINURLLOG(db.Model):
    """Represents a LnkADMINURLLOG record."""
    __tablename__ = 'lnkADMINURLLOG'

    id_lnkADMINURL = db.Column(db.Integer(15, unsigned=True),
                               db.ForeignKey(LnkADMINURL.id),
                               primary_key=True,
                               nullable=False)
    id_lnkLOG = db.Column(db.Integer(15, unsigned=True),
                          db.ForeignKey(LnkLOG.id),
                          primary_key=True,
                          nullable=False)
class LnkLOG(db.Model):
    """Represents a LnkLOG record."""
    __tablename__ = 'lnkLOG'

    id = db.Column(db.Integer(15, unsigned=True),
                   primary_key=True,
                   nullable=False)
    id_user = db.Column(db.Integer(15, unsigned=True), db.ForeignKey(User.id))
    action = db.Column(db.String(30), nullable=False, index=True)
    log_time = db.Column(db.DateTime,
                         server_default='1900-01-01 00:00:00',
                         index=True)
Example #13
0
class HstBATCHUPLOAD(db.Model):
    """Represents a HstBATCHUPLOAD record."""
    __tablename__ = 'hstBATCHUPLOAD'
    id = db.Column(db.Integer(15, unsigned=True), nullable=False,
                primary_key=True, autoincrement=True)
    user = db.Column(db.String(50), nullable=False, index=True)
    submitdate = db.Column(db.DateTime, nullable=False)
    filename = db.Column(db.String(255), nullable=False)
    execdate = db.Column(db.DateTime, nullable=False)
    id_schTASK = db.Column(db.Integer(15, unsigned=True),
                db.ForeignKey(SchTASK.id), nullable=False)
    batch_mode = db.Column(db.String(15), nullable=False)
    task = db.relationship(SchTASK, backref='batchuploads')
Example #14
0
class CmtCOLLAPSED(db.Model):
    """Represents a CmtCOLLAPSED record."""

    __tablename__ = 'cmtCOLLAPSED'

    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          primary_key=True)
    id_cmtRECORDCOMMENT = db.Column(db.Integer(15, unsigned=True),
                                    db.ForeignKey(CmtRECORDCOMMENT.id),
                                    primary_key=True)
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        primary_key=True)
class LnkENTRYURLTITLE(db.Model):
    """Represents a LnkENTRYURLTITLE record."""
    __tablename__ = 'lnkENTRYURLTITLE'

    id = db.Column(db.Integer(15, unsigned=True),
                   primary_key=True,
                   nullable=False)
    url = db.Column(db.String(100), nullable=False, unique=True)
    title = db.Column(db.String(100), nullable=False, index=True)
    manual_set = db.Column(db.TinyInteger(1),
                           nullable=False,
                           server_default='0')
    broken_count = db.Column(db.Integer(5), server_default='0')
    broken = db.Column(db.TinyInteger(1), nullable=False, server_default='0')
Example #16
0
class ExpJOBExpQUERY(db.Model):
    """Represents a ExpJOBExpQUERY record."""
    __tablename__ = 'expJOB_expQUERY'
    id_expJOB = db.Column(db.Integer(15, unsigned=True),
                          db.ForeignKey(ExpJOB.id),
                          nullable=False,
                          primary_key=True)
    id_expQUERY = db.Column(db.Integer(15, unsigned=True),
                            db.ForeignKey(ExpQUERY.id),
                            nullable=False,
                            primary_key=True)

    query = db.relationship(ExpQUERY, backref='jobs')
    job = db.relationship(ExpJOB, backref='queries')
Example #17
0
class WebDepositDraft(db.Model):
    """Represents a deposition draft."""
    __tablename__ = 'depDRAFT'
    uuid = db.Column(db.String(36),
                     db.ForeignKey(Workflow.uuid),
                     primary_key=True)
    step = db.Column(db.Integer(15, unsigned=True),
                     primary_key=True,
                     autoincrement=False)
    form_type = db.Column(db.String(45), nullable=False)
    form_values = db.Column(db.JSON, nullable=False)
    status = db.Column(db.Integer(15, unsigned=True), autoincrement=False)
    timestamp = db.Column(db.DateTime, nullable=False)
    workflow = db.relationship(Workflow, backref='drafts')
class LnkENTRY(db.Model):
    """Represents a LnkENTRY record."""
    __tablename__ = 'lnkENTRY'

    id = db.Column(db.Integer(15, unsigned=True),
                   primary_key=True,
                   nullable=False)
    origin_url = db.Column(db.String(100), nullable=False)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False)
    additional_properties = db.Column(db.Binary)
    type = db.Column(db.String(30), nullable=False, index=True)
    status = db.Column(db.String(30),
                       nullable=False,
                       server_default='PENDING',
                       index=True)
    insert_time = db.Column(db.DateTime,
                            server_default='1900-01-01 00:00:00',
                            index=True)

    @property
    def title(self):
        try:
            return db.object_session(self).query(LnkENTRYURLTITLE).\
                filter(db.and_(
                    LnkENTRYURLTITLE.url==self.origin_url,
                    LnkENTRYURLTITLE.title<>"",
                    LnkENTRYURLTITLE.broken==0)).first().title
        except:
            return self.origin_url
Example #19
0
class UserBskBASKET(db.Model):
    """Represents a UserBskBASKET record."""
    __tablename__ = 'user_bskBASKET'
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=False,
                        server_default='0',
                        primary_key=True)
    id_bskBASKET = db.Column(db.Integer(15, unsigned=True),
                             db.ForeignKey(BskBASKET.id),
                             nullable=False,
                             server_default='0',
                             primary_key=True)
    topic = db.Column(db.String(50), nullable=False, server_default='')
    user = db.relationship(User, backref='user_baskets')
    user_basket = db.relationship(BskBASKET, backref='users')
Example #20
0
class UserAccROLE(db.Model):
    """Represents a UserAccROLE record."""
    __tablename__ = 'user_accROLE'
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=False,
                        primary_key=True)
    id_accROLE = db.Column(db.Integer(15, unsigned=True),
                           db.ForeignKey(AccROLE.id),
                           nullable=False,
                           primary_key=True)
    expiration = db.Column(db.DateTime,
                           nullable=False,
                           server_default='9999-12-31 23:59:59')
    user = db.relationship(User, backref='roles')
    role = db.relationship(AccROLE, backref='users')
Example #21
0
class CmtSUBSCRIPTION(db.Model):
    """Represents a CmtSUBSCRIPTION record."""
    __tablename__ = 'cmtSUBSCRIPTION'

    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          primary_key=True)
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        nullable=False,
                        primary_key=True)
    creation_time = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')

    bibrec = db.relationship(Bibrec)
    user = db.relationship(User, backref='comment_subscriptions')
    user_commented_records = db.relationship(
        Bibrec,
        backref='user_comment_subscritions',
        primaryjoin=lambda: db.and_(
            CmtSUBSCRIPTION.id_bibrec == Bibrec.id, CmtSUBSCRIPTION.id_user ==
            current_user.get_id()),
        viewonly=True)
Example #22
0
class ExpQUERYRESULT(db.Model):
    """Represents a ExpQUERYRESULT record."""
    __tablename__ = 'expQUERYRESULT'
    id = db.Column(db.Integer(15, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    id_expQUERY = db.Column(db.Integer(15, unsigned=True),
                            db.ForeignKey(ExpQUERY.id),
                            nullable=False)
    result = db.Column(db.Text, nullable=False)
    status = db.Column(db.MediumInteger(12),
                       nullable=False,
                       server_default='0')
    status_message = db.Column(db.Text, nullable=False)
    query = db.relationship(ExpQUERY, backref='queryresults')
class OaiHARVESTLOG(db.Model):
    """Represents a OaiHARVESTLOG record."""
    __tablename__ = 'oaiHARVESTLOG'
    id_oaiHARVEST = db.Column(db.MediumInteger(9, unsigned=True),
                              db.ForeignKey(OaiHARVEST.id),
                              nullable=False)
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          server_default='0')
    bibupload_task_id = db.Column(db.Integer(11),
                                  db.ForeignKey(SchTASK.id),
                                  nullable=False,
                                  server_default='0',
                                  primary_key=True)
    oai_id = db.Column(db.String(40),
                       nullable=False,
                       server_default='',
                       primary_key=True)
    date_harvested = db.Column(db.DateTime,
                               nullable=False,
                               server_default='1900-01-01 00:00:00',
                               primary_key=True)
    date_inserted = db.Column(db.DateTime,
                              nullable=False,
                              server_default='1900-01-01 00:00:00')
    inserted_to_db = db.Column(db.Char(1), nullable=False, server_default='P')
    bibrec = db.relationship(Bibrec, backref='harvestlogs')
    schtask = db.relationship(SchTASK)
class UserQuery(db.Model):
    """Represents a UserQuery record."""
    __tablename__ = 'user_query'
    id_user = db.Column(db.Integer(15, unsigned=True),
                        db.ForeignKey(User.id),
                        primary_key=True,
                        server_default='0')
    id_query = db.Column(db.Integer(15, unsigned=True),
                         db.ForeignKey(WebQuery.id),
                         primary_key=True,
                         index=True,
                         server_default='0')
    hostname = db.Column(db.String(50),
                         nullable=True,
                         server_default='unknown host')
    date = db.Column(db.DateTime, nullable=True)
Example #25
0
class BibWorkflowObjectLogging(db.Model):
    """
    This class represent a record of a log emit by an object
    into the database the object must be saved before using
    this class. Indeed it needs the id of the object into
    the database.
    """
    #db table definition
    __tablename__ = 'bwlOBJECTLOGGING'
    id = db.Column(db.Integer, primary_key=True)
    id_bibworkflowobject = db.Column(db.Integer(255),
                                     db.ForeignKey('bwlOBJECT.id'),
                                     nullable=False)
    log_type = db.Column(db.Integer, default=0, nullable=False)
    created = db.Column(db.DateTime, default=datetime.now)
    message = db.Column(db.TEXT, default="", nullable=False)
    error_msg = db.Column(db.TEXT, default="", nullable=False)
    extra_data = db.Column(db.JSON, default={})

    ###
    #This function should be use only for debug purpose
    #Normal log acces should be done throught the database
    #That's all
    ###
    def __repr__(self):
        return "<ObjectLog(%i, %s, %s, %s)>" % \
               (self.id, self.id_bibworkflowobject, self.message, self.created)

    @classmethod
    def get(cls, *criteria, **filters):
        """ A wrapper for the filter and filter_by functions of sqlalchemy.
        Define a dict with which columns should be filtered by which values.

        e.g. Workflow.get(uuid=uuid)
             Workflow.get(Workflow.uuid != uuid)

        The function supports also "hybrid" arguments.
        e.g. Workflow.get(Workflow.module_name != 'i_hate_this_module',
                          user_id=user_id)

        look up also sqalchemy BaseQuery's filter and filter_by documentation
        """
        return cls.query.filter(*criteria).filter_by(**filters)

    @classmethod
    def get_most_recent(cls, *criteria, **filters):
        """ Returns the most recently modified workflow. """

        most_recent = cls.get(*criteria, **filters).\
                              order_by(desc(BibWorkflowObjectLogging.created)).first()
        if most_recent is None:
            raise NoResultFound
        else:
            return most_recent

    @classmethod
    def delete(cls, id=None):
        cls.get(BibWorkflowObjectLogging.id_bibworkflowobject == id).delete()
        db.session.commit()
Example #26
0
class HstTASK(db.Model):
    """Represents a HstTASK record."""
    __tablename__ = 'hstTASK'
    id = db.Column(db.Integer(15, unsigned=True), nullable=False,
                primary_key=True, autoincrement=False)
    proc = db.Column(db.String(255), nullable=False)
    host = db.Column(db.String(255), nullable=False,
                server_default='')
    user = db.Column(db.String(50), nullable=False)
    runtime = db.Column(db.DateTime, nullable=False, index=True)
    sleeptime = db.Column(db.String(20), nullable=True)
    arguments = db.Column(db.iMediumBinary, nullable=True)
    status = db.Column(db.String(50), nullable=True, index=True)
    progress = db.Column(db.String(255), nullable=True)
    priority = db.Column(db.TinyInteger(4), nullable=False,
                server_default='0', index=True)
    sequenceid = db.Column(db.Integer(8), db.ForeignKey(SeqSTORE.id))
class WebQuery(db.Model):
    """Represents a WebQuery record."""
    __tablename__ = 'query'
    id = db.Column(db.Integer(15, unsigned=True),
                   primary_key=True,
                   autoincrement=True)
    type = db.Column(db.Char(1), nullable=False, server_default='r')
    urlargs = db.Column(db.Text(100), nullable=False, index=True)
Example #28
0
class CrcLOAN(db.Model):
    """Represents a CrcLOAN record."""
    def __init__(self):
        pass

    __tablename__ = 'crcLOAN'
    id = db.Column(db.Integer(15, unsigned=True),
                   nullable=False,
                   primary_key=True,
                   autoincrement=True)
    id_crcBORROWER = db.Column(db.Integer(15, unsigned=True),
                               db.ForeignKey(CrcBORROWER.id),
                               nullable=False,
                               server_default='0')
    id_bibrec = db.Column(db.MediumInteger(8, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          server_default='0')
    barcode = db.Column(db.String(30),
                        db.ForeignKey(CrcITEM.barcode),
                        nullable=False,
                        server_default='')
    loaned_on = db.Column(db.DateTime,
                          nullable=False,
                          server_default='1900-01-01 00:00:00')
    returned_on = db.Column(db.Date,
                            nullable=False,
                            server_default='0000-00-00')
    due_date = db.Column(db.DateTime,
                         nullable=False,
                         server_default='1900-01-01 00:00:00')
    number_of_renewals = db.Column(db.Integer(3, unsigned=True),
                                   nullable=False,
                                   server_default='0')
    overdue_letter_number = db.Column(db.Integer(3, unsigned=True),
                                      nullable=False,
                                      server_default='0')
    overdue_letter_date = db.Column(db.DateTime,
                                    nullable=False,
                                    server_default='1900-01-01 00:00:00')
    status = db.Column(db.String(20), nullable=False, server_default='')
    type = db.Column(db.String(20), nullable=False, server_default='')
    notes = db.Column(db.Text, nullable=True)
    borrower = db.relationship(CrcBORROWER, backref='loans')
    bibrec = db.relationship(Bibrec, backref='loans')
    item = db.relationship(CrcITEM, backref='loans')
Example #29
0
class WtgTAGRecord(db.Model, Serializable):
    """ Represents a connection between Tag and Record """

    __tablename__ = 'wtgTAG_bibrec'
    __public__ = ['id_tag', 'id_bibrec', 'date_added']

    # tagTAG.id
    id_tag = db.Column(db.Integer(15, unsigned=True),
                       db.ForeignKey(WtgTAG.id),
                       nullable=False,
                       primary_key=True)

    # Bibrec.id
    id_bibrec = db.Column(db.Integer(15, unsigned=True),
                          db.ForeignKey(Bibrec.id),
                          nullable=False,
                          primary_key=True)

    # Creation date
    date_added = db.Column(db.DateTime, default=datetime.now)

    # Relationships
    tag = db.relationship(WtgTAG,
                          backref=db.backref('records_association',
                                             cascade='all'))

    tag_query = db.relationship(WtgTAG,
                                backref=db.backref('records_association_query',
                                                   cascade='all',
                                                   lazy='dynamic'))

    bibrec = db.relationship(Bibrec,
                             backref=db.backref('tags_association',
                                                cascade='all'))

    bibrec_query = db.relationship(Bibrec,
                                   backref=db.backref('tags_association_query',
                                                      cascade='all',
                                                      lazy='dynamic'))

    # Constructor
    def __init__(self, bibrec=None, **kwargs):
        super(WtgTAGRecord, self).__init__(**kwargs)

        self.bibrec = bibrec
class LnkADMINURL(db.Model):
    """Represents a LnkADMINURL record."""
    __tablename__ = 'lnkADMINURL'

    id = db.Column(db.Integer(15, unsigned=True),
                   primary_key=True,
                   nullable=False)
    url = db.Column(db.String(100), nullable=False, unique=True)
    list = db.Column(db.String(30), nullable=False, index=True)