feat(core): add split view to experimental features settings (#6093)

This commit is contained in:
Peng Xiao
2024-03-14 05:13:04 +00:00
parent 05583dbe98
commit dd9a253772
12 changed files with 157 additions and 36 deletions

View File

@@ -115,4 +115,10 @@ export class FeatureManagementService {
async listFeatureWorkspaces(feature: FeatureType) {
return this.feature.listFeatureWorkspaces(feature);
}
async getUserFeatures(userId: string): Promise<FeatureType[]> {
return (await this.feature.getUserFeatures(userId)).map(
f => f.feature.name
);
}
}

View File

@@ -21,7 +21,7 @@ import {
import { CurrentUser } from '../auth/current-user';
import { Public } from '../auth/guard';
import { sessionUser } from '../auth/service';
import { FeatureManagementService } from '../features';
import { FeatureManagementService, FeatureType } from '../features';
import { QuotaService } from '../quota';
import { AvatarStorage } from '../storage';
import { UserService } from './service';
@@ -108,6 +108,15 @@ export class UserResolver {
});
}
@Throttle({ default: { limit: 10, ttl: 60 } })
@ResolveField(() => [FeatureType], {
name: 'features',
description: 'Enabled features of a user',
})
async userFeatures(@CurrentUser() user: CurrentUser) {
return this.feature.getUserFeatures(user.id);
}
@Throttle({
default: {
limit: 10,

View File

@@ -374,6 +374,9 @@ type UserType {
"""User email verified"""
emailVerified: Boolean!
"""Enabled features of a user"""
features: [FeatureType!]!
"""User password has been set"""
hasPassword: Boolean
id: ID!