Advertisement
Infidelis

swaggeer api

Feb 18th, 2020
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.86 KB | None | 0 0
  1. openapi: 3.0.0
  2.  
  3. info:
  4. # You application title. Required.
  5. title: SkyProg
  6. # API version. You can use semantic versioning like 1.0.0,
  7. # or an arbitrary string like 0.99-beta. Required.
  8. version: 1.0.3
  9.  
  10. paths:
  11. /auth/sign_up:
  12. post:
  13. description: Регистрация родителя
  14. parameters:
  15. - name: SUBJECT
  16. in: query
  17. schema:
  18. type: string
  19. description: Курс
  20. required: true
  21. tags:
  22. - parent
  23. operationId: sign_up
  24. responses:
  25. '200':
  26. description: all ok
  27. content:
  28. application/json:
  29. schema:
  30. type: object
  31. properties:
  32. token:
  33. type: string
  34. id_parent:
  35. type: integer
  36. '400':
  37. description: request error
  38.  
  39. requestBody:
  40. $ref: '#/components/requestBodies/Parent'
  41.  
  42. /auth/sign_up/teacher:
  43. post:
  44. description: Регистрация учителя, у учителя может быть много курсов(SUBJECTS)
  45. tags:
  46. - teacher
  47. operationId: sign_up_teacher
  48. responses:
  49. '400':
  50. description: request error
  51. '200':
  52. description: all ok
  53. content:
  54. application/json:
  55. schema:
  56. type: object
  57. properties:
  58. token:
  59. type: string
  60. id_teacher:
  61. type: integer
  62.  
  63. requestBody:
  64. $ref: '#/components/requestBodies/sign_up_teacher'
  65.  
  66.  
  67. /auth/sign_up/admin:
  68. post:
  69. description: Регистрация админа
  70. tags:
  71. - admin
  72. operationId: sign_up_admin
  73. responses:
  74. '400':
  75. description: request error
  76. '200':
  77. description: all ok
  78. content:
  79. application/json:
  80. schema:
  81. type: object
  82. properties:
  83. token:
  84. type: string
  85. id_admin:
  86. type: integer
  87.  
  88. requestBody:
  89. $ref: '#/components/requestBodies/sign_up_admin'
  90.  
  91. /auth/sign_in:
  92. post:
  93. description: auth пользователя, в зависимости от роли юзера выдается три разных response
  94. tags:
  95. - auth
  96. operationId: sign_in
  97. responses:
  98. '200':
  99. description: ok
  100. content:
  101. application/json:
  102. schema:
  103. oneOf:
  104. - $ref: '#/components/schemas/Parent_response'
  105. - $ref: '#/components/schemas/Admin_response'
  106. - $ref: '#/components/schemas/Teacher_response'
  107. '401':
  108. description: no such user
  109. content:
  110. application/json:
  111. schema:
  112. type: object
  113. properties:
  114. message:
  115. type: string
  116. example: No such user
  117.  
  118. requestBody:
  119. $ref: '#/components/requestBodies/login_pass'
  120.  
  121. /add_child:
  122. post:
  123. description: Добавление ребенка к родителю
  124. parameters:
  125. - in: header
  126. name: token
  127. schema:
  128. type: string
  129. required: true
  130. tags:
  131. - parent
  132. operationId: add_child
  133. responses:
  134. '400':
  135. description: request error
  136. '200':
  137. description: all ok
  138. content:
  139. application/json:
  140. schema:
  141. type: object
  142. properties:
  143. id_child:
  144. type: integer
  145. id_parent:
  146. type: integer
  147. requestBody:
  148. content:
  149. application/json:
  150. schema:
  151. type: object
  152. properties:
  153. age:
  154. type: integer
  155. name_child:
  156. type: string
  157. subjects:
  158. type: string
  159. example: [1, subjcode_2]
  160.  
  161.  
  162. /child:
  163. get:
  164. description: инфа о ребенке
  165. parameters:
  166. - in: header
  167. name: token
  168. schema:
  169. type: string
  170. required: true
  171. - in: query
  172. name: status
  173. description: posible status
  174. schema:
  175. type: integer
  176. enum: [0,1,2]
  177. tags:
  178. - child
  179. operationId: child
  180. responses:
  181. '400':
  182. description: request error
  183. '200':
  184. description: all ok
  185. content:
  186. application/json:
  187. schema:
  188. items:
  189. type: object
  190. properties:
  191. id_child:
  192. type: integer
  193. id_parent:
  194. type: integer
  195. subjects:
  196. example: [1, subject_code_2]
  197. age:
  198. type: integer
  199. id_match:
  200. type: integer
  201. id_teacher:
  202. type: integer
  203. date_match:
  204. type: string
  205. format: date-time
  206. status:
  207. type: integer
  208.  
  209. /teacher:
  210. get:
  211. description: инфа об учителе
  212. parameters:
  213. - in: header
  214. name: token
  215. schema:
  216. type: string
  217. required: true
  218. tags:
  219. - teacher
  220. operationId: get_teacher
  221. responses:
  222. '400':
  223. description: request error
  224. '200':
  225. description: all ok
  226. content:
  227. application/json:
  228. schema:
  229. type: object
  230. properties:
  231. id_teacher:
  232. type: integer
  233. login:
  234. type: string
  235. password:
  236. type: string
  237. subjects:
  238. type: string
  239. example: [1, subjcode_2]
  240. skype:
  241. type: string
  242. mail:
  243. type: string
  244. date_reg:
  245. type: string
  246. format: date-time
  247. example: 07:38:07 17-Feb-20
  248. date_last:
  249. type: string
  250. format: date-time
  251. example: 07:38:07 17-Feb-20
  252. rating:
  253. type: number
  254. number_of_lessons:
  255. type: integer
  256. rates_number:
  257. type: integer
  258.  
  259. post:
  260. tags:
  261. - teacher
  262. description: оценка учителю за урок
  263. parameters:
  264. - in: header
  265. name: token
  266. schema:
  267. type: string
  268. required: true
  269. operationId: rate_teacher
  270. responses:
  271. '400':
  272. description: request error
  273. '200':
  274. description: ok
  275. content:
  276. application/json:
  277. schema:
  278. type: object
  279. properties:
  280. id_teacher:
  281. type: integer
  282. sum_rating:
  283. type: integer
  284. number_of_lessons:
  285. type: integer
  286. rates_number:
  287. type: integer
  288.  
  289. requestBody:
  290. content:
  291. application/json:
  292. schema:
  293. type: object
  294. properties:
  295. child_rate:
  296. type: integer
  297.  
  298. put:
  299. tags:
  300. - teacher
  301. description: изменение информации об учителе
  302. parameters:
  303. - in: header
  304. name: token
  305. schema:
  306. type: string
  307. required: true
  308. operationId: edit_teacher
  309. responses:
  310. '400':
  311. description: request error
  312. '401':
  313. description: There is an user with such fields
  314. '200':
  315. description: all ok
  316. content:
  317. application/json:
  318. schema:
  319. type: object
  320. properties:
  321. id_teacher:
  322. type: integer
  323. name_teacher:
  324. type: string
  325. mail_teacher:
  326. type: string
  327. date_reg:
  328. type: string
  329. example: 10:15:02 17-Feb-20
  330. date_last:
  331. type: string
  332. example: 10:15:02 17-Feb-20
  333. requestBody:
  334. content:
  335. application/json:
  336. schema:
  337. type: object
  338. properties:
  339. name_teacher:
  340. type: string
  341. mail_teacher:
  342. type: string
  343. phone_teacher:
  344. type: string
  345.  
  346. /teacher/match:
  347. get:
  348. tags:
  349. - teacher
  350. description: все ученики учителя
  351. parameters:
  352. - in: header
  353. name: token
  354. schema:
  355. type: string
  356. required: true
  357. - in: query
  358. name: status
  359. schema:
  360. type: integer
  361. enum: [0,1,2]
  362. description: статусы - ждёт подтверждения(0), отклонил(1), принял(2)
  363. required: true
  364. operationId: match_get_teacher
  365. responses:
  366. '400':
  367. description: request error
  368. '200':
  369. description: all ok
  370. content:
  371. application/json:
  372. schema:
  373. type: array
  374. items:
  375. type: object
  376. properties:
  377. id_match:
  378. type: integer
  379. id_child:
  380. type: integer
  381. id_teacher:
  382. type: integer
  383. status:
  384. type: integer
  385. date_match:
  386. type: string
  387. format: date-time
  388.  
  389. post:
  390. tags:
  391. - teacher
  392. description: кидает заявку на прохождение курса, происходит подбор учителя
  393. parameters:
  394. - in: header
  395. name: token
  396. schema:
  397. type: string
  398. required: true
  399. - in: query
  400. name: status
  401. schema:
  402. type: integer
  403. enum: [0,1,2]
  404. description: статусы - ждёт подтверждения(0), отклонил(1), принял(2)
  405. operationId: match_post_teacher
  406. responses:
  407. '400':
  408. description: request error
  409. '200':
  410. description: all ok
  411.  
  412. requestBody:
  413. content:
  414. application/json:
  415. schema:
  416. type: object
  417. properties:
  418. id_match:
  419. type: integer
  420. status:
  421. type: integer
  422.  
  423. /user:
  424. get:
  425. tags:
  426. - parent
  427. description: информация о родителе
  428. parameters:
  429. - in: header
  430. name: token
  431. schema:
  432. type: string
  433. required: true
  434. operationId: get_parent
  435. responses:
  436. '400':
  437. description: request error
  438. '200':
  439. description: all ok
  440. content:
  441. application/json:
  442. schema:
  443. type: object
  444. properties:
  445. id_parent:
  446. type: integer
  447. name_parent:
  448. type: string
  449. phone_parent:
  450. type: string
  451. mail_parent:
  452. type: string
  453. date_reg:
  454. type: string
  455. example: 10:15:02 17-Feb-20
  456. date_last:
  457. type: string
  458. example: 10:15:02 17-Feb-20
  459.  
  460. put:
  461. tags:
  462. - parent
  463. description: изменение информации о родителе
  464. parameters:
  465. - in: header
  466. name: token
  467. schema:
  468. type: string
  469. required: true
  470. operationId: edit_parent
  471. responses:
  472. '400':
  473. description: request error
  474. '401':
  475. description: There is an user with such fields
  476. '200':
  477. description: all ok
  478. content:
  479. application/json:
  480. schema:
  481. type: object
  482. properties:
  483. id_parent:
  484. type: integer
  485. login:
  486. type: string
  487. name_parent:
  488. type: string
  489. phone_parent:
  490. type: string
  491. mail_parent:
  492. type: string
  493. date_reg:
  494. type: string
  495. example: 10:15:02 17-Feb-20
  496. date_last:
  497. type: string
  498. example: 10:15:02 17-Feb-20
  499. requestBody:
  500. content:
  501. application/json:
  502. schema:
  503. type: object
  504. properties:
  505. name_parent:
  506. type: string
  507. phone_parent:
  508. type: string
  509. mail_parent:
  510. type: string
  511.  
  512. /admin:
  513. get:
  514. tags:
  515. - admin
  516. description: информация об админе
  517. parameters:
  518. - in: header
  519. name: token
  520. schema:
  521. type: string
  522. required: true
  523. operationId: get_admin
  524. responses:
  525. '400':
  526. description: request error
  527. '200':
  528. description: all ok
  529. content:
  530. application/json:
  531. schema:
  532. type: object
  533. properties:
  534. id_admin:
  535. type: integer
  536. name:
  537. type: string
  538. mail:
  539. type: string
  540. date_reg:
  541. example: "07:40:24 18-Feb-20"
  542. date_last:
  543. example: "07:40:24 18-Feb-20"
  544.  
  545. put:
  546. tags:
  547. - admin
  548. description: изменение информации об админе
  549. parameters:
  550. - in: header
  551. name: token
  552. schema:
  553. type: string
  554. required: true
  555. operationId: edit_admin
  556. responses:
  557. '400':
  558. description: request error
  559. '401':
  560. description: There is an user with such fields
  561. '200':
  562. description: all ok
  563. content:
  564. application/json:
  565. schema:
  566. type: object
  567. properties:
  568. id_admin:
  569. type: integer
  570. name_admin:
  571. type: string
  572. mail_admin:
  573. type: string
  574. date_reg:
  575. type: string
  576. example: 10:15:02 17-Feb-20
  577. date_last:
  578. type: string
  579. example: 10:15:02 17-Feb-20
  580. requestBody:
  581. content:
  582. application/json:
  583. schema:
  584. type: object
  585. properties:
  586. name_admin:
  587. type: string
  588. mail_admin:
  589. type: string
  590. phone_admin:
  591. type: string
  592.  
  593. /subject:
  594. get:
  595. tags:
  596. - subject
  597. description: информация о курсах
  598. parameters:
  599. - in: header
  600. name: token
  601. schema:
  602. type: string
  603. required: true
  604. operationId: get_subjects
  605. responses:
  606. '400':
  607. description: request error
  608. '200':
  609. description: all ok
  610. content:
  611. application/json:
  612. schema:
  613. type: array
  614. items:
  615. type: object
  616. properties:
  617. id_subject:
  618. type: integer
  619. name_subject:
  620. type: string
  621. img:
  622. type: string
  623. price:
  624. type: string
  625. duration:
  626. type: string
  627. description:
  628. type: string
  629. components:
  630. schemas:
  631. Parent_response:
  632. type: object
  633. properties:
  634. token:
  635. type: string
  636. id_parent:
  637. type: string
  638. Admin_response:
  639. type: object
  640. properties:
  641. token:
  642. type: string
  643. id_admin:
  644. type: string
  645.  
  646. Teacher_response:
  647. type: object
  648. properties:
  649. token:
  650. type: string
  651. id_teacher:
  652. type: string
  653. sign_up_teacher:
  654. type: object
  655. properties:
  656. login:
  657. type: string
  658. password:
  659. type: string
  660. name:
  661. type: string
  662. mail:
  663. type: string
  664. subjects:
  665. type: integer
  666. example: [ 1, 2, subjcode_3]
  667. uniqueItems: true
  668.  
  669. sign_up_admin:
  670. type: object
  671. properties:
  672. login:
  673. type: string
  674. password:
  675. type: string
  676. name:
  677. type: string
  678. mail:
  679. type: string
  680.  
  681.  
  682. login_pass:
  683. type: object
  684. properties:
  685. login:
  686. type: string
  687. password:
  688. type: string
  689. Parent:
  690. type: object
  691. properties:
  692. login:
  693. type: string
  694. password:
  695. type: string
  696. name_parent:
  697. type: string
  698. name_child:
  699. type: string
  700. age:
  701. type: integer
  702. phone_parent:
  703. type: string
  704. mail_parent:
  705. type: string
  706.  
  707. requestBodies:
  708. sign_up_teacher:
  709. content:
  710. application/json:
  711. schema:
  712. $ref: '#/components/schemas/sign_up_teacher'
  713. sign_up_admin:
  714. content:
  715. application/json:
  716. schema:
  717. $ref: '#/components/schemas/sign_up_admin'
  718. Parent:
  719. content:
  720. application/json:
  721. schema:
  722. $ref: '#/components/schemas/Parent'
  723. required: true
  724. login_pass:
  725. content:
  726. application/json:
  727. schema:
  728. $ref: '#/components/schemas/login_pass'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement