contest-controller.ts 5.0 KB

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