Changeset 4c7b208 in pycorepos


Ignore:
Timestamp:
07/22/2020 08:25:20 PM (3 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
ef1a25f
Parents:
365d679
Message:

Add Suspension and ReasonCodes? to model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • corepos/db/office_op/model.py

    r365d679 r4c7b208  
    10541054            """))
    10551055
     1056    suspension = orm.relationship(
     1057        'Suspension',
     1058        primaryjoin='Suspension.card_number == MemberInfo.card_number',
     1059        foreign_keys='Suspension.card_number',
     1060        uselist=False,
     1061        doc="""
     1062        Suspension record for the member, if applicable.
     1063        """,
     1064        backref=orm.backref(
     1065            'member_info',
     1066            doc="""
     1067            Reference to the :class:`MemberInfo` record to which the suspension
     1068            applies.
     1069            """))
     1070
    10561071    @property
    10571072    def full_name(self):
     
    11461161
    11471162
     1163class ReasonCode(Base):
     1164    """
     1165    Reason codes for legacy account suspensions.
     1166    """
     1167    __tablename__ = 'reasoncodes'
     1168
     1169    mask = sa.Column(sa.Integer(), nullable=False, primary_key=True, autoincrement=False)
     1170
     1171    text_string = sa.Column('textStr', sa.String(length=100), nullable=True)
     1172
     1173    def __str__(self):
     1174        return "#{}: {}".format(self.mask, self.text_string)
     1175
     1176
     1177class Suspension(Base):
     1178    """
     1179    Suspension status for legacy customer accounts.
     1180    """
     1181    __tablename__ = 'suspensions'
     1182    __table_args__ = (
     1183        sa.ForeignKeyConstraint(['reasoncode'], ['reasoncodes.mask']),
     1184    )
     1185
     1186    card_number = sa.Column('cardno', sa.Integer(), nullable=False, primary_key=True, autoincrement=False)
     1187
     1188    type = sa.Column(sa.String(length=1), nullable=True)
     1189
     1190    memtype1 = sa.Column(sa.Integer(), nullable=True)
     1191
     1192    memtype2 = sa.Column(sa.String(length=6), nullable=True)
     1193
     1194    suspension_date = sa.Column('suspDate', sa.DateTime(), nullable=True)
     1195
     1196    reason = sa.Column(sa.Text(), nullable=True)
     1197
     1198    mail_flag = sa.Column('mailflag', sa.Integer(), nullable=True)
     1199
     1200    discount = sa.Column(sa.Integer(), nullable=True)
     1201
     1202    charge_limit = sa.Column('chargelimit', sa.Numeric(precision=10, scale=2), nullable=True)
     1203
     1204    reason_code = sa.Column('reasoncode', sa.Integer(), nullable=True)
     1205    reason_object = orm.relationship(ReasonCode)
     1206
     1207
    11481208class HouseCoupon(Base):
    11491209    """
Note: See TracChangeset for help on using the changeset viewer.