62 lines
3.4 KiB
TypeScript
62 lines
3.4 KiB
TypeScript
import { SupportConversationRow, SupportConversationStatus, SupportMessageRow, SupportSenderType } from '../models/support.model';
|
|
export type ConversationListFilters = {
|
|
status?: SupportConversationStatus;
|
|
assignedTo?: string | null;
|
|
search?: string;
|
|
limit?: number;
|
|
offset?: number;
|
|
};
|
|
export declare function findConversationById(id: string): Promise<SupportConversationRow | null>;
|
|
export declare function findActiveConversationForUser(userId: string): Promise<SupportConversationRow | null>;
|
|
export declare function findActiveConversationForVisitor(visitorToken: string): Promise<SupportConversationRow | null>;
|
|
export declare function listConversationsForUser(userId: string, limit?: number): Promise<SupportConversationRow[]>;
|
|
export declare function listConversationsAdmin(filters: ConversationListFilters): Promise<{
|
|
rows: SupportConversationRow[];
|
|
total: number;
|
|
}>;
|
|
export declare function createConversation(input: {
|
|
userId?: string | null;
|
|
visitorToken?: string | null;
|
|
subject?: string | null;
|
|
}): Promise<SupportConversationRow>;
|
|
export declare function attachVisitorConversationToUser(conversationId: string, userId: string): Promise<SupportConversationRow | null>;
|
|
export declare function updateConversation(id: string, patch: Partial<{
|
|
status: SupportConversationStatus;
|
|
assignedTo: string | null;
|
|
subject: string | null;
|
|
unreadUser: number;
|
|
unreadStaff: number;
|
|
}>): Promise<SupportConversationRow | null>;
|
|
export declare function touchConversationLastMessage(id: string, preview: string, incrementUnreadUser: boolean, incrementUnreadStaff: boolean): Promise<void>;
|
|
export declare function resetUnreadCounters(id: string, side: 'user' | 'staff'): Promise<void>;
|
|
export declare function listMessages(conversationId: string, after?: string, limit?: number): Promise<SupportMessageRow[]>;
|
|
export declare function findMessageById(id: string): Promise<SupportMessageRow | null>;
|
|
export declare function findLatestVisibleMessage(conversationId: string): Promise<SupportMessageRow | null>;
|
|
export declare function updateMessageBody(id: string, body: string): Promise<SupportMessageRow | null>;
|
|
export declare function softDeleteMessage(id: string): Promise<SupportMessageRow | null>;
|
|
export declare function updateConversationPreview(id: string, preview: string, lastMessageAt: Date | null): Promise<void>;
|
|
export declare function createMessage(input: {
|
|
conversationId: string;
|
|
senderType: SupportSenderType;
|
|
senderUserId?: string | null;
|
|
body?: string | null;
|
|
attachmentUrl?: string | null;
|
|
attachmentName?: string | null;
|
|
attachmentMime?: string | null;
|
|
}): Promise<SupportMessageRow>;
|
|
export declare function markMessagesRead(conversationId: string, readerSide: 'user' | 'staff'): Promise<number>;
|
|
export declare function countUnreadStaffInbox(): Promise<number>;
|
|
export declare function getUserContextForSupport(userId: string): Promise<{
|
|
id: string;
|
|
email_encrypted: string | null;
|
|
first_name: string | null;
|
|
last_name: string | null;
|
|
role_name: string;
|
|
email_verified: boolean;
|
|
is_enabled: boolean;
|
|
created_at: Date;
|
|
} | null>;
|
|
export declare function getStaffDisplayName(userId: string): Promise<string | null>;
|
|
/** Attach every open visitor conversation to the user and rewrite visitor senders. */
|
|
export declare function mergeAllVisitorConversationsToUser(visitorToken: string, userId: string): Promise<number>;
|
|
//# sourceMappingURL=supportRepository.d.ts.map
|