From 7d310ecb1a427e940c008939e62f33d2dd96c907 Mon Sep 17 00:00:00 2001 From: Piotr Rogowski Date: Fri, 13 Jan 2023 19:49:45 +0100 Subject: [PATCH] Refactor get tune by tuneId, closes: #2 --- main.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/main.go b/main.go index 144eacb..73eeb8f 100644 --- a/main.go +++ b/main.go @@ -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) },