diff --git a/src/lib/features/project/project-service.ts b/src/lib/features/project/project-service.ts index c6da2ad6cb..0723adfc8d 100644 --- a/src/lib/features/project/project-service.ts +++ b/src/lib/features/project/project-service.ts @@ -49,6 +49,7 @@ import { ProjectUserUpdateRoleEvent, RoleName, SYSTEM_USER_ID, + type ProjectCreated, } from '../../types'; import type { IProjectAccessModel, @@ -284,7 +285,7 @@ export default class ProjectService { user: IUser, auditUser: IAuditUser, enableChangeRequestsForSpecifiedEnvironments: () => Promise = async () => {}, - ): Promise { + ): Promise { await this.validateProjectEnvironments(newProject.environments); const validatedData = await projectSchema.validateAsync(newProject); @@ -321,7 +322,7 @@ export default class ProjectService { }), ); - return data; + return { ...data, environments: envsToEnable }; } async updateProject( diff --git a/src/lib/types/model.ts b/src/lib/types/model.ts index c1495324bd..6cc536148a 100644 --- a/src/lib/types/model.ts +++ b/src/lib/types/model.ts @@ -474,6 +474,19 @@ export type CreateProject = Pick & { environments?: string[]; }; +// Create project aligns with #/components/schemas/projectCreatedSchema +export type ProjectCreated = Pick< + IProject, + | 'id' + | 'name' + | 'mode' + | 'defaultStickiness' + | 'description' + | 'featureLimit' +> & { + environments: string[]; +}; + export interface IProject { id: string; name: string;