fix: store content filters

This commit is contained in:
Richard Ramos 2022-08-09 14:26:57 -04:00
parent 0525b1cbc7
commit f8d7572548
No known key found for this signature in database
GPG Key ID: BD36D48BC9FFC88C
2 changed files with 10 additions and 3 deletions

View File

@ -14,7 +14,9 @@ import (
// "startTime": 1234, // optional, unix epoch time in nanoseconds
// "endTime": 1234, // optional, unix epoch time in nanoseconds
// "contentFilters": [ // optional
// "contentTopic1", ...
// {
// contentTopic: "contentTopic1"
// }, ...
// ],
// "pagingOptions": {// optional pagination information
// "pageSize": 40, // number

View File

@ -22,7 +22,7 @@ type storePagingOptions struct {
type storeMessagesArgs struct {
Topic string `json:"pubsubTopic,omitempty"`
ContentFilters []string `json:"contentFilters,omitempty"`
ContentFilters []pb.ContentFilter `json:"contentFilters,omitempty"`
StartTime int64 `json:"startTime,omitempty"`
EndTime int64 `json:"endTime,omitempty"`
PagingOptions storePagingOptions `json:"pagingOptions,omitempty"`
@ -73,11 +73,16 @@ func StoreQuery(queryJSON string, peerID string, ms int) string {
ctx = context.Background()
}
var contentTopics []string
for _, ct := range args.ContentFilters {
contentTopics = append(contentTopics, ct.ContentTopic)
}
res, err := wakuNode.Store().Query(
ctx,
store.Query{
Topic: args.Topic,
ContentTopics: args.ContentFilters,
ContentTopics: contentTopics,
StartTime: args.StartTime,
EndTime: args.EndTime,
},