Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swagger: '2.0'
- info:
- version: 0.0.1
- title: Lottery Server
- host: 'localhost:3141'
- basePath: /
- schemes:
- - http
- - https
- consumes:
- - application/json
- produces:
- - application/json
- paths:
- /user:
- x-swagger-router-controller: user.routes
- get:
- tags:
- - User
- summary: get all users (admin only)
- operationId: getUsers
- responses:
- '200':
- description: Success
- schema:
- type: array
- items:
- $ref: '#/definitions/userInfo'
- post:
- tags:
- - User
- summary: add a new user (admin only)
- operationId: addUser
- parameters:
- - name: body
- in: body
- description: info of the user you wish to register
- required: true
- schema:
- $ref: '#/definitions/userRegisterInfo'
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/userInfo'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /user/addCredit:
- x-swagger-router-controller: user.routes
- post:
- tags:
- - User
- summary: add credit for user (admin only)
- operationId: addCredit
- parameters:
- - name: body
- in: body
- description: user name and credit to add
- schema:
- $ref: '#/definitions/userAndCredit'
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/SuccessResponse'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /user/changePassword:
- x-swagger-router-controller: user.routes
- post:
- tags:
- - User
- summary: change user password (admin only)
- operationId: changePassword
- parameters:
- - name: userAndPassword
- in: body
- description: user name and new password
- schema:
- $ref: '#/definitions/userAndPassword'
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/SuccessResponse'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /lottery:
- x-swagger-router-controller: lottery.routes
- get:
- tags:
- - Lottery
- summary: Get lotteries
- description: can be filtered by name, type, isClosed or hasResult
- parameters:
- - name: lotteryName
- in: query
- description: lotteryName
- type: string
- - name: lotteryType
- in: query
- description: type of lottery
- type: string
- enum:
- [loto, toto]
- - name: isClosed
- in: query
- description: has lottery been closed by admin
- type: boolean
- - name: hasResult
- in: query
- description: has lottery result been submitted by admin
- type: boolean
- responses:
- '200':
- description: Success
- schema:
- type: array
- items:
- $ref: '#/definitions/lottery'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- post:
- tags:
- - Lottery
- summary: Add a new lottery (admin only)
- operationId: addLottery
- parameters:
- - name: newLottery
- in: body
- schema:
- $ref: '#/definitions/newLottery'
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/lottery'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /lottery/close:
- x-swagger-router-controller: lottery.routes
- post:
- tags:
- - Lottery
- operationId: closeLottery
- summary: close lottery so there will be no new bets (admin only)
- parameters:
- - name: lotteryId
- in: body
- schema:
- type: string
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/lottery'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /lottery/submitResult:
- x-swagger-router-controller: lottery.routes
- post:
- tags:
- - Lottery
- operationId: submitResult
- summary: Submit lottery result
- description: Submit lottery result
- parameters:
- - name: lotteryIdAndResult
- in: body
- schema:
- $ref: '#/definitions/lotteryIdAndResult'
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/lottery'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /lottery/submitPassword:
- x-swagger-router-controller: lottery.routes
- post:
- tags:
- - Lottery
- operationId: submitPassword
- parameters:
- - name: lotteryIdAndPassword
- in: body
- schema:
- type: object
- properties:
- lotteryId:
- type: string
- password:
- type: string
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/lottery'
- '403':
- description: Wrong Password
- schema:
- $ref: '#/definitions/ErrorResponse'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /bet:
- post:
- tags:
- - Bet
- summary: add a new bet
- parameters:
- - name: newBet
- in: body
- schema:
- $ref: '#/definitions/newBet'
- responses:
- 200:
- description: Success
- schema:
- $ref: '#/definitions/SuccessResponse'
- /bet/_search:
- post:
- tags:
- - Bet
- summary: get all bets, can filter by any bet field
- operationId: getBets
- parameters:
- - name: betFields
- in: body
- description: filter by any field of bet, can be left empty to return all bets
- schema:
- type: object
- properties:
- betId:
- type: string
- lotteryId:
- type: string
- userName:
- type: string
- responses:
- '200':
- description: Success
- schema:
- type: array
- items:
- $ref: '#/definitions/bet'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /bet/won:
- get:
- tags:
- - Bet
- summary: get bets that have been successfull
- description: get bets that have been successfull, retrieve either by userName, lotteryId or all won bets
- operationId: getWonBets
- parameters:
- - in: query
- name: userName
- type: string
- - in: query
- name: lotteryId
- type: string
- responses:
- '200':
- description: Sucess
- schema:
- type: array
- items:
- $ref: '#/definitions/wonBet'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /adminMessage:
- x-swagger-router-controller: adminMessage.routes
- get:
- tags:
- - Admin Message
- summary: get all admin messages (admin only)
- operationId: getAdminMessages
- responses:
- '200':
- description: Success
- schema:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- text:
- type: string
- isModal:
- type: boolean
- post:
- tags:
- - Admin Message
- summary: adds a new admin message (admin only)
- operationId: addAdminMessage
- parameters:
- - name: body
- in: body
- required: true
- schema:
- $ref: '#/definitions/adminMessage'
- responses:
- '200':
- description: Success
- schema:
- $ref: '#/definitions/SuccessResponse'
- default:
- description: Error
- schema:
- $ref: '#/definitions/ErrorResponse'
- /swagger:
- x-swagger-pipe: swagger_raw
- definitions:
- userRegisterInfo:
- required:
- - userName
- - name
- - password
- properties:
- userName:
- type: string
- name:
- type: string
- password:
- type: string
- credit:
- type: number
- userInfo:
- properties:
- userName:
- type: string
- name:
- type: string
- credit:
- type: number
- userAndCredit:
- required:
- - userName
- - credit
- properties:
- userName:
- type: string
- credit:
- type: number
- userAndPassword:
- required:
- - userName
- - password
- properties:
- userName:
- type: string
- password:
- type: string
- lottery:
- properties:
- id:
- type: string
- name:
- type: string
- price:
- type: number
- maxUsers:
- type: number
- isClosed:
- type: boolean
- type:
- type: string
- enum:
- [loto, toto]
- games:
- description: lottery games (in case the lottery is toto)
- type: array
- items:
- type: object
- properties:
- gameId:
- type: string
- teamA:
- type: string
- teamB:
- type: string
- date:
- type: string
- format: date-time
- endDate:
- type: string
- format: date-time
- comission:
- description: admin's comission
- type: number
- firstPercentage:
- type: number
- secondPercentage:
- type: number
- thirdPercentage:
- type: number
- result:
- $ref: '#/definitions/lotteryResult'
- password:
- type: number
- wins:
- type: array
- items:
- type: object
- properties:
- betId:
- type: string
- place:
- type: number
- description: which place has this bet won (1/2/3)
- split:
- type: number
- description: if multiple bets won at the same place this will tell between how many bets the prize has been split (1 if no other bets won)
- newLottery:
- properties:
- name:
- type: string
- price:
- type: number
- maxUsers:
- type: number
- isClosed:
- type: boolean
- type:
- type: string
- enum:
- [loto, toto]
- games:
- description: lottery games (in case the lottery is toto)
- type: array
- items:
- type: object
- properties:
- gameId:
- type: string
- teamA:
- type: string
- teamB:
- type: string
- date:
- type: string
- format: date-time
- endDate:
- type: string
- format: date-time
- comission:
- description: admin's comission
- type: number
- firstPercentage:
- type: number
- secondPercentage:
- type: number
- thirdPercentage:
- type: number
- result:
- $ref: '#/definitions/lotteryResult'
- password:
- type: number
- bet:
- required:
- - userName
- - lotteryId
- - gamblerName
- - betInfo
- properties:
- userName:
- type: string
- lotteryId:
- type: string
- gamblerName:
- type: string
- betInfo:
- $ref: '#/definitions/betInfo'
- newBet:
- required:
- - lotteryId
- - gamblerName
- - betInfo
- properties:
- lotteryId:
- type: string
- gamblerName:
- type: string
- betInfo:
- $ref: '#/definitions/betInfo'
- betInfo:
- description: do not leave empty, fill either loto or toto
- properties:
- loto:
- type: array
- items:
- type: number
- toto:
- type: array
- items:
- type: object
- properties:
- gameId:
- type: number
- guess:
- description: 0 for tie, 1 for teamA, 2 for teamB
- type: number
- lotteryResult:
- $ref: '#/definitions/betInfo'
- lotteryIdAndResult:
- properties:
- lotteryId:
- type: string
- lotteryResult:
- $ref: '#/definitions/lotteryResult'
- wonBet:
- description: a bet that has been won
- properties:
- betId:
- type: string
- lotteryId:
- type: string
- place:
- type: number
- description: which place has this bet won (1/2/3)
- split:
- type: number
- description: if multiple bets won at the same place this will tell between how many bets the prize has been split (1 if no other bets won)
- adminMessage:
- properties:
- text:
- type: string
- isModal:
- type: boolean
- SuccessResponse:
- required:
- - message
- properties:
- message:
- type: string
- ErrorResponse:
- required:
- - message
- properties:
- message:
- type: string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement