Refactor get tune by tuneId, closes: #2
This commit is contained in:
parent
30c2b16232
commit
7d310ecb1a
10
main.go
10
main.go
|
@ -33,15 +33,7 @@ func main() {
|
||||||
return apis.NewNotFoundError("Tune not found", nil)
|
return apis.NewNotFoundError("Tune not found", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
_errors := app.Dao().ExpandRecord(record, []string{"author"}, func(relCollection *models.Collection, relIds []string) ([]*models.Record, error) {
|
apis.EnrichRecord(c, app.Dao(), record, "author")
|
||||||
record, _err := app.Dao().FindRecordById(relCollection.Name, relIds[0])
|
|
||||||
|
|
||||||
return []*models.Record{record}, _err
|
|
||||||
})
|
|
||||||
|
|
||||||
if len(_errors) > 0 {
|
|
||||||
return apis.NewNotFoundError("Author not found", nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.JSON(http.StatusOK, record)
|
return c.JSON(http.StatusOK, record)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue