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

#1699, add relationshop to routing plan/group/rateplan and rate_group #1700

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

Ivanov-Anton
Copy link
Member

@Ivanov-Anton Ivanov-Anton commented Feb 25, 2025

Description

add has_many relationships between two API resources (routing_plan and routing_group)
add has_many relationships between two API resources (rateplan - rate_group)

Examples

how to add rate_group for a specific rate-plan

POST {{host}}/api/rest/admin/rateplans/{{last_created_rateplan_id}}/relationships/rate-groups

{
  "data": [
    { "type": "rate-groups", "id": "1" }
  ]
}

how to remove all rate-groups from rate-plan

PATCH {{host}}/api/rest/admin/rateplans/:id?include=rate-groups

{
    "data": {
        "type": "rateplans",
        "id": {{last_created_rateplan_id}},
        "relationships": {
            "rate-groups": {
                "data": []
            }
        }
    }
}

how to add a group to rate-plan (through PATCH request) when rate-plan already contains one group

PATCH {{host}}/api/rest/admin/rateplans/33?include=rate-groups

{
  "data": {
    "type": "rateplans",
    "id": "33",
    "relationships": {
      "rate-groups": {
        "data": [
          {"type": "rate-groups", "id": "1"}, // Existing group
          {"type": "rate-groups", "id": "2"}  // New group
        ]
      }
    }
  }
}

Additional links

closes #1699

@Ivanov-Anton Ivanov-Anton self-assigned this Feb 25, 2025
@Ivanov-Anton Ivanov-Anton linked an issue Feb 25, 2025 that may be closed by this pull request
@Ivanov-Anton Ivanov-Anton force-pushed the 1699-admin-api-missing-relationships branch 2 times, most recently from 213f43a to fac9a74 Compare February 25, 2025 08:03
@Ivanov-Anton Ivanov-Anton added Waiting for code review It means that the owner or member of the repositor can do a code review. and removed Waiting for code review It means that the owner or member of the repositor can do a code review. labels Feb 25, 2025
@Ivanov-Anton Ivanov-Anton removed the request for review from dmitry-sinina February 26, 2025 11:13
@Ivanov-Anton Ivanov-Anton force-pushed the 1699-admin-api-missing-relationships branch from fac9a74 to 525b232 Compare February 26, 2025 19:03
@Ivanov-Anton
Copy link
Member Author

Screenshot 2025-02-26 at 21 03 56

@Ivanov-Anton Ivanov-Anton force-pushed the 1699-admin-api-missing-relationships branch from 525b232 to cb76b56 Compare February 26, 2025 19:07
@Ivanov-Anton Ivanov-Anton force-pushed the 1699-admin-api-missing-relationships branch from cb76b56 to 4a2e969 Compare February 26, 2025 19:08
@Ivanov-Anton Ivanov-Anton added the Waiting for code review It means that the owner or member of the repositor can do a code review. label Feb 26, 2025
@dmitry-sinina dmitry-sinina merged commit 1e04c11 into master Feb 26, 2025
14 checks passed
@Ivanov-Anton Ivanov-Anton deleted the 1699-admin-api-missing-relationships branch February 26, 2025 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for code review It means that the owner or member of the repositor can do a code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin API missing relationships
2 participants