This repository was archived by the owner on Mar 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodels.py
More file actions
52 lines (41 loc) · 1.44 KB
/
models.py
File metadata and controls
52 lines (41 loc) · 1.44 KB
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
from peewee import *
database = MySQLDatabase('lhsmachines', **{'host': 'db01.home.snowdenlabs.co.uk', 'port': 3306, 'user': 'machines', 'password': 'Password99'})
class UnknownField(object):
def __init__(self, *_, **__): pass
class ModelBase(Model):
class Meta:
database = database
class Log(ModelBase):
endtime = DateTimeField(null=True)
machineuid = CharField(null=True)
notes = CharField(null=True)
starttime = DateTimeField(null=True)
useruid = CharField(null=True)
charge = FloatField()
class Meta:
table_name = 'log'
class Machine(ModelBase):
id = PrimaryKeyField()
creator = CharField()
machineuid = CharField(unique=True)
machinename = CharField()
status = IntegerField(null=True)
costperminute = FloatField()
costminimum = FloatField()
class Meta:
table_name = 'machine'
class User(ModelBase):
carduid = CharField(null=True)
username = CharField(null=True)
useruid = CharField(null=True, unique=True)
valid = IntegerField(null=True)
class Meta:
table_name = 'user'
class Permission(ModelBase):
caninduct = IntegerField(null=True)
canuse = IntegerField(null=True)
creator = CharField(null=True)
machineuid = ForeignKeyField(column_name='machineuid', model=Machine, field='machineuid')
useruid = ForeignKeyField(column_name='useruid', model=User, field='useruid')
class Meta:
table_name = 'permission'