add external id to .model

main
Bel LaPointe 2024-04-16 05:55:31 -06:00
parent a7d5d021d6
commit 0cecd5ea04
3 changed files with 16 additions and 14 deletions

View File

@ -2,8 +2,8 @@ package model
import "time"
// EVENT ||--|{ THREAD: "spawns"
type Event struct {
Updated uint64
ID string
URL string
TS uint64
@ -12,11 +12,11 @@ type Event struct {
Datacenter string
Team string
Resolved bool
Updated uint64
}
func NewEvent(ID, URL string, TS uint64, Name, Asset, Datacenter, Team string, Resolved bool) Event {
return Event{
Updated: updated(),
ID: ID,
URL: URL,
TS: TS,
@ -25,6 +25,9 @@ func NewEvent(ID, URL string, TS uint64, Name, Asset, Datacenter, Team string, R
Datacenter: Datacenter,
Team: Team,
Resolved: Resolved,
Updated: uint64(time.Now().UnixNano() / int64(time.Millisecond)),
}
}
func updated() uint64 {
return uint64(time.Now().UnixNano() / int64(time.Millisecond))
}

View File

@ -1,24 +1,24 @@
package model
import "time"
// THREAD ||--|{ MESSAGE: "populated by"
type Message struct {
Updated uint64
ID string
URL string
TS uint64
Author string
Plaintext string
Updated uint64
ThreadID string
}
func NewMessage(ID, URL string, TS uint64, Author, Plaintext string) Message {
func NewMessage(ID, URL string, TS uint64, Author, Plaintext string, ThreadID string) Message {
return Message{
Updated: updated(),
ID: ID,
URL: URL,
TS: TS,
Author: Author,
Plaintext: Plaintext,
Updated: uint64(time.Now().UnixNano() / int64(time.Millisecond)),
ThreadID: ThreadID,
}
}

View File

@ -1,23 +1,22 @@
package model
import "time"
// EVENT ||--|{ THREAD: "spawns"
// THREAD ||--|{ MESSAGE: "populated by"
type Thread struct {
Updated uint64
ID string
URL string
TS uint64
Channel string
Updated uint64
EventID string
}
func NewThread(ID, URL string, TS uint64, Channel string) Thread {
func NewThread(ID, URL string, TS uint64, Channel string, EventID string) Thread {
return Thread{
Updated: updated(),
ID: ID,
URL: URL,
TS: TS,
Channel: Channel,
Updated: uint64(time.Now().UnixNano() / int64(time.Millisecond)),
EventID: EventID,
}
}