1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-13 13:48:59 +02:00

fix: revert other changes

This commit is contained in:
Thomas Heartman 2024-05-08 11:34:09 +02:00
parent 4a8f747f6f
commit db8ef3f38f
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78
2 changed files with 4 additions and 27 deletions

View File

@ -310,15 +310,6 @@ export default class ProjectService {
return id;
}
async generateUniqueProjectId(name: string): Promise<string> {
const id = this.generateProjectId(name);
if (await this.projectStore.hasProject(id)) {
return await this.generateUniqueProjectId(name);
} else {
return id;
}
}
async createProject(
newProject: CreateProject,
user: IUser,
@ -334,22 +325,9 @@ export default class ProjectService {
const validateData = async (): Promise<ProjectCreationData> => {
await this.validateProjectEnvironments(newProject.environments);
if (
!newProject.id?.trim() &&
this.flagResolver.isEnabled(
'createProjectWithEnvironmentConfig',
)
) {
newProject.id = await this.generateUniqueProjectId(
newProject.name,
);
return await projectSchema.validateAsync(newProject);
} else {
const validatedData =
await projectSchema.validateAsync(newProject);
await this.validateUniqueId(validatedData.id);
return validatedData;
}
const validatedData = await projectSchema.validateAsync(newProject);
await this.validateUniqueId(validatedData.id);
return validatedData;
};
const validatedData = await validateData();

View File

@ -487,8 +487,7 @@ export interface IImportData extends ImportCommon {
// Create project aligns with #/components/schemas/createProjectSchema
// joi is providing default values when the optional inputs are not provided
// const data = await projectSchema.validateAsync(newProject);
export type CreateProject = Pick<IProject, 'name'> & {
id?: string;
export type CreateProject = Pick<IProject, 'id' | 'name'> & {
mode?: ProjectMode;
defaultStickiness?: string;
environments?: string[];