Fuckin yaldi, working kimai import 💅
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from datetime import datetime
|
||||
import logging
|
||||
from peewee import SqliteDatabase, Model, CharField, ForeignKeyField, DateTimeField
|
||||
from peewee import SqliteDatabase, Model, CharField, ForeignKeyField, DateTimeField, SmallIntegerField, BooleanField
|
||||
|
||||
from textual.logging import TextualHandler
|
||||
|
||||
@ -49,6 +50,7 @@ class KimaiCustomer(Model):
|
||||
class KimaiProject(Model):
|
||||
name = CharField()
|
||||
customer = ForeignKeyField(KimaiCustomer, backref="projects")
|
||||
allow_global_activities = BooleanField(default=True)
|
||||
|
||||
class Meta:
|
||||
database = db
|
||||
@ -64,7 +66,7 @@ class KimaiActivity(Model):
|
||||
table_name = "kimai_activities"
|
||||
|
||||
|
||||
class HamsterKimaiMapping(Model):
|
||||
class HamsterActivityKimaiMapping(Model):
|
||||
hamster_activity = ForeignKeyField(HamsterActivity, backref="mappings")
|
||||
kimai_customer = ForeignKeyField(KimaiCustomer, backref="mappings")
|
||||
kimai_project = ForeignKeyField(KimaiProject, backref="mappings")
|
||||
@ -75,3 +77,13 @@ class HamsterKimaiMapping(Model):
|
||||
class Meta:
|
||||
database = db
|
||||
table_name = "hamster_kimai_mappings"
|
||||
|
||||
|
||||
class HamsterFactKimaiImport(Model):
|
||||
hamster_fact = ForeignKeyField(HamsterFact, backref="mappings")
|
||||
kimai_id = SmallIntegerField()
|
||||
imported = DateTimeField(default=datetime.now)
|
||||
|
||||
class Meta:
|
||||
database = db
|
||||
table_name = "hamster_fact_kimai_imports"
|
||||
|
Reference in New Issue
Block a user