fel kesz game backend
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
/**
|
||||
* @swagger
|
||||
* components:
|
||||
* securitySchemes:
|
||||
* bearerAuth:
|
||||
* type: http
|
||||
* scheme: bearer
|
||||
* bearerFormat: JWT
|
||||
* schemas:
|
||||
* User:
|
||||
* type: object
|
||||
@@ -299,6 +294,34 @@
|
||||
* chatId:
|
||||
* type: string
|
||||
*
|
||||
* Game:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* format: uuid
|
||||
* gamecode:
|
||||
* type: string
|
||||
* maxplayers:
|
||||
* type: integer
|
||||
* logintype:
|
||||
* type: integer
|
||||
* gamedecks:
|
||||
* type: array
|
||||
* players:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* started:
|
||||
* type: boolean
|
||||
* finished:
|
||||
* type: boolean
|
||||
* state:
|
||||
* type: integer
|
||||
* createdate:
|
||||
* type: string
|
||||
* format: date-time
|
||||
*
|
||||
* Error:
|
||||
* type: object
|
||||
* properties:
|
||||
@@ -309,32 +332,35 @@
|
||||
* format: date-time
|
||||
* details:
|
||||
* type: string
|
||||
*
|
||||
* paths:
|
||||
* /api/users/login:
|
||||
* post:
|
||||
* tags: [Users]
|
||||
* summary: User login
|
||||
* description: Authenticate user and return JWT token
|
||||
* requestBody:
|
||||
* required: true
|
||||
*/
|
||||
/**
|
||||
* @swagger
|
||||
*
|
||||
* /api/users/login:
|
||||
* post:
|
||||
* tags: [Users]
|
||||
* summary: User login
|
||||
* description: Authenticate user and return JWT token
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/LoginRequest'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Login successful
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/LoginRequest'
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Login successful
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/LoginResponse'
|
||||
* 401:
|
||||
* description: Invalid credentials
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Error'
|
||||
* $ref: '#/components/schemas/LoginResponse'
|
||||
* 401:
|
||||
* description: Invalid credentials
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Error'
|
||||
*
|
||||
*
|
||||
* /api/users/create:
|
||||
* post:
|
||||
@@ -1397,6 +1423,163 @@
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Contact'
|
||||
*
|
||||
* /api/games/start:
|
||||
* post:
|
||||
* summary: Start a new game
|
||||
* tags: [Games]
|
||||
* security:
|
||||
* - bearerAuth: []
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - deckids
|
||||
* - maxplayers
|
||||
* - logintype
|
||||
* properties:
|
||||
* deckids:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* description: Array of deck IDs (must include all 3 types LUCK, JOKER, QUESTION)
|
||||
* maxplayers:
|
||||
* type: integer
|
||||
* minimum: 2
|
||||
* maximum: 8
|
||||
* description: Maximum number of players allowed in the game
|
||||
* logintype:
|
||||
* type: integer
|
||||
* enum: [0, 1, 2]
|
||||
* description: How players can join (PUBLIC=0, PRIVATE=1, ORGANIZATION=2)
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Game started successfully
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: Game UUID
|
||||
* gamecode:
|
||||
* type: string
|
||||
* description: 6-character game code for joining
|
||||
* maxplayers:
|
||||
* type: integer
|
||||
* logintype:
|
||||
* type: integer
|
||||
* gamedecks:
|
||||
* type: array
|
||||
* description: Shuffled game decks
|
||||
* players:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* started:
|
||||
* type: boolean
|
||||
* finished:
|
||||
* type: boolean
|
||||
* state:
|
||||
* type: integer
|
||||
* description: Game state (WAITING=0, ACTIVE=1, FINISHED=2, CANCELLED=3)
|
||||
* createdate:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* 400:
|
||||
* description: Invalid input parameters
|
||||
* 401:
|
||||
* description: Authentication required
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*
|
||||
* /api/games/join:
|
||||
* post:
|
||||
* summary: Join a game (automatically detects game type)
|
||||
* description: Join any game by providing the game code. The system automatically determines if authentication is required based on the game type.
|
||||
* tags: [Games]
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - gameCode
|
||||
* properties:
|
||||
* gameCode:
|
||||
* type: string
|
||||
* description: 6-character game code
|
||||
* example: "ABC123"
|
||||
* playerName:
|
||||
* type: string
|
||||
* description: Display name for the player (required for public games, optional for authenticated games)
|
||||
* example: "John Doe"
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Successfully joined the game
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Game'
|
||||
* 400:
|
||||
* description: Invalid input or missing required fields
|
||||
* 401:
|
||||
* description: Authentication required for this game type
|
||||
* 403:
|
||||
* description: Organization membership required
|
||||
* 404:
|
||||
* description: Game not found
|
||||
* 409:
|
||||
* description: Game is full or not accepting players
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*
|
||||
* /api/games/{gameId}/start:
|
||||
* post:
|
||||
* summary: Start gameplay for an existing game
|
||||
* description: Initialize gameplay by setting all player positions to 0 and assigning random turn order. This is separate from game creation.
|
||||
* tags: [Games]
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: gameId
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* description: The ID of the game to start
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Game started successfully
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* message:
|
||||
* type: string
|
||||
* example: "Game started successfully"
|
||||
* gameId:
|
||||
* type: string
|
||||
* example: "game123"
|
||||
* playerCount:
|
||||
* type: number
|
||||
* example: 4
|
||||
* 400:
|
||||
* description: Invalid input or game cannot be started
|
||||
* 401:
|
||||
* description: Authentication required
|
||||
* 403:
|
||||
* description: Only game master can start the game
|
||||
* 404:
|
||||
* description: Game not found
|
||||
* 409:
|
||||
* description: Game already started or not ready to start
|
||||
* 500:
|
||||
* description: Internal server error
|
||||
*/
|
||||
|
||||
export {};
|
||||
|
||||
Reference in New Issue
Block a user