Skip to content

Commit

Permalink
feat: add environments to project created payload (#6901)
Browse files Browse the repository at this point in the history
This commit adds an `environments` property to the project created
payload. The list contains only the projects that the project has
enabled.

The point of adding it is that it gives you a better overview over
what you have created.
  • Loading branch information
thomasheartman committed Apr 22, 2024
1 parent b6833d9 commit 9ba6be6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/features/project/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
ProjectUserUpdateRoleEvent,
RoleName,
SYSTEM_USER_ID,
type ProjectCreated,
} from '../../types';
import type {
IProjectAccessModel,
Expand Down Expand Up @@ -284,7 +285,7 @@ export default class ProjectService {
user: IUser,
auditUser: IAuditUser,
enableChangeRequestsForSpecifiedEnvironments: () => Promise<void> = async () => {},
): Promise<IProject> {
): Promise<ProjectCreated> {
await this.validateProjectEnvironments(newProject.environments);

const validatedData = await projectSchema.validateAsync(newProject);
Expand Down Expand Up @@ -321,7 +322,7 @@ export default class ProjectService {
}),
);

return data;
return { ...data, environments: envsToEnable };
}

async updateProject(
Expand Down
13 changes: 13 additions & 0 deletions src/lib/types/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,19 @@ export type CreateProject = Pick<IProject, 'id' | 'name'> & {
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;
Expand Down

0 comments on commit 9ba6be6

Please sign in to comment.