Merge branch 'optional_performer_image' of https://github.com/WithoutPants/stash into optional_performer_image

This commit is contained in:
WithoutPants
2019-08-24 17:17:40 +10:00
3 changed files with 17 additions and 6 deletions

View File

@@ -112,15 +112,18 @@ func (r *mutationResolver) PerformerUpdate(ctx context.Context, input models.Per
UpdatedAt: models.SQLiteTimestamp{Timestamp: time.Now()},
}
if input.Image != nil {
checksum, imageData, err := utils.ProcessBase64Image(*input.Image)
_, imageData, err := utils.ProcessBase64Image(*input.Image)
if err != nil {
return nil, err
}
updatedPerformer.Image = imageData
updatedPerformer.Checksum = checksum
}
if input.Name != nil {
// generate checksum from performer name rather than image
checksum := utils.MD5FromString(*input.Name)
updatedPerformer.Name = sql.NullString{String: *input.Name, Valid: true}
updatedPerformer.Checksum = checksum
}
if input.URL != nil {
updatedPerformer.URL = sql.NullString{String: *input.URL, Valid: true}