Skip to content

Commit

Permalink
Merge pull request #2092 from romanesko/fix-1950-workspace-logo
Browse files Browse the repository at this point in the history
🛠 fix getting config for console
  • Loading branch information
romanesko authored Apr 15, 2022
2 parents 8a16cfa + ec713cd commit 7bba622
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { getWorkspaceRooms } from "../../realtime";
import { CrudException } from "../../../../core/platform/framework/api/crud-service";
import CompanyUser from "../../../user/entities/company_user";
import gr from "../../../global-resolver";
import { getLogger, TwakeLogger } from "../../../../core/platform/framework";

export class WorkspacesCrudController
implements
Expand All @@ -32,6 +33,7 @@ export class WorkspacesCrudController
ResourceDeleteResponse
>
{
private logger: TwakeLogger;
private getCompanyUserRole(context: WorkspaceExecutionContext) {
return gr.services.companies
.getCompanyUser({ id: context.company_id }, { id: context.user.id })
Expand Down Expand Up @@ -183,12 +185,18 @@ export class WorkspacesCrudController
}

const r = request.body.resource;

const existedEntity = await gr.services.workspaces.get({
company_id: request.params.company_id,
id: request.params.id,
});

const entity = plainToClass(Workspace, {
...{
name: r.name,
logo: r.logo,
isDefault: r.default,
isArchived: r.archived,
name: r.name || existedEntity?.name,
logo: r.logo || existedEntity?.logo,
isDefault: r.default || existedEntity?.isDefault,
isArchived: r.archived || existedEntity?.isArchived,
},
...{
group_id: request.params.company_id,
Expand Down Expand Up @@ -244,6 +252,10 @@ export class WorkspacesCrudController
status: "error",
};
}

constructor() {
this.logger = getLogger("Workspaces controller");
}
}

function getExecutionContext(
Expand Down

0 comments on commit 7bba622

Please sign in to comment.