From 2c85aeedf4a66d2bf4f8b25b8f3bcf8c29722028 Mon Sep 17 00:00:00 2001 From: InfiniteTF Date: Sun, 3 May 2020 00:54:02 +0200 Subject: [PATCH] Set movies studioId on create mutation (#511) --- pkg/api/resolver_mutation_movie.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/api/resolver_mutation_movie.go b/pkg/api/resolver_mutation_movie.go index 75acf83f6..d52d0dabe 100644 --- a/pkg/api/resolver_mutation_movie.go +++ b/pkg/api/resolver_mutation_movie.go @@ -64,6 +64,11 @@ func (r *mutationResolver) MovieCreate(ctx context.Context, input models.MovieCr newMovie.Rating = sql.NullInt64{Int64: rating, Valid: true} } + if input.StudioID != nil { + studioID, _ := strconv.ParseInt(*input.StudioID, 10, 64) + newMovie.StudioID = sql.NullInt64{Int64: studioID, Valid: true} + } + if input.Director != nil { newMovie.Director = sql.NullString{String: *input.Director, Valid: true} }