-
Notifications
You must be signed in to change notification settings - Fork 3
/
User.py
56 lines (52 loc) · 1.89 KB
/
User.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from sqlalchemy import Column, String, Integer
from sqlalchemy.orm import relationship
from models.User import User as UserModel
from repository.base import Base
import database.Analysis
class User(Base.Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
email = Column(String(200))
username = Column(String(20))
password = Column(String(2000))
salt = Column(String(32))
dateInsertion = Column('date_insertion', String(100))
dateUpdate = Column('date_last_update', String(100))
idType = Column('id_type', Integer)
analysis = relationship('database.Analysis.Analysis', lazy='subquery',
back_populates='user')
def __init__(self,
id=0,
email="",
username="",
password="",
salt="",
dateInsertion="",
dateUpdate="",
idType=0,
user=UserModel,
analysis=[]):
if (user.id or user.username):
self.id = user.id
self.email = user.email
self.username = user.username
self.password = user.password
self.salt = user.salt
self.dateInsertion = user.dateInsertion
self.dateUpdate = user.dateUpdate
self.idType = user.idType
self.analysis = []
for an in analysis:
self.analysis.append(database.Analysis.Analysis(an))
else:
self.id = id
self.email = email
self.username = username
self.password = password
self.salt = salt
self.dateInsertion = dateInsertion
self.dateUpdate = dateUpdate
self.idType = idType
self.analysis = []
for an in analysis:
self.analysis.append(database.Analysis.Analysis(an))