mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-24 13:48:49 +08:00
Fix order (#1406)
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
This commit is contained in:
parent
0fe9f55bae
commit
84978c034b
@ -41,7 +41,7 @@ func (tr postgresRepository) ReadAll(chanID string, rpm readers.PageMetadata) (r
|
||||
order := "time"
|
||||
format := defTable
|
||||
|
||||
if rpm.Format != "" {
|
||||
if rpm.Format != "" && rpm.Format != defTable {
|
||||
order = "created"
|
||||
format = rpm.Format
|
||||
}
|
||||
|
@ -174,6 +174,19 @@ func TestReadSenml(t *testing.T) {
|
||||
Messages: fromSenml(queryMsgs),
|
||||
},
|
||||
},
|
||||
"read message with publisher and format": {
|
||||
chanID: chanID,
|
||||
pageMeta: readers.PageMetadata{
|
||||
Format: "messages",
|
||||
Offset: 0,
|
||||
Limit: uint64(len(queryMsgs)),
|
||||
Publisher: pubID2,
|
||||
},
|
||||
page: readers.MessagesPage{
|
||||
Total: uint64(len(queryMsgs)),
|
||||
Messages: fromSenml(queryMsgs),
|
||||
},
|
||||
},
|
||||
"read message with protocol": {
|
||||
chanID: chanID,
|
||||
pageMeta: readers.PageMetadata{
|
||||
|
Loading…
x
Reference in New Issue
Block a user