Refactor get tune by tuneId, closes: #2

This commit is contained in:
Piotr Rogowski 2023-01-13 19:49:45 +01:00
parent 30c2b16232
commit 7d310ecb1a
No known key found for this signature in database
GPG Key ID: 4A842D702D9C6F8F
1 changed files with 1 additions and 9 deletions

10
main.go
View File

@ -33,15 +33,7 @@ func main() {
return apis.NewNotFoundError("Tune not found", nil)
}
_errors := app.Dao().ExpandRecord(record, []string{"author"}, func(relCollection *models.Collection, relIds []string) ([]*models.Record, error) {
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)
}
apis.EnrichRecord(c, app.Dao(), record, "author")
return c.JSON(http.StatusOK, record)
},