feat(projects): auto-create NAS folder for order-spawned projects

Manual project creation already creates the 02_PROJEKTY/<number>_<name>
folder (projects.service.createProject). Projects created from an order —
both from an accepted offer (createOrderFromQuotation) and a manual
offer-less order (createOrder) — did not, so they had no NAS folder until
a user opened the project and clicked "create folder" or uploaded a file.

- orders.service: best-effort, non-fatal createProjectFolder after each
  project-creating transaction commits (mirrors createProject; gated on
  isConfigured(), logs on failure, never rolls back the order).
- projects.service: log when the existing auto-create returns false
  (was silently discarded — CLAUDE.md known-issue #4).
- nas-file-manager: optional constructor basePath seam for tests.
- tests: NasFileManager.createProjectFolder coverage — naming, idempotency,
  Czech diacritics, empty name, not-mounted (152 -> 158 tests).

Bump version to 2.0.3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-08 08:43:59 +02:00
parent 9c862034ca
commit df83eb2091
5 changed files with 137 additions and 5 deletions

View File

@@ -105,8 +105,12 @@ interface DownloadResult {
export class NasFileManager {
private readonly basePath: string;
constructor() {
this.basePath = path.resolve(config.nas.path).replace(/\\/g, "/");
constructor(basePath?: string) {
// basePath is an injection seam for tests; production callers pass nothing
// and get the configured NAS_PATH.
this.basePath = path
.resolve(basePath ?? config.nas.path)
.replace(/\\/g, "/");
}
public isConfigured(): boolean {