user-controller.ts 4.0 KB

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