mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
fix: always add global environment to new projects
This commit is contained in:
parent
45fdd6e2f6
commit
72993002a2
@ -27,6 +27,8 @@ import {
|
|||||||
MILLISECONDS_IN_DAY,
|
MILLISECONDS_IN_DAY,
|
||||||
MILLISECONDS_IN_ONE_HOUR,
|
MILLISECONDS_IN_ONE_HOUR,
|
||||||
} from '../util/constants';
|
} from '../util/constants';
|
||||||
|
import EnvironmentStore from '../db/environment-store';
|
||||||
|
import { GLOBAL_ENV } from '../types/environment';
|
||||||
|
|
||||||
const getCreatedBy = (user: User) => user.email || user.username;
|
const getCreatedBy = (user: User) => user.email || user.username;
|
||||||
|
|
||||||
@ -48,6 +50,8 @@ export default class ProjectService {
|
|||||||
|
|
||||||
private featureTypeStore: FeatureTypeStore;
|
private featureTypeStore: FeatureTypeStore;
|
||||||
|
|
||||||
|
private environmentStore: EnvironmentStore;
|
||||||
|
|
||||||
private logger: any;
|
private logger: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -56,17 +60,20 @@ export default class ProjectService {
|
|||||||
eventStore,
|
eventStore,
|
||||||
featureToggleStore,
|
featureToggleStore,
|
||||||
featureTypeStore,
|
featureTypeStore,
|
||||||
|
environmentStore,
|
||||||
}: Pick<
|
}: Pick<
|
||||||
IUnleashStores,
|
IUnleashStores,
|
||||||
| 'projectStore'
|
| 'projectStore'
|
||||||
| 'eventStore'
|
| 'eventStore'
|
||||||
| 'featureToggleStore'
|
| 'featureToggleStore'
|
||||||
| 'featureTypeStore'
|
| 'featureTypeStore'
|
||||||
|
| 'environmentStore'
|
||||||
>,
|
>,
|
||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
accessService: AccessService,
|
accessService: AccessService,
|
||||||
) {
|
) {
|
||||||
this.projectStore = projectStore;
|
this.projectStore = projectStore;
|
||||||
|
this.environmentStore = environmentStore;
|
||||||
this.accessService = accessService;
|
this.accessService = accessService;
|
||||||
this.eventStore = eventStore;
|
this.eventStore = eventStore;
|
||||||
this.featureToggleStore = featureToggleStore;
|
this.featureToggleStore = featureToggleStore;
|
||||||
@ -88,6 +95,8 @@ export default class ProjectService {
|
|||||||
|
|
||||||
await this.projectStore.create(data);
|
await this.projectStore.create(data);
|
||||||
|
|
||||||
|
await this.environmentStore.connectProject(GLOBAL_ENV, data.id);
|
||||||
|
|
||||||
await this.accessService.createDefaultProjectRoles(user, data.id);
|
await this.accessService.createDefaultProjectRoles(user, data.id);
|
||||||
|
|
||||||
await this.eventStore.store({
|
await this.eventStore.store({
|
||||||
|
Loading…
Reference in New Issue
Block a user