예제 #1
0
class Comment(db.Model):
    user_id = db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
    post_id = db.Column('post_id',
                        db.Integer,
                        db.ForeignKey('post.id'),
                        primary_key=True)
    body = db.Column(db.String(50))
예제 #2
0
파일: models.py 프로젝트: itsDrac/twin-book
class StockManagment(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    inventory_id = db.Column(db.Integer,
                             db.ForeignKey('inventory.id'),
                             primary_key=True)
    quantity = db.Column(db.Integer)
    company_id = db.Column(db.Integer,
                           db.ForeignKey('company.id'),
                           nullable=False)
예제 #3
0
파일: models.py 프로젝트: itsDrac/twin-book
class QuantityPerItem(db.Model):
    '''This table store quantity required by each inventory to make a product'''

    inventory_id = db.Column(db.Integer,
                             db.ForeignKey('inventory.id'),
                             primary_key=True)
    product_id = db.Column(db.Integer,
                           db.ForeignKey('product.id'),
                           primary_key=True)
    quantity = db.Column(db.Integer, default=1)
예제 #4
0
파일: models.py 프로젝트: itsDrac/twin-book
class QuantityPerPurchase(db.Model):
    '''This table store quantity of each inventory in a purchase'''

    inventory_id = db.Column(db.Integer,
                             db.ForeignKey('inventory.id'),
                             primary_key=True)
    unit_id = db.Column(db.Integer, db.ForeignKey('unit.id'), primary_key=True)
    purchase_id = db.Column(db.Integer,
                            db.ForeignKey('purchase.id'),
                            primary_key=True)
    quantity = db.Column(db.Integer, default=1)
    price = db.Column(db.Float())
예제 #5
0
파일: models.py 프로젝트: itsDrac/twin-book
class Product(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=True, nullable=False)
    company_id = db.Column(db.Integer,
                           db.ForeignKey('company.id'),
                           nullable=False)
    stock = db.Column(db.Integer, default=1)
    items = db.relationship('QuantityPerItem', backref='product')
예제 #6
0
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    caption = db.Column(db.String(50))
    images = db.Column(db.String(100), nullable=False)
    comments = db.relationship('Comment', backref='post', lazy='dynamic')

    get_images = lambda self: ast.literal_eval(self.images)
예제 #7
0
파일: models.py 프로젝트: itsDrac/twin-book
class Purchase(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    party_name = db.Column(db.String(50))
    current_date = db.Column(db.Date)
    suplier_date = db.Column(db.Date)
    invoice = db.Column(db.String(20), unique=True, nullable=False)
    items = db.relationship('QuantityPerPurchase', backref='purchase')
    company_id = db.Column(db.Integer,
                           db.ForeignKey('company.id'),
                           nullable=False)
예제 #8
0
파일: models.py 프로젝트: itsDrac/twin-book
class Unit(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), unique=True, nullable=False)
    company_id = db.Column(db.Integer,
                           db.ForeignKey('company.id'),
                           nullable=False)
예제 #9
0
class Follow(db.Model):
    followed_id = db.Column('followed_id', db.Integer, db.ForeignKey('user.id'), primary_key=True)
    follower_id = db.Column('follower_id', db.Integer, db.ForeignKey('user.id'), primary_key=True)
예제 #10
0
import ast
from app.extinsions import db

likes = db.Table('likes',
                 db.Column('user_id', db.Integer, db.ForeignKey('user.id')),
                 db.Column('post_id', db.Integer, db.ForeignKey('post.id')))


class Comment(db.Model):
    user_id = db.Column('user_id', db.Integer, db.ForeignKey('user.id'))
    post_id = db.Column('post_id',
                        db.Integer,
                        db.ForeignKey('post.id'),
                        primary_key=True)
    body = db.Column(db.String(50))


class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    caption = db.Column(db.String(50))
    images = db.Column(db.String(100), nullable=False)
    comments = db.relationship('Comment', backref='post', lazy='dynamic')

    get_images = lambda self: ast.literal_eval(self.images)