gql.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. // 注意是否使用 gql
  2. // apollo client 需要使用 gql
  3. // graphql-request 不需要使用 gql
  4. // import gql from "graphql-tag";
  5. const GET_USER = `
  6. query USER($id: ID!) {
  7. user_by_id(id: $id) {
  8. nickname
  9. avatar
  10. }
  11. }
  12. `;
  13. const SEARCH_USER = `
  14. query USER($username: String) {
  15. user_by_props(username: $username) {
  16. username
  17. }
  18. }
  19. `;
  20. const ADD_USER = `
  21. mutation USER($email: String, $updatedAt: String, $password: String, $telephone: String, $nickname: String, $username: String, $createdAt: String, $openid: String, $id: ID!, $avatar: String) {
  22. create_user(
  23. email: $email
  24. updatedAt: $updatedAt
  25. password: $password
  26. telephone: $telephone
  27. nickname: $nickname
  28. username: $username
  29. createdAt: $createdAt
  30. openid: $openid
  31. id: $id
  32. avatar: $avatar
  33. ) {
  34. email
  35. updatedAt
  36. password
  37. telephone
  38. nickname
  39. username
  40. createdAt
  41. openid
  42. id
  43. avatar
  44. }
  45. }
  46. `;
  47. const SHOW_SCHEMA = `
  48. query SCHEMA($user_id: ID) {
  49. schema_by_props(user_id: $user_id) {
  50. schemaData
  51. schemaName
  52. id
  53. reference
  54. }
  55. }
  56. `;
  57. const SHOW_ALL_SCHEMA = `
  58. query SCHEMA($user_id: ID) {
  59. userSchema:schema_by_props(user_id: $user_id) {
  60. schemaData
  61. schemaName
  62. id
  63. reference
  64. }
  65. caseSchema:schema_by_props(user_id: "ioobot") {
  66. schemaData
  67. schemaName
  68. id
  69. reference
  70. }
  71. }
  72. `;
  73. const SEARCH_SCHEMA = `
  74. query SCHEMA($id: ID!) {
  75. schema_by_id(id: $id) {
  76. schemaName
  77. schemaData
  78. id
  79. reference
  80. }
  81. }
  82. `;
  83. const ADD_SCHEMA = `
  84. mutation SCHEMA($id: ID!, $user_id: ID!, $schemaName: String!, $schemaData: String!, $createdAt: String, $updatedAt: String, $schemaState: String, $reference: String) {
  85. create_schema(
  86. id: $id,
  87. user_id: $user_id,
  88. schemaName: $schemaName,
  89. createdAt: $createdAt,
  90. updatedAt: $updatedAt,
  91. schemaData: $schemaData,
  92. schemaState: $schemaState
  93. reference: $reference
  94. ) {
  95. schemaName,
  96. schemaData
  97. id
  98. reference
  99. }
  100. }
  101. `;
  102. const DELETE_SCHEMA = `
  103. mutation SCHEMA($schemaName: String, $user_id: ID) {
  104. delete_schema(schemaName: $schemaName, user_id: $user_id)
  105. }
  106. `;
  107. const UPDATE_SCHEMA = `
  108. mutation SCHEMA($id: ID!, $schemaData: String!, $updatedAt: String, $schemaState: String) {
  109. update_schema(
  110. id: $id,
  111. updatedAt: $updatedAt,
  112. schemaData: $schemaData,
  113. schemaState: $schemaState
  114. ) {
  115. schemaName,
  116. schemaData
  117. id
  118. }
  119. }
  120. `;
  121. const UPDATE_SCHEMA_NAME = `
  122. mutation SCHEMA($id: ID!, $schemaName: String, $updatedAt: String) {
  123. update_schema(
  124. id: $id,
  125. updatedAt: $updatedAt,
  126. schemaName: $schemaName,
  127. ) {
  128. schemaName,
  129. id
  130. }
  131. }
  132. `;
  133. const SHOW_TABLE = `
  134. query TABLE($schema_id: ID!) {
  135. schema_by_id(id: $schema_id) {
  136. schemaData
  137. schemaName
  138. reference
  139. }
  140. }
  141. `;
  142. const ADD_CLOUD = `
  143. mutation CLOUD($id: ID!, $user_id: ID, $cloudName: String, $secretId: String, $secretKey: String, $updatedAt: String, $createdAt: String, $appId: String) {
  144. create_cloud(
  145. id: $id
  146. user_id: $user_id
  147. cloudName: $cloudName
  148. secretId: $secretId
  149. secretKey: $secretKey
  150. createdAt: $createdAt
  151. updatedAt: $updatedAt
  152. appId: $appId
  153. ) {
  154. id
  155. }
  156. }
  157. `;
  158. const SHOW_CLOUD = `
  159. query CLOUD($user_id: ID!) {
  160. cloud_by_props(user_id: $user_id) {
  161. id
  162. cloudName
  163. secretId
  164. secretKey
  165. }
  166. }
  167. `;
  168. const UPDATE_CLOUD = `
  169. mutation updatecloud($id: ID, $secretId: String, $secretKey: String $updatedAt: String) {
  170. update_cloud(
  171. id: $id
  172. secretId: $secretId
  173. secretKey: $secretKey
  174. updatedAt: $updatedAt
  175. ) {
  176. id
  177. }
  178. }
  179. `;
  180. const SHOW_DEPLOY = `
  181. query DEPLOY($cloud_id: ID!) {
  182. deploy_by_props(cloud_id: $cloud_id) {
  183. id
  184. functionName
  185. region
  186. description
  187. cosBucketName
  188. cosObjectName
  189. cosBucketRegion
  190. handler
  191. memorySize
  192. timeout
  193. vpcId
  194. subnetId
  195. }
  196. }
  197. `;
  198. const ADD_DEPLOY = `
  199. mutation DEPLOY($serviceName:String, $description: String, $updatedAt: String, $cosBucketName: String, $memorySize: Int, $fc_id: ID, $createdAt: String, $subnetId: String, $cosObjectName: String, $region: String, $vpcId: String, $cosBucketRegion: String, $id: ID!, $cloud_id: ID, $user_id: ID, $timeout: Int, $handler: String, $functionName: String) {
  200. create_deploy(
  201. id: $id
  202. description: $description
  203. cosBucketName: $cosBucketName
  204. memorySize: $memorySize
  205. fc_id: $fc_id
  206. subnetId: $subnetId
  207. cosObjectName: $cosObjectName
  208. region: $region
  209. vpcId: $vpcId
  210. cosBucketRegion: $cosBucketRegion
  211. cloud_id: $cloud_id
  212. user_id: $user_id
  213. timeout: $timeout
  214. handler: $handler
  215. functionName: $functionName
  216. serviceName: $serviceName
  217. createdAt: $createdAt
  218. updatedAt: $updatedAt
  219. ) {
  220. id
  221. }
  222. }
  223. `;
  224. const UPDATE_DEPLOY = `
  225. mutation DEPLOY($id: ID!, $description: String, $updatedAt: String, $cosBucketName: String, $subnetId: String, $cosObjectName: String, $region: String, $vpcId: String, $cosBucketRegion: String, $functionName: String) {
  226. update_deploy(
  227. id: $id
  228. description: $description
  229. cosBucketName: $cosBucketName
  230. subnetId: $subnetId
  231. cosObjectName: $cosObjectName
  232. region: $region
  233. vpcId: $vpcId
  234. cosBucketRegion: $cosBucketRegion
  235. functionName: $functionName
  236. updatedAt: $updatedAt
  237. ) {
  238. id
  239. }
  240. }
  241. `;
  242. const SHOW_APIGWGROUP = `
  243. query GROUP($cloud_id: ID!) {
  244. apiGWGroup_by_props(cloud_id: $cloud_id) {
  245. id
  246. groupName
  247. region
  248. frontType
  249. defaultDomain
  250. userStatus
  251. userDomain
  252. }
  253. }
  254. `;
  255. const ADD_APIGROUP = `
  256. mutation GROUP($serviceId: String, $environmentName: String, $userStatus: String, $defaultDomain: String, $updatedAt: String, $userDomain: String, $groupName: String, $createdAt: String, $frontType: String, $region: String, $status: String, $id: ID!, $cloud_id: ID, $user_id: ID) {
  257. create_apiGWGroup(
  258. id: $id
  259. userStatus: $userStatus
  260. defaultDomain: $defaultDomain
  261. updatedAt: $updatedAt
  262. userDomain: $userDomain
  263. groupName: $groupName
  264. createdAt: $createdAt
  265. frontType: $frontType
  266. region: $region
  267. status: $status
  268. cloud_id: $cloud_id
  269. user_id: $user_id
  270. environmentName: $environmentName
  271. serviceId: $serviceId
  272. ) {
  273. id
  274. }
  275. }
  276. `;
  277. const UPDATE_APIGROUP = `
  278. mutation GROUP($id:ID!, $environmentName: String, $userStatus: String, $updatedAt: String, $userDomain: String, $groupName: String, $frontType: String, $region: String) {
  279. update_apiGWGroup(
  280. id: $id
  281. userStatus: $userStatus
  282. userDomain: $userDomain
  283. groupName: $groupName
  284. frontType: $frontType
  285. region: $region
  286. environmentName: $environmentName
  287. updatedAt: $updatedAt
  288. ) {
  289. id
  290. }
  291. }
  292. `;
  293. const SHOW_APIGWPATH = `
  294. query PATH($apiGWGroup_id: ID!) {
  295. apiGWPath_by_props(apiGWGroup_id: $apiGWGroup_id) {
  296. id
  297. apiGWName
  298. apiGWDesc
  299. requestMethod
  300. }
  301. }
  302. `;
  303. const ADD_APIGWPATH = `
  304. mutation PATH($apiId: String, $apiGWName: String, $updatedAt: String, $apiGWGroup_id: ID, $createdAt: String, $deploy_id: ID, $serviceType: String, $id: ID!, $apiGWPath: String, $user_id: ID, $timeout: Int, $apiGWDesc: String, $requestMethod: String) {
  305. create_apiGWPath(
  306. apiGWName: $apiGWName
  307. updatedAt: $updatedAt
  308. apiGWGroup_id: $apiGWGroup_id
  309. createdAt: $createdAt
  310. deploy_id: $deploy_id
  311. serviceType: $serviceType
  312. id: $id
  313. apiGWPath: $apiGWPath
  314. user_id: $user_id
  315. timeout: $timeout
  316. apiGWDesc: $apiGWDesc
  317. requestMethod: $requestMethod
  318. apiId: $apiId
  319. ) {
  320. id
  321. }
  322. }
  323. `;
  324. const UPDATE_APIGWPATH = `
  325. mutation PATH($apiGWName: String, $updatedAt: String, $apiGWDesc: String, $requestMethod: String) {
  326. update_apiGWPath(
  327. apiGWName: $apiGWName
  328. apiGWDesc: $apiGWDesc
  329. requestMethod: $requestMethod
  330. updatedAt: $updatedAt
  331. ) {
  332. id
  333. }
  334. }
  335. `;
  336. const SHOW_FC_SCHEMA = `
  337. query FC($schema_id: ID!) {
  338. fc_by_props(schema_id: $schema_id) {
  339. cloud_id {
  340. id
  341. cloudName
  342. }
  343. }
  344. }
  345. `;
  346. const SHOW_FC_CONFIG = `
  347. query FC($wxConfig_id: ID!) {
  348. fc_by_props(wxConfig_id: $wxConfig_id) {
  349. cloud_id {
  350. id
  351. cloudName
  352. }
  353. }
  354. }
  355. `;
  356. const SHOW_ALL_WXCONFIG = `
  357. query WXCONFIG($user_id: ID) {
  358. userWxConfig:wxConfig_by_props(user_id: $user_id) {
  359. appID
  360. appName
  361. appSecret
  362. attach
  363. body
  364. enter_url
  365. id
  366. mch_id
  367. notify_url
  368. pay_api_key
  369. spbill_create_ip
  370. token
  371. welcome_words
  372. }
  373. caseWxConfig:wxConfig_by_props(user_id: "ioobot") {
  374. appID
  375. appName
  376. appSecret
  377. attach
  378. body
  379. enter_url
  380. id
  381. mch_id
  382. notify_url
  383. pay_api_key
  384. spbill_create_ip
  385. token
  386. welcome_words
  387. }
  388. }
  389. `;
  390. const SHOW_WXCONFIG = `
  391. query WXCONFIG($user_id: ID) {
  392. wxConfig_by_props(user_id: $user_id) {
  393. appID
  394. appName
  395. appSecret
  396. attach
  397. body
  398. enter_url
  399. id
  400. mch_id
  401. notify_url
  402. pay_api_key
  403. spbill_create_ip
  404. token
  405. welcome_words
  406. }
  407. }
  408. `;
  409. const ADD_WXCONFIG = `
  410. mutation createwxConfig($updatedAt: String, $mch_id: String, $appName: String, $notify_url: String, $appSecret: String, $createdAt: String, $appID: String, $token: String, $spbill_create_ip: String, $enter_url: String, $id: ID!, $pay_api_key: String, $user_id: ID, $body: String, $welcome_words: String, $attach: String) {
  411. create_wxConfig(
  412. updatedAt: $updatedAt
  413. mch_id: $mch_id
  414. appName: $appName
  415. notify_url: $notify_url
  416. appSecret: $appSecret
  417. createdAt: $createdAt
  418. appID: $appID
  419. token: $token
  420. spbill_create_ip: $spbill_create_ip
  421. enter_url: $enter_url
  422. id: $id
  423. pay_api_key: $pay_api_key
  424. user_id: $user_id
  425. body: $body
  426. welcome_words: $welcome_words
  427. attach: $attach
  428. ) {
  429. mch_id
  430. appName
  431. notify_url
  432. appSecret
  433. appID
  434. token
  435. spbill_create_ip
  436. enter_url
  437. id
  438. pay_api_key
  439. body
  440. welcome_words
  441. attach
  442. }
  443. }
  444. `;
  445. const SHOW_WXCONTENT = `
  446. query wxConfigbyid($id: ID) {
  447. wxConfig_by_id(id: $id) {
  448. mch_id
  449. appName
  450. notify_url
  451. appSecret
  452. appID
  453. token
  454. spbill_create_ip
  455. enter_url
  456. id
  457. pay_api_key
  458. body
  459. welcome_words
  460. attach
  461. }
  462. }
  463. `;
  464. const UPDATE_WXCONFIG = `
  465. mutation updatewxConfig($id: ID, $updatedAt: String, $mch_id: String, $appName: String, $notify_url: String, $appSecret: String, $appID: String, $token: String, $spbill_create_ip: String, $enter_url: String, $pay_api_key: String, $body: String, $welcome_words: String, $attach: String) {
  466. update_wxConfig(
  467. id: $id
  468. updatedAt: $updatedAt
  469. mch_id: $mch_id
  470. appName: $appName
  471. notify_url: $notify_url
  472. appSecret: $appSecret
  473. appID: $appID
  474. token: $token
  475. spbill_create_ip: $spbill_create_ip
  476. enter_url: $enter_url
  477. pay_api_key: $pay_api_key
  478. body: $body
  479. welcome_words: $welcome_words
  480. attach: $attach
  481. ) {
  482. id
  483. mch_id
  484. appName
  485. notify_url
  486. appSecret
  487. appID
  488. token
  489. spbill_create_ip
  490. enter_url
  491. pay_api_key
  492. body
  493. welcome_words
  494. attach
  495. }
  496. }
  497. `;
  498. const DELETE_WXCONFIG = `
  499. mutation deletewxConfig($id: ID) {
  500. delete_wxConfig(id: $id)
  501. }
  502. `;
  503. export {
  504. ADD_USER,
  505. GET_USER,
  506. SEARCH_USER,
  507. SEARCH_SCHEMA,
  508. ADD_SCHEMA,
  509. SHOW_ALL_SCHEMA,
  510. SHOW_SCHEMA,
  511. UPDATE_SCHEMA,
  512. UPDATE_SCHEMA_NAME,
  513. DELETE_SCHEMA,
  514. SHOW_TABLE,
  515. ADD_CLOUD,
  516. SHOW_CLOUD,
  517. UPDATE_CLOUD,
  518. SHOW_DEPLOY,
  519. ADD_DEPLOY,
  520. UPDATE_DEPLOY,
  521. SHOW_APIGWGROUP,
  522. ADD_APIGROUP,
  523. UPDATE_APIGROUP,
  524. SHOW_APIGWPATH,
  525. ADD_APIGWPATH,
  526. UPDATE_APIGWPATH,
  527. SHOW_FC_SCHEMA,
  528. SHOW_FC_CONFIG,
  529. SHOW_ALL_WXCONFIG,
  530. SHOW_WXCONFIG,
  531. ADD_WXCONFIG,
  532. SHOW_WXCONTENT,
  533. UPDATE_WXCONFIG,
  534. DELETE_WXCONFIG,
  535. }