Before thr forst try of multiple key to note Status

master
Kerem Yollu 2 years ago
parent 357468a941
commit 87d2e04646

@ -35,6 +35,7 @@ class Config:
# (SQLALCHEMY) COnfiguration # (SQLALCHEMY) COnfiguration
SQLALCHEMY_DATABASE_URI = os.environ.get('MINIBASE_SQLALCHEMY_DATABASE_URI') SQLALCHEMY_DATABASE_URI = os.environ.get('MINIBASE_SQLALCHEMY_DATABASE_URI')
SQLALCHEMY_TRACK_MODIFICATIONS = False
# (MAIL AGENT) Configure mail Server to send EMails. # (MAIL AGENT) Configure mail Server to send EMails.
MAIL_SERVER = os.environ.get('MINIBASE_MAIL_SERVER') MAIL_SERVER = os.environ.get('MINIBASE_MAIL_SERVER')

File diff suppressed because one or more lines are too long

@ -99,13 +99,39 @@ class Status(db.Model):
return f"{self.name}" 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): class Industry(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True) id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False) name = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), nullable=False) description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) 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) 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 # returns a more information-rich, or official, string representation of an object
def __repr__(self): def __repr__(self):
@ -119,39 +145,41 @@ class Person(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True) id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False) name = db.Column(db.String(50), nullable=False)
last_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='') date_of_birth = db.Column(db.Date, nullable=True, default=datetime.utcnow)
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)
mail_prof = db.Column(db.String(320), nullable=False) mail_prof = db.Column(db.String(320), nullable=False)
mail_priv = db.Column(db.String(320), nullable=True, default='') mail_priv = db.Column(db.String(320), nullable=True, default='')
tel_prof_fix = db.Column(db.String(30), 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_prof_mobile = db.Column(db.String(30), nullable=True, default='')
tel_priv_fix = 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='') tel_priv_mobile = db.Column(db.String(30), nullable=True, default='')
street_name = db.Column(db.String(150), nullable=True, default='') street_name = db.Column(db.String(150), nullable=True, default='')
street_no = db.Column(db.Integer, nullable=True, default='') street_no = db.Column(db.Integer, nullable=True, default='')
city = db.Column(db.String(75), nullable=True, default='') city = db.Column(db.String(75), nullable=True, default='')
post_code = db.Column(db.String(10), nullable=True, default='') post_code = db.Column(db.String(10), nullable=True, default='')
state = db.Column(db.String(75), nullable=True, default='') state = db.Column(db.String(75), nullable=True, default='')
country = 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') image_file = db.Column(db.String(20), nullable=False, default='default_person.jpg')
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) 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) 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): class Person_role(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True) id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False) name = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), nullable=False) description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) persons = db.relationship('Person', backref='role', lazy=True)
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 # returns a more information-rich, or official, string representation of an object
def __repr__(self): def __repr__(self):
@ -162,8 +190,7 @@ class Person_competence(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True) id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False) name = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), nullable=False) description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) persons = db.relationship('Person', backref='competence', lazy=True)
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 # returns a more information-rich, or official, string representation of an object
def __repr__(self): def __repr__(self):
@ -172,12 +199,14 @@ class Person_competence(db.Model):
class Person_note(db.Model): class Person_note(db.Model):
id = db.Column(db.Integer, primary_key=True) 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) title = db.Column(db.String(100), nullable=False)
content = db.Column(db.Text, 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_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
date_due = 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) 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 # returns a more information-rich, or official, string representation of an object
def __repr__(self): def __repr__(self):
@ -190,39 +219,40 @@ class Person_note(db.Model):
class Company(db.Model): class Company(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True) id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(100), nullable=False) name = db.Column(db.String(100), nullable=False)
main_company = db.Column(db.Integer, nullable=False, default='1')
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)
subsidiary_of = db.Column(db.Integer, nullable=True, default='') subsidiary_of = db.Column(db.Integer, nullable=True, default='')
website = db.Column(db.String(100), nullable=True, default='') website = db.Column(db.String(100), nullable=True, default='')
street_bill = db.Column(db.String(100), nullable=False) street_bill = db.Column(db.String(100), nullable=False)
street_no_bill = db.Column(db.Integer, nullable=False) street_no_bill = db.Column(db.Integer, nullable=False)
city_bill = db.Column(db.String(100), nullable=False) city_bill = db.Column(db.String(100), nullable=False)
post_code_bill = db.Column(db.Integer, nullable=False) post_code_bill = db.Column(db.Integer, nullable=False)
state_bill = db.Column(db.String(100), nullable=False) state_bill = db.Column(db.String(100), nullable=False)
country_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_ship = db.Column(db.String(100), nullable=False)
street_no_ship = db.Column(db.Integer, nullable=False) street_no_ship = db.Column(db.Integer, nullable=False)
city_ship = db.Column(db.String(100), nullable=False) city_ship = db.Column(db.String(100), nullable=False)
post_code_ship = db.Column(db.Integer, nullable=False) post_code_ship = db.Column(db.Integer, nullable=False)
state_ship = db.Column(db.String(100), nullable=False) state_ship = db.Column(db.String(100), nullable=False)
country_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) classification = db.Column(db.Integer, nullable=False, default=0)
comment = db.Column(db.String(300), nullable=True) comment = db.Column(db.String(300), nullable=True)
image_file = db.Column(db.String(20), nullable=False, default='default_company.jpg') 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) 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) 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 # returns a more information-rich, or official, string representation of an object
# >>> company.query.all() # >>> company.query.all()
# [1, ComanyName, CompanyCounntry] (Do not change this presentation # [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) id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False) name = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), 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) companies = db.relationship('Company', backref='relation', lazy=True)
# returns a more information-rich, or official, string representation of an object # 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) id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(50), nullable=False) name = db.Column(db.String(50), nullable=False)
description = db.Column(db.String(300), nullable=False) description = db.Column(db.String(300), nullable=False)
upload_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) companies = db.relationship('Company', backref='legal_entiy', lazy=True)
last_update_date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow)
companies = db.relationship('Company', backref='legal_entity', lazy=True)
# returns a more information-rich, or official, string representation of an object # returns a more information-rich, or official, string representation of an object
def __repr__(self): def __repr__(self):
@ -259,12 +285,14 @@ class Company_legal_entity(db.Model):
class Company_note(db.Model): class Company_note(db.Model):
id = db.Column(db.Integer, primary_key=True) 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) title = db.Column(db.String(100), nullable=False)
content = db.Column(db.Text, 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_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
date_due = 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) 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 # returns a more information-rich, or official, string representation of an object
def __repr__(self): def __repr__(self):
@ -273,3 +301,53 @@ class Company_note(db.Model):
################################################################################################### ###################################################################################################
# Project # 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}"
'''

@ -1,5 +1,5 @@
from flask import render_template, request, Blueprint from flask import render_template, request, Blueprint
from minibase.database.models import Company, Post from minibase.database.models import Company, Post, Company_note
from minibase.config import themeMinibase from minibase.config import themeMinibase
from minibase import db from minibase import db
@ -15,8 +15,9 @@ def home():
# (POSTS) Query posts usin SQLAlchemy # (POSTS) Query posts usin SQLAlchemy
posts = Post.query.order_by(Post.date_posted.asc()).paginate(per_page=2) posts = Post.query.order_by(Post.date_posted.asc()).paginate(per_page=2)
companies = Company.query.order_by(Company.name.asc()) companies = Company.query.order_by(Company.name.asc())
companie_notes = Company_note.query.order_by(Company_note.title.asc())
# (HTML) Renders the template for templates/home.html # (HTML) Renders the template for templates/home.html
return render_template('home.html', theme=themeMinibase, posts=posts, companies=companies) return render_template('home.html', theme=themeMinibase, posts=posts, companies=companies, companie_notes=companie_notes)
@main.route("/about") @main.route("/about")

Binary file not shown.

@ -15,6 +15,7 @@
<th scope="col">Website</th> <th scope="col">Website</th>
<th scope="col">Relation</th> <th scope="col">Relation</th>
<th scope="col">Industry</th> <th scope="col">Industry</th>
<th scope="col">Status</th>
<th scope="col">ID</th> <th scope="col">ID</th>
</tr> </tr>
</thead> </thead>
@ -25,7 +26,8 @@
<td>{{ company.country_bill}}</td> <td>{{ company.country_bill}}</td>
<td> <a href="http://{{ company.website }}/" target="_blank" rel="noopener noreferrer">{{ company.website}} </a> </td> <td> <a href="http://{{ company.website }}/" target="_blank" rel="noopener noreferrer">{{ company.website}} </a> </td>
<td>{{ company.relation}}</td> <td>{{ company.relation}}</td>
<td>{{ company.industry}}</td> <td>{{ company.company_industry}}</td>
<td>{{ company.status}}</td>
<td>{{ company.id}}</td> <td>{{ company.id}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
@ -33,25 +35,31 @@
</table> </table>
</div> </div>
<div class="col"> <div class="col">
<h3> <a href="#">News</a> </h3> <h3> <a href="#">Notes</a> </h3>
<table class="{{ theme.tableClass }}"> <table class="{{ theme.tableClass }}">
<thead> <thead>
<tr> <tr>
<th scope="col">Total POS</th> <th scope="col">Company</th>
<th scope="col">Max Marg</th> <th scope="col">Title</th>
<th scope="col">Min Marg</th> <th scope="col">Content</th>
<th scope="col">Avg Marg</th> <th scope="col">Status</th>
<th scope="col">Total Rev</th> <th scope="col">Priority</th>
<th scope="col">Date Posted</th>
<th scope="col">Due Date</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for elem in companie_notes %}
<tr> <tr>
<th scope="row">100'000 CHF</th> <th scope="row">{{ elem.company.name }}</th>
<td>35 %</td> <td>{{ elem.title }}</td>
<td>12 %</td> <td>{{ elem.content }}</td>
<td>23 %</td> <td>{{ elem.company_note_status }}</td>
<td>12'453 CHF</td> <td>{{ elem.priority }}</td>
<td>{{ elem.date_posted.strftime('%d-%m-%Y') }}</td>
<td>{{ elem.date_due.strftime('%d-%m-%Y') }}</td>
</tr> </tr>
{% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>

@ -1,7 +1,8 @@
from minibase import db, create_minibase from minibase import db, create_minibase
from minibase.database.models import Person, Person_role, Person_competence from minibase.database.models import Person, Person_role, Person_competence, Person_note
from minibase.database.models import Company, Company_relation, Company_legal_entity from minibase.database.models import Company, Company_relation, Company_legal_entity, Company_note, Company_status
from minibase.database.models import Status, Industry from minibase.database.models import Status, Industry, Note_status
#from minibase.database.models import Project
app = create_minibase() app = create_minibase()
app.app_context().push() app.app_context().push()
@ -9,38 +10,6 @@ db.drop_all()
db.create_all() db.create_all()
###################################################################################################
PeresonRole1 = Person_role(
name='Engineer',
description='Standart Engineer')
db.session.add(PeresonRole1)
PeresonRole2 = Person_role(
name='Engineerin Manager',
description='Manager for egineering')
db.session.add(PeresonRole2)
db.session.commit()
PeresonRole3 = Person_role(
name='CEO',
description='Chief Executif Operation')
db.session.add(PeresonRole1)
PersonCompethence1 = Person_competence(
name='Embedded Systems',
description='Embedded Systems Engineer')
db.session.add(PersonCompethence1)
PersonCompethence2 = Person_role(
name='hardware',
description='Electronics Hardwre specialist')
db.session.add(PersonCompethence2)
PersonCompethence3 = Person_role(
name='Software',
description='Software engineer')
db.session.add(PersonCompethence1)
################################################################################################### ###################################################################################################
@ -80,22 +49,27 @@ companyLegal2 = Company_legal_entity(
db.session.add(companyLegal2) db.session.add(companyLegal2)
################################################################################################### ###################################################################################################
status1 = Status( companyStatus1 = Company_status(
name='Obsolete', name='Activ',
description='Obsolete from Manufacturer') description='Company is active and business is running')
db.session.add(status1) db.session.add(companyStatus1)
status2 = Status( companyStatus2 = Company_status(
name='Active', name='Bankrupt',
description='Everything is in order') description='Company is bankrupt')
db.session.add(status2) db.session.add(companyStatus2)
companyStatus3 = Company_status(
name='Closed',
description='Company is closed')
db.session.add(companyStatus3)
###################################################################################################
company1 = Company( company1 = Company(
name='Steinel', name='Steinel',
legal_entity_id='1', legal_entity_id='1',
relation_id='1', relation_id='1',
industry_id='1', industry_id='1',
status_id='1',
website='www.steinel.ch', website='www.steinel.ch',
street_bill='Alemeinrstrasse', street_bill='Alemeinrstrasse',
street_no_bill='10', street_no_bill='10',
@ -116,6 +90,7 @@ company2 = Company(
legal_entity_id='1', legal_entity_id='1',
relation_id='1', relation_id='1',
industry_id='1', industry_id='1',
status_id='3',
website='www.kynsight.com', website='www.kynsight.com',
street_bill='Meierackerstrasse', street_bill='Meierackerstrasse',
street_no_bill='10', street_no_bill='10',
@ -131,4 +106,153 @@ company2 = Company(
country_ship='Switzerland') country_ship='Switzerland')
db.session.add(company2) db.session.add(company2)
noteStatus1 = Note_status(
name='Open',
description='Ongoing')
db.session.add(noteStatus1)
noteStatus2 = Note_status(
name='Closed',
description='Ongoing')
db.session.add(noteStatus2)
noteStatus3 = Note_status(
name='Done',
description='Ongoing')
db.session.add(noteStatus3)
note1 = Company_note(
title='Need to find a valid MCU For Stefan',
content='ST is not able to deliver F0 mcu so NXP may do the trick',
priority='1',
company_id='1',
status_id='1')
db.session.add(note1)
note2 = Company_note(
title='Need to find a valid LDO',
content='Please find an LDO for 100mAh',
priority='2',
company_id='1',
status_id='3')
db.session.add(note2)
note2 = Company_note(
title='Please contact your custommers',
content='I won\'t earn any money if i don\'t get in touch with them',
priority='0',
company_id='2',
status_id='1')
db.session.add(note2)
###################################################################################################
PeresonRole1 = Person_role(
name='Engineer',
description='Standart Engineer')
db.session.add(PeresonRole1)
PeresonRole2 = Person_role(
name='Engineerin Manager',
description='Manager for egineering')
db.session.add(PeresonRole2)
PeresonRole3 = Person_role(
name='CEO',
description='Chief Executif Operation')
db.session.add(PeresonRole1)
PersonCompethence1 = Person_competence(
name='Embedded Systems',
description='Embedded Systems Engineer')
db.session.add(PersonCompethence1)
PersonCompethence2 = Person_competence(
name='hardware',
description='Electronics Hardwre specialist')
db.session.add(PersonCompethence2)
PersonCompethence3 = Person_competence(
name='Software',
description='Software engineer')
db.session.add(PersonCompethence1)
person1 = Person(
name='Kerem',
last_name='Yollu',
company_id='2',
role_id='3',
competence_id='1',
mail_prof='kerem.yollu@kynsight.com',
mail_priv='kerem.yollu@gmail.com',
tel_prof_mobile='+41789716697',
street_name='Meierackerstrasse',
street_no='10',
city='Uster',
post_code='8610',
state='Zürich',
country='Switzerland')
db.session.add(person1)
person2 = Person(
name='Stefan',
last_name='Walker',
company_id='1',
role_id='2',
competence_id='2',
mail_prof='stefan.walker@steinel.ch',
mail_priv='stefan.walker@gmail.com',
tel_prof_mobile='+4178956787',
street_name='Alemeinrstrasse',
street_no='10',
city='Einsiedeln',
post_code='8406',
state='Schyz',
country='Switzerland')
db.session.add(person2)
note3 = Person_note(
title='Birthday of Stefan',
content='Congratulate Stefan for his birthday',
priority='5',
person_id='2')
#status_id='1')
db.session.add(note3)
note4 = Person_note(
title='Wake Up kerem',
content='He is still slepping',
priority='10',
person_id='1')
#status_id='3')
db.session.add(note4)
note5 = Person_note(
title='Research for Stefan',
content='He is looking for a new job',
priority='8',
person_id='2')
#status_id='2')
db.session.add(note5)
'''
project1 = Project(
name='Stwa-Hs',
description='Akku Sprüh Gerät für hautmittel!')
# buyer='2',
# responsible='1')
db.session.add(project1)
###################################################################################################
status1 = Status(
name='Obsolete',
description='Obsolete from Manufacturer')
db.session.add(status1)
status2 = Status(
name='Active',
description='Everything is in order')
db.session.add(status2)
'''
db.session.commit() db.session.commit()

@ -1,5 +1,4 @@
from minibase import create_minibase from minibase import create_minibase
from minibase.database import models
# Enable debug option even if run directly form Python3 # Enable debug option even if run directly form Python3
@ -7,4 +6,3 @@ app = create_minibase()
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) app.run(debug=True)
app.db.create_all()

Loading…
Cancel
Save