Skip to content

Commit

Permalink
fix: for online price locations, no OSM fields (#997)
Browse files Browse the repository at this point in the history
Impacted files:
* `api_prices_test.dart`: minor change
* `location.dart`: made OSM fields nullable
* `location.g.dart`: wtf
  • Loading branch information
monsieurtanuki authored Nov 26, 2024
1 parent 8a01b5c commit 43bb499
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/src/prices/location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ part 'location.g.dart';
class Location extends JsonObject {
/// ID of the location in OpenStreetMap: the store where the product was bought.
@JsonKey(name: 'osm_id')
late int osmId;
int? osmId;

/// Type of the location object.
@JsonKey(name: 'type')
Expand All @@ -26,7 +26,7 @@ class Location extends JsonObject {
/// It is necessary to be able to fetch the correct information about the
/// store using the ID.
@JsonKey(name: 'osm_type')
late LocationOSMType type;
LocationOSMType? type;

/// Number of prices for this location.
@JsonKey(name: 'price_count')
Expand Down
6 changes: 3 additions & 3 deletions lib/src/prices/location.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions test/api_prices_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ void main() {

final MaybeError<Location> maybeSameOSMLocation =
await OpenPricesAPIClient.getOSMLocation(
locationOSMType: location.type,
locationOSMId: location.osmId,
locationOSMType: location.type!,
locationOSMId: location.osmId!,
uriHelper: uriHelper,
);
expect(maybeSameOSMLocation.isError, isFalse);
Expand Down

0 comments on commit 43bb499

Please sign in to comment.