feat(projects): rename, delete, and a trash you can actually reach
A project could be created and shared and never renamed or deleted. Both have worked through the API since the beginning; there was simply nothing to click. The heading is now the field — a heading that happens to be editable rather than a form that looks like one — and saves on blur, with Escape putting the old name back. Owner only, and the Inbox keeps its plain heading because it cannot be either renamed away or deleted. Deleting needed more than a button. It is soft, with thirty days to change your mind, and restoring has been possible the whole time — from an id, which is exactly what you no longer have once the project has gone from the screen. A recovery window nobody can reach is not one. So GET /trash/projects lists what you have deleted, with how many tasks went with it and how long is left, and Settings → Data has the button. Owned, not shared: a member of a project somebody else deleted has no business bringing it back, and there is a test that says so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
committed by
Kristian Wind
co-authored by
Claude Opus 5
parent
0dbea0ea4b
commit
8a6e1bc39e
@@ -100,6 +100,8 @@ curl -X POST https://todo.example.dk/api/v1/tasks/quick-add \
|
||||
| `POST` | `/projects/{id}/invites` | Share it. `{"email": …, "role": "editor"\|"viewer"}` |
|
||||
| `DELETE` | `/projects/{id}/members/{userID}` | |
|
||||
| `GET` | `/projects/{id}/activity` | |
|
||||
| `GET` | `/trash/projects` | What you have deleted and can still bring back, with how long is left. |
|
||||
| `POST` | `/trash/projects/{id}/restore` | Brings it back with the tasks that went with it. |
|
||||
|
||||
### Views, filters and labels
|
||||
|
||||
|
||||
@@ -785,6 +785,42 @@ paths:
|
||||
"204": { description: Deleted. }
|
||||
"404": { $ref: "#/components/responses/NotFound" }
|
||||
|
||||
/api/v1/trash/projects:
|
||||
get:
|
||||
tags: [projects]
|
||||
summary: Projects you have deleted and can still bring back.
|
||||
description: |
|
||||
Only your own. Restoring has been possible since the trash existed, but
|
||||
the endpoint takes an id — and the id is what you no longer have once the
|
||||
project has gone from the interface.
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
projects:
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/Project"
|
||||
- type: object
|
||||
properties:
|
||||
deleted_at: { type: string, format: date-time }
|
||||
purge_after:
|
||||
type: string
|
||||
format: date-time
|
||||
description: |
|
||||
When it stops being recoverable. Sent rather than
|
||||
left for the client to work out, because the
|
||||
retention window is the server's and a second
|
||||
copy of it will one day disagree.
|
||||
task_count:
|
||||
type: integer
|
||||
description: Tasks that went with it, and would come back with it.
|
||||
|
||||
/api/v1/trash/projects/{projectID}/restore:
|
||||
parameters:
|
||||
- { name: projectID, in: path, required: true, schema: { type: string } }
|
||||
|
||||
Reference in New Issue
Block a user