Skip to content

Commit

Permalink
Merge pull request #21 from Vizzuality/fix/cms/precision_on_decimal_c…
Browse files Browse the repository at this point in the history
…olumns

Amended precision on decimal columns to allow storing bigger numbers
  • Loading branch information
Agnieszka Figiel authored Oct 24, 2023
2 parents 26e496b + 8276a28 commit d88c2a8
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@
"target": "api::fishing-protection-level.fishing-protection-level"
},
"area": {
"type": "decimal"
"type": "decimal",
"required": true,
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
}
}
}
14 changes: 12 additions & 2 deletions cms/src/api/habitat-stat/content-types/habitat-stat/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@
"protectedArea": {
"type": "decimal",
"required": true,
"min": 0
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
},
"totalArea": {
"type": "decimal",
"required": true,
"min": 0
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
"area": {
"type": "decimal",
"required": true,
"min": 0
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
}
}
}
9 changes: 8 additions & 1 deletion cms/src/api/mpa/content-types/mpa/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@
"required": true
},
"area": {
"type": "decimal"
"type": "decimal",
"required": true,
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
},
"year": {
"type": "integer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
"area": {
"type": "decimal",
"required": true,
"min": 0
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@
"area": {
"type": "decimal",
"required": true,
"min": 0
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,21 @@
"cumSumProtectedArea": {
"type": "decimal",
"required": true,
"min": 0
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
},
"protectedArea": {
"type": "decimal",
"required": true,
"min": 0
"min": 0,
"column": {
"defaultTo": 0,
"type": "decimal",
"args": [10,2]
}
},
"protectedAreasCount": {
"type": "integer",
Expand Down
2 changes: 1 addition & 1 deletion cms/src/extensions/documentation/public/index.html

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions cms/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,11 @@ export interface ApiFishingProtectionLevelStatFishingProtectionLevelStat
'oneToOne',
'api::fishing-protection-level.fishing-protection-level'
>;
area: Attribute.Decimal;
area: Attribute.Decimal &
Attribute.Required &
Attribute.SetMinMax<{
min: 0;
}>;
createdAt: Attribute.DateTime;
updatedAt: Attribute.DateTime;
createdBy: Attribute.Relation<
Expand Down Expand Up @@ -908,7 +912,11 @@ export interface ApiMpaMpa extends Schema.CollectionType {
attributes: {
wdpaid: Attribute.Integer;
name: Attribute.String & Attribute.Required;
area: Attribute.Decimal;
area: Attribute.Decimal &
Attribute.Required &
Attribute.SetMinMax<{
min: 0;
}>;
year: Attribute.Integer &
Attribute.SetMinMax<{
min: 0;
Expand Down Expand Up @@ -1189,7 +1197,6 @@ export interface ApiProtectionCoverageStatProtectionCoverageStat
min: 0;
}>;
protectedArea: Attribute.Decimal &
Attribute.Required &
Attribute.SetMinMax<{
min: 0;
}>;
Expand Down

0 comments on commit d88c2a8

Please sign in to comment.