Пример #1
0
from models.db import db

t_ParameterFormulas = db.Table(
    'ParameterFormulas', db.metadata,
    db.Column('Parameter_Id',
              db.ForeignKey('Parameters.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True),
    db.Column('Formula_Id',
              db.ForeignKey('Formulae.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True))
Пример #2
0
from models.db import db

t_WorkTypeCategories = db.Table(
    'WorkTypeCategories', db.metadata,
    db.Column('WorkType_Id',
              db.ForeignKey('WorkTypes.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True),
    db.Column('Category_Id',
              db.ForeignKey('Categories.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True))
Пример #3
0
from models.db import db

t_RoomParameterValue = db.Table(
    'ParameterWithValueRooms', db.metadata,
    db.Column('ParameterWithValue_Id',
              db.ForeignKey('ParameterWithValues.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True),
    db.Column('Room_Id',
              db.ForeignKey('Rooms.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True))
Пример #4
0
from models.db import db

UserRole = db.Table(
    "user_role", db.metadata,
    db.Column("user_id",
              db.Integer,
              db.ForeignKey("user.id", ondelete="cascade"),
              primary_key=True,
              nullable=False),
    db.Column("role_id",
              db.Integer,
              db.ForeignKey("role.id", ondelete="cascade"),
              primary_key=True,
              nullable=False))
Пример #5
0
from models.Passport import Passport
from models.Event import Event, vendor_event_table
from models.User import User

from flask_admin.contrib.sqla import ModelView

import datetime

product_purchase_table = db.Table(
    'db_product_purchase', db.Model.metadata,
    db.Column('product_id',
              db.Integer,
              db.ForeignKey('db_product.id',
                            onupdate="CASCADE",
                            ondelete="CASCADE"),
              primary_key=True),
    db.Column('purchase_id',
              db.Integer,
              db.ForeignKey('db_purchase.id',
                            onupdate="CASCADE",
                            ondelete="CASCADE"),
              primary_key=True),
    db.Column('amount', db.Integer, default=1, nullable=False))


class Vendor(db.Model):
    __tablename__ = "db_vendor"
    id = db.Column(db.Integer, autoincrement=True, primary_key=True)
    user_id = db.Column(db.Integer,
                        db.ForeignKey('db_user.id'),
                        nullable=False)
Пример #6
0
from App import admin
from models.db import db

from flask_admin.contrib.sqla import ModelView

vendor_event_table = db.Table(
    'db_vendor_event',
    db.Model.metadata,
    db.Column('vendor_id',
              db.Integer,
              db.ForeignKey('db_vendor.id',
                            onupdate="CASCADE",
                            ondelete="CASCADE"),
              primary_key=True),
    db.Column('event_id',
              db.Integer,
              db.ForeignKey('db_event.id',
                            onupdate="CASCADE",
                            ondelete="CASCADE"),
              primary_key=True),
)


class Event(db.Model):
    __tablename__ = "db_event"
    id = db.Column(db.Integer, autoincrement=True, primary_key=True)
    date = db.Column(db.Date, nullable=False)
    location = db.Column(db.String, nullable=False)
    duff_value = db.Column(db.Float, nullable=False)
    name = db.Column(db.String, nullable=False)
    active = db.Column(db.Boolean, default=True, nullable=False)
Пример #7
0
import datetime
from models.db import ModelBase, db

event_contacts = db.Table(
    'event_contacts',
    db.Column(
        'event_id',
        db.Integer,
        db.ForeignKey('application_event.id', ondelete='CASCADE'),
        nullable=False,
    ),
    db.Column(
        'contact_id',
        db.Integer,
        db.ForeignKey('application_contact.id', ondelete='CASCADE'),
        nullable=False,
    ))

application_keyword = db.Table(
    'application_keyword',
    db.Column(
        'keyword_id',
        db.Integer,
        db.ForeignKey('keyword.id', ondelete='CASCADE'),
        nullable=False,
    ),
    db.Column(
        'application_id',
        db.Integer,
        db.ForeignKey('application.id', ondelete='CASCADE'),
        nullable=False,
Пример #8
0
from models.db import db

t_ElementParameterValue = db.Table(
    'ParameterWithValueElements', db.metadata,
    db.Column('ParameterWithValue_Id',
              db.ForeignKey('ParameterWithValues.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True),
    db.Column('Element_Id',
              db.ForeignKey('Elements.Id', ondelete='CASCADE'),
              primary_key=True,
              nullable=False,
              index=True))
Пример #9
0
"""this is role_users table structure."""

from models.db import db


role_users = db.Table('role_users', db.metadata,
                      db.Column('role_id', db.Integer, db.ForeignKey('role.id')),
                      db.Column('user_id', db.Integer, db.ForeignKey('users.id'))
                      )
Пример #10
0
import datetime
from models.db import ModelBase, db

accomplishment_keyword = db.Table(
    'accomplishment_keyword',
    db.Column(
        'keyword_id',
        db.Integer,
        db.ForeignKey('keyword.id', ondelete='CASCADE'),
        nullable=False,
    ),
    db.Column(
        'accomplishment_id',
        db.Integer,
        db.ForeignKey('position_accomplishment.id', ondelete='CASCADE'),
        nullable=False,
    ))


class ResumePosition(ModelBase):
    user_id = db.Column(
        db.Integer,
        db.ForeignKey('user.id', ondelete='CASCADE'),
        nullable=False,
    )
    company_name = db.Column(db.String(255), nullable=False, index=True)
    position_title = db.Column(db.String(255), nullable=False, index=True)
    position_start_date = db.Column(
        db.DateTime,
        nullable=False,
        default=datetime.datetime.utcnow,
Пример #11
0
from models.db import db
from App import admin

from flask_admin.contrib.sqla import ModelView

# This is the association table for the many-to-many relationship between
# groups and permissions.
group_permission_table = db.Table(
    'db_group_permission', db.Model.metadata,
    db.Column('group_id',
              db.Integer,
              db.ForeignKey('db_group.id',
                            onupdate="CASCADE",
                            ondelete="CASCADE"),
              primary_key=True),
    db.Column('permission_id',
              db.Integer,
              db.ForeignKey('db_permission.id',
                            onupdate="CASCADE",
                            ondelete="CASCADE"),
              primary_key=True))

# This is the association table for the many-to-many relationship between
# groups and members - this is, the memberships.
user_group_table = db.Table(
    'db_user_group', db.Model.metadata,
    db.Column('user_id',
              db.Integer,
              db.ForeignKey('db_user.id',
                            onupdate="CASCADE",
                            ondelete="CASCADE"),
Пример #12
0
from dataclasses import dataclass
from typing import List, Optional

from models.db import db
from models.posts import Post

posts_identifier = db.Table(
    "posts_identifier",
    db.Column(
        "post_id",
        db.Integer,
        db.ForeignKey("post.id", ondelete="CASCADE"),
        nullable=True,
    ),
    db.Column(
        "email_id",
        db.Integer,
        db.ForeignKey("email.id", ondelete="CASCADE"),
        nullable=True,
    ),
)


@dataclass
class Email(db.Model):
    id: Optional[int]
    email: str
    url: str
    search_query: str
    sent_posts: Optional[List[Post]]
Пример #13
0
from models.db import db
topic_identifier = db.Table('topic_identifier',
                            db.Column('user_id', db.Integer,
                                      db.ForeignKey('users.id')),
                            db.Column('topic_id', db.Integer,
                                      db.ForeignKey('topics.id'))
                            )


class Users(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(100), nullable=False, unique=True)
    name = db.Column(db.String, nullable=False)
    password = db.Column(db.String, nullable=False)
    vocabularys = db.relationship('Vocabularys')
    progress = db.relationship('Progress')
    news = db.relationship('News')
    topics = db.relationship('Topics', secondary=topic_identifier)
    # Create function to return String

    def __repr__(self):
        return self.id