gql.js 18 KB

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