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 default `ORDER BY`

boojack948b53393aa7
diff --git a/store/memo.go b/store/memo.go
index 3e7269e6b..9a6264876 100644
--- a/store/memo.go
+++ b/store/memo.go
@@ -219,7 +219,8 @@ func findMemoRawList(db *sql.DB, find *api.MemoFind) ([]*memoRaw, error) {
content,
row_status
FROM memo
- WHERE `+strings.Join(where, " AND "),
+ WHERE `+strings.Join(where, " AND ")+`
+ ORDER BY created_ts DESC`,
args...,
)
if err != nil {
diff --git a/store/resource.go b/store/resource.go
index 94804efce..230480d64 100644
--- a/store/resource.go
+++ b/store/resource.go
@@ -154,7 +154,8 @@ func findResourceList(db *sql.DB, find *api.ResourceFind) ([]*resourceRaw, error
created_ts,
updated_ts
FROM resource
- WHERE `+strings.Join(where, " AND "),
+ WHERE `+strings.Join(where, " AND ")+`
+ ORDER BY created_ts DESC`,
args...,
)
if err != nil {
diff --git a/store/shortcut.go b/store/shortcut.go
index f9f5ee368..0cd583c06 100644
--- a/store/shortcut.go
+++ b/store/shortcut.go
@@ -202,7 +202,8 @@ func findShortcutList(db *sql.DB, find *api.ShortcutFind) ([]*shortcutRaw, error
updated_ts,
row_status
FROM shortcut
- WHERE `+strings.Join(where, " AND "),
+ WHERE `+strings.Join(where, " AND ")+`
+ ORDER BY created_ts DESC`,
args...,
)
if err != nil {
diff --git a/store/user.go b/store/user.go
index 9735ad113..559c255e5 100644
--- a/store/user.go
+++ b/store/user.go
@@ -219,7 +219,8 @@ func findUserList(db *sql.DB, find *api.UserFind) ([]*userRaw, error) {
created_ts,
updated_ts
FROM user
- WHERE `+strings.Join(where, " AND "),
+ WHERE `+strings.Join(where, " AND ")+`
+ ORDER BY created_ts DESC`,
args...,
)
if err != nil {