allow fetching merps of all types now
This commit is contained in:
parent
037a23dd94
commit
62e7600a22
6
merp.go
6
merp.go
|
@ -34,6 +34,7 @@ func getLatestMerps() gin.HandlerFunc {
|
||||||
|
|
||||||
h := func(c *gin.Context) {
|
h := func(c *gin.Context) {
|
||||||
thing := c.Param("thing")
|
thing := c.Param("thing")
|
||||||
|
if thing != "" {
|
||||||
if ThingRegex.MatchString(thing) == false {
|
if ThingRegex.MatchString(thing) == false {
|
||||||
c.JSON(http.StatusPreconditionFailed, gin.H{
|
c.JSON(http.StatusPreconditionFailed, gin.H{
|
||||||
"this": "failed",
|
"this": "failed",
|
||||||
|
@ -42,9 +43,12 @@ func getLatestMerps() gin.HandlerFunc {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
qs := orm.QueryTable("merp").Filter("thing", thing).OrderBy("-created").Limit(50)
|
||||||
|
} else {
|
||||||
|
qs := orm.QueryTable("merp").OrderBy("-created").Limit(50)
|
||||||
|
}
|
||||||
|
|
||||||
var merps []*models.Merp
|
var merps []*models.Merp
|
||||||
qs := orm.QueryTable("merp").Filter("thing", thing).OrderBy("-created").Limit(50)
|
|
||||||
qs.All(&merps)
|
qs.All(&merps)
|
||||||
|
|
||||||
output := make([]map[string]interface{}, 0)
|
output := make([]map[string]interface{}, 0)
|
||||||
|
|
Loading…
Reference in New Issue