Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: add `CreatedTs` field to `MemoCreate` (#1073)

boojackbdf0c442467c
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, ", ") + `