{
  "meta": {
    "$_GET": [
      {
        "type": "text",
        "name": "id"
      }
    ]
  },
  "exec": {
    "steps": [
      {
        "name": "gettheuser",
        "module": "dbconnector",
        "action": "single",
        "options": {
          "connection": "authdb",
          "sql": {
            "type": "select",
            "columns": [
              {
                "table": "users",
                "column": "id"
              },
              {
                "table": "users",
                "column": "email"
              },
              {
                "table": "users",
                "column": "pwd"
              },
              {
                "table": "users",
                "column": "firstname"
              },
              {
                "table": "users",
                "column": "lastname"
              }
            ],
            "params": [],
            "table": {
              "name": "users"
            },
            "primary": "id",
            "joins": [],
            "wheres": {
              "condition": "AND",
              "rules": [
                {
                  "id": "users.email",
                  "field": "users.email",
                  "type": "string",
                  "operator": "equal",
                  "value": "admin@prelub.com",
                  "data": {
                    "table": "users",
                    "column": "email",
                    "type": "text",
                    "columnObj": {
                      "type": "string",
                      "maxLength": 255,
                      "primary": false,
                      "unique": false,
                      "nullable": true,
                      "name": "email"
                    }
                  },
                  "operation": "="
                }
              ],
              "conditional": null,
              "valid": true
            },
            "query": "select `id`, `email`, `pwd`, `firstname`, `lastname` from `users` where `users`.`email` = ?"
          }
        },
        "output": true,
        "meta": [
          {
            "type": "number",
            "name": "id"
          },
          {
            "type": "text",
            "name": "email"
          },
          {
            "type": "text",
            "name": "pwd"
          },
          {
            "type": "text",
            "name": "firstname"
          },
          {
            "type": "text",
            "name": "lastname"
          }
        ],
        "outputType": "object"
      },
      {
        "name": "",
        "module": "core",
        "action": "condition",
        "options": {
          "if": "{{!gettheuser}}",
          "then": {
            "steps": [
              {
                "name": "insertuser",
                "module": "api",
                "action": "send",
                "options": {
                  "url": "{{$_ENV.API_BASEURL+'users/insert'}}",
                  "method": "POST",
                  "schema": [
                    {
                      "type": "object",
                      "name": "data",
                      "sub": [
                        {
                          "type": "text",
                          "name": "updatedate"
                        },
                        {
                          "type": "text",
                          "name": "password"
                        },
                        {
                          "type": "boolean",
                          "name": "isactive"
                        },
                        {
                          "type": "number",
                          "name": "id"
                        },
                        {
                          "type": "text",
                          "name": "lastname"
                        },
                        {
                          "type": "number",
                          "name": "updateuserid"
                        },
                        {
                          "type": "text",
                          "name": "firstname"
                        },
                        {
                          "type": "text",
                          "name": "username"
                        },
                        {
                          "type": "text",
                          "name": "email"
                        },
                        {
                          "type": "text",
                          "name": "createdate"
                        },
                        {
                          "type": "number",
                          "name": "createuserid"
                        }
                      ]
                    }
                  ],
                  "dataType": "json",
                  "data": {
                    "id": "{{gettheuser.id.toString()}}",
                    "firstname": "{{gettheuser.firstname}}",
                    "lastname": "{{gettheuser.lastname}}",
                    "email": "{{gettheuser.email}}",
                    "password": "{{gettheuser.password}}",
                    "isactive": true,
                    "createuserid": -1,
                    "updateuserid": -1,
                    "username": null
                  }
                },
                "output": true,
                "meta": [
                  {
                    "type": "object",
                    "name": "data",
                    "sub": [
                      {
                        "type": "text",
                        "name": "updatedate"
                      },
                      {
                        "type": "text",
                        "name": "password"
                      },
                      {
                        "type": "boolean",
                        "name": "isactive"
                      },
                      {
                        "type": "number",
                        "name": "id"
                      },
                      {
                        "type": "text",
                        "name": "lastname"
                      },
                      {
                        "type": "number",
                        "name": "updateuserid"
                      },
                      {
                        "type": "text",
                        "name": "firstname"
                      },
                      {
                        "type": "text",
                        "name": "username"
                      },
                      {
                        "type": "text",
                        "name": "email"
                      },
                      {
                        "type": "text",
                        "name": "createdate"
                      },
                      {
                        "type": "number",
                        "name": "createuserid"
                      }
                    ]
                  }
                ],
                "outputType": "object"
              },
              {
                "name": "addrole",
                "module": "api",
                "action": "send",
                "options": {
                  "url": "{{$_ENV.API_BASEURL+'xuserroles/add/'+gettheuser.id+'/1'}}",
                  "method": "POST",
                  "dataType": "json"
                },
                "output": true
              }
            ]
          }
        },
        "outputType": "boolean"
      }
    ]
  }
}