26322c92ff
The folder dropdown was showing every DocumentFolder in EspoCRM (global
list). The user expected "folders that exist in THIS case" — only the
folders already in use for the chosen case's documents.
Change: when the user picks a case in the SaveAttachments dialog, the
folder list refreshes by walking
GET /Case/{id}/documents?select=id,folderId,folderName&maxSize=200
and deduping the folderId values it finds. EspoCRM denormalizes
folderName onto Document, so no second lookup is needed.
If a case has no documents yet, the dropdown shows just the sentinel
"(בלי תיקייה)" — same default behavior as before, but no more
unrelated folders from other cases.
Files:
- Core: DocumentEntity gets FolderName; IEspoCrmClient and EspoCrmClient
get ListFoldersUsedInCaseAsync(caseId)
- UI: SaveAttachmentsViewModel re-fetches on SelectedCase change
(LoadFoldersForCaseAsync); AddInHost no longer calls the old
LoadFoldersAsync.
Tests: 39 still passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
32 lines
821 B
C#
32 lines
821 B
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace MarcusLaw.OutlookAddin.Core.Models
|
|
{
|
|
public sealed class DocumentEntity
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("name")]
|
|
public string? Name { get; set; }
|
|
|
|
[JsonPropertyName("status")]
|
|
public string? Status { get; set; }
|
|
|
|
[JsonPropertyName("fileId")]
|
|
public string? FileId { get; set; }
|
|
|
|
[JsonPropertyName("folderId")]
|
|
public string? FolderId { get; set; }
|
|
|
|
[JsonPropertyName("folderName")]
|
|
public string? FolderName { get; set; }
|
|
|
|
[JsonPropertyName("parentType")]
|
|
public string? ParentType { get; set; }
|
|
|
|
[JsonPropertyName("parentId")]
|
|
public string? ParentId { get; set; }
|
|
}
|
|
}
|