mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
refactor: encapsulate playground limit in service (#7700)
This commit is contained in:
parent
50167d4f9e
commit
c828d01135
@ -101,12 +101,18 @@ export class PlaygroundService {
|
||||
projects: typeof ALL | string[],
|
||||
environments: string[],
|
||||
context: SdkContextSchema,
|
||||
limit: number,
|
||||
userId: number,
|
||||
): Promise<{
|
||||
result: AdvancedPlaygroundFeatureEvaluationResult[];
|
||||
invalidContextProperties: string[];
|
||||
}> {
|
||||
// used for runtime control, do not remove
|
||||
const { payload } = this.flagResolver.getVariant('advancedPlayground');
|
||||
const limit =
|
||||
payload?.value && Number.isInteger(Number.parseInt(payload?.value))
|
||||
? Number.parseInt(payload?.value)
|
||||
: 15000;
|
||||
|
||||
const segments = await this.segmentReadModel.getActive();
|
||||
|
||||
let filteredProjects: typeof projects = projects;
|
||||
|
@ -118,19 +118,12 @@ export default class PlaygroundController extends Controller {
|
||||
res: Response<AdvancedPlaygroundResponseSchema>,
|
||||
): Promise<void> {
|
||||
const { user } = req;
|
||||
// used for runtime control, do not remove
|
||||
const { payload } = this.flagResolver.getVariant('advancedPlayground');
|
||||
const limit =
|
||||
payload?.value && Number.isInteger(Number.parseInt(payload?.value))
|
||||
? Number.parseInt(payload?.value)
|
||||
: 15000;
|
||||
|
||||
const { result, invalidContextProperties } =
|
||||
await this.playgroundService.evaluateAdvancedQuery(
|
||||
req.body.projects || '*',
|
||||
req.body.environments,
|
||||
req.body.context,
|
||||
limit,
|
||||
extractUserIdFromUser(user),
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user