~sircmpwn/meta.sr.ht

ref: 72548bd7545f78670878667674cc7645835a17bd meta.sr.ht/metasrht/types/invoice.py -rw-r--r-- 679 bytes
72548bd7Drew DeVault API: Updates per core-go auth changes 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sqlalchemy as sa
from srht.database import Base

class Invoice(Base):
    __tablename__ = 'invoice'
    id = sa.Column(sa.Integer, primary_key=True)
    created = sa.Column(sa.DateTime, nullable=False)
    updated = sa.Column(sa.DateTime, nullable=False)
    cents = sa.Column(sa.Integer, nullable=False)
    user_id = sa.Column(sa.Integer, sa.ForeignKey('user.id'), nullable=False)
    user = sa.orm.relationship("User", backref="invoices")
    valid_thru = sa.Column(sa.DateTime, nullable=False)
    source = sa.Column(sa.String(256))

    def __repr__(self):
        return '<Invoice {} uid:{} ${:.2f}>'.format(
                self.id, self.user_id, self.cents / 100)