user-controller.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. * Generated by orval v7.0.1 🍺
  3. * Do not edit manually.
  4. * OpenAPI definition
  5. * OpenAPI spec version: v0
  6. */
  7. import type {
  8. DeleteByIdParams,
  9. QueryByPageParams,
  10. Response,
  11. ResponseBoolean,
  12. ResponsePageVoListUserVo,
  13. ResponseUserVo,
  14. UpdateUserAvatarDto,
  15. UpdateUserPasswordDto,
  16. UpdateUserStatusDto,
  17. UserDto,
  18. } from "./models";
  19. import { customAxiosInstance } from "../util/axios-instance";
  20. export const getUserController = () => {
  21. const queryByPage = (params: QueryByPageParams) => {
  22. return customAxiosInstance<ResponsePageVoListUserVo>({
  23. url: `/user`,
  24. method: "GET",
  25. params,
  26. });
  27. };
  28. const edit = (userDto: UserDto) => {
  29. return customAxiosInstance<ResponseBoolean>({
  30. url: `/user`,
  31. method: "PUT",
  32. headers: { "Content-Type": "application/json" },
  33. data: userDto,
  34. });
  35. };
  36. const add = (userDto: UserDto) => {
  37. return customAxiosInstance<ResponseBoolean>({
  38. url: `/user`,
  39. method: "POST",
  40. headers: { "Content-Type": "application/json" },
  41. data: userDto,
  42. });
  43. };
  44. const deleteById = (params: DeleteByIdParams) => {
  45. return customAxiosInstance<ResponseBoolean>({
  46. url: `/user`,
  47. method: "DELETE",
  48. params,
  49. });
  50. };
  51. const updateUserStatus = (updateUserStatusDto: UpdateUserStatusDto) => {
  52. return customAxiosInstance<Response>({
  53. url: `/user/updateStatus`,
  54. method: "PUT",
  55. headers: { "Content-Type": "application/json" },
  56. data: updateUserStatusDto,
  57. });
  58. };
  59. const updatePassword = (updateUserPasswordDto: UpdateUserPasswordDto) => {
  60. return customAxiosInstance<Response>({
  61. url: `/user/updatePassword`,
  62. method: "PUT",
  63. headers: { "Content-Type": "application/json" },
  64. data: updateUserPasswordDto,
  65. });
  66. };
  67. const updateUserAvatar = (updateUserAvatarDto: UpdateUserAvatarDto) => {
  68. return customAxiosInstance<Response>({
  69. url: `/user/updateAvatar`,
  70. method: "PUT",
  71. headers: { "Content-Type": "application/json" },
  72. data: updateUserAvatarDto,
  73. });
  74. };
  75. const queryById = (id: string) => {
  76. return customAxiosInstance<ResponseUserVo>({
  77. url: `/user/${id}`,
  78. method: "GET",
  79. });
  80. };
  81. return {
  82. queryByPage,
  83. edit,
  84. add,
  85. deleteById,
  86. updateUserStatus,
  87. updatePassword,
  88. updateUserAvatar,
  89. queryById,
  90. };
  91. };
  92. export type QueryByPageResult = NonNullable<
  93. Awaited<ReturnType<ReturnType<typeof getUserController>["queryByPage"]>>
  94. >;
  95. export type EditResult = NonNullable<
  96. Awaited<ReturnType<ReturnType<typeof getUserController>["edit"]>>
  97. >;
  98. export type AddResult = NonNullable<
  99. Awaited<ReturnType<ReturnType<typeof getUserController>["add"]>>
  100. >;
  101. export type DeleteByIdResult = NonNullable<
  102. Awaited<ReturnType<ReturnType<typeof getUserController>["deleteById"]>>
  103. >;
  104. export type UpdateUserStatusResult = NonNullable<
  105. Awaited<ReturnType<ReturnType<typeof getUserController>["updateUserStatus"]>>
  106. >;
  107. export type UpdatePasswordResult = NonNullable<
  108. Awaited<ReturnType<ReturnType<typeof getUserController>["updatePassword"]>>
  109. >;
  110. export type UpdateUserAvatarResult = NonNullable<
  111. Awaited<ReturnType<ReturnType<typeof getUserController>["updateUserAvatar"]>>
  112. >;
  113. export type QueryByIdResult = NonNullable<
  114. Awaited<ReturnType<ReturnType<typeof getUserController>["queryById"]>>
  115. >;