aboutsummaryrefslogtreecommitdiffstats
path: root/internal/thing/model/model.go
diff options
context:
space:
mode:
authorLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-06-30 21:41:41 -0400
committerLibravatar Mo Tarbin <mhed.t91@gmail.com>2024-06-30 21:41:41 -0400
commitc13dd9addbf89f716e4ef5cfdf1d673139ffcb68 (patch)
treebc09646ce1d6d3a402abb4694e19da51b57204f6 /internal/thing/model/model.go
downloaddonetick-c13dd9addbf89f716e4ef5cfdf1d673139ffcb68.tar.gz
donetick-c13dd9addbf89f716e4ef5cfdf1d673139ffcb68.tar.bz2
donetick-c13dd9addbf89f716e4ef5cfdf1d673139ffcb68.zip
Move to Donetick Org, first commit
Diffstat (limited to 'internal/thing/model/model.go')
-rw-r--r--internal/thing/model/model.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/thing/model/model.go b/internal/thing/model/model.go
new file mode 100644
index 0000000..1780c64
--- /dev/null
+++ b/internal/thing/model/model.go
@@ -0,0 +1,30 @@
+package model
+
+import "time"
+
+type Thing struct {
+ ID int `json:"id" gorm:"primary_key"`
+ UserID int `json:"userID" gorm:"column:user_id"`
+ CircleID int `json:"circleId" gorm:"column:circle_id"`
+ Name string `json:"name" gorm:"column:name"`
+ State string `json:"state" gorm:"column:state"`
+ Type string `json:"type" gorm:"column:type"`
+ ThingChores []ThingChore `json:"thingChores" gorm:"foreignkey:ThingID;references:ID"`
+ UpdatedAt *time.Time `json:"updatedAt" gorm:"column:updated_at"`
+ CreatedAt *time.Time `json:"createdAt" gorm:"column:created_at"`
+}
+
+type ThingHistory struct {
+ ID int `json:"id" gorm:"primary_key"`
+ ThingID int `json:"thingId" gorm:"column:thing_id"`
+ State string `json:"state" gorm:"column:state"`
+ UpdatedAt *time.Time `json:"updatedAt" gorm:"column:updated_at"`
+ CreatedAt *time.Time `json:"createdAt" gorm:"column:created_at"`
+}
+
+type ThingChore struct {
+ ThingID int `json:"thingId" gorm:"column:thing_id;primaryKey;uniqueIndex:idx_thing_user"`
+ ChoreID int `json:"choreId" gorm:"column:chore_id;primaryKey;uniqueIndex:idx_thing_user"`
+ TriggerState string `json:"triggerState" gorm:"column:trigger_state"`
+ Condition string `json:"condition" gorm:"column:condition"`
+}