diff --git a/svc/pkg/domain/model/question/file.go b/svc/pkg/domain/model/question/file.go index 5ddee16..7a05698 100644 --- a/svc/pkg/domain/model/question/file.go +++ b/svc/pkg/domain/model/question/file.go @@ -88,5 +88,6 @@ func (q FileQuestion) Export() (*StandardQuestion, error) { qt := []bool{q.FileTypes.AcceptAny, q.FileTypes.AcceptImage, q.FileTypes.AcceptPDF} customs[FileQuestionFileTypeField] = qt + customs[FileImageConstraintField] = q.ImageFileConstraint.Export() return NewStandardQuestion(TypeFile, q.ID, q.FormID, q.Text, customs), nil } diff --git a/svc/pkg/domain/model/question/file_constraint_image.go b/svc/pkg/domain/model/question/file_constraint_image.go index c9b7c60..7286747 100644 --- a/svc/pkg/domain/model/question/file_constraint_image.go +++ b/svc/pkg/domain/model/question/file_constraint_image.go @@ -285,5 +285,7 @@ func (c ImageFileConstraint) Export() map[string]interface{} { result[FileImageConstraintWidth] = widthC heightC := c.Height.Export() result[FileImageConstraintHeight] = heightC + ratioC := c.Ratio.Export() + result[FileImageConstraintRatio] = ratioC return result } diff --git a/svc/pkg/domain/model/question/file_test.go b/svc/pkg/domain/model/question/file_test.go index 3162220..a710e26 100644 --- a/svc/pkg/domain/model/question/file_test.go +++ b/svc/pkg/domain/model/question/file_test.go @@ -24,6 +24,11 @@ func TestImportFileQuestion(t *testing.T) { Type: TypeFile, Customs: map[string]interface{}{ FileQuestionFileTypeField: []bool{false, true, false}, + FileImageConstraintField: map[string]interface{}{ + FileImageConstraintRatio: map[string]interface{}{}, + FileImageConstraintWidth: map[string]interface{}{}, + FileImageConstraintHeight: map[string]interface{}{}, + }, }, }, want: NewFileQuestion(SampleID1, @@ -121,6 +126,10 @@ func TestImportFileQuestion(t *testing.T) { assert.Equal(t, tc.want.Width, got.Width) assert.Equal(t, tc.want.Height, got.Height) assert.Equal(t, tc.want.Ratio, got.Ratio) + export, err := got.Export() + if assert.NoError(t, err) { + assert.Equal(t, tc.from, *export) + } }) } }