mindlesscloud opened a new issue, #5503:
URL: https://github.com/apache/incubator-devlake/issues/5503

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar feature requirement.
   
   
   ### Use case
   
   Definition:
   A scope is considered "deletable" if it is not referenced by any blueprint. 
Similarly, a connection is "deletable" if all scopes associated with it are 
deletable.
   
   To ensure data integrity, we need to perform a deletable check before 
deleting scopes or connections. However, if the user simply wants to clear the 
data, we won't perform this check.
   
   ### Description
   
   ## Delete Scope
   When attempting to delete a scope, the following steps should be followed:
   
   If the scope is not deletable, we should not delete it. Instead, return a 
status code 409 (conflict) along with the following JSON body:
   ```json
   {
     "projects": [
       "projectName1",
       "projectName2"
     ],
     "blueprints": [
       "blueprintName1",
       "blueprintName2"
     ]
   }
   ```
   ## Delete Connection
   When attempting to delete a connection, the process should be as follows:
   
   If the connection is deletable, remove all scopes associated with it and 
then delete the connection itself.
   If the connection is not deletable, we should not delete it. Instead, return 
a status code 409 (conflict) along with the following JSON body:
   ```json
   {
     "projects": [
       "projectName1",
       "projectName2"
     ],
     "blueprints": [
       "blueprintName1",
       "blueprintName2"
     ]
   }
   ```
   By following these guidelines, we can ensure that only deletable scopes and 
connections are removed, and conflicts are properly handled by returning the 
appropriate status codes and JSON bodies.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to