示例#1
0
class Project(Entity, db.Model):
    proposal_author = db.Column(db.Integer,
                                db.ForeignKey('proposal_author.id'),
                                nullable=False)
    title = db.Column(db.String(255))
    description = db.Column(db.Text)
    file_name = db.Column(db.String(255), nullable=True)
    deadline = db.Column(db.DateTime, nullable=True)
    city = db.Column(db.String(255))
    country = db.Column(db.String(255))
    platform = db.Column(db.String(255), nullable=True)
    availability = db.Column(db.String(255), nullable=True)
    category = db.relationship('ProjectCategory',
                               secondary=project_to_category,
                               backref=db.backref('projects', lazy='dynamic'))
    status = db.Column(db.String(50), default="PROPOSED")
    students = db.relationship('Student', backref='projects', lazy=True)

    def __init__(self, last_updated_by='system', **kwargs):
        super().__init__(last_updated_by)
        self.title = kwargs['title']
        self.description = kwargs['description']
        self.proposal_author = kwargs['proposal_author']
        self.city = kwargs['city']
        self.country = kwargs['country']
        self.deadline = kwargs.get('deadline', None)
        self.platform = kwargs.get('platform', None)
        self.availability = kwargs.get('availability', None)
示例#2
0
class Comment(Entity, db.Model):
    complaint = db.Column(db.Integer,
                          db.ForeignKey('complaint.id'),
                          nullable=True)
    text = db.Column(db.Text)
    sent_email = db.Column(db.BOOLEAN, default=False)
    status = db.Column(db.Boolean, default=True)
    commented_by = db.Column(db.Integer,
                             db.ForeignKey('user.id'),
                             nullable=False)

    def __init__(self, last_updated_by='system', **kwargs):
        super().__init__(last_updated_by)
        self.text = kwargs['text']
        self.complaint = kwargs.get('complaint', None)
        self.sent_email = kwargs.get('sent_email', False)
        self.commented_by = kwargs['commented_by']
示例#3
0
class EmailLog(Entity, db.Model):
    body = db.Column(db.Text)
    subject = db.Column(db.String(255))
    email_to = db.Column(db.String(255))
    status = db.Column(db.Boolean, default=True)
    project = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True)
    sent_by = db.Column(db.Integer, db.ForeignKey('staff.id'), nullable=False)
    student = db.Column(db.Integer, db.ForeignKey('student.id'), nullable=True)
    proposal_author = db.Column(db.Integer, db.ForeignKey('proposal_author.id'), nullable=True)

    def __init__(self, last_updated_by='system', **kwargs):
        super().__init__(last_updated_by)
        self.subject = kwargs.get('subject', None)
        self.body = kwargs.get('body', None)
        self.email_to = kwargs.get('email_to', None)
        self.sent_by = kwargs.get('sent_by', None)
        self.student = kwargs.get('student', None)
        self.proposal_author = kwargs.get('proposal_author', None)
        self.project = kwargs.get('project', None)
示例#4
0
class Complaint(Entity, db.Model):
    title = db.Column(db.String(50))
    text = db.Column(db.Text)
    address = db.Column(db.Text)
    city = db.Column(db.String(255))
    state = db.Column(db.String(255))
    country = db.Column(db.String(255))
    pin_code = db.Column(db.Integer)
    vehicle_number = db.Column(db.String(15))
    vehicle_details = db.Column(db.Text)
    file_name = db.Column(db.String(255), nullable=True)
    complaint_status = db.Column(db.String(50), default='PENDING')
    complaint_by = db.Column(db.Integer,
                             db.ForeignKey('user.id'),
                             nullable=False)
    responded_by = db.Column(db.Integer,
                             db.ForeignKey('user.id'),
                             nullable=True,
                             default=None)
    response_details = db.Column(db.Text, nullable=True, default=None)
    status = db.Column(db.Boolean, default=True)

    def __init__(self, last_updated_by='system', **kwargs):
        super().__init__(last_updated_by)
        self.title = kwargs['title']
        self.text = kwargs['text']
        self.address = kwargs['address']
        self.vehicle_number = kwargs['vehicle_number']
        self.vehicle_details = kwargs['vehicle_details']
        self.city = kwargs['city']
        self.state = kwargs['state']
        self.country = kwargs['country']
        self.pin_code = kwargs['pin_code']
        self.file_name = kwargs.get('file_name', None)
        self.complaint_status = kwargs.get('complaint_status', None)
        self.complaint_by = kwargs['complaint_by']
        self.responded_by = kwargs.get('responded_by', None)
示例#5
0
class Student(Entity, db.Model):
    name = db.Column(db.String(80))
    email = db.Column(db.String(255))
    phone_number = db.Column(db.String(15), nullable=True)
    description = db.Column(db.Text)
    city = db.Column(db.String(255))
    country = db.Column(db.String(255))
    is_in_team = db.Column(db.Boolean, default=False)
    status = db.Column(db.String(15), default='INTERESTED')
    project = db.Column(db.Integer,
                        db.ForeignKey('project.id'),
                        nullable=False)
    comments = db.relationship('Comment', backref='students', lazy=True)
    email_logs = db.relationship('EmailLog', backref='students', lazy=True)

    def __init__(self, last_updated_by='system', **kwargs):
        super().__init__(last_updated_by)
        self.email = kwargs['email']
        self.name = kwargs['name']
        self.project = kwargs['project']
        self.phone_number = kwargs.get('phone_number', None)
        self.description = kwargs.get('description', None)
        self.city = kwargs.get('city', None)
        self.country = kwargs.get('country', None)
from src.main.model import db

project_to_category = db.Table(
    'project_to_category',
    db.Column('project_id', db.Integer(), db.ForeignKey('project.id')),
    db.Column('category_id', db.Integer(), db.ForeignKey('project_category.id'))
)
示例#7
0
from src.main.model import db

roles_users = db.Table(
    'roles_users',
    db.Column('staff_id', db.Integer(), db.ForeignKey('staff.id')),
    db.Column('role_id', db.Integer(), db.ForeignKey('role.id')))
示例#8
0
from src.main.model import db

roles_users = db.Table(
    'roles_users',
    db.Column('user_id', db.Integer(), db.ForeignKey('user.id')),
    db.Column('role_id', db.Integer(), db.ForeignKey('role.id'))
)