Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
  • Loading branch information
ruanyl committed Sep 18, 2023
1 parent 5daad69 commit 19fbfd7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/plugins/workspace/server/workspace_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceDBImpl {
this.savedObjects = savedObjects;
}

private getScopeClientWithoutPermission(
private getScopedClientWithoutPermission(
requestDetail: IRequestDetail
): SavedObjectsClientContract | undefined {
return this.savedObjects?.getScopedClient(requestDetail.request, {
Expand Down Expand Up @@ -80,11 +80,13 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceDBImpl {
const { permissions, ...attributes } = payload;
const id = generateRandomId(WORKSPACE_ID_SIZE);
const client = this.getSavedObjectClientsFromRequestDetail(requestDetail);
const existingWorkspaceRes = await this.getScopeClientWithoutPermission(requestDetail)?.find({
type: WORKSPACE_TYPE,
search: attributes.name,
searchFields: ['name'],
});
const existingWorkspaceRes = await this.getScopedClientWithoutPermission(requestDetail)?.find(
{
type: WORKSPACE_TYPE,
search: attributes.name,
searchFields: ['name'],
}
);
if (existingWorkspaceRes && existingWorkspaceRes.total > 0) {
throw new Error(DUPLICATE_WORKSPACE_NAME_ERROR);
}
Expand Down Expand Up @@ -166,7 +168,7 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceDBImpl {
const client = this.getSavedObjectClientsFromRequestDetail(requestDetail);
const workspaceInDB: SavedObject<WorkspaceAttribute> = await client.get(WORKSPACE_TYPE, id);
if (workspaceInDB.attributes.name !== attributes.name) {
const existingWorkspaceRes = await this.getScopeClientWithoutPermission(
const existingWorkspaceRes = await this.getScopedClientWithoutPermission(
requestDetail
)?.find({
type: WORKSPACE_TYPE,
Expand Down

0 comments on commit 19fbfd7

Please sign in to comment.