Skip to content

feat: add LocationService.create method#838

Open
2ndalpha wants to merge 2 commits intomasterfrom
feat/location-create
Open

feat: add LocationService.create method#838
2ndalpha wants to merge 2 commits intomasterfrom
feat/location-create

Conversation

@2ndalpha
Copy link
Copy Markdown
Member

@2ndalpha 2ndalpha commented Apr 2, 2026

Summary

  • Add LocationService.create() method that calls POST /locations (V2 API) to create a new location
  • New LocationCreationRequest interface with required fields (name, latitude, longitude, address, country) and optional fields (openingHours, inputFields, languages)
  • New LocationCreatedResponse interface returning { id: string }
  • Client-side validation of required fields before sending the request, with typeof/isNaN checks for numeric coordinates to correctly accept 0 as a valid value
  • Follows the same pattern established by LineService.create

New files

  • model/location/location-creation-request.ts — request interface
  • model/location/location-created-response.ts — response interface

Modified files

  • services/location/location.tscreate function implementation
  • services/location/location.service.ts — service export with JSDoc
  • services/location/location.service.spec.ts — 15 new tests
  • public-api/model.ts — type exports

Test plan

  • All 26 location service tests pass (15 new)
  • TypeScript compiles with no errors (tsc --noEmit)
  • Verify POST /locations works against a running backend with required fields only
  • Verify optional fields (openingHours, inputFields, languages) are passed through correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant