Files
2026-11-10 20:42:03 +03:00

19 lines
568 B
Go

package attachment
import (
"encoding/json"
"gitflic.ru/akselbant/mtusi2026lab1-fork/dto"
)
// MarshalJSON uses the API's fixed microsecond precision instead of time.Time's
// variable fractional precision, which Python 3.9 clients cannot always parse.
func (a Attachment) MarshalJSON() ([]byte, error) {
type fields Attachment
return json.Marshal(struct {
fields
CreatedAt dto.Timestamp `json:"created_at"`
UpdatedAt dto.Timestamp `json:"updated_at"`
}{fields: fields(a), CreatedAt: dto.Timestamp(a.CreatedAt), UpdatedAt: dto.Timestamp(a.UpdatedAt)})
}