initial commit

master
alex 2023-08-30 21:42:40 +02:00
commit a99ecb7d4d
11 changed files with 161 additions and 0 deletions

3
.idea/.gitignore vendored 100644
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,14 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="flask-swagger-ui" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml 100644
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (putzplan)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/putzplan.iml" filepath="$PROJECT_DIR$/.idea/putzplan.iml" />
</modules>
</component>
</project>

10
.idea/putzplan.iml 100644
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml 100644
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

BIN
local.db 100644

Binary file not shown.

25
main.py 100644
View File

@ -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)

74
models.py 100644
View File

@ -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'

8
requirements.txt 100644
View File

@ -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