fixing rescue settings

This commit is contained in:
blaisadmin
2026-04-15 22:57:34 -04:00
parent ce2b7a15bf
commit 765d6c61db
8 changed files with 476 additions and 11 deletions
+58
View File
@@ -634,6 +634,31 @@ Response `200`:
}
```
#### `DELETE /api/workspace`
Requires a browser session and role `owner`. Deletes the active flock only when it has no birds.
Behavior:
- if the flock still has birds, deletion is blocked
- collaborators, sessions, and integration tokens tied to the flock are removed with it
- the backend switches the user to another existing flock, or creates a new personal flock automatically if needed
Response `200`:
```json
{
"deletedWorkspaceId": 1001,
"token": "raw-session-token",
"session": {}
}
```
Possible errors:
- `409` if birds are still assigned to the flock
- `404` if the flock no longer exists
#### `GET /api/workspace/members`
Requires auth. Lists members for the active workspace. Browser sessions and integration tokens can both use this endpoint.
@@ -749,6 +774,39 @@ Possible errors:
- `404` if the bird does not exist in the active workspace
- `409` if the workspace already uses that `tagId`
#### `POST /api/birds/:birdId/transfer`
Requires a browser session, write access, and role `owner` or `assistant`. Moves a bird from the active flock to another flock the same user can access.
Request body:
```json
{
"targetWorkspaceId": 1002
}
```
Notes:
- the destination flock must be different from the current flock
- the signed-in user must already be a member of the destination flock
- the bird keeps its existing weight and vet history because the record itself is reassigned
Response `200`:
```json
{
"bird": {}
}
```
Possible errors:
- `400` if the destination flock is the current flock or the payload is invalid
- `403` if the user does not have access to the destination flock
- `404` if the bird is not in the active flock
- `409` if the destination flock already has a bird using the same `tagId`
#### `DELETE /api/birds/:birdId`
Requires auth with write access and role `owner`, `assistant`, or `caregiver`. Deletes a bird.