gql.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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. email
  9. updatedAt
  10. password
  11. telephone
  12. nickname
  13. username
  14. createdAt
  15. openid
  16. id
  17. avatar
  18. }
  19. }
  20. `;
  21. const SEARCH_USER = `
  22. query USER($username: String) {
  23. user_by_props(username: $username) {
  24. email
  25. updatedAt
  26. password
  27. telephone
  28. nickname
  29. username
  30. createdAt
  31. openid
  32. id
  33. avatar
  34. }
  35. }
  36. `;
  37. const ADD_USER = `
  38. mutation USER($email: String, $updatedAt: String, $password: String, $telephone: String, $nickname: String, $username: String, $createdAt: String, $openid: String, $id: ID!, $avatar: String) {
  39. create_user(
  40. email: $email
  41. updatedAt: $updatedAt
  42. password: $password
  43. telephone: $telephone
  44. nickname: $nickname
  45. username: $username
  46. createdAt: $createdAt
  47. openid: $openid
  48. id: $id
  49. avatar: $avatar
  50. ) {
  51. email
  52. updatedAt
  53. password
  54. telephone
  55. nickname
  56. username
  57. createdAt
  58. openid
  59. id
  60. avatar
  61. }
  62. }
  63. `;
  64. const UPDATE_USER = `
  65. mutation USER($email: String, $updatedAt: String, $telephone: String, $nickname: String, $openid: String, $id: ID!, $avatar: String) {
  66. update_user(
  67. id: $id
  68. email: $email
  69. updatedAt: $updatedAt
  70. telephone: $telephone
  71. nickname: $nickname
  72. openid: $openid
  73. avatar: $avatar
  74. ) {
  75. email
  76. updatedAt
  77. password
  78. telephone
  79. nickname
  80. username
  81. createdAt
  82. openid
  83. id
  84. avatar
  85. }
  86. }
  87. `;
  88. const SHOW_SCHEMA = `
  89. query SCHEMA($user_id: ID) {
  90. schema_by_props(user_id: $user_id) {
  91. schemaData
  92. schemaName
  93. id
  94. reference
  95. schemaState
  96. }
  97. }
  98. `;
  99. const SHOW_ALL_SCHEMA = `
  100. query SCHEMA($user_id: ID) {
  101. userSchema:schema_by_props(user_id: $user_id) {
  102. schemaData
  103. schemaName
  104. id
  105. reference
  106. schemaState
  107. }
  108. caseSchema:schema_by_props(user_id: "ioobot") {
  109. schemaData
  110. schemaName
  111. id
  112. reference
  113. schemaState
  114. }
  115. }
  116. `;
  117. const SEARCH_SCHEMA = `
  118. query SCHEMA($id: ID!) {
  119. schema_by_id(id: $id) {
  120. schemaName
  121. schemaData
  122. id
  123. reference
  124. schemaState
  125. }
  126. }
  127. `;
  128. const ADD_SCHEMA = `
  129. mutation SCHEMA($id: ID!, $user_id: ID!, $schemaName: String!, $schemaData: String!, $createdAt: String, $updatedAt: String, $schemaState: String, $reference: String) {
  130. create_schema(
  131. id: $id,
  132. user_id: $user_id,
  133. schemaName: $schemaName,
  134. createdAt: $createdAt,
  135. updatedAt: $updatedAt,
  136. schemaData: $schemaData,
  137. schemaState: $schemaState
  138. reference: $reference
  139. ) {
  140. schemaName,
  141. schemaData
  142. id
  143. reference
  144. schemaState
  145. }
  146. }
  147. `;
  148. const DELETE_SCHEMA = `
  149. mutation SCHEMA($schemaName: String, $user_id: ID) {
  150. delete_schema(schemaName: $schemaName, user_id: $user_id)
  151. }
  152. `;
  153. const UPDATE_SCHEMA = `
  154. mutation SCHEMA($id: ID!, $schemaData: String!, $updatedAt: String, $schemaState: String) {
  155. update_schema(
  156. id: $id,
  157. updatedAt: $updatedAt,
  158. schemaData: $schemaData,
  159. schemaState: $schemaState
  160. ) {
  161. schemaName,
  162. schemaData
  163. id
  164. schemaState
  165. }
  166. }
  167. `;
  168. const UPDATE_SCHEMA_NAME = `
  169. mutation SCHEMA($id: ID!, $schemaName: String, $updatedAt: String) {
  170. update_schema(
  171. id: $id,
  172. updatedAt: $updatedAt,
  173. schemaName: $schemaName,
  174. ) {
  175. schemaName,
  176. id
  177. schemaState
  178. }
  179. }
  180. `;
  181. const SHOW_TABLE = `
  182. query TABLE($schema_id: ID!) {
  183. schema_by_id(id: $schema_id) {
  184. schemaData
  185. schemaName
  186. reference
  187. schemaState
  188. }
  189. }
  190. `;
  191. const ADD_CLOUD = `
  192. mutation CLOUD($id: ID!, $user_id: ID, $cloudName: String, $secretId: String, $secretKey: String, $updatedAt: String, $createdAt: String, $appId: String) {
  193. create_cloud(
  194. id: $id
  195. user_id: $user_id
  196. cloudName: $cloudName
  197. secretId: $secretId
  198. secretKey: $secretKey
  199. createdAt: $createdAt
  200. updatedAt: $updatedAt
  201. appId: $appId
  202. ) {
  203. id
  204. cloudName
  205. secretId
  206. secretKey
  207. appId
  208. }
  209. }
  210. `;
  211. const SHOW_CLOUD = `
  212. query CLOUD($user_id: ID!) {
  213. cloud_by_props(user_id: $user_id) {
  214. id
  215. cloudName
  216. secretId
  217. secretKey
  218. appId
  219. }
  220. }
  221. `;
  222. const UPDATE_CLOUD = `
  223. mutation updatecloud($id: ID, $secretId: String, $secretKey: String $updatedAt: String, $appId: String) {
  224. update_cloud(
  225. id: $id
  226. secretId: $secretId
  227. secretKey: $secretKey
  228. updatedAt: $updatedAt
  229. appId: $appId
  230. ) {
  231. id
  232. cloudName
  233. secretId
  234. secretKey
  235. appId
  236. }
  237. }
  238. `;
  239. const SHOW_DEPLOY = `
  240. query DEPLOY($cloud_id: ID!) {
  241. deploy_by_props(cloud_id: $cloud_id) {
  242. id
  243. functionName
  244. region
  245. description
  246. cosBucketName
  247. cosObjectName
  248. cosBucketRegion
  249. handler
  250. memorySize
  251. timeout
  252. vpcId
  253. subnetId
  254. }
  255. }
  256. `;
  257. const ADD_DEPLOY = `
  258. 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) {
  259. create_deploy(
  260. id: $id
  261. description: $description
  262. cosBucketName: $cosBucketName
  263. memorySize: $memorySize
  264. fc_id: $fc_id
  265. subnetId: $subnetId
  266. cosObjectName: $cosObjectName
  267. region: $region
  268. vpcId: $vpcId
  269. cosBucketRegion: $cosBucketRegion
  270. cloud_id: $cloud_id
  271. user_id: $user_id
  272. timeout: $timeout
  273. handler: $handler
  274. functionName: $functionName
  275. serviceName: $serviceName
  276. createdAt: $createdAt
  277. updatedAt: $updatedAt
  278. ) {
  279. id
  280. }
  281. }
  282. `;
  283. const UPDATE_DEPLOY = `
  284. mutation DEPLOY($id: ID!, $description: String, $updatedAt: String, $cosBucketName: String, $subnetId: String, $cosObjectName: String, $region: String, $vpcId: String, $cosBucketRegion: String, $functionName: String) {
  285. update_deploy(
  286. id: $id
  287. description: $description
  288. cosBucketName: $cosBucketName
  289. subnetId: $subnetId
  290. cosObjectName: $cosObjectName
  291. region: $region
  292. vpcId: $vpcId
  293. cosBucketRegion: $cosBucketRegion
  294. functionName: $functionName
  295. updatedAt: $updatedAt
  296. ) {
  297. id
  298. }
  299. }
  300. `;
  301. const SHOW_APIGWGROUP = `
  302. query GROUP($schema_id: ID!) {
  303. apiGWGroup_by_props(schema_id: $schema_id) {
  304. id
  305. groupName
  306. region
  307. frontType
  308. defaultDomain
  309. userStatus
  310. userDomain
  311. }
  312. }
  313. `;
  314. const ADD_APIGROUP = `
  315. 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) {
  316. create_apiGWGroup(
  317. id: $id
  318. userStatus: $userStatus
  319. defaultDomain: $defaultDomain
  320. updatedAt: $updatedAt
  321. userDomain: $userDomain
  322. groupName: $groupName
  323. createdAt: $createdAt
  324. frontType: $frontType
  325. region: $region
  326. status: $status
  327. cloud_id: $cloud_id
  328. user_id: $user_id
  329. environmentName: $environmentName
  330. serviceId: $serviceId
  331. ) {
  332. id
  333. }
  334. }
  335. `;
  336. const UPDATE_APIGROUP = `
  337. mutation GROUP($id:ID!, $environmentName: String, $userStatus: String, $updatedAt: String, $userDomain: String, $groupName: String, $frontType: String, $region: String) {
  338. update_apiGWGroup(
  339. id: $id
  340. userStatus: $userStatus
  341. userDomain: $userDomain
  342. groupName: $groupName
  343. frontType: $frontType
  344. region: $region
  345. environmentName: $environmentName
  346. updatedAt: $updatedAt
  347. ) {
  348. id
  349. }
  350. }
  351. `;
  352. const SHOW_APIGWPATH = `
  353. query PATH($apiGWGroup_id: ID!) {
  354. apiGWPath_by_props(apiGWGroup_id: $apiGWGroup_id) {
  355. id
  356. apiGWName
  357. apiGWDesc
  358. requestMethod
  359. }
  360. }
  361. `;
  362. const ADD_APIGWPATH = `
  363. 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) {
  364. create_apiGWPath(
  365. apiGWName: $apiGWName
  366. updatedAt: $updatedAt
  367. apiGWGroup_id: $apiGWGroup_id
  368. createdAt: $createdAt
  369. deploy_id: $deploy_id
  370. serviceType: $serviceType
  371. id: $id
  372. apiGWPath: $apiGWPath
  373. user_id: $user_id
  374. timeout: $timeout
  375. apiGWDesc: $apiGWDesc
  376. requestMethod: $requestMethod
  377. apiId: $apiId
  378. ) {
  379. id
  380. }
  381. }
  382. `;
  383. const UPDATE_APIGWPATH = `
  384. mutation PATH($apiGWName: String, $updatedAt: String, $apiGWDesc: String, $requestMethod: String) {
  385. update_apiGWPath(
  386. apiGWName: $apiGWName
  387. apiGWDesc: $apiGWDesc
  388. requestMethod: $requestMethod
  389. updatedAt: $updatedAt
  390. ) {
  391. id
  392. }
  393. }
  394. `;
  395. const SHOW_FC_SCHEMA = `
  396. query FC($schema_id: ID!) {
  397. fc_by_props(schema_id: $schema_id) {
  398. cloud_id {
  399. id
  400. cloudName
  401. }
  402. }
  403. }
  404. `;
  405. const SHOW_FC_CONFIG = `
  406. query FC($wxConfig_id: ID!) {
  407. fc_by_props(wxConfig_id: $wxConfig_id) {
  408. cloud_id {
  409. id
  410. cloudName
  411. }
  412. }
  413. }
  414. `;
  415. const SHOW_ALL_WXCONFIG = `
  416. query WXCONFIG($user_id: ID) {
  417. userWxConfig:wxConfig_by_props(user_id: $user_id) {
  418. appID
  419. appName
  420. appSecret
  421. attach
  422. body
  423. enter_url
  424. id
  425. mch_id
  426. notify_url
  427. pay_api_key
  428. spbill_create_ip
  429. token
  430. welcome_words
  431. }
  432. caseWxConfig:wxConfig_by_props(user_id: "ioobot") {
  433. appID
  434. appName
  435. appSecret
  436. attach
  437. body
  438. enter_url
  439. id
  440. mch_id
  441. notify_url
  442. pay_api_key
  443. spbill_create_ip
  444. token
  445. welcome_words
  446. }
  447. }
  448. `;
  449. const SHOW_WXCONFIG = `
  450. query WXCONFIG($user_id: ID) {
  451. wxConfig_by_props(user_id: $user_id) {
  452. appID
  453. appName
  454. appSecret
  455. attach
  456. body
  457. enter_url
  458. id
  459. mch_id
  460. notify_url
  461. pay_api_key
  462. spbill_create_ip
  463. token
  464. welcome_words
  465. }
  466. }
  467. `;
  468. const ADD_WXCONFIG = `
  469. 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) {
  470. create_wxConfig(
  471. updatedAt: $updatedAt
  472. mch_id: $mch_id
  473. appName: $appName
  474. notify_url: $notify_url
  475. appSecret: $appSecret
  476. createdAt: $createdAt
  477. appID: $appID
  478. token: $token
  479. spbill_create_ip: $spbill_create_ip
  480. enter_url: $enter_url
  481. id: $id
  482. pay_api_key: $pay_api_key
  483. user_id: $user_id
  484. body: $body
  485. welcome_words: $welcome_words
  486. attach: $attach
  487. ) {
  488. mch_id
  489. appName
  490. notify_url
  491. appSecret
  492. appID
  493. token
  494. spbill_create_ip
  495. enter_url
  496. id
  497. pay_api_key
  498. body
  499. welcome_words
  500. attach
  501. }
  502. }
  503. `;
  504. const SHOW_WXCONTENT = `
  505. query wxConfigbyid($id: ID) {
  506. wxConfig_by_id(id: $id) {
  507. mch_id
  508. appName
  509. notify_url
  510. appSecret
  511. appID
  512. token
  513. spbill_create_ip
  514. enter_url
  515. id
  516. pay_api_key
  517. body
  518. welcome_words
  519. attach
  520. }
  521. }
  522. `;
  523. const UPDATE_WXCONFIG = `
  524. 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) {
  525. update_wxConfig(
  526. id: $id
  527. updatedAt: $updatedAt
  528. mch_id: $mch_id
  529. appName: $appName
  530. notify_url: $notify_url
  531. appSecret: $appSecret
  532. appID: $appID
  533. token: $token
  534. spbill_create_ip: $spbill_create_ip
  535. enter_url: $enter_url
  536. pay_api_key: $pay_api_key
  537. body: $body
  538. welcome_words: $welcome_words
  539. attach: $attach
  540. ) {
  541. id
  542. mch_id
  543. appName
  544. notify_url
  545. appSecret
  546. appID
  547. token
  548. spbill_create_ip
  549. enter_url
  550. pay_api_key
  551. body
  552. welcome_words
  553. attach
  554. }
  555. }
  556. `;
  557. const DELETE_WXCONFIG = `
  558. mutation deletewxConfig($id: ID) {
  559. delete_wxConfig(id: $id)
  560. }
  561. `;
  562. const GET_PROJECT = `
  563. query projectbyid($id: ID) {
  564. project_by_id(id: $id) {
  565. updatedAt
  566. database_id {
  567. id
  568. }
  569. apiGWGroup_id {
  570. id
  571. groupName
  572. region
  573. frontType
  574. defaultDomain
  575. userStatus
  576. userDomain
  577. }
  578. projectName
  579. deploy_id {
  580. description
  581. updatedAt
  582. cosBucketName
  583. memorySize
  584. createdAt
  585. subnetId
  586. cosObjectName
  587. region
  588. vpcId
  589. cosBucketRegion
  590. id
  591. serviceName
  592. timeout
  593. handler
  594. functionName
  595. }
  596. id
  597. projectType
  598. cloud_id {
  599. id
  600. cloudName
  601. secretId
  602. secretKey
  603. appId
  604. createdAt
  605. updatedAt
  606. }
  607. user_id {
  608. id
  609. }
  610. wxConfig_id {
  611. updatedAt
  612. mch_id
  613. appName
  614. notify_url
  615. appSecret
  616. createdAt
  617. appID
  618. token
  619. spbill_create_ip
  620. enter_url
  621. id
  622. pay_api_key
  623. body
  624. welcome_words
  625. attach
  626. }
  627. schema_id {
  628. updatedAt
  629. schemaState
  630. createdAt
  631. schemaName
  632. reference
  633. id
  634. schemaData
  635. }
  636. }
  637. }
  638. `;
  639. export {
  640. ADD_USER,
  641. GET_USER,
  642. SEARCH_USER,
  643. UPDATE_USER,
  644. SEARCH_SCHEMA,
  645. ADD_SCHEMA,
  646. SHOW_ALL_SCHEMA,
  647. SHOW_SCHEMA,
  648. UPDATE_SCHEMA,
  649. UPDATE_SCHEMA_NAME,
  650. DELETE_SCHEMA,
  651. SHOW_TABLE,
  652. ADD_CLOUD,
  653. SHOW_CLOUD,
  654. UPDATE_CLOUD,
  655. SHOW_DEPLOY,
  656. ADD_DEPLOY,
  657. UPDATE_DEPLOY,
  658. SHOW_APIGWGROUP,
  659. ADD_APIGROUP,
  660. UPDATE_APIGROUP,
  661. SHOW_APIGWPATH,
  662. ADD_APIGWPATH,
  663. UPDATE_APIGWPATH,
  664. SHOW_FC_SCHEMA,
  665. SHOW_FC_CONFIG,
  666. SHOW_ALL_WXCONFIG,
  667. SHOW_WXCONFIG,
  668. ADD_WXCONFIG,
  669. SHOW_WXCONTENT,
  670. UPDATE_WXCONFIG,
  671. DELETE_WXCONFIG,
  672. GET_PROJECT
  673. }