mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
## About the changes - Introducing ISegmentService interface to decouple from the actual implementation - Moving UpsertSegmentSchema to OSS to be able to use types - Added comments where our code is coupled with segments just to highlight and have a conversation about some use cases if needed, but they can be removed before merging - Removed segment service from some project features as it was not used
30 lines
752 B
TypeScript
30 lines
752 B
TypeScript
import { UpsertSegmentSchema } from 'lib/openapi';
|
|
import { ISegment, IUser } from 'lib/types';
|
|
|
|
export interface ISegmentService {
|
|
updateStrategySegments: (
|
|
strategyId: string,
|
|
segmentIds: number[],
|
|
) => Promise<void>;
|
|
|
|
addToStrategy(id: number, strategyId: string): Promise<void>;
|
|
|
|
getByStrategy(strategyId: string): Promise<ISegment[]>;
|
|
|
|
getActive(): Promise<ISegment[]>;
|
|
|
|
getAll(): Promise<ISegment[]>;
|
|
|
|
create(
|
|
data: UpsertSegmentSchema,
|
|
user: Partial<Pick<IUser, 'username' | 'email'>>,
|
|
): Promise<ISegment>;
|
|
|
|
delete(id: number, user: IUser): Promise<void>;
|
|
|
|
cloneStrategySegments(
|
|
sourceStrategyId: string,
|
|
targetStrategyId: string,
|
|
): Promise<void>;
|
|
}
|