1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-24 13:48:49 +08:00
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
This commit is contained in:
Dušan Borovčanin 2021-04-19 11:54:08 +02:00 committed by GitHub
parent 0fe9f55bae
commit 84978c034b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -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
}

View File

@ -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{