Skip to content

Commit

Permalink
fix update step since the updateMysqlUser function uses a PUT route
Browse files Browse the repository at this point in the history
  • Loading branch information
niristius committed Aug 21, 2024
1 parent 93deea9 commit 42bdbfd
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/commands/database/mysql/user/update.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export default class Update extends ExecRenderBaseCommand<
const updateMysqlUserPayload: {
accessLevel: "full" | "readonly";
description: string;
accessIpMask?: string | undefined;
externalAccess?: boolean | undefined;
accessIpMask: string;
externalAccess: boolean;
} = {
accessLevel:
accessLevel == "full" || accessLevel == "readonly"
Expand All @@ -99,18 +99,14 @@ export default class Update extends ExecRenderBaseCommand<
typeof description === "string"
? description
: (currentMysqlUserData.data.description as string),
accessIpMask: accessIpMask
? accessIpMask
: (currentMysqlUserData.data.accessIpMask as string),
externalAccess: externalAccess
? externalAccess
: (currentMysqlUserData.data.externalAccess as boolean),
};

if (accessIpMask) {
updateMysqlUserPayload.accessIpMask = accessIpMask;
}

if (externalAccess) {
updateMysqlUserPayload.externalAccess = true;
} else if (externalAccess != undefined && !externalAccess) {
updateMysqlUserPayload.externalAccess = false;
}

if (Object.keys(updateMysqlUserPayload).length == 1) {
await process.complete(
<Success>Nothing to change. Have a good day!</Success>,
Expand Down

0 comments on commit 42bdbfd

Please sign in to comment.