graphile / graphile/global-ids

Roadmap: additional CRUD methods on mapping tables

Open
#2 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
9
Forks
1
PR merge metrics
No merged PRs in 30d

Description

In the special case of mapping tables (i.e. where all columns of the table definition can be represented as `nodeId`s), it would be nice if additional default CRUD methods were exposed for operating on them as a set of `nodeId`s. For example:

```sql
create table public.users_to_organizations (
contract_id text NOT NULL,
organization_code text NOT NULL,
user_id text NOT NULL REFERENCES public.users(auid),

FOREIGN KEY (contract_id, organization_code) REFERENCES public.organizations(contract_id, code),
PRIMARY KEY (auid, contract_id, organization_code)
)
```

```graphql
mutation {
# delete specified (or all, by default) existing mappings
deleteAllUserToOrganizations(userNodeId: "...", organizationNodeIds: [ "..." ]) {
user {
# ...
}
organizations {
# ...
}
}

# create specified (or all, by default) existing mappings
createAllUserToOrganizations(userNodeId: "...", organizationNodeIds: [ "..." ]) {
user {
# ...
}
organizations {
# ...
}
}

# delete all existing mappings from the table and insert specified new ones
setAllUserToOrganizations(userNodeId: "...", organizationNodeIds: [ "..." ]) {
user {
# ...
}
organizations {
# ...
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.