games_app/backend/dist/repositories/supportRepository.d.ts
2026-11-09 18:14:42 +02:00

84 lines
4.3 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>;
export type SupportUploadedFileRow = {
filename: string;
mime: string;
original_name: string | null;
conversation_id: string | null;
uploaded_by_user_id: string | null;
visitor_token: string | null;
created_at: Date;
};
export declare function insertUploadedFile(input: {
filename: string;
mime: string;
originalName?: string | null;
conversationId?: string | null;
uploadedByUserId?: string | null;
visitorToken?: string | null;
}): Promise<SupportUploadedFileRow>;
export declare function findUploadedFile(filename: string): Promise<SupportUploadedFileRow | null>;
export declare function bindUploadedFileConversation(filename: string, conversationId: string): Promise<void>;
export declare function findMessageByAttachmentFilename(filename: string): Promise<{
conversation_id: string;
} | null>;
//# sourceMappingURL=supportRepository.d.ts.map