feat: implement template storage and download functionality with Docker support

This commit is contained in:
2026-01-09 08:07:18 +01:00
parent 661f57cace
commit 97a12a3bcd
9 changed files with 106 additions and 4 deletions

View File

@@ -168,6 +168,32 @@ If you need additional transformations (like extracting different parts of codes
- Maximum file size: 10MB
- **For repeated information**: If you need the same data to appear multiple times, create unique placeholders like `{project_name_header}` and `{project_name_footer}` and provide the same value for both
## Storage & Persistence
Templates are stored in two locations for persistence in Docker environments:
### Database Storage
- **Location**: `data/database.sqlite` (table: `docx_templates`)
- **Content**: Template metadata (name, description, file paths, timestamps)
- **Persistence**: Handled by Docker volume mount `./data:/app/data`
### File Storage
- **Location**: `templates/` (host) → `/app/templates/` (container)
- **Content**: Actual DOCX template files
- **Persistence**: Handled by Docker volume mount `./templates:/app/templates`
- **Web Access**: Files are served via `/api/templates/download/{filename}`
### Docker Volume Mounts
Both development and production Docker setups include volume mounts to ensure template persistence across container restarts:
```yaml
volumes:
- ./data:/app/data # Database
- ./templates:/app/templates # Template files
- ./uploads:/app/public/uploads # Other uploads
- ./backups:/app/backups # Backup files
```
## Troubleshooting
- **Duplicate tags error**: Each placeholder can only be used once in the template. If you need the same information to appear multiple times, use unique placeholders like `{project_name_1}` and `{project_name_2}` with the same data value.