Set movies studioId on create mutation (#511)

This commit is contained in:
InfiniteTF 2020-05-03 00:54:02 +02:00 committed by GitHub
parent 0e01177440
commit 2c85aeedf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -64,6 +64,11 @@ func (r *mutationResolver) MovieCreate(ctx context.Context, input models.MovieCr
newMovie.Rating = sql.NullInt64{Int64: rating, Valid: true} 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 { if input.Director != nil {
newMovie.Director = sql.NullString{String: *input.Director, Valid: true} newMovie.Director = sql.NullString{String: *input.Director, Valid: true}
} }