https://project.mdnd-it.cc/work_packages/94
This commit is contained in:
2025-08-23 04:25:28 +02:00
parent 725516ad6c
commit 19cfa031d0
25823 changed files with 1095587 additions and 2801760 deletions
@@ -0,0 +1,11 @@
import { ChatArchiveAggregate } from '../Chat/ChatArchiveAggregate';
export interface IChatArchiveRepository {
create(archive: Partial<ChatArchiveAggregate>): Promise<ChatArchiveAggregate>;
findAll(): Promise<ChatArchiveAggregate[]>;
findById(id: string): Promise<ChatArchiveAggregate | null>;
findByChatId(chatId: string): Promise<ChatArchiveAggregate[]>;
findByGameId(gameId: string): Promise<ChatArchiveAggregate[]>;
delete(id: string): Promise<any>;
cleanup(olderThanDays: number): Promise<number>; // Clean up old archives
}
@@ -0,0 +1,21 @@
import { ChatAggregate } from '../Chat/ChatAggregate';
import { ChatArchiveAggregate } from '../Chat/ChatArchiveAggregate';
export interface IChatRepository {
create(chat: Partial<ChatAggregate>): Promise<ChatAggregate>;
findByPage(from: number, to: number): Promise<{ chats: ChatAggregate[], totalCount: number }>;
findByPageIncludingDeleted(from: number, to: number): Promise<{ chats: ChatAggregate[], totalCount: number }>;
findById(id: string): Promise<ChatAggregate | null>;
findByIdIncludingDeleted(id: string): Promise<ChatAggregate | null>;
findByUserId(userId: string): Promise<ChatAggregate[]>;
findByUserIdIncludingDeleted(userId: string): Promise<ChatAggregate[]>;
findByGameId(gameId: string): Promise<ChatAggregate | null>;
findActiveChatsForUser(userId: string): Promise<ChatAggregate[]>;
findInactiveChats(inactivityMinutes: number): Promise<ChatAggregate[]>;
update(id: string, update: Partial<ChatAggregate>): Promise<ChatAggregate | null>;
delete(id: string): Promise<any>;
softDelete(id: string): Promise<ChatAggregate | null>;
archiveChat(chat: ChatAggregate): Promise<ChatArchiveAggregate>;
getArchivedChat(chatId: string): Promise<ChatArchiveAggregate | null>;
restoreFromArchive(chatId: string): Promise<ChatAggregate | null>;
}
@@ -0,0 +1,14 @@
import { ContactAggregate } from '../Contact/ContactAggregate';
export interface IContactRepository {
create(contact: Partial<ContactAggregate>): Promise<ContactAggregate>;
findById(id: string): Promise<ContactAggregate | null>;
findByPage(from: number, to: number): Promise<{ contacts: ContactAggregate[], totalCount: number }>;
findByPageIncludingDeleted(from: number, to: number): Promise<{ contacts: ContactAggregate[], totalCount: number }>;
update(id: string, update: Partial<ContactAggregate>): Promise<ContactAggregate | null>;
delete(id: string): Promise<any>;
softDelete(id: string): Promise<ContactAggregate | null>;
findByIdIncludingDeleted(id: string): Promise<ContactAggregate | null>;
search(searchTerm: string): Promise<ContactAggregate[]>;
searchIncludingDeleted(searchTerm: string): Promise<ContactAggregate[]>;
}
@@ -0,0 +1,19 @@
import { DeckAggregate } from '../Deck/DeckAggregate';
export interface IDeckRepository {
create(deck: Partial<DeckAggregate>): Promise<DeckAggregate>;
findByPage(from: number, to: number): Promise<{ decks: DeckAggregate[], totalCount: number }>;
findByPageIncludingDeleted(from: number, to: number): Promise<{ decks: DeckAggregate[], totalCount: number }>;
findById(id: string): Promise<DeckAggregate | null>;
findByIdIncludingDeleted(id: string): Promise<DeckAggregate | null>;
search(query: string, limit?: number, offset?: number): Promise<{ decks: DeckAggregate[], totalCount: number }>;
searchIncludingDeleted(query: string, limit?: number, offset?: number): Promise<{ decks: DeckAggregate[], totalCount: number }>;
update(id: string, update: Partial<DeckAggregate>): Promise<DeckAggregate | null>;
delete(id: string): Promise<any>;
softDelete(id: string): Promise<DeckAggregate | null>;
// New methods for deck restrictions and filtering
countActiveByUserId(userId: string): Promise<number>;
countOrganizationalByUserId(userId: string): Promise<number>;
findFilteredDecks(userId: string, userOrgId?: string | null, isAdmin?: boolean, from?: number, to?: number): Promise<{ decks: DeckAggregate[], totalCount: number }>;
}
@@ -0,0 +1,14 @@
import { OrganizationAggregate } from '../Organization/OrganizationAggregate';
export interface IOrganizationRepository {
create(org: Partial<OrganizationAggregate>): Promise<OrganizationAggregate>;
findByPage(from: number, to: number): Promise<{ organizations: OrganizationAggregate[], totalCount: number }>;
findByPageIncludingDeleted(from: number, to: number): Promise<{ organizations: OrganizationAggregate[], totalCount: number }>;
findById(id: string): Promise<OrganizationAggregate | null>;
findByIdIncludingDeleted(id: string): Promise<OrganizationAggregate | null>;
search(query: string, limit?: number, offset?: number): Promise<{ organizations: OrganizationAggregate[], totalCount: number }>;
searchIncludingDeleted(query: string, limit?: number, offset?: number): Promise<{ organizations: OrganizationAggregate[], totalCount: number }>;
update(id: string, update: Partial<OrganizationAggregate>): Promise<OrganizationAggregate | null>;
delete(id: string): Promise<any>;
softDelete(id: string): Promise<OrganizationAggregate | null>;
}
@@ -0,0 +1,18 @@
import { UserAggregate } from '../User/UserAggregate';
export interface IUserRepository {
create(user: Partial<UserAggregate>): Promise<UserAggregate>;
findByPage(from: number, to: number): Promise<{ users: UserAggregate[], totalCount: number }>;
findByPageIncludingDeleted(from: number, to: number): Promise<{ users: UserAggregate[], totalCount: number }>;
findById(id: string): Promise<UserAggregate | null>;
findByIdIncludingDeleted(id: string): Promise<UserAggregate | null>;
findByUsername(username: string): Promise<UserAggregate | null>;
findByEmail(email: string): Promise<UserAggregate | null>;
findByToken(token: string): Promise<UserAggregate | null>;
search(query: string, limit?: number, offset?: number): Promise<{ users: UserAggregate[], totalCount: number }>;
searchIncludingDeleted(query: string, limit?: number, offset?: number): Promise<{ users: UserAggregate[], totalCount: number }>;
update(id: string, update: Partial<UserAggregate>): Promise<UserAggregate | null>;
delete(id: string): Promise<any>;
softDelete(id: string): Promise<UserAggregate | null>;
deactivate(id: string): Promise<UserAggregate | null>;
}