From a99ecb7d4d4f19100fa9fbbad2c85399ba0b536c Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 30 Aug 2023 21:42:40 +0200 Subject: [PATCH] initial commit --- .idea/.gitignore | 3 + .idea/inspectionProfiles/Project_Default.xml | 14 ++++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 7 ++ .idea/modules.xml | 8 ++ .idea/putzplan.iml | 10 +++ .idea/vcs.xml | 6 ++ local.db | Bin 0 -> 24576 bytes main.py | 25 ++++++ models.py | 74 ++++++++++++++++++ requirements.txt | 8 ++ 11 files changed, 161 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/putzplan.iml create mode 100644 .idea/vcs.xml create mode 100644 local.db create mode 100644 main.py create mode 100644 models.py create mode 100644 requirements.txt diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..3531d06 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,14 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..34decca --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1fd0969 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/putzplan.iml b/.idea/putzplan.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/putzplan.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/local.db b/local.db new file mode 100644 index 0000000000000000000000000000000000000000..288de0eb4b1bf312a509dd76957a35cb41427761 GIT binary patch literal 24576 zcmeI&-AWrl6u|MFd_uvGo3K~HVW8NR&qd`dfsYo{@UELLmC1IAbTjgtHPrPhv2D>f3hj(SFPKBwi2PKR2$VQe}klCU33c;4&DkEnaviZ12E zTsB3I2X~2<*j(7v`6q(YO3nY=P+2-2CXWyI$>hpC@hTmI-~wCG!9O)!%3;L;wK<5I_I{1Q0*~0R#|OYXN@$U+e9s XcmxnY009ILKmY**5I_KdH4%6PU*N6? literal 0 HcmV?d00001 diff --git a/main.py b/main.py new file mode 100644 index 0000000..98ebf28 --- /dev/null +++ b/main.py @@ -0,0 +1,25 @@ +from flask import Flask +import peewee as pw +from models import * + +app = Flask(__name__) + + + + + + + + + + + +db = pw.SqliteDatabase('local.db') +db_proxy.initialize(db) + +with db: + db.create_tables([Role, User, Location]) + + +if __name__ == '__main__': + app.run(debug=True) diff --git a/models.py b/models.py new file mode 100644 index 0000000..e8ffc2d --- /dev/null +++ b/models.py @@ -0,0 +1,74 @@ +import peewee as pw +from peewee import Model, DatabaseProxy + + +db_proxy = DatabaseProxy() + + +class BaseModel(Model): + id = pw.PrimaryKeyField() + + class Meta: + database = db_proxy + + +class Role(BaseModel): + name = pw.TextField() + + class Meta: + db_table = 'roles' + + +class User(BaseModel): + name = pw.TextField() + role = pw.ForeignKeyField(Role.id) + + class Meta: + db_table = 'users' + + +class Location(BaseModel): + name = pw.TextField() + + class Meta: + db_table = 'locations' + + +class Dashboard(BaseModel): + name = pw.TextField() + location = pw.ForeignKeyField(Location.id) + + class Meta: + db_table = 'dashboards' + + +class Event(BaseModel): + name = pw.TextField() + dashboard = pw.ForeignKeyField(Dashboard.id) + active = pw.BooleanField() + location = pw.ForeignKeyField(Location.id) + start_time = pw.DateTimeField() + end_time = pw.DateTimeField() + duration = pw.DateTimeField() + + class Meta: + db_table = 'events' + + +class Reminder(BaseModel): + name = pw.TextField() + event = pw.ForeignKeyField(Event.id) + + class Meta: + db_table = 'reminders' + + +class Task(BaseModel): + name = pw.TextField() + event = pw.ForeignKeyField(Event.id) + interval = pw.IntegerField() + + class Meta: + db_table = 'tasks' + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..943adb0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +blinker==1.6.2 +click==8.1.7 +Flask==2.3.3 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.3 +peewee==3.16.3 +Werkzeug==2.3.7