Support location-scoped notification subscriptions (location.feed_added)

Open
#1,779 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
openapi, python, yaml
Domain
api, database

Research direction

Start with the API schema in docs/UserServiceAPI.yaml and the existing subscription creation and response code for POST /v1/user/subscriptions; the issue does not name the implementation files or tests. Trace how subscriptions currently reference targets, then determine how the new location join table fits the database layer. Done means the endpoint creates a subscription for the supplied location IDs and returns those IDs, with the required validation enforced in code.

Written by the indexing model from the issue text.

Description

Description

location.feed_added alerts a user when a feed is added for a location they follow, so a subscription must carry the list of locations. We'll add a dedicated notification_subscription_location join table and expose the location list through the API.

Notification type in scope

Notification type Target
location.feed_added list of location IDs

Schema changes (docs/UserServiceAPI.yaml)

Add location_ids to the create request and to the subscription response:

CreateNotificationSubscriptionRequest:
  properties:
    # ...notification_id...
    location_ids:
      type: array
      items:
        type: string
      description: Location IDs to subscribe to. Required for location.feed_added.

NotificationSubscription:
  properties:
    # ...existing fields...
    location_ids:
      type: array
      items:
        type: string
      nullable: true
      description: Locations this subscription targets (location.feed_added).

Code changes

  • POST /v1/user/subscriptions creates one subscription referencing all supplied locations and returns it with location_ids populated. _Validation is enforced in code, not the schema. Per-type schema validation would need oneOf/discriminator or JSON Schema if/then/else (3.1 only; this spec is 3.0.0), and union typing was already abandoned here due to openapi-generator limitations (see docs/DatabaseCatalogAPI.yaml SearchFeedItemResult).

DB changes

Add new relation table between user subscriptions and locations

Dominant language
Python
Stars
34
Forks
7
Avg merge
2d 22h
Merged PRs (30d)
21

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MobilityData/mobility-feed-api

All issues in MobilityData/mobility-feed-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.