Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): number field was returned as integer #1283

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/internal/adapter/gql/gqlmodel/convert_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ func ToSchemaFieldTypeProperty(tp *schema.TypeProperty, dv *value.Multiple, mult
v, _ = dv.First().ValueNumber()
}
}
res = &SchemaFieldInteger{
res = &SchemaFieldNumber{
DefaultValue: v,
Min: util.ToPtrIfNotEmpty(int(lo.FromPtr(f.Min()))),
Max: util.ToPtrIfNotEmpty(int(lo.FromPtr(f.Max()))),
Min: util.ToPtrIfNotEmpty(float64(lo.FromPtr(f.Min()))),
Max: util.ToPtrIfNotEmpty(float64(lo.FromPtr(f.Max()))),
}
},
Integer: func(f *schema.FieldInteger) {
Expand Down
4 changes: 3 additions & 1 deletion server/internal/adapter/gql/gqlmodel/convert_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func ToValueType(t value.Type) SchemaFieldType {
case value.TypeSelect:
return SchemaFieldTypeSelect
case value.TypeNumber:
return SchemaFieldTypeInteger
return SchemaFieldTypeNumber
case value.TypeInteger:
return SchemaFieldTypeInteger
case value.TypeReference:
Expand Down Expand Up @@ -69,6 +69,8 @@ func FromValueType(t SchemaFieldType) value.Type {
return value.TypeCheckbox
case SchemaFieldTypeInteger:
return value.TypeInteger
case SchemaFieldTypeNumber:
return value.TypeNumber
case SchemaFieldTypeReference:
return value.TypeReference
case SchemaFieldTypeURL:
Expand Down
Loading