2788 lines
67 KiB
TypeScript
2788 lines
67 KiB
TypeScript
/**
|
|
* @swagger
|
|
* components:
|
|
* schemas:
|
|
* User:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* username:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* fname:
|
|
* type: string
|
|
* lname:
|
|
* type: string
|
|
* phone:
|
|
* type: string
|
|
* nullable: true
|
|
* type:
|
|
* type: string
|
|
* state:
|
|
* type: integer
|
|
* regdate:
|
|
* type: string
|
|
* format: date-time
|
|
* updatedate:
|
|
* type: string
|
|
* format: date-time
|
|
* orgid:
|
|
* type: string
|
|
* nullable: true
|
|
*
|
|
* CreateUserRequest:
|
|
* type: object
|
|
* required:
|
|
* - username
|
|
* - email
|
|
* - password
|
|
* - fname
|
|
* - lname
|
|
* - type
|
|
* properties:
|
|
* username:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* password:
|
|
* type: string
|
|
* format: password
|
|
* fname:
|
|
* type: string
|
|
* lname:
|
|
* type: string
|
|
* phone:
|
|
* type: string
|
|
* type:
|
|
* type: string
|
|
*
|
|
* LoginRequest:
|
|
* type: object
|
|
* required:
|
|
* - username
|
|
* - password
|
|
* properties:
|
|
* username:
|
|
* type: string
|
|
* password:
|
|
* type: string
|
|
* format: password
|
|
*
|
|
* LoginResponse:
|
|
* type: object
|
|
* properties:
|
|
* token:
|
|
* type: string
|
|
* user:
|
|
* $ref: '#/components/schemas/User'
|
|
* requiresOrgReauth:
|
|
* type: boolean
|
|
* orgLoginUrl:
|
|
* type: string
|
|
* organizationName:
|
|
* type: string
|
|
*
|
|
* UpdateProfileRequest:
|
|
* type: object
|
|
* properties:
|
|
* fname:
|
|
* type: string
|
|
* lname:
|
|
* type: string
|
|
* phone:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
*
|
|
* ForgotPasswordRequest:
|
|
* type: object
|
|
* required:
|
|
* - email
|
|
* properties:
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
*
|
|
* ResetPasswordRequest:
|
|
* type: object
|
|
* required:
|
|
* - token
|
|
* - newPassword
|
|
* properties:
|
|
* token:
|
|
* type: string
|
|
* newPassword:
|
|
* type: string
|
|
* format: password
|
|
* minLength: 6
|
|
* maxLength: 100
|
|
*
|
|
* AuthSuccessResponse:
|
|
* type: object
|
|
* properties:
|
|
* success:
|
|
* type: boolean
|
|
* message:
|
|
* type: string
|
|
*
|
|
* Organization:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* contactfname:
|
|
* type: string
|
|
* contactlname:
|
|
* type: string
|
|
* contactphone:
|
|
* type: string
|
|
* contactemail:
|
|
* type: string
|
|
* format: email
|
|
* state:
|
|
* type: integer
|
|
* regdate:
|
|
* type: string
|
|
* format: date-time
|
|
* updatedate:
|
|
* type: string
|
|
* format: date-time
|
|
* url:
|
|
* type: string
|
|
* nullable: true
|
|
* userinorg:
|
|
* type: integer
|
|
* maxOrganizationalDecks:
|
|
* type: integer
|
|
*
|
|
* Deck:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* type:
|
|
* type: integer
|
|
* enum: [0, 1, 2, 3]
|
|
* description: 0=JOKER, 1=LUCK, 2=QUESTION, 3=GENERAL
|
|
* userid:
|
|
* type: string
|
|
* format: uuid
|
|
* creationdate:
|
|
* type: string
|
|
* format: date-time
|
|
* cards:
|
|
* type: array
|
|
* items:
|
|
* type: object
|
|
* playedNumber:
|
|
* type: integer
|
|
* ctype:
|
|
* type: integer
|
|
* enum: [0, 1, 2]
|
|
* description: 0=PUBLIC, 1=ORGANIZATIONAL, 2=PRIVATE
|
|
* updatedate:
|
|
* type: string
|
|
* format: date-time
|
|
* state:
|
|
* type: integer
|
|
* enum: [0, 1, 2]
|
|
* description: 0=ACTIVE, 1=INACTIVE, 2=SOFT_DELETE
|
|
* organization:
|
|
* $ref: '#/components/schemas/Organization'
|
|
* nullable: true
|
|
*
|
|
* CreateDeckRequest:
|
|
* type: object
|
|
* required:
|
|
* - name
|
|
* - type
|
|
* - cards
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* type:
|
|
* type: integer
|
|
* cards:
|
|
* type: array
|
|
* items:
|
|
* type: object
|
|
* ctype:
|
|
* type: integer
|
|
*
|
|
* Chat:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* type:
|
|
* type: integer
|
|
* participants:
|
|
* type: array
|
|
* items:
|
|
* type: string
|
|
* creatorId:
|
|
* type: string
|
|
* gameId:
|
|
* type: string
|
|
* nullable: true
|
|
* createDate:
|
|
* type: string
|
|
* format: date-time
|
|
* updateDate:
|
|
* type: string
|
|
* format: date-time
|
|
* state:
|
|
* type: integer
|
|
*
|
|
* ChatMessage:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* senderId:
|
|
* type: string
|
|
* senderName:
|
|
* type: string
|
|
* message:
|
|
* type: string
|
|
* timestamp:
|
|
* type: string
|
|
* format: date-time
|
|
* chatId:
|
|
* type: string
|
|
*
|
|
* Contact:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* userid:
|
|
* type: string
|
|
* format: uuid
|
|
* nullable: true
|
|
* type:
|
|
* type: integer
|
|
* enum: [0, 1, 2]
|
|
* description: 0=QUESTION, 1=BUG_REPORT, 2=SUGGESTION
|
|
* txt:
|
|
* type: string
|
|
* state:
|
|
* type: integer
|
|
* createDate:
|
|
* type: string
|
|
* format: date-time
|
|
* updateDate:
|
|
* type: string
|
|
* format: date-time
|
|
* adminResponse:
|
|
* type: string
|
|
* nullable: true
|
|
* responseDate:
|
|
* type: string
|
|
* format: date-time
|
|
* nullable: true
|
|
* respondedBy:
|
|
* type: string
|
|
* nullable: true
|
|
*
|
|
* CreateContactRequest:
|
|
* type: object
|
|
* required:
|
|
* - name
|
|
* - email
|
|
* - type
|
|
* - txt
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* type:
|
|
* type: integer
|
|
* txt:
|
|
* 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:
|
|
* error:
|
|
* type: string
|
|
* timestamp:
|
|
* type: string
|
|
* format: date-time
|
|
* details:
|
|
* type: string
|
|
*/
|
|
|
|
/**
|
|
* @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/LoginResponse'
|
|
* 401:
|
|
* description: Invalid credentials
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/users/create:
|
|
* post:
|
|
* tags: [Users]
|
|
* summary: Create new user
|
|
* description: Register a new user account
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/CreateUserRequest'
|
|
* responses:
|
|
* 201:
|
|
* description: User created successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/User'
|
|
* 400:
|
|
* description: Validation error
|
|
* 409:
|
|
* description: User already exists
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/users/profile:
|
|
* get:
|
|
* tags: [Users]
|
|
* summary: Get user profile
|
|
* description: Get current user's profile information
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: User profile data
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/User'
|
|
* 401:
|
|
* description: Unauthorized
|
|
* patch:
|
|
* tags: [Users]
|
|
* summary: Update user profile
|
|
* description: Update current user's profile information
|
|
* security:
|
|
* - bearerAuth: []
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/UpdateProfileRequest'
|
|
* responses:
|
|
* 200:
|
|
* description: Profile updated successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/User'
|
|
* 400:
|
|
* description: Validation error
|
|
* 401:
|
|
* description: Unauthorized
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/users/verify-email/{token}:
|
|
* get:
|
|
* tags: [Users]
|
|
* summary: Verify email address
|
|
* description: Verify user's email address using verification token
|
|
* parameters:
|
|
* - name: token
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* description: Email verification token
|
|
* responses:
|
|
* 200:
|
|
* description: Email verified successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/AuthSuccessResponse'
|
|
* 400:
|
|
* description: Invalid or expired verification token
|
|
* 500:
|
|
* description: Internal server error
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/users/forgot-password:
|
|
* post:
|
|
* tags: [Users]
|
|
* summary: Request password reset
|
|
* description: Send password reset email to user
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/ForgotPasswordRequest'
|
|
* responses:
|
|
* 200:
|
|
* description: Password reset email sent (if email exists)
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/AuthSuccessResponse'
|
|
* 400:
|
|
* description: Validation error
|
|
* 500:
|
|
* description: Internal server error
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/users/reset-password:
|
|
* post:
|
|
* tags: [Users]
|
|
* summary: Reset password
|
|
* description: Reset user password using reset token
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/ResetPasswordRequest'
|
|
* responses:
|
|
* 200:
|
|
* description: Password reset successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/AuthSuccessResponse'
|
|
* 400:
|
|
* description: Invalid token or password validation failed
|
|
* 500:
|
|
* description: Internal server error
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/organizations/search:
|
|
* get:
|
|
* tags: [Organizations]
|
|
* summary: Search organizations
|
|
* description: Search organizations by query
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: query
|
|
* in: query
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* - name: from
|
|
* in: query
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* - name: to
|
|
* in: query
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* responses:
|
|
* 200:
|
|
* description: Search results
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* results:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Organization'
|
|
* totalCount:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/organizations/{orgId}/login-url:
|
|
* get:
|
|
* tags: [Organizations]
|
|
* summary: Get organization login URL
|
|
* description: Get OAuth login URL for organization
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: orgId
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Login URL
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* loginUrl:
|
|
* type: string
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/organizations/auth-callback:
|
|
* post:
|
|
* tags: [Organizations]
|
|
* summary: OAuth callback
|
|
* description: Handle OAuth callback from organization
|
|
* security:
|
|
* - bearerAuth: []
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* code:
|
|
* type: string
|
|
* state:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Authentication successful
|
|
* 400:
|
|
* description: Invalid callback data
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/decks/page/{from}/{to}:
|
|
* get:
|
|
* tags: [Decks]
|
|
* summary: Get decks by page
|
|
* description: Retrieve paginated list of decks
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: from
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* - name: to
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* responses:
|
|
* 200:
|
|
* description: Paginated decks
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* decks:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* totalCount:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/decks/search:
|
|
* get:
|
|
* tags: [Decks]
|
|
* summary: Search decks
|
|
* description: Search decks by query
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: query
|
|
* in: query
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* - name: from
|
|
* in: query
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* - name: to
|
|
* in: query
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* responses:
|
|
* 200:
|
|
* description: Search results
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* results:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* totalCount:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/decks/{id}:
|
|
* get:
|
|
* tags: [Decks]
|
|
* summary: Get deck by ID
|
|
* description: Retrieve a specific deck by ID
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Deck details
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* 404:
|
|
* description: Deck not found
|
|
* put:
|
|
* tags: [Decks]
|
|
* summary: Update deck
|
|
* description: Update an existing deck
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/CreateDeckRequest'
|
|
* responses:
|
|
* 200:
|
|
* description: Deck updated successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* delete:
|
|
* tags: [Decks]
|
|
* summary: Delete deck
|
|
* description: Delete a deck (soft delete)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 204:
|
|
* description: Deck deleted successfully
|
|
* 404:
|
|
* description: Deck not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/chats/user-chats:
|
|
* get:
|
|
* tags: [Chats]
|
|
* summary: Get user chats
|
|
* description: Get all chats for the current user
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: User chats
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Chat'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/chats/history/{chatId}:
|
|
* get:
|
|
* tags: [Chats]
|
|
* summary: Get chat history
|
|
* description: Get message history for a chat
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: chatId
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* responses:
|
|
* 200:
|
|
* description: Chat history
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/ChatMessage'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/chats/message:
|
|
* post:
|
|
* tags: [Chats]
|
|
* summary: Send message
|
|
* description: Send a message to a chat
|
|
* security:
|
|
* - bearerAuth: []
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required:
|
|
* - chatId
|
|
* - message
|
|
* properties:
|
|
* chatId:
|
|
* type: string
|
|
* message:
|
|
* type: string
|
|
* responses:
|
|
* 201:
|
|
* description: Message sent successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/ChatMessage'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/chats/archive/{chatId}:
|
|
* post:
|
|
* tags: [Chats]
|
|
* summary: Archive chat
|
|
* description: Archive a chat room
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: chatId
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Chat archived successfully
|
|
* 404:
|
|
* description: Chat not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/chats/restore/{chatId}:
|
|
* post:
|
|
* tags: [Chats]
|
|
* summary: Restore chat
|
|
* description: Restore an archived chat room
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: chatId
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Chat restored successfully
|
|
* 404:
|
|
* description: Chat not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/contact/create:
|
|
* post:
|
|
* tags: [Contact]
|
|
* summary: Create contact message
|
|
* description: Send a contact message to the system
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required:
|
|
* - name
|
|
* - email
|
|
* - message
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* subject:
|
|
* type: string
|
|
* nullable: true
|
|
* message:
|
|
* type: string
|
|
* responses:
|
|
* 201:
|
|
* description: Contact message sent successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Contact'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/users:
|
|
* get:
|
|
* tags: [Admin - Users]
|
|
* summary: Get all users (Admin)
|
|
* description: Retrieve all users in the system with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 1
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 10
|
|
* - name: search
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Users retrieved successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* users:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/User'
|
|
* total:
|
|
* type: integer
|
|
* page:
|
|
* type: integer
|
|
* limit:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/users/{id}:
|
|
* get:
|
|
* tags: [Admin - Users]
|
|
* summary: Get user by ID (Admin)
|
|
* description: Get detailed information about a specific user
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: User found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/User'
|
|
* 404:
|
|
* description: User not found
|
|
* put:
|
|
* tags: [Admin - Users]
|
|
* summary: Update user (Admin)
|
|
* description: Update user information by admin
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* username:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* firstName:
|
|
* type: string
|
|
* lastName:
|
|
* type: string
|
|
* isActive:
|
|
* type: boolean
|
|
* role:
|
|
* type: string
|
|
* enum: [user, admin, moderator]
|
|
* responses:
|
|
* 200:
|
|
* description: User updated successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/User'
|
|
* delete:
|
|
* tags: [Admin - Users]
|
|
* summary: Delete user (Admin)
|
|
* description: Delete a user from the system
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: User deleted successfully
|
|
* 404:
|
|
* description: User not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/users/{id}/ban:
|
|
* post:
|
|
* tags: [Admin - Users]
|
|
* summary: Ban user (Admin)
|
|
* description: Ban a user from the system
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* reason:
|
|
* type: string
|
|
* duration:
|
|
* type: string
|
|
* description: Ban duration in ISO format or 'permanent'
|
|
* responses:
|
|
* 200:
|
|
* description: User banned successfully
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/users/{id}/unban:
|
|
* post:
|
|
* tags: [Admin - Users]
|
|
* summary: Unban user (Admin)
|
|
* description: Remove ban from a user
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: User unbanned successfully
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/decks:
|
|
* get:
|
|
* tags: [Admin - Decks]
|
|
* summary: Get all decks (Admin)
|
|
* description: Retrieve all decks in the system with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 1
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 10
|
|
* - name: search
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* - name: status
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* enum: [public, private, reported]
|
|
* responses:
|
|
* 200:
|
|
* description: Decks retrieved successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* decks:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* total:
|
|
* type: integer
|
|
* page:
|
|
* type: integer
|
|
* limit:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/decks/{id}:
|
|
* get:
|
|
* tags: [Admin - Decks]
|
|
* summary: Get deck by ID (Admin)
|
|
* description: Get detailed information about a specific deck
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Deck found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* 404:
|
|
* description: Deck not found
|
|
* put:
|
|
* tags: [Admin - Decks]
|
|
* summary: Update deck (Admin)
|
|
* description: Update deck information by admin
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* description:
|
|
* type: string
|
|
* isPublic:
|
|
* type: boolean
|
|
* isActive:
|
|
* type: boolean
|
|
* responses:
|
|
* 200:
|
|
* description: Deck updated successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* delete:
|
|
* tags: [Admin - Decks]
|
|
* summary: Delete deck (Admin)
|
|
* description: Delete a deck from the system
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Deck deleted successfully
|
|
* 404:
|
|
* description: Deck not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/decks/{id}/moderate:
|
|
* post:
|
|
* tags: [Admin - Decks]
|
|
* summary: Moderate deck (Admin)
|
|
* description: Approve or reject a deck for public visibility
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required:
|
|
* - action
|
|
* properties:
|
|
* action:
|
|
* type: string
|
|
* enum: [approve, reject, flag]
|
|
* reason:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Deck moderated successfully
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/organizations:
|
|
* get:
|
|
* tags: [Admin - Organizations]
|
|
* summary: Get all organizations (Admin)
|
|
* description: Retrieve all organizations in the system with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 1
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 10
|
|
* - name: search
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Organizations retrieved successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* organizations:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Organization'
|
|
* total:
|
|
* type: integer
|
|
* page:
|
|
* type: integer
|
|
* limit:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/organizations/{id}:
|
|
* get:
|
|
* tags: [Admin - Organizations]
|
|
* summary: Get organization by ID (Admin)
|
|
* description: Get detailed information about a specific organization
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Organization found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Organization'
|
|
* 404:
|
|
* description: Organization not found
|
|
* put:
|
|
* tags: [Admin - Organizations]
|
|
* summary: Update organization (Admin)
|
|
* description: Update organization information by admin
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* description:
|
|
* type: string
|
|
* isActive:
|
|
* type: boolean
|
|
* responses:
|
|
* 200:
|
|
* description: Organization updated successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Organization'
|
|
* delete:
|
|
* tags: [Admin - Organizations]
|
|
* summary: Delete organization (Admin)
|
|
* description: Delete an organization from the system
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Organization deleted successfully
|
|
* 404:
|
|
* description: Organization not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/organizations/{id}/members:
|
|
* get:
|
|
* tags: [Admin - Organizations]
|
|
* summary: Get organization members (Admin)
|
|
* description: Get all members of an organization
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Organization members
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/User'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/chats:
|
|
* get:
|
|
* tags: [Admin - Chats]
|
|
* summary: Get all chats (Admin)
|
|
* description: Retrieve all chats in the system with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 1
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 10
|
|
* - name: search
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* - name: status
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* enum: [active, archived, reported]
|
|
* responses:
|
|
* 200:
|
|
* description: Chats retrieved successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* chats:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Chat'
|
|
* total:
|
|
* type: integer
|
|
* page:
|
|
* type: integer
|
|
* limit:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/chats/{id}:
|
|
* get:
|
|
* tags: [Admin - Chats]
|
|
* summary: Get chat by ID (Admin)
|
|
* description: Get detailed information about a specific chat
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Chat found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Chat'
|
|
* 404:
|
|
* description: Chat not found
|
|
* delete:
|
|
* tags: [Admin - Chats]
|
|
* summary: Delete chat (Admin)
|
|
* description: Delete a chat from the system
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Chat deleted successfully
|
|
* 404:
|
|
* description: Chat not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/chats/{id}/messages:
|
|
* get:
|
|
* tags: [Admin - Chats]
|
|
* summary: Get chat messages (Admin)
|
|
* description: Get all messages in a chat
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* responses:
|
|
* 200:
|
|
* description: Chat messages
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/ChatMessage'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/chats/{id}/moderate:
|
|
* post:
|
|
* tags: [Admin - Chats]
|
|
* summary: Moderate chat (Admin)
|
|
* description: Moderate a chat room (archive, restore, flag)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required:
|
|
* - action
|
|
* properties:
|
|
* action:
|
|
* type: string
|
|
* enum: [archive, restore, flag, unflag]
|
|
* reason:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Chat moderated successfully
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/contacts:
|
|
* get:
|
|
* tags: [Admin - Contacts]
|
|
* summary: Get all contact messages (Admin)
|
|
* description: Retrieve all contact messages with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 1
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 10
|
|
* - name: status
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* enum: [unread, read, resolved]
|
|
* - name: search
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Contact messages retrieved successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* contacts:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Contact'
|
|
* total:
|
|
* type: integer
|
|
* page:
|
|
* type: integer
|
|
* limit:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/contacts/{id}:
|
|
* get:
|
|
* tags: [Admin - Contacts]
|
|
* summary: Get contact message by ID (Admin)
|
|
* description: Get detailed information about a specific contact message
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Contact message found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Contact'
|
|
* 404:
|
|
* description: Contact message not found
|
|
* put:
|
|
* tags: [Admin - Contacts]
|
|
* summary: Update contact message status (Admin)
|
|
* description: Update the status of a contact message
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* status:
|
|
* type: string
|
|
* enum: [unread, read, resolved]
|
|
* adminNotes:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Contact message updated successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Contact'
|
|
* delete:
|
|
* tags: [Admin - Contacts]
|
|
* summary: Delete contact message (Admin)
|
|
* description: Delete a contact message from the system
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Contact message deleted successfully
|
|
* 404:
|
|
* description: Contact message not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/contacts/{id}/reply:
|
|
* post:
|
|
* tags: [Admin - Contacts]
|
|
* summary: Reply to contact message (Admin)
|
|
* description: Send a reply to a contact message
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required:
|
|
* - reply
|
|
* properties:
|
|
* reply:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Reply sent successfully
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/games:
|
|
* get:
|
|
* tags: [Admin - Games]
|
|
* summary: Get all games (Admin)
|
|
* description: Retrieve all games in the system with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: page
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 1
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 10
|
|
* - name: status
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* enum: [active, completed, abandoned]
|
|
* responses:
|
|
* 200:
|
|
* description: Games retrieved successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* games:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Game'
|
|
* total:
|
|
* type: integer
|
|
* page:
|
|
* type: integer
|
|
* limit:
|
|
* type: integer
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/games/{id}:
|
|
* get:
|
|
* tags: [Admin - Games]
|
|
* summary: Get game by ID (Admin)
|
|
* description: Get detailed information about a specific game
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Game found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Game'
|
|
* 404:
|
|
* description: Game not found
|
|
* delete:
|
|
* tags: [Admin - Games]
|
|
* summary: Delete game (Admin)
|
|
* description: Delete a game from the system
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Game deleted successfully
|
|
* 404:
|
|
* description: Game not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/system/stats:
|
|
* get:
|
|
* tags: [Admin - System]
|
|
* summary: Get system statistics (Admin)
|
|
* description: Get comprehensive system statistics
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: System statistics
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* uptime:
|
|
* type: string
|
|
* version:
|
|
* type: string
|
|
* memoryUsage:
|
|
* type: object
|
|
* activeConnections:
|
|
* type: integer
|
|
* databaseHealth:
|
|
* type: string
|
|
* redisHealth:
|
|
* type: string
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/system/logs:
|
|
* get:
|
|
* tags: [Admin - System]
|
|
* summary: Get system logs (Admin)
|
|
* description: Retrieve system logs with filtering
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: level
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* enum: [error, warn, info, debug]
|
|
* - name: limit
|
|
* in: query
|
|
* schema:
|
|
* type: integer
|
|
* default: 100
|
|
* - name: since
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* format: date-time
|
|
* responses:
|
|
* 200:
|
|
* description: System logs
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* type: object
|
|
* properties:
|
|
* timestamp:
|
|
* type: string
|
|
* level:
|
|
* type: string
|
|
* message:
|
|
* type: string
|
|
* metadata:
|
|
* type: object
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/health:
|
|
* get:
|
|
* tags: [System]
|
|
* summary: Health check
|
|
* description: Check the health status of the API
|
|
* responses:
|
|
* 200:
|
|
* description: Service is healthy
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* status:
|
|
* type: string
|
|
* example: "OK"
|
|
* timestamp:
|
|
* type: string
|
|
* format: date-time
|
|
* version:
|
|
* type: string
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* components:
|
|
* securitySchemes:
|
|
* bearerAuth:
|
|
* type: http
|
|
* scheme: bearer
|
|
* schemas:
|
|
* User:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* username:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* fname:
|
|
* type: string
|
|
* lname:
|
|
* type: string
|
|
* phone:
|
|
* type: string
|
|
* nullable: true
|
|
* type:
|
|
* type: string
|
|
* state:
|
|
* type: integer
|
|
* regdate:
|
|
* type: string
|
|
* format: date-time
|
|
* updatedate:
|
|
* type: string
|
|
* format: date-time
|
|
* orgid:
|
|
* type: string
|
|
* nullable: true
|
|
* Deck:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* type:
|
|
* type: integer
|
|
* userid:
|
|
* type: string
|
|
* format: uuid
|
|
* creationdate:
|
|
* type: string
|
|
* format: date-time
|
|
* cards:
|
|
* type: array
|
|
* items:
|
|
* type: object
|
|
* Organization:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* description:
|
|
* type: string
|
|
* members:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/User'
|
|
* Contact:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* type:
|
|
* type: integer
|
|
* txt:
|
|
* type: string
|
|
* userid:
|
|
* type: string
|
|
* nullable: true
|
|
* createdate:
|
|
* type: string
|
|
* format: date-time
|
|
* Chat:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* name:
|
|
* type: string
|
|
* gameId:
|
|
* type: string
|
|
* format: uuid
|
|
* messages:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/ChatMessage'
|
|
* ChatMessage:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* chatId:
|
|
* type: string
|
|
* format: uuid
|
|
* senderId:
|
|
* type: string
|
|
* format: uuid
|
|
* message:
|
|
* type: string
|
|
* timestamp:
|
|
* type: string
|
|
* format: date-time
|
|
* Game:
|
|
* type: object
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* format: uuid
|
|
* deckids:
|
|
* type: array
|
|
* items:
|
|
* type: string
|
|
* maxplayers:
|
|
* type: integer
|
|
* logintype:
|
|
* type: string
|
|
* state:
|
|
* type: string
|
|
* createdate:
|
|
* type: string
|
|
* format: date-time
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* tags:
|
|
* - name: Users
|
|
* - name: Decks
|
|
* - name: Organizations
|
|
* - name: Contact
|
|
* - name: Chats
|
|
* - name: Games
|
|
* - name: Admin - Users
|
|
* - name: Admin - Decks
|
|
* - name: Admin - Organizations
|
|
* - name: Admin - Contacts
|
|
* - name: Admin - Chats
|
|
* - name: Admin - Games
|
|
* - name: System
|
|
*/
|
|
|
|
// User endpoints
|
|
/**
|
|
* @swagger
|
|
* /api/users/login:
|
|
* post:
|
|
* tags: [Users]
|
|
* summary: User login
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required: [username, password]
|
|
* properties:
|
|
* username:
|
|
* type: string
|
|
* password:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Login successful
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* token:
|
|
* type: string
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/users/create:
|
|
* post:
|
|
* tags: [Users]
|
|
* summary: Create user
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required: [username, email, password]
|
|
* properties:
|
|
* username:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* password:
|
|
* type: string
|
|
* responses:
|
|
* 201:
|
|
* description: User created
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/User'
|
|
*/
|
|
|
|
// ...existing code...
|
|
/**
|
|
* @swagger
|
|
* /api/decks/page/{from}/{to}:
|
|
* get:
|
|
* tags: [Decks]
|
|
* summary: Get decks with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: from
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* - name: to
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* responses:
|
|
* 200:
|
|
* description: Paginated decks
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Deck'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/decks/search:
|
|
* get:
|
|
* tags: [Decks]
|
|
* summary: Search decks
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: q
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Search results
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Deck'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/decks/{id}:
|
|
* get:
|
|
* tags: [Decks]
|
|
* summary: Get deck by ID
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: id
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Deck found
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Deck'
|
|
* 404:
|
|
* description: Deck not found
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/organizations/page/{from}/{to}:
|
|
* get:
|
|
* tags: [Organizations]
|
|
* summary: Get organizations with pagination
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: from
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* - name: to
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: integer
|
|
* responses:
|
|
* 200:
|
|
* description: Paginated organizations
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Organization'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/organizations/search:
|
|
* get:
|
|
* tags: [Organizations]
|
|
* summary: Search organizations
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: q
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Search results
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Organization'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/contact/create:
|
|
* post:
|
|
* tags: [Contact]
|
|
* summary: Create contact message
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required: [name, email, txt]
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* txt:
|
|
* type: string
|
|
* responses:
|
|
* 201:
|
|
* description: Contact created
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Contact'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/chats/create:
|
|
* post:
|
|
* tags: [Chats]
|
|
* summary: Create chat
|
|
* security:
|
|
* - bearerAuth: []
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required: [name, gameId]
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* gameId:
|
|
* type: string
|
|
* responses:
|
|
* 201:
|
|
* description: Chat created
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Chat'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/chats/history/{chatId}:
|
|
* get:
|
|
* tags: [Chats]
|
|
* summary: Get chat history
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: chatId
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Chat history
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/ChatMessage'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/games/start:
|
|
* post:
|
|
* tags: [Games]
|
|
* summary: Start a new game
|
|
* security:
|
|
* - bearerAuth: []
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required: [deckids, maxplayers, logintype]
|
|
* properties:
|
|
* deckids:
|
|
* type: array
|
|
* items:
|
|
* type: string
|
|
* maxplayers:
|
|
* type: integer
|
|
* logintype:
|
|
* type: string
|
|
* responses:
|
|
* 201:
|
|
* description: Game started
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Game'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/games/join:
|
|
* post:
|
|
* tags: [Games]
|
|
* summary: Join a game
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required: [gameId]
|
|
* properties:
|
|
* gameId:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Joined game
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Game'
|
|
*/
|
|
|
|
// Admin endpoints (examples)
|
|
/**
|
|
* @swagger
|
|
* /api/admin/users:
|
|
* get:
|
|
* tags: [Admin - Users]
|
|
* summary: Get all users (Admin)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: Users retrieved
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/User'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/decks:
|
|
* get:
|
|
* tags: [Admin - Decks]
|
|
* summary: Get all decks (Admin)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: Decks retrieved
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Deck'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/organizations:
|
|
* get:
|
|
* tags: [Admin - Organizations]
|
|
* summary: Get all organizations (Admin)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: Organizations retrieved
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Organization'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/contacts:
|
|
* get:
|
|
* tags: [Admin - Contacts]
|
|
* summary: Get all contact messages (Admin)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: Contacts retrieved
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Contact'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/chats:
|
|
* get:
|
|
* tags: [Admin - Chats]
|
|
* summary: Get all chats (Admin)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: Chats retrieved
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Chat'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/admin/games:
|
|
* get:
|
|
* tags: [Admin - Games]
|
|
* summary: Get all games (Admin)
|
|
* security:
|
|
* - bearerAuth: []
|
|
* responses:
|
|
* 200:
|
|
* description: Games retrieved
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: array
|
|
* items:
|
|
* $ref: '#/components/schemas/Game'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/contacts:
|
|
* post:
|
|
* tags: [Contacts]
|
|
* summary: Create contact
|
|
* description: Create a new contact message
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* required:
|
|
* - name
|
|
* - email
|
|
* - type
|
|
* - txt
|
|
* properties:
|
|
* name:
|
|
* type: string
|
|
* email:
|
|
* type: string
|
|
* format: email
|
|
* type:
|
|
* type: integer
|
|
* enum: [0, 1, 2]
|
|
* description: 0=QUESTION, 1=BUG_REPORT, 2=SUGGESTION
|
|
* txt:
|
|
* type: string
|
|
* responses:
|
|
* 201:
|
|
* description: Contact created successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Contact'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/deck-import-export/export/{deckId}:
|
|
* get:
|
|
* tags: [Deck Import/Export]
|
|
* summary: Export deck
|
|
* description: Export a deck as JSON or .spr file
|
|
* security:
|
|
* - bearerAuth: []
|
|
* parameters:
|
|
* - name: deckId
|
|
* in: path
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* - name: format
|
|
* in: query
|
|
* schema:
|
|
* type: string
|
|
* enum: [json, spr]
|
|
* default: json
|
|
* responses:
|
|
* 200:
|
|
* description: Deck exported successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* type: object
|
|
* application/octet-stream:
|
|
* schema:
|
|
* type: string
|
|
* format: binary
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/deck-import-export/import:
|
|
* post:
|
|
* tags: [Deck Import/Export]
|
|
* summary: Import deck
|
|
* description: Import a deck from JSON or .spr file
|
|
* security:
|
|
* - bearerAuth: []
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* multipart/form-data:
|
|
* schema:
|
|
* type: object
|
|
* properties:
|
|
* file:
|
|
* type: string
|
|
* format: binary
|
|
* responses:
|
|
* 201:
|
|
* description: Deck imported successfully
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* $ref: '#/components/schemas/Deck'
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /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:
|
|
* $ref: '#/components/schemas/Game'
|
|
* 400:
|
|
* description: Invalid input parameters
|
|
* 401:
|
|
* description: Authentication required
|
|
* 500:
|
|
* description: Internal server error
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /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
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /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 {}; |