lab4 done
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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)})
|
||||
}
|
||||
Reference in New Issue
Block a user