nuwave / nuwave/lighthouse

Pay attention of @softDeletes in mutation directives

Open
#1,145 13 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
PHP
Stars
3.5k
Forks
468
Avg merge
3h 9m
Merged PRs (30d)
2

Description

Is your feature proposal related to a problem? Please describe.

Currently implementation of update/upsert don't use enchanceBuilder(), therefore it is not possible to update soft deleted model, because without appending e.g. withTrashed model will not be fetched.

So it is not possible to do something like this:

extend type Mutation {
   updateAuthor(input: AuthorInput @spread): Author @update @softDeletes
}

Well you can use it, but if model is soft deleted, @update is not able to find the entity, as user reporter here

Describe the solution you'd like

So here is my question: Should we take care of soft deleted models in update/upsert?

In my application I currently disabled in UI the ability to edit entity, if it is soft deleted (it is actually in trash). What do you think?

Contributor guide

Open the 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.

Research direction

Start by tracing the update and upsert mutation directive implementations and the referenced enhanceBuilder() behavior, then compare them with the @softDeletes directive. The issue needs an agreed answer on whether trashed models should be editable and corresponding tests before the work is considered done.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, laravel, php
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.