diff --git a/api/memo.go b/api/memo.go index 32e53835f..b34403d78 100644 --- a/api/memo.go +++ b/api/memo.go @@ -46,7 +46,8 @@ type Memo struct { type MemoCreate struct { // Standard fields - CreatorID int `json:"-"` + CreatorID int `json:"-"` + CreatedTs *int64 `json:"createdTs"` // Domain specific fields Visibility Visibility `json:"visibility"` diff --git a/store/memo.go b/store/memo.go index 4b1900be3..469491e63 100644 --- a/store/memo.go +++ b/store/memo.go @@ -217,6 +217,10 @@ func createMemoRaw(ctx context.Context, tx *sql.Tx, create *api.MemoCreate) (*me args := []interface{}{create.CreatorID, create.Content, create.Visibility} placeholder := []string{"?", "?", "?"} + if v := create.CreatedTs; v != nil { + set, args, placeholder = append(set, "created_ts"), append(args, *v), append(placeholder, "?") + } + query := ` INSERT INTO memo ( ` + strings.Join(set, ", ") + `