contest-controller.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. ContestDto,
  10. ContestProblemDto,
  11. ContestRegisterDto,
  12. DeleteByIds1Params,
  13. GetDetail2Params,
  14. GetRankingParams,
  15. QueryByPage2Params,
  16. RemoveProblemParams,
  17. ResponseBoolean,
  18. ResponseContestDetailVo,
  19. ResponseListContestRegistrationVo,
  20. ResponseListRankVo,
  21. ResponsePageVoListContestVo,
  22. } from "./models";
  23. import { customAxiosInstance } from "../util/axios-instance";
  24. export const getContestController = () => {
  25. /**
  26. * @summary 分页查询比赛列表
  27. */
  28. const queryByPage2 = (params: QueryByPage2Params) => {
  29. return customAxiosInstance<ResponsePageVoListContestVo>({
  30. url: `/contest`,
  31. method: "GET",
  32. params,
  33. });
  34. };
  35. /**
  36. * @summary 修改比赛
  37. */
  38. const edit2 = (contestDto: ContestDto) => {
  39. return customAxiosInstance<ResponseBoolean>({
  40. url: `/contest`,
  41. method: "PUT",
  42. headers: { "Content-Type": "application/json" },
  43. data: contestDto,
  44. });
  45. };
  46. /**
  47. * @summary 新增比赛
  48. */
  49. const add2 = (contestDto: ContestDto) => {
  50. return customAxiosInstance<ResponseBoolean>({
  51. url: `/contest`,
  52. method: "POST",
  53. headers: { "Content-Type": "application/json" },
  54. data: contestDto,
  55. });
  56. };
  57. /**
  58. * @summary 批量删除比赛
  59. */
  60. const deleteByIds1 = (params: DeleteByIds1Params) => {
  61. return customAxiosInstance<ResponseBoolean>({
  62. url: `/contest`,
  63. method: "DELETE",
  64. params,
  65. });
  66. };
  67. /**
  68. * @summary 修改比赛题目
  69. */
  70. const updateProblem = (id: number, contestProblemDto: ContestProblemDto) => {
  71. return customAxiosInstance<ResponseBoolean>({
  72. url: `/contest/${id}/problem`,
  73. method: "PUT",
  74. headers: { "Content-Type": "application/json" },
  75. data: contestProblemDto,
  76. });
  77. };
  78. /**
  79. * @summary 比赛添加题目
  80. */
  81. const addProblem = (id: number, contestProblemDto: ContestProblemDto) => {
  82. return customAxiosInstance<ResponseBoolean>({
  83. url: `/contest/${id}/problem`,
  84. method: "POST",
  85. headers: { "Content-Type": "application/json" },
  86. data: contestProblemDto,
  87. });
  88. };
  89. /**
  90. * @summary 比赛移除题目
  91. */
  92. const removeProblem = (id: number, params: RemoveProblemParams) => {
  93. return customAxiosInstance<ResponseBoolean>({
  94. url: `/contest/${id}/problem`,
  95. method: "DELETE",
  96. params,
  97. });
  98. };
  99. /**
  100. * @summary 报名比赛
  101. */
  102. const register = (id: number, contestRegisterDto: ContestRegisterDto) => {
  103. return customAxiosInstance<ResponseBoolean>({
  104. url: `/contest/${id}/register`,
  105. method: "POST",
  106. headers: { "Content-Type": "application/json" },
  107. data: contestRegisterDto,
  108. });
  109. };
  110. /**
  111. * @summary 查询比赛详情
  112. */
  113. const getDetail2 = (id: number, params?: GetDetail2Params) => {
  114. return customAxiosInstance<ResponseContestDetailVo>({
  115. url: `/contest/${id}`,
  116. method: "GET",
  117. params,
  118. });
  119. };
  120. /**
  121. * @summary 查询比赛报名名单
  122. */
  123. const queryRegistrations = (id: number) => {
  124. return customAxiosInstance<ResponseListContestRegistrationVo>({
  125. url: `/contest/${id}/registrations`,
  126. method: "GET",
  127. });
  128. };
  129. /**
  130. * @summary 查询比赛排行榜
  131. */
  132. const getRanking = (id: number, params?: GetRankingParams) => {
  133. return customAxiosInstance<ResponseListRankVo>({
  134. url: `/contest/${id}/ranking`,
  135. method: "GET",
  136. params,
  137. });
  138. };
  139. return {
  140. queryByPage2,
  141. edit2,
  142. add2,
  143. deleteByIds1,
  144. updateProblem,
  145. addProblem,
  146. removeProblem,
  147. register,
  148. getDetail2,
  149. queryRegistrations,
  150. getRanking,
  151. };
  152. };
  153. export type QueryByPage2Result = NonNullable<
  154. Awaited<ReturnType<ReturnType<typeof getContestController>["queryByPage2"]>>
  155. >;
  156. export type Edit2Result = NonNullable<
  157. Awaited<ReturnType<ReturnType<typeof getContestController>["edit2"]>>
  158. >;
  159. export type Add2Result = NonNullable<
  160. Awaited<ReturnType<ReturnType<typeof getContestController>["add2"]>>
  161. >;
  162. export type DeleteByIds1Result = NonNullable<
  163. Awaited<ReturnType<ReturnType<typeof getContestController>["deleteByIds1"]>>
  164. >;
  165. export type UpdateProblemResult = NonNullable<
  166. Awaited<ReturnType<ReturnType<typeof getContestController>["updateProblem"]>>
  167. >;
  168. export type AddProblemResult = NonNullable<
  169. Awaited<ReturnType<ReturnType<typeof getContestController>["addProblem"]>>
  170. >;
  171. export type RemoveProblemResult = NonNullable<
  172. Awaited<ReturnType<ReturnType<typeof getContestController>["removeProblem"]>>
  173. >;
  174. export type RegisterResult = NonNullable<
  175. Awaited<ReturnType<ReturnType<typeof getContestController>["register"]>>
  176. >;
  177. export type GetDetail2Result = NonNullable<
  178. Awaited<ReturnType<ReturnType<typeof getContestController>["getDetail2"]>>
  179. >;
  180. export type QueryRegistrationsResult = NonNullable<
  181. Awaited<
  182. ReturnType<ReturnType<typeof getContestController>["queryRegistrations"]>
  183. >
  184. >;
  185. export type GetRankingResult = NonNullable<
  186. Awaited<ReturnType<ReturnType<typeof getContestController>["getRanking"]>>
  187. >;