.mechanism.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. module.exports = {
  2. create: {
  3. requestBody: [
  4. "name",
  5. "contacts",
  6. "phone",
  7. "passwd",
  8. "email",
  9. "address",
  10. "juris",
  11. "industry",
  12. ],
  13. },
  14. destroy: {
  15. params: ["!id"],
  16. service: "delete",
  17. },
  18. update: {
  19. params: ["!id"],
  20. requestBody: [
  21. "name",
  22. "contacts",
  23. "phone",
  24. "email",
  25. "address",
  26. "industry",
  27. "juris",
  28. "status",
  29. ],
  30. },
  31. show: {
  32. parameters: {
  33. params: ["!id"],
  34. },
  35. service: "fetch",
  36. },
  37. index: {
  38. parameters: {
  39. query: {
  40. name: "name",
  41. industry: "industry",
  42. juris: "juris",
  43. "create_time@start": "create_time@start",
  44. "create_time@end": "create_time@end",
  45. },
  46. // options: {
  47. // "meta.state": 0 // 默认条件
  48. // },
  49. options: {
  50. isdel: "0", // 默认条件
  51. },
  52. },
  53. service: "query",
  54. options: {
  55. query: ["skip", "limit"],
  56. sort: ["meta.createdAt"],
  57. desc: true,
  58. count: true,
  59. },
  60. },
  61. //修改密码
  62. password: {
  63. params: ["!id"],
  64. requestBody: ["passwd"],
  65. service: "password",
  66. },
  67. // 登陆
  68. login: {
  69. requestBody: ["phone", "passwd"],
  70. service: "login",
  71. },
  72. };