{
  "db_name": "PostgreSQL",
  "query": "\n    WITH workspace_check AS (\n        SELECT EXISTS(\n            SELECT 1\n            FROM af_workspace_member\n            WHERE af_workspace_member.uid = (SELECT uid FROM af_user WHERE uuid = $1) AND\n            af_workspace_member.workspace_id = $3\n        ) AS \"workspace_exists\"\n    ),\n    collab_check AS (\n        SELECT EXISTS(\n            SELECT 1\n            FROM af_collab_member\n            WHERE oid = $2\n        ) AS \"collab_exists\"\n    )\n    SELECT \n        NOT collab_check.collab_exists OR (\n            workspace_check.workspace_exists AND \n            EXISTS(\n                SELECT 1\n                FROM af_collab_member\n                JOIN af_permissions ON af_collab_member.permission_id = af_permissions.id\n                WHERE \n                    af_collab_member.uid = (SELECT uid FROM af_user WHERE uuid = $1) AND \n                    af_collab_member.oid = $2 AND \n                    af_permissions.access_level > 20\n            )\n        ) AS \"permission_check\"\n    FROM workspace_check, collab_check;\n     ",
  "describe": {
    "columns": [
      {
        "ordinal": 0,
        "name": "permission_check",
        "type_info": "Bool"
      }
    ],
    "parameters": {
      "Left": [
        "Uuid",
        "Text",
        "Uuid"
      ]
    },
    "nullable": [
      null
    ]
  },
  "hash": "83b14b1f8483785ddfeab7752f698b663e78936c40a028492aab63e9dda9dc30"
}
