commit a99ecb7d4d4f19100fa9fbbad2c85399ba0b536c Author: alex Date: Wed Aug 30 21:42:40 2023 +0200 initial commit 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 0000000..288de0e Binary files /dev/null and b/local.db differ 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