finos / finos/architecture-as-code

Allow archiving of documents in CalmHub

Open
#2,856 8 comments 0 reactions 1 assignee Claimed by @markscott-ms View on GitHub
calm-hub
Dominant language
TypeScript
Stars
399
Forks
138
Avg merge
2d 14h
Merged PRs (30d)
37

Description

## Feature Proposal

### Target Project:
CalmHub

### Description of Feature:
Currently we don't have a delete feature in CalmHub as it's intended to be an immutable store, primarily.
However we do need a way to make things drop off the main UI - so we can clean up clutter.
We will also need a way to move things around, in case they're created in the wrong namespace.

### User Stories:
- As a CalmHub user, I want to archive a document, so that it is no longer visible in the UI
- As a CalmHub user, I want to move a document into a new namespace

### Current Limitations:
There's no way to delete things via the CalmHub API, so short of manual DB changes things can't be deleted.

### Proposed Implementation:
- Give documents a status - 'ACTIVE' or 'ARCHIVED'
- New documents are active by default
- Allow the PUT method to set an archived flag via a query parameter
- `PUT /calm/namespaces/test/architectures/my-architecture/versions/1.0.0?status=archived`
- Exempt this status check from the general config property that bans PUTs to resources

Once we have API support for it, we could add a `calm hub archive/move` command to call it.

### Alternatives Considered:
Leave PUT as-is - for actual content changes - and use another endpoint for metadata changes.
Two options spring to mind:

1. Add a `/metadata` to the path. As this is a partial update most likely, PATCH makes sense:

```
PATCH /calm/namespaces/test/architectures/my-architecture/versions/1.0.0/metadata
Content-Type: application/json

{ "status": "ARCHIVED" }
```
This approach is nice because it leaves room for other metadata such as e.g. document tagging, if we ever want to add that.

2. Use PATCH to modify metadata but on the main path: `PATCH /calm/namespaces/test/architectures/my-architecture/versions/1.0.0`

### Testing Strategy:
Unit and integration testing on calmhub API

### Documentation Requirements:
- Good documentation for the swagger docs.
- Updated READMEs.

### Implementation Checklist:
- [ ] Design reviewed and approved
- [ ] Implementation completed
- [ ] Tests written and passing
- [ ] Documentation updated
- [ ] Relevant workflows updated (if needed)
- [ ] Performance impact assessed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.