-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
50 lines (39 loc) · 1.09 KB
/
models.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
import os
from peewee import *
DB_URL_ENV_KEY = "DB_URI"
db = SqliteDatabase(os.environ[DB_URL_ENV_KEY] if DB_URL_ENV_KEY in os.environ else "main.db")
class BaseModel(Model):
class Meta:
database = db
class Offer(BaseModel):
id = AutoField()
company = TextField()
org = TextField()
title = TextField()
industry = TextField()
location = TextField()
salary = TextField()
bonus = TextField()
package = TextField()
note = TextField()
hukou = TextField()
level = TextField()
type_ = TextField()
comments = TextField()
key = TextField()
difficulty = TextField()
up_count = IntegerField(default=0)
down_count = IntegerField(default=0)
created = DateTimeField()
class Comment(BaseModel):
id = AutoField()
offer = ForeignKeyField(Offer, backref='user_comments')
comment = TextField()
ip = TextField()
created = DateTimeField()
class Mark(BaseModel):
id = AutoField()
offer = ForeignKeyField(Offer, backref='user_marks')
mark = IntegerField()
ip = TextField()
created = DateTimeField()