- Request entity (GmailMessageId unique, ThreadId, threading headers, From*, Subject, BodyText,
ReceivedAt, Status enum-as-string New|InProgress|Assigned|Answered|Abandoned, AssignedContactId? FK,
DraftReply?, AnsweredAt?). MailSettings singleton (GmailAddress, AppPassword ENCRYPTED via Data
Protection, PollInterval, Folder, LastUid). Migration AddRequestsAndMailSettings.
- IGmailMailReader (mockable) + MailKit GmailMailReader (imap.gmail.com:993 SSL, envelope+X-GM-THRID
+body). RequestSyncService: dedup on Message-Id, track LastUid. MailKit 4.17.0.
- Endpoints: POST /api/requests/sync, GET /api/requests (Gridify, filter status), GET /api/requests/{id},
PUT triage (status+assignedContactId), GET/PUT /api/mail-settings (App Password never returned).
- Tests (in-memory DB + canned reader): sync dedup/idempotency/config-guard, HTTP sync->triage->assign,
mail-settings secrecy. + gitignore the runtime photo-storage/ dir (god housekeeping).
39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using GerbilManagerWebAPI.Models;
|
|
|
|
namespace GerbilManagerWebAPI.Dtos
|
|
{
|
|
public record RequestDto(
|
|
Guid Id,
|
|
string GmailMessageId,
|
|
string? ThreadId,
|
|
string FromAddress,
|
|
string? FromName,
|
|
string? Subject,
|
|
string? BodyText,
|
|
DateTimeOffset ReceivedAt,
|
|
RequestStatus Status,
|
|
Guid? AssignedContactId,
|
|
string? DraftReply,
|
|
DateTimeOffset? AnsweredAt);
|
|
|
|
/// <summary>Triage update: change status and/or assign a contact.</summary>
|
|
public record RequestTriageInput(RequestStatus? Status, Guid? AssignedContactId);
|
|
|
|
/// <summary>Mail settings read shape — the App Password is NEVER returned (only HasAppPassword).</summary>
|
|
public record MailSettingsDto(
|
|
string? GmailAddress,
|
|
int PollIntervalMinutes,
|
|
string Folder,
|
|
bool BackgroundPollEnabled,
|
|
bool HasAppPassword);
|
|
|
|
/// <summary>Mail settings write shape. AppPassword is write-only; null/omitted leaves it unchanged,
|
|
/// empty string clears it.</summary>
|
|
public record MailSettingsInput(
|
|
string? GmailAddress,
|
|
string? AppPassword,
|
|
int? PollIntervalMinutes,
|
|
string? Folder,
|
|
bool? BackgroundPollEnabled);
|
|
}
|