EDMS/dms-api.md
shb 6cb4396f20 Adding mapping function to match API data with current document structure
The current API endpoint data doesn't match the document structure in the frontend logic. So I introduced a mapping function but it has not been called into the code yet as this needs a major refactoring to do.
2025-06-13 11:29:45 +08:00

118 lines
2.8 KiB
Markdown

# DMS API Documentation
## Folders
### GET /api/dms/folder
- **Description**: Retrieves all folders/cabinets in the DMS
- **Method**: GET
- **Response**: List of all folders with their details
- **Response Example**:
```json
{
"status": 200,
"message": "Hello from the backend",
"folders": [...]
}
```
### POST /api/dms/folder
- **Description**: Creates a new folder/cabinet in the DMS
- **Method**: POST
- **Request Body**:
```json
{
"cabinet_name": "Cabinet 1",
"cabinet_parent_id": null,
"cabinet_owner": "",
"cabinet_sector": "",
"dp_id": null,
"userID": null
}
```
- **Required Fields**: cabinet_name, cabinet_sector
- **Response Example**:
```json
{
"status": 201,
"message": "Folder created successfully",
"folder": {...}
}
```
### PATCH /api/dms/folder
- **Description**: Updates an existing folder (rename or move)
- **Method**: PATCH
- **Request Body**:
```json
{
"function": "rename|move",
"cabinet_id": "folder-id",
"new_name": "New Folder Name",
"new_parent_id": "parent-folder-id"
}
```
- **Required Fields**: cabinet_id, function
- **Functions**:
- `rename`: Changes folder name (requires new_name)
- `move`: Changes parent folder (requires new_parent_id)
- **Response Example**:
```json
{
"status": 200,
"message": "Folder renamed successfully",
"folder": {...}
}
```
### DELETE /api/dms/folder
- **Description**: Deletes an existing folder/cabinet from the DMS
- **Method**: DELETE
- **Request Body**:
```json
{
"cabinet_id": "folder-id"
}
```
- **Required Fields**: cabinet_id
- **Response Example**:
```json
{
"status": 200,
"message": "Folder deleted successfully",
"folder": {...}
}
```
## Settings
### GET /api/dms/settings
- **Description**: Retrieves DMS configuration settings
- **Method**: GET
- **Response**: Comprehensive settings for the DMS organized by category
- **Categories**:
- User & Access Management
- Document & Folder Settings
- Metadata & Tagging
- Workflow & Automation
- Upload & Storage Settings
- System Settings
### POST /api/dms/settings
- **Description**: Updates DMS configuration settings
- **Method**: POST
- **Request Body**: Object containing settings to update, structured by category
- **Categories**:
- access: User roles, permissions, authentication
- documents: Folder hierarchy, naming conventions, retention, version control
- metadata: Custom fields, tagging, classification
- workflow: Approval flows, notifications, automation
- upload: File types, size limits, quotas, storage
- system: Timezone, backup, maintenance, monitoring
- **Response Example**:
```json
{
"statusCode": 200,
"message": "DMS settings updated successfully",
"data": { "settingID": 1 }
}
```