|
|
|
@ -99,13 +99,39 @@ class Status(db.Model):
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Note_status(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
notes = db.relationship('Company_note', backref='company_note_status', lazy=True)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
class Company_status(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
companies = db.relationship('Company', backref='status', lazy=True)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Industry(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
companies = db.relationship('Company', backref='industry', lazy=True)
|
|
|
|
|
companies = db.relationship('Company', backref='company_industry', lazy=True)
|
|
|
|
|
#projects = db.relationship('Project', backref='project_industry', lazy=True)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
@ -119,39 +145,41 @@ class Person(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
last_name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
date_of_birth = db.Column(db.Date, nullable=True, default='')
|
|
|
|
|
|
|
|
|
|
company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
|
|
|
|
|
role_id = db.Column(db.Integer, db.ForeignKey('person_role.id'), nullable=False)
|
|
|
|
|
competence_id = db.Column(db.Integer, db.ForeignKey('person_competence.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
date_of_birth = db.Column(db.Date, nullable=True, default=datetime.utcnow)
|
|
|
|
|
mail_prof = db.Column(db.String(320), nullable=False)
|
|
|
|
|
mail_priv = db.Column(db.String(320), nullable=True, default='')
|
|
|
|
|
tel_prof_fix = db.Column(db.String(30), nullable=True, default='')
|
|
|
|
|
tel_prof_mobile = db.Column(db.String(30), nullable=True, default='')
|
|
|
|
|
tel_priv_fix = db.Column(db.String(30), nullable=True, default='')
|
|
|
|
|
tel_priv_mobile = db.Column(db.String(30), nullable=True, default='')
|
|
|
|
|
|
|
|
|
|
street_name = db.Column(db.String(150), nullable=True, default='')
|
|
|
|
|
street_no = db.Column(db.Integer, nullable=True, default='')
|
|
|
|
|
city = db.Column(db.String(75), nullable=True, default='')
|
|
|
|
|
post_code = db.Column(db.String(10), nullable=True, default='')
|
|
|
|
|
state = db.Column(db.String(75), nullable=True, default='')
|
|
|
|
|
country = db.Column(db.String(75), nullable=True, default='')
|
|
|
|
|
|
|
|
|
|
notes = db.relationship('Person_note', backref='concerns', lazy=True)
|
|
|
|
|
|
|
|
|
|
image_file = db.Column(db.String(20), nullable=False, default='default_person.jpg')
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
# One To Many relationships where indexes can point o mutiple companies.
|
|
|
|
|
# Example : One Legal_entity could cocern multiple companies. (There are surely more than just one GmBH)
|
|
|
|
|
company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
|
|
|
|
|
role_id = db.Column(db.Integer, db.ForeignKey('person_role.id'), nullable=False)
|
|
|
|
|
competence_id = db.Column(db.Integer, db.ForeignKey('person_competence.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
# One To Many relationships for a company having mutliple elements of the following indexes
|
|
|
|
|
# Example : One company would/could have many eployees
|
|
|
|
|
notes = db.relationship('Person_note', backref='person', lazy=True)
|
|
|
|
|
# projects = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True)
|
|
|
|
|
# elements = db.Column(db.Integer, db.ForeignKey('project_element.id'), nullable=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Person_role(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
persons = db.relationship('Person', backref='role', lazy=True)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
@ -162,8 +190,7 @@ class Person_competence(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
persons = db.relationship('Person', backref='competence', lazy=True)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
@ -172,12 +199,14 @@ class Person_competence(db.Model):
|
|
|
|
|
|
|
|
|
|
class Person_note(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
|
priority = db.Column(db.Integer, nullable=False, default='0')
|
|
|
|
|
title = db.Column(db.String(100), nullable=False)
|
|
|
|
|
content = db.Column(db.Text, nullable=False)
|
|
|
|
|
status = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
date_due = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
person_id = db.Column(db.Integer, db.ForeignKey('person.id'), nullable=False)
|
|
|
|
|
#status_id = db.Column(db.Integer, db.ForeignKey('note_status.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
@ -190,39 +219,40 @@ class Person_note(db.Model):
|
|
|
|
|
class Company(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
|
|
|
|
|
|
legal_entity_id = db.Column(db.Integer, db.ForeignKey('company_legal_entity.id'), nullable=False)
|
|
|
|
|
relation_id = db.Column(db.Integer, db.ForeignKey('company_relation.id'), nullable=False)
|
|
|
|
|
industry_id = db.Column(db.Integer, db.ForeignKey('industry.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
main_company = db.Column(db.Integer, nullable=False, default=1)
|
|
|
|
|
main_company = db.Column(db.Integer, nullable=False, default='1')
|
|
|
|
|
subsidiary_of = db.Column(db.Integer, nullable=True, default='')
|
|
|
|
|
website = db.Column(db.String(100), nullable=True, default='')
|
|
|
|
|
|
|
|
|
|
street_bill = db.Column(db.String(100), nullable=False)
|
|
|
|
|
street_no_bill = db.Column(db.Integer, nullable=False)
|
|
|
|
|
city_bill = db.Column(db.String(100), nullable=False)
|
|
|
|
|
post_code_bill = db.Column(db.Integer, nullable=False)
|
|
|
|
|
state_bill = db.Column(db.String(100), nullable=False)
|
|
|
|
|
country_bill = db.Column(db.String(100), nullable=False)
|
|
|
|
|
|
|
|
|
|
street_ship = db.Column(db.String(100), nullable=False)
|
|
|
|
|
street_no_ship = db.Column(db.Integer, nullable=False)
|
|
|
|
|
city_ship = db.Column(db.String(100), nullable=False)
|
|
|
|
|
post_code_ship = db.Column(db.Integer, nullable=False)
|
|
|
|
|
state_ship = db.Column(db.String(100), nullable=False)
|
|
|
|
|
country_ship = db.Column(db.String(100), nullable=False)
|
|
|
|
|
|
|
|
|
|
classification = db.Column(db.Integer, nullable=False, default=0)
|
|
|
|
|
comment = db.Column(db.String(300), nullable=True)
|
|
|
|
|
image_file = db.Column(db.String(20), nullable=False, default='default_company.jpg')
|
|
|
|
|
|
|
|
|
|
employees = db.relationship('Person', backref='company', lazy=True)
|
|
|
|
|
notes = db.relationship('Company_note', backref='concerns', lazy=True)
|
|
|
|
|
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
# One To Many relationships where indexes can point o mutiple companies.
|
|
|
|
|
# Example : One Legal_entity could cocern multiple companies. (There are surely more than just one GmBH)
|
|
|
|
|
legal_entity_id = db.Column(db.Integer, db.ForeignKey('company_legal_entity.id'), nullable=False)
|
|
|
|
|
relation_id = db.Column(db.Integer, db.ForeignKey('company_relation.id'), nullable=False)
|
|
|
|
|
industry_id = db.Column(db.Integer, db.ForeignKey('industry.id'), nullable=False)
|
|
|
|
|
status_id = db.Column(db.Integer, db.ForeignKey('company_status.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
# One To Many relationships for a company having mutliple elements of the following indexes
|
|
|
|
|
# Example : One company would/could have many eployees
|
|
|
|
|
employees = db.relationship('Person', backref='employer', lazy=True)
|
|
|
|
|
notes = db.relationship('Company_note', backref='company', lazy=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
# >>> company.query.all()
|
|
|
|
|
# [1, ComanyName, CompanyCounntry] (Do not change this presentation
|
|
|
|
@ -235,8 +265,6 @@ class Company_relation(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
companies = db.relationship('Company', backref='relation', lazy=True)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
@ -248,9 +276,7 @@ class Company_legal_entity(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(50), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
companies = db.relationship('Company', backref='legal_entity', lazy=True)
|
|
|
|
|
companies = db.relationship('Company', backref='legal_entiy', lazy=True)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
@ -259,12 +285,14 @@ class Company_legal_entity(db.Model):
|
|
|
|
|
|
|
|
|
|
class Company_note(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
|
priority = db.Column(db.Integer, nullable=False, default='0')
|
|
|
|
|
title = db.Column(db.String(100), nullable=False)
|
|
|
|
|
content = db.Column(db.Text, nullable=False)
|
|
|
|
|
status = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
date_due = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
|
|
|
|
|
status_id = db.Column(db.Integer, db.ForeignKey('note_status.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
@ -273,3 +301,53 @@ class Company_note(db.Model):
|
|
|
|
|
###################################################################################################
|
|
|
|
|
# Project
|
|
|
|
|
###################################################################################################
|
|
|
|
|
'''
|
|
|
|
|
class Project(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
|
|
#elements = db.relationship('Project_element', backref='project_elements', lazy=True)
|
|
|
|
|
|
|
|
|
|
#company_id = db.Column(db.Integer, db.ForeignKey('company.id'), nullable=False)
|
|
|
|
|
#industry_id = db.Column(db.Integer, db.ForeignKey('industry.id'), nullable=False)
|
|
|
|
|
|
|
|
|
|
project_owner = db.relationship('Person', backref='project_owner', lazy=True)
|
|
|
|
|
#buyer = db.relationship('Person', backref='project_buyer', lazy=True)
|
|
|
|
|
#responsible = db.relationship('Person', backref='project_manager', lazy=True)
|
|
|
|
|
date_prototype = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
qte_prototype = db.Column(db.Integer, nullable=True)
|
|
|
|
|
date_start = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
qte_start = db.Column(db.Integer, nullable=True)
|
|
|
|
|
date_production = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
qte_production = db.Column(db.Integer, nullable=True)
|
|
|
|
|
|
|
|
|
|
status = db.Column(db.String(100), nullable=True, default='')
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
|
|
|
|
|
class Project_element(db.Model):
|
|
|
|
|
id = db.Column(db.Integer, nullable=False, primary_key=True)
|
|
|
|
|
name = db.Column(db.String(100), nullable=False)
|
|
|
|
|
description = db.Column(db.String(300), nullable=False)
|
|
|
|
|
|
|
|
|
|
project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=True)
|
|
|
|
|
industry_id = db.Column(db.Integer, db.ForeignKey('industry.id'), nullable=True)
|
|
|
|
|
owner = db.relationship('Person', backref='element_owner', lazy=True)
|
|
|
|
|
buyer = db.relationship('Person', backref='element_buyer', lazy=True)
|
|
|
|
|
responsible = db.relationship('Person', backref='element_manager', lazy=True)
|
|
|
|
|
|
|
|
|
|
qte_per_project = db.Column(db.Integer, nullable=False, default='0')
|
|
|
|
|
|
|
|
|
|
status = db.Column(db.String(100), nullable=True, default='')
|
|
|
|
|
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
|
|
|
|
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
|
|
|
|
|
|
# returns a more information-rich, or official, string representation of an object
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return f"{self.name}"
|
|
|
|
|
'''
|
|
|
|
|