class ProjectComment(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False) project_id = db.Column(db.Integer, db.ForeignKey('project.id', ondelete='cascade'), nullable=False) message = db.Column(db.Text, nullable=False) hide = db.Column(db.Boolean, default=False) file = db.Column(db.String(200))
class Task(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) name = db.Column(db.String(100), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False) project_id = db.Column(db.Integer, db.ForeignKey('project.id', ondelete='cascade'), nullable=False) description = db.Column(db.Text, nullable=False) date = db.Column(db.DateTime, nullable=False) due_date = db.Column(db.DateTime, nullable=False) status = db.Column(db.Enum('Ongoing', 'Complete', 'Upcoming'), nullable=False, default='Ongoing')
class Project(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) uuid = db.Column(UUIDType, default=uuid4(), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=True) name = db.Column(db.String(100), nullable=False) description = db.Column(db.Text, nullable=False) start_date = db.Column(db.Date, nullable=False, default=datetime.utcnow) due_date = db.Column(db.Date, nullable=False) budget = db.Column(db.Numeric(10, 2, asdecimal=False), nullable=False) priority = db.Column(db.Enum('High', 'Low', 'Normal'), nullable=False, default='Low') files = db.relationship('ProjectFile', backref=db.backref('project'), lazy='dynamic', cascade='all,delete,delete-orphan') tickets = db.relationship('Ticket', backref=db.backref('project'), cascade='all,delete,delete-orphan', lazy='dynamic') project_team = db.relationship('Team', backref=db.backref('project'), cascade='all,delete', secondary='project_team') # member_team = db.relationship('User', backref=db.backref('project'), cascade='all,delete', # secondary='member_project') tasks = db.relationship('Task', backref=db.backref('project'), cascade='all,delete,delete-orphan', lazy='dynamic') comments = db.relationship('ProjectComment', backref=db.backref('project'), cascade='all,delete,delete-orphan', lazy='dynamic') status = db.Column(db.Enum('Reviewing', 'Approved', 'Disapproved', 'Complete', 'Incomplete', 'Halt'), default='Reviewing') active = db.Column(db.Boolean, nullable=False, default=True)
class Ticket(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) uuid = db.Column(UUIDType, default=uuid4(), nullable=False) title = db.Column(db.String(100), nullable=False) project_id = db.Column(db.Integer, db.ForeignKey('project.id', ondelete='cascade'), nullable=False) status = db.Column(db.Enum('Achieve', 'Open', 'Closed'), default='Open') comments = db.relationship('TicketComment', backref=db.backref('ticket'), cascade='all,delete,delete-orphan', lazy='dynamic')
class Notification(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False) title = db.Column(db.String(100), nullable=False) message = db.Column(db.Text, nullable=False) status = db.Column(db.Boolean, default=False, nullable=False) priority = db.Column(db.Enum('High', 'Low', 'Normal')) schedule_at = db.Column(db.DateTime) read = db.Column(db.Boolean, default=False, nullable=False)
class Kyc(db.Model, ActiveRecord, Timestamp): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False) business_name = db.Column(db.String(100), nullable=False, unique=True) ident = db.Column(db.String(100), nullable=False, unique=True) ident_name = db.Column(db.String(100), nullable=False, ) about_business = db.Column(db.Text, nullable=False, unique=True) phone_number = db.Column(PhoneNumberType(region='GH'), nullable=False, unique=True) country = db.Column(db.String(100), nullable=False) file = db.Column(db.String(100), nullable=True) status = db.Column(db.Enum('Approved', 'Pending', 'Disapproved', 'Suspended', 'Processing'), nullable=False, default='Pending')
class BillingInfo(db.Model, ActiveRecord, Timestamp): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False)
class RqJob(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) uuid = db.Column(UUIDType, nullable=False, default=uuid4()) description = db.Column(db.String(100), nullable=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False)
class TicketComment(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) ticket_id = db.Column(db.Integer, db.ForeignKey('ticket.id', ondelete='cascade'), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False) message = db.Column(db.Text, nullable=False) file = db.Column(db.String(200))
class ProjectTeam(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) team_id = db.Column(db.Integer, db.ForeignKey('team.id', ondelete='cascade'), nullable=False) project_id = db.Column(db.Integer, db.ForeignKey('project.id', ondelete='cascade'), nullable=False)
class ProjectFile(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) project_id = db.Column(db.Integer, db.ForeignKey('project.id', ondelete='cascade'), nullable=False) attached_file = db.Column(db.String(200), nullable=False) description = db.Column(db.Text, nullable=False)
class UserTag(db.Model, ActiveRecord): id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='cascade'), nullable=False) tag_id = db.Column(db.Integer, db.ForeignKey('tag.id', ondelete='cascade'), nullable=False)