diff --git a/src/tyt/main.go b/src/tyt/main.go index c5275ee..9b3f31f 100644 --- a/src/tyt/main.go +++ b/src/tyt/main.go @@ -83,6 +83,14 @@ func installAPI(db *buntdb.DB) { factory: func() IEntity { return &Team{} }, }.install() + // organizations API + API{ + db: db, + resource: "org", + collection: "orgs", + factory: func() IEntity { return &Organization{} }, + }.install() + // events API API{ db: db, @@ -91,5 +99,13 @@ func installAPI(db *buntdb.DB) { factory: func() IEntity { return &Event{} }, }.install() + // events API + API{ + db: db, + resource: "spectacle", + collection: "spectacles", + factory: func() IEntity { return &Spectacle{} }, + }.install() + // TODO api to change user password } diff --git a/src/tyt/model.go b/src/tyt/model.go index 0ed16e6..c64741b 100644 --- a/src/tyt/model.go +++ b/src/tyt/model.go @@ -1,8 +1,9 @@ package main import ( - "github.com/satori/go.uuid" "time" + + "github.com/satori/go.uuid" ) type IEntity interface { @@ -56,13 +57,23 @@ type User struct { } type Team struct { + Entity + OrganizationID string `json:"organization_id,omitempty"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + Slug string `json:"slug,omitempty"` + Github string `json:"github,omitempty"` // github URL + Telegram string `json:"telegram,omitempty"` // team chat + Members []string `json:"members,omitempty"` // member ids +} + +type Organization struct { Entity Name string `json:"name"` Description string `json:"description,omitempty"` Slug string `json:"slug,omitempty"` - Github string `json:"github,omitempty"` // github URL - Telegram string `json:"telegram,omitempty"` // team chat - Members []string `json:"members,omitempty"` // member ids + Github string `json:"github,omitempty"` // organization github URL + Teams []string `json:"teams,omitempty"` // team ids } type Event struct { @@ -73,5 +84,14 @@ type Event struct { Start time.Time `json:"start"` End time.Time `json:"end"` // allow to track just time spent in hours - Duration int32 `json:"duration"` + Duration int32 `json:"duration"` + SpectacleID string `json:"spectacle_id,omitempty"` +} + +type Spectacle struct { + Entity + Type string `json:"type"` + Title string `json:"title"` + Start time.Time `json:"start"` + End time.Time `json:"end"` }