Files
mtusi2026lab2/src/internal/model/models.go
T
Sh1pYe 41e8d67a1a
Application (lab2) / app (pull_request) Failing after 36s
Skeleton contracts / contracts (pull_request) Failing after 29s
Lab2- оценка 5
2026-10-08 14:14:20 +03:00

52 lines
1.1 KiB
Go

package model
import "time"
type Time struct {
time.Time
}
func NewTime(t time.Time) Time { return Time{Time: t} }
func (t Time) MarshalJSON() ([]byte, error) {
return []byte(`"` + t.UTC().Format("2006-01-02T15:04:05.000Z") + `"`), nil
}
type User struct {
ID string `json:"id"`
Username string `json:"username"`
DisplayName string `json:"display_name"`
CreatedAt Time `json:"created_at"`
}
type Chat struct {
ID string `json:"id"`
Title string `json:"title"`
MemberIDs []string `json:"member_ids"`
CreatedAt Time `json:"created_at"`
}
type Message struct {
ID string `json:"id"`
ChatID string `json:"chat_id"`
SenderID string `json:"sender_id"`
Text string `json:"text"`
CreatedAt Time `json:"created_at"`
}
type Page[T any] struct {
Items []T `json:"items"`
NextCursor *string `json:"next_cursor"`
}
type Health struct {
Status string `json:"status"`
}
type Session struct {
Token string `json:"token"`
TokenType string `json:"token_type"`
ExpiresAt Time `json:"expires_at"`
User User `json:"user"`
}