mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(core): Add description to projects (#15611)
This commit is contained in:
@@ -167,7 +167,7 @@ export class ProjectController {
|
||||
_res: Response,
|
||||
@Param('projectId') projectId: string,
|
||||
): Promise<ProjectRequest.ProjectWithRelations> {
|
||||
const [{ id, name, icon, type }, relations] = await Promise.all([
|
||||
const [{ id, name, icon, type, description }, relations] = await Promise.all([
|
||||
this.projectsService.getProject(projectId),
|
||||
this.projectsService.getProjectRelations(projectId),
|
||||
]);
|
||||
@@ -178,6 +178,7 @@ export class ProjectController {
|
||||
name,
|
||||
icon,
|
||||
type,
|
||||
description,
|
||||
relations: relations.map((r) => ({
|
||||
id: r.user.id,
|
||||
email: r.user.email,
|
||||
@@ -202,9 +203,9 @@ export class ProjectController {
|
||||
@Body payload: UpdateProjectDto,
|
||||
@Param('projectId') projectId: string,
|
||||
) {
|
||||
const { name, icon, relations } = payload;
|
||||
if (name || icon) {
|
||||
await this.projectsService.updateProject(projectId, { name, icon });
|
||||
const { name, icon, relations, description } = payload;
|
||||
if ([name, icon, description].some((data) => typeof data === 'string')) {
|
||||
await this.projectsService.updateProject(projectId, { name, icon, description });
|
||||
}
|
||||
if (relations) {
|
||||
try {
|
||||
|
||||
@@ -294,6 +294,7 @@ export declare namespace ProjectRequest {
|
||||
name: string | undefined;
|
||||
icon: ProjectIcon | null;
|
||||
type: ProjectType;
|
||||
description: string | null;
|
||||
relations: ProjectRelationResponse[];
|
||||
scopes: Scope[];
|
||||
};
|
||||
|
||||
@@ -242,10 +242,13 @@ export class ProjectService {
|
||||
}
|
||||
}
|
||||
|
||||
async updateProject(projectId: string, { name, icon }: UpdateProjectDto): Promise<void> {
|
||||
async updateProject(
|
||||
projectId: string,
|
||||
{ name, icon, description }: UpdateProjectDto,
|
||||
): Promise<void> {
|
||||
const result = await this.projectRepository.update(
|
||||
{ id: projectId, type: 'team' },
|
||||
{ name, icon },
|
||||
{ name, icon, description },
|
||||
);
|
||||
if (!result.affected) {
|
||||
throw new ProjectNotFoundError(projectId);
|
||||
|
||||
@@ -1063,6 +1063,7 @@ describe('Public API endpoints with feat:apiKeyScopes enabled', () => {
|
||||
name: 'some-project',
|
||||
icon: null,
|
||||
type: 'team',
|
||||
description: null,
|
||||
id: expect.any(String),
|
||||
createdAt: expect.any(String),
|
||||
updatedAt: expect.any(String),
|
||||
|
||||
@@ -143,6 +143,7 @@ describe('Projects in Public API', () => {
|
||||
name: 'some-project',
|
||||
icon: null,
|
||||
type: 'team',
|
||||
description: null,
|
||||
id: expect.any(String),
|
||||
createdAt: expect.any(String),
|
||||
updatedAt: expect.any(String),
|
||||
|
||||
Reference in New Issue
Block a user