package webshared import ( "time" "git.mstar.dev/mstar/linstrom/shared" "git.mstar.dev/mstar/linstrom/storage-new/models" ) type Note struct { // ---- Section public data ID string `json:"id"` CreatedAt time.Time `json:"created_at"` CreatorId string `json:"creator_id"` ServerId uint `json:"server_id"` RawContent string `json:"raw_content"` ContentWarning *string `json:"content_warning"` RepliesToId *string `json:"replies_to_id"` QuotesId *string `json:"quotes_id"` AccessLevel uint8 `json:"access_level"` } // Compile time interface implementation enforcement var _ shared.Clonable = &Note{} var _ shared.Sanitisable = &Note{} func (note *Note) Sanitize() { } func (note *Note) Clone() shared.Clonable { tmp := *note return &tmp } func (n *Note) FromModel(m *models.Note) { n.ID = m.ID n.CreatedAt = m.CreatedAt n.CreatorId = m.CreatorId n.ServerId = m.OriginId n.RawContent = m.RawContent if m.ContentWarning.Valid { n.ContentWarning = &m.ContentWarning.String } else { n.ContentWarning = nil } if m.RepliesTo.Valid { n.RepliesToId = &m.RepliesTo.String } else { n.RepliesToId = nil } if m.Quotes.Valid { n.QuotesId = &m.Quotes.String } else { n.QuotesId = nil } n.AccessLevel = uint8(m.AccessLevel) }