* feat: cal ai self serve architecture * chore: add package * chore: update evnet controller * refactor: improvements * chore: rename * chore: type error and naming * chore: just set it to nul * chore: just set it to nul * chore: some more improvements * chore: packate version * fix: API v2 * chore: change name of files * chore: add select * chore: add missing teamId * chore: save progress * refactor: split into multiple services * refactor: make schema provider agonistic * chore: improvements * chore: * chore: remove duplicate files * chore: semicolon * chore: formatting * refactor: logging and error handling * chore: rename variable * refactor: use trpc error * chore: replace with HttpError * chore: remove from option * We need the enum and not just the type --------- Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
/**
|
|
* Abstract transaction interface that allows providers to request transactional operations
|
|
* without being coupled to any specific database implementation
|
|
*/
|
|
export interface TransactionInterface {
|
|
/**
|
|
* Execute operations within a transaction
|
|
* @param operations - A function that performs the operations within the transaction context
|
|
* @returns Promise that resolves when the transaction completes
|
|
*/
|
|
executeInTransaction<T>(operations: (context: TransactionContext) => Promise<T>): Promise<T>;
|
|
}
|
|
|
|
/**
|
|
* Transaction context that provides access to transactional repository operations
|
|
*/
|
|
export interface TransactionContext {
|
|
/**
|
|
* Phone number repository operations within this transaction
|
|
*/
|
|
phoneNumberRepository: TransactionalPhoneNumberRepository;
|
|
}
|
|
|
|
/**
|
|
* Phone number repository operations that can be performed within a transaction
|
|
*/
|
|
export interface TransactionalPhoneNumberRepository {
|
|
/**
|
|
* Create a new phone number record within the transaction
|
|
*/
|
|
createPhoneNumber(params: {
|
|
phoneNumber: string;
|
|
userId: number;
|
|
provider: string;
|
|
teamId?: number;
|
|
outboundAgentId?: string | null;
|
|
}): Promise<void>;
|
|
}
|