Skip to content

feature/M8F-76 initial updates for new templace package import export#39

Open
abilpraju-aot wants to merge 3 commits intoAOT-Technologies:mainfrom
abilpraju-aot:feature/M8F-76
Open

feature/M8F-76 initial updates for new templace package import export#39
abilpraju-aot wants to merge 3 commits intoAOT-Technologies:mainfrom
abilpraju-aot:feature/M8F-76

Conversation

@abilpraju-aot
Copy link
Collaborator

@abilpraju-aot abilpraju-aot commented Feb 9, 2026

JIRA Ticket

https://aottech.atlassian.net/browse/M8F-76
https://aottech.atlassian.net/browse/M8F-25

Description

Features

  • Multi-file templates – Templates can have multiple files (BPMN, DMN, JSON, MD). New endpoints: list/upload/download/delete files per template (/templates/{id}/files, /templates/{id}/files/{file_name}).
  • ZIP export/import – Export a template as a ZIP (all files + template.json). Import a template from a ZIP; creates a new version when the key already exists.
  • Export process model as template – New endpoint POST /v1.0/m8flow/process-models/{model_id}/export-as-template to save a process model as a template (frontend uses the correct base path).

Backend

  • Storage – Added get_bpmn / store_bpmn to the template storage layer (MinIO/Filesystem/Noop) so BPMN-by-key and multi-file flows both work.
  • Create template – Supports (1) legacy application/xml body + X-Template-* headers and (2) multipart/form-data with form fields and optional files. OpenAPI spec updated for both.
  • Schema/DBbpmn_object_key is now nullable; migration adds primary_file_name and file_list_cached (no column drop). Template model and AuditDateTimeMixin aligned (modified_at used correctly).
  • Fixes – FileValidator called with a list of dicts {file_name, size} from the create flow. Import-from-ZIP response returns camelCase templateKey. Template file cache builds TemplateFile with modified_at as datetime. Connexion: extension src added to sys.path and specification_dir passed when registering the merged spec; pre-validate import of templates_controller so path/import errors surface at startup.

Frontend

  • TemplateService – New methods: getTemplateFiles, uploadTemplateFiles, downloadTemplateFile, deleteTemplateFile, exportTemplateAsZip, importTemplateFromZip, exportProcessModelAsTemplate (using /v1.0/m8flow/process-models/...).
  • UI – Template file list/upload, import-from-ZIP modal, and related types/hooks (existing template gallery and create flows unchanged; create still works via XML + headers).

Type

  • Feature
  • Bug fix
  • Documentation
  • Other

Changes

  • Backend
  • Frontend
  • Documentation

Testing

Related Issues

Closes #

@abilpraju-aot abilpraju-aot marked this pull request as ready for review February 10, 2026 08:30
"""template_files_json: add files JSON column, migrate from bpmn_object_key, drop bpmn_object_key

Revision ID: b1c2d3e4f5a6
Revises: 22aaaa61d8f6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please update version in comment to 9f2d0e4c8abc to match actual down_revision = "9f2d0e4c8abc"

) # type: ignore
visibility: str = db.Column(db.String(20), nullable=False, default=TemplateVisibility.private.value)
bpmn_object_key: str = db.Column(db.String(1024), nullable=False)
files: list[dict] | None = db.Column(db.JSON, nullable=True) # [{"file_type": "bpmn"|"json"|"dmn"|"md", "file_name": str}]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files column requires at least one bpmn file. Can we make nullable=False

with open(new_path, "wb") as f:
f.write(content)
except (OSError, IOError):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we consider logging too incase of exception

template: TemplateModel,
file_name: str,
content: bytes,
user: UserModel | None = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user is not used inside the method. Is this intended to update modified_by(template.modified_by = user.username) in the table?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants