-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodels.py
More file actions
73 lines (64 loc) · 2.98 KB
/
models.py
File metadata and controls
73 lines (64 loc) · 2.98 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
"""
MIT License
Copyright (c) 2022 DSLink Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from app import db
from sqlalchemy.orm import relationship
from flask_login import UserMixin
class User(UserMixin, db.Model):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(64), unique=True)
email = db.Column(db.String(120), unique=True)
password_hash = db.Column(db.String(128))
gsuser = db.relationship("GSUser", backref="user", lazy="dynamic")
def __repr__(self):
return "<User {}>".format(self.username)
class GSUser(db.Model):
__tablename__ = "gsuser"
id = db.Column(
db.Integer, primary_key=True
) # TODO: create a frontend where you can see GS related info, and download your save, and maybe even edit it
tid = db.Column(db.Integer)
# NOTE: this should be pretty easy to implement
name = db.Column(db.String(14))
poke_is_sleeping = db.Column(db.Boolean())
gender = db.Column(
db.Integer, default=0
) # 0 = male, 1 = female (I think? Don't know yet so it just defaults to 0)
gamever = db.Column(
db.Integer
) # 20 = white, 21 = black, 22 = white 2, 23 = black 2
uid = db.Column(db.Integer, db.ForeignKey("users.id"))
selected_cgear_skin = db.Column(db.String)
selected_dex_skin = db.Column(db.String)
selected_musical = db.Column(db.String)
# this has got to be the jankiest thing i have done in my life
pokemon0 = db.Column(db.LargeBinary)
pokemon1 = db.Column(db.LargeBinary)
pokemon2 = db.Column(db.LargeBinary)
pokemon3 = db.Column(db.LargeBinary)
pokemon4 = db.Column(db.LargeBinary)
pokemon5 = db.Column(db.LargeBinary)
pokemon6 = db.Column(db.LargeBinary)
pokemon7 = db.Column(db.LargeBinary)
pokemon8 = db.Column(db.LargeBinary)
pokemon9 = db.Column(db.LargeBinary)
# TODO: What else?
def __repr__(self):
return "<GSUser %r>" % self.id