-
Notifications
You must be signed in to change notification settings - Fork 0
/
modules.py
46 lines (35 loc) · 1.42 KB
/
modules.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
from sqlalchemy import Column, ForeignKey, Integer, String, Boolean, DateTime, Text
from sqlalchemy.orm import relationship
from datetime import datetime
from .database import Base
ProblemType=["疑问","故障","清理"]
HelpType=["软件问题","硬件问题","两者都有","其他问题"]
class Worker(Base):
__tablename__ = 'workers'
id = Column(Integer, primary_key=True)
name = Column(String,unique=True)
contact = Column(String)
available = Column(Boolean,default=False)
lark_id = Column(String,nullable=True)
class Ticket(Base):
__tablename__ = 'tickets'
id = Column(Integer, primary_key=True)
contact = Column(String)
name = Column(String, nullable=True)
description = Column(Text,nullable=True)
# 0:question 1:error 2:clean
problem_type = Column(Integer,nullable=True)
# 0:software 1:hardware 2:both 3:other
help_type = Column(Integer,nullable=True)
hope_date = Column(DateTime,nullable=True)
handled = Column(Boolean, default=False)
create_time = Column(DateTime, default=datetime.now)
update_time = Column(DateTime, onupdate=datetime.now)
worker_id = Column(Integer,ForeignKey('workers.id'),nullable=True)
class Image(Base):
__tablename__ = 'images'
id = Column(Integer,primary_key=True)
path = Column(String)
token = Column(String,nullable=True)
size = Column(Integer)
ticket_id = Column(Integer,ForeignKey('tickets.id'))