mlipscombe / postgraphile-plugin-nested-mutations

Nested mutations for Postgraphile
MIT License
83 stars 41 forks source link

Delete mutations not visible #55

Open Tam opened 3 years ago

Tam commented 3 years ago

The delete mutations aren't available in the Update patch relation, even though there is a top-level delete mutation available for the relation.

Available nested mutations:

connectByCurrencyIdAndCountryId: [CurrencyCountryCurrencyCountryPkeyConnect!]

connectByNodeId: [CurrencyCountryNodeIdConnect!]

updateByCurrencyIdAndCountryId: [CurrencyCountryOnCurrencyCountryForCurrencyCountryCountryIdFkeyUsingCurrencyCountryPkeyUpdate!]

updateByNodeId: [CountryOnCurrencyCountryForCurrencyCountryCountryIdFkeyNodeIdUpdate!]

create: [CurrencyCountryCountryIdFkeyCurrencyCountryCreateInput!]

Available root delete mutation:

Mutation.deleteCurrencyCountry

The table schema:

create table if not exists pivot.currency_country (
  currency_id uuid references public.currency(id) on delete cascade,
  country_id  uuid references public.country(id) on delete cascade,
  primary key (currency_id, country_id)
);

comment on table pivot.currency_country is E'@omit all';

comment on constraint currency_country_currency_id_fkey on pivot.currency_country is E'@fieldName currency\n@foreignFieldName countries';
comment on constraint currency_country_country_id_fkey on pivot.currency_country is E'@fieldName country\n@foreignFieldName currencies';

alter table pivot.currency_country enable row level security;

revoke all on table pivot.currency_country from anonymous, member;
grant select on table pivot.currency_country to anonymous, member;

revoke all on table pivot.currency_country from admin;
grant all on table pivot.currency_country to admin;

drop policy if exists pivot_currency_country_select on pivot.currency_country;
create policy pivot_currency_country_select on pivot.currency_country for select
  using (true);

drop policy if exists pivot_currency_country_all on pivot.currency_country;
create policy pivot_currency_country_all on pivot.currency_country for all
  using (util.is_admin());

The above should give admin users permissions to not only create but also delete relations.

vnphanquang commented 3 years ago

Same issue here but in my case removing the PrimaryKeyMutationsOnlyPlugin plugin forked from graphile-starter fixed it. You might have some similar plugin that created the conflict. Hope that helps @Tam

My env: