Private
Public Access
1
0

Ensure all dates returned are ISO8601

This commit is contained in:
James Magahern
2024-01-05 16:26:19 -08:00
parent a8043e53b3
commit 831636216d
8 changed files with 53 additions and 24 deletions

View File

@@ -1,16 +1,15 @@
package model
import (
"time"
"github.com/rs/zerolog"
"time"
)
type Message struct {
Text string `json:"text"`
Guid string `json:"guid"`
Sender *string `json:"sender,omitempty"` // Optional: nil means from "me"
Date time.Time `json:"date"`
Text string `json:"text"`
Guid string `json:"guid"`
Sender *string `json:"sender,omitempty"` // Optional: nil means from "me"
Date Date `json:"date"`
// Map of attachment GUID to attachment metadata
Attachments *map[string]AttributionInfo `json:"attachmentMetadata,omitempty"` // Optional
@@ -24,7 +23,7 @@ type AttributionInfo struct {
func (c Message) MarshalZerologObject(e *zerolog.Event) {
e.Str("guid", c.Guid)
e.Str("text", c.Text)
e.Time("date", c.Date)
e.Time("date", time.Time(c.Date))
if c.Sender != nil {
e.Str("sender", *c.Sender)