Compare commits

..

2 Commits

Author SHA1 Message Date
1ce4fd93b9 fix: error handling if nothing can be found 2024-07-11 13:32:42 +02:00
1712cb512e fix: now with correct query parameters 2024-07-11 13:32:16 +02:00
2 changed files with 5 additions and 5 deletions

View File

@ -35,22 +35,22 @@ func NewGetDMailsBuilder(requestContext model.RequestContext) DMailsBuilder {
}
func (g getDMails) ByTitle(title string) DMailsBuilder {
g.query["title_matches"] = title
g.query["search[title_matches]"] = title
return g
}
func (g getDMails) ByBody(body string) DMailsBuilder {
g.query["message_matches"] = body
g.query["search[message_matches]"] = body
return g
}
func (g getDMails) ByToName(toName string) DMailsBuilder {
g.query["to_name"] = toName
g.query["search[to_name]"] = toName
return g
}
func (g getDMails) ByFromName(fromName string) DMailsBuilder {
g.query["from_name"] = fromName
g.query["search[from_name]"] = fromName
return g
}

View File

@ -192,7 +192,7 @@ func GetAllDmails(requestContext model.RequestContext, query map[string]string)
if err != nil {
// Log the error and return an empty slice and the error.
return nil, err
return []model.DMail{}, nil
}
// Return the list of posts and no error (nil).