コード例 #1
0
ファイル: models.py プロジェクト: zenoSama001/game_store
class Run(db.Model):
    platform_id = db.Column(db.Integer, db.ForeignKey('platform.id'), primary_key=True)
    game_id = db.Column(db.Integer, db.ForeignKey('game.id'), primary_key=True)

    def __init__(self, platform_id, game_id):
        self.platform_id = platform_id
        self.game_id = game_id

    def __repr__(self):
        return f"Run('{self.platform_id}', '{self.game_id}')"
コード例 #2
0
ファイル: models.py プロジェクト: zenoSama001/game_store
class Odetails(db.Model):
    order_id = db.Column(db.Integer, db.ForeignKey('order.id'), primary_key=True)
    game_id = db.Column(db.Integer, db.ForeignKey('game.id'), primary_key=True)
    qty = db.Column(db.Integer)

    def __init__(self, order_id, game_id, qty):
        self.order_id = order_id
        self.game_id = game_id
        self.qty = qty

    def __repr__(self):
        return f"Odetails('{self.qty}')"
コード例 #3
0
class Purchase(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    customer_id = db.Column(db.Integer, db.ForeignKey('customer.id'))
    date = db.Column(db.DateTime, nullable=False)
    game_id = db.Column(db.Integer, db.ForeignKey('game.id'))
    qty = db.Column(db.Integer)

    def __init__(self, customer_id, date, game_id, qty):
        self.customer_id = customer_id
        self.date = date
        self.game_id = game_id
        self.qty = qty

    def __repr__(self):
        return f"Purchase('{self.customer_id}', '{self.date}', '{self.game_id}', '{self.qty}')"
コード例 #4
0
class Return(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    customer_id = db.Column(db.Integer,
                            db.ForeignKey('customer.id'),
                            nullable=False)
    date = db.Column(db.DateTime, nullable=False)
    purchase_id = db.Column(db.Integer,
                            db.ForeignKey('purchase.id'),
                            nullable=False)

    def __init__(self, customer_id, date, purchase_id):
        self.customer_id = customer_id
        self.date = date
        self.purchase_id = purchase_id

    def __repr__(self):
        return f"Return('{self.date}')"
コード例 #5
0
ファイル: models.py プロジェクト: zenoSama001/game_store
class Order(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    customer_id = db.Column(db.Integer, db.ForeignKey('customer.id'), nullable=False)
    date = db.Column(db.DateTime, nullable=False)
    order_details = db.relationship("Odetails", cascade="all, delete-orphan")

    def __init__(self, customer_id, date):
        self.customer_id = customer_id
        self.date = date

    def __repr__(self):
        return f"Order('{self.customer_id}', '{self.date}')"
コード例 #6
0
ファイル: models.py プロジェクト: ColeW23/FloorSpace2
class Ticket(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    tenant_email = db.Column(db.String(120), db.ForeignKey("tenant.email"))
    room_id = db.Column(db.Integer, nullable=False)
    build_id = db.Column(db.Integer, nullable=False)
    mtype = db.Column(db.String(40), nullable=False)
    submitdate = db.Column(db.Date, nullable=False)
    resolvedate = db.Column(db.Date)
    description = db.Column(db.String(720), nullable=False)

    def __init__(self, email, room_id, build_id, mtype, description, submitdate, resolvedate):
        self.tenant_email=email
        self.room_id=room_id
        self.build_id=build_id
        self.mtype=mtype
        self.description=description
        self.submitdate=submitdate
        self.resolvedate=resolvedate
コード例 #7
0
ファイル: models.py プロジェクト: zenoSama001/game_store
class Game(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    game_name = db.Column(db.String(50), nullable=False)
    genre = db.Column(db.String(50), nullable=False)
    release_date = db.Column(db.Date, nullable=False)
    price = db.Column(db.Numeric(4, 2), nullable=False)
    publisher_id = db.Column(db.Integer, db.ForeignKey('publisher.id'))
    order_details = db.relationship("Odetails", cascade="all, delete-orphan")
    runs = db.relationship("Run", cascade="all, delete-orphan")

    def __init__(self, game_name, genre, release_date, price, publisher_id):
        self.game_name = game_name
        self.genre = genre
        self.release_date = release_date
        self.price = price
        self.publisher_id = publisher_id

    def __repr__(self):
        return f"Game('{self.game_name}', '{self.genre}', '{self.release_date}', '{self.price}', '{self.publisher_id}')"