diff --git a/doc/img/ERD.png b/doc/img/ERD.png index f5c86d70..699e18df 100644 Binary files a/doc/img/ERD.png and b/doc/img/ERD.png differ diff --git a/doc/img/architecture/api_modules.drawio b/doc/img/architecture/api_modules.drawio index 44b0832c..3ad8ec9e 100644 --- a/doc/img/architecture/api_modules.drawio +++ b/doc/img/architecture/api_modules.drawio @@ -1,416 +1,401 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - + - + - + - + - - - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + diff --git a/doc/img/architecture/api_modules.svg b/doc/img/architecture/api_modules.svg index 4f7e4593..5e5920d3 100644 --- a/doc/img/architecture/api_modules.svg +++ b/doc/img/architecture/api_modules.svg @@ -1,4 +1,4 @@ -
SoulHome
SoulHome
Stock
Stock
Room
Room
Item
Item
Clan inventory
Clan inventory
Clan
Clan
Clan
Clan
Join
Join
Player
Player
Player
Player
Profile
Profile
Auth
Auth
Authentication
Authentication
CustomCharacter
CustomCharacter
Custom character
Custom character
GameData
GameData
Game data
Game data
Authorization
Authorization
Authorization
Authorization
FleaMarket
FleaMarket
Fleamarket 
Fleamarket 
Basic service
Basic service
BasicService
BasicService
ClanRewarder
ClanRewarder
Rewarder
Rewarder
PlayerRewarder
PlayerRewarder
ItemMover
ItemMover
Item mover
Item mover
Chat
Chat
Chat
Chat
Message
Message
Statistics keeper
Statistics keeper
PlayerStatisticKeeper
PlayerStatisticKeeper
GameEventBroker
GameEventBroker
Game events broker
Game events broker
PlayerEventHandler
PlayerEventHandler
ClanEventHandler
ClanEventHandler
Voting
Voting
Voting
Voting
VotingNotifier
VotingNotifier
PlayerTasks
PlayerTasks
Player tasks
Player tasks
PlayerTaskNotifier
PlayerTaskNotifier
GameData
GameData
Game data
Game data
GameEventBroker
GameEventBroker
Game events broker
Game events broker
PlayerTasks
PlayerTasks
Player tasks
Player tasks
PlayerTaskNotifier
PlayerTaskNotifier
Statistics keeper
Statistics keeper
PlayerStatisticKeeper
PlayerStatisticKeeper
ClanRewarder
ClanRewarder
Rewarder
Rewarder
PlayerRewarder
PlayerRewarder
Clan
Clan
Clan
Clan
Join
Join
Player
Player
Player
Player
Profile
Profile
Player wins a game.
1. Save data about this game
2. Notify the game events broker about it
Player wins a game....
It knows what to do with the information:
1. Player task need to be registered
2. Player game statistics should be updated
It knows what to do with the information:...
1. Updates the task info
2. Notify the player about update

It knows that from a daily task some reward should be given for a Clan
1. Updates the task info...
It knows the reward amount and gives rewards to player and clan as requested
It knows the reward amount and gives rewards...
1. Updates the player statistics info

It knows that from a won game some reward should be given for a Player
1. Updates the player statistics info...
Updates data of the Player in DB
Updates data of the Player in DB
Updates data of the Clan in DB
Updates data of the Clan in DB
Player won a game event flow
Player won a game event flow
RequestHelper
RequestHelper
Request Helper
Request Helper
GameAnalytics
GameAnalytics
Game Analytics
Game Analytics
LeaderBoard
LeaderBoard
Leader Board
Leader Board
Text is not SVG - cannot display
\ No newline at end of file +
SoulHome
Stock
Room
Item
Clan inventory
Clan
Clan
Join
Auth
Authentication
GameData
Game data
Authorization
Authorization
FleaMarket
Fleamarket 
Basic service
BasicService
ClanRewarder
Rewarder
PlayerRewarder
ItemMover
Item mover
Chat
Chat
Message
Statistics keeper
PlayerStatisticKeeper
GameEventBroker
Game events broker
PlayerEventHandler
ClanEventHandler
Voting
Voting
VotingNotifier
DailyTasks
Daily tasks
DailyTaskNotifier
GameData
Game data
GameEventBroker
Game events broker
PlayerTasks
Player tasks
PlayerTaskNotifier
Statistics keeper
PlayerStatisticKeeper
ClanRewarder
Rewarder
PlayerRewarder
Clan
Clan
Join
Player
Player
Profile
Player wins a game.
1. Save data about this game
2. Notify the game events broker about it
It knows what to do with the information:
1. Player task need to be registered
2. Player game statistics should be updated
1. Updates the task info
2. Notify the player about update

It knows that from a daily task some reward should be given for a Clan
It knows the reward amount and gives rewards to player and clan as requested
1. Updates the player statistics info

It knows that from a won game some reward should be given for a Player
Updates data of the Player in DB
Updates data of the Clan in DB
Player won a game event flow
RequestHelper
Request Helper
GameAnalytics
Game Analytics
LeaderBoard
Leader Board
Player
Player
Profile
CustomCharacter
\ No newline at end of file diff --git a/swagger/releases/09-02-2025-release.json b/swagger/releases/09-02-2025-release.json new file mode 100644 index 00000000..0c8ee466 --- /dev/null +++ b/swagger/releases/09-02-2025-release.json @@ -0,0 +1,6117 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Altzone API", + "version": "1.0.0", + "description": "This is a description of API for the Altzone game.\nThis swagger document is describing endpoint in more details and includes the request objects structure, examples, authorization rules and any other additional information.\nNotice, that it does not include common rules and functions, since they are covered on the wikipages in GitHub", + "x-logo": { + "url": "" + } + }, + "servers": [ + { + "url": "https://altzone.fi/api", + "description": "Production. Stable version of API, which might not have all of the new changes" + }, + { + "url": "http://localhost:8080", + "description": "Local" + }, + { + "url": "https://devapi.altzone.fi", + "description": "Development. Current version of API with latest changes" + } + ], + "paths": { + "/clan": { + "get": { + "tags": [ + "Clan" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200" + }, + "examples": { + "1": { + "value": { + "data": { + "Clan": [ + { + "objectType": "ClanDto", + "_id": "67961fbb1b3237ccb9628a44", + "name": "clan1", + "tag": "clan1", + "clanLogo": { + "objectType": "ClanLogoDto", + "logoType": "Heart", + "pieceColors": [ + "#FFFFFF", + "#000000" + ] + }, + "labels": [ + "eläinrakkaat" + ], + "gameCoins": 0, + "points": 0, + "admin_ids": [ + "67961be31b3237ccb9628a37" + ], + "playerCount": 1, + "itemCount": 0, + "stockCount": 0, + "ageRange": "None", + "goal": "None", + "phrase": "Clan 1 is the best", + "language": "None", + "isOpen": true + }, + { + "objectType": "ClanDto", + "_id": "66d70d08941f1d7be5033a3c", + "name": "clan1", + "labels": [ + "eläinrakkaat", + "urheilevat", + "rikkaat" + ], + "gameCoins": 0, + "admin_ids": [ + "66d705c645b40dd7f491e6eb" + ], + "playerCount": 1, + "itemCount": 0, + "stockCount": 0, + "ageRange": "None", + "goal": "None", + "language": "None", + "isOpen": true, + "clanLogo": { + "objectType": "ClanLogoDto", + "logoType": "Heart", + "pieceColors": [ + "#FFFFFF", + "#000000" + ] + } + } + ] + }, + "metaData": { + "dataKey": "Clan", + "modelName": "Clan", + "dataType": "Array", + "dataCount": 2 + }, + "paginationData": { + "currentPage": 1, + "limit": 2, + "offset": 0, + "itemCount": 2, + "pageCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Read all clans", + "description": "Read all created Clans. Remember about the pagination\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | no |\n| Authorization | no |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | ", + "externalDocs": { + "url": "https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests)" + } + }, + "put": { + "requestBody": { + "description": "Clan object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClanUpdate" + }, + "examples": { + "Clan": { + "$ref": "#/components/examples/ClanWithId" + } + } + } + }, + "required": true + }, + "tags": [ + "Clan" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update a clan", + "description": "Update the Clan, which _id is specified in the body. \n\nOnly Clan admins can change the Clan's data, as well as add or remove admins. Notice that while removing Clan admins, its is not allowed to remove all of them, because Clan must have at least one admin.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only for Clan admins | \n\n\nThe **labels** enum values:\n\n| | | | |\n|-------------------------|----------------------------|----------------------|-----------------------|\n| 'eläinrakkaat' | 'maahanmuuttomyönteiset' | 'lgbtq+' | 'raittiit' |\n| 'kohteliaat' | 'kiusaamisenvastaiset' | 'urheilevat' | 'syvälliset' |\n| 'oikeudenmukaiset' | 'kaikkien kaverit' | 'itsenäiset' | 'retkeilijät' |\n| 'suomenruotsalaiset' | 'huumorintajuiset' | 'rikkaat' | 'ikiteinit' |\n| 'juoruilevat' | 'rakastavat' | 'oleilijat' | 'nörtit' |\n| 'musadiggarit' | 'tunteelliset' | 'gamerit' | 'animefanit' |\n| 'sinkut' | 'monikulttuuriset' | 'kauniit' | 'järjestelmälliset' |\n| 'epäjärjestelmälliset' | 'tasa-arvoiset' | 'somepersoonat' | 'kädentaitajat' |\n| 'muusikot' | 'taiteilijat' | 'spämmääjät' | 'kasvissyöjät' |\n| 'tasapainoiset' | | | |\n\n-------------------------------------------------------------------------------------------------------\n\nThe **language** enum values:\n\n| | | | |\n|---------------------|-------------------|---------------------|-----------------------|\n| 'None' | 'English' | 'Finnish' | 'Swedish' |\n| 'Mandarin Chinese' | 'Hindi' | 'Spanish' | 'French' |\n| 'Arabic' | 'Bengali' | 'Russian' | 'Portuguese' |\n| 'Urdu' | 'Indonesian' | 'German' | 'Japanese' |\n| 'Swahili' | 'Marathi' | | |\n\n-------------------------------------------------------------------------------------------------------\n\nThe **goal** enum values:\n\n| | | | |\n|-----------------|------------------|----------------|--------------|\n| 'None' | 'Fiilistely' | 'Grindaus' | 'Intohimoisuus' |\n| 'Keraily' | | | |\n\n-------------------------------------------------------------------------------------------------------\n\nThe **ageRange** enum values:\n\n| | | | |\n|---------------|---------------|---------------|-----------|\n| 'None' | 'Teenagers' | 'Toddlers' | 'Adults' |\n| 'All' | | | |" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClanCreate" + } + } + }, + "required": true + }, + "tags": [ + "Clan" + ], + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/201" + }, + "examples": { + "1": { + "value": { + "data": { + "Clan": { + "objectType": "ClanDto", + "_id": "67961fbb1b3237ccb9628a44", + "name": "clan1", + "tag": "clan1", + "clanLogo": { + "objectType": "ClanLogoDto", + "logoType": "Heart", + "pieceColors": [ + "#FFFFFF", + "#000000" + ] + }, + "labels": [ + "eläinrakkaat" + ], + "gameCoins": 0, + "points": 0, + "admin_ids": [ + "67961be31b3237ccb9628a37" + ], + "playerCount": 1, + "itemCount": 0, + "stockCount": 0, + "ageRange": "None", + "goal": "None", + "phrase": "Clan 1 is the best", + "language": "None", + "isOpen": true, + "Stock": { + "objectType": "StockDto", + "_id": "67961fbb1b3237ccb9628a47", + "cellCount": 20, + "clan_id": "67961fbb1b3237ccb9628a44" + }, + "SoulHome": { + "objectType": "SoulHomeDto", + "_id": "67961fbb1b3237ccb9628a4f", + "name": "clan1", + "clan_id": "67961fbb1b3237ccb9628a44" + } + } + }, + "metaData": { + "dataKey": "Clan", + "modelName": "Clan", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Created" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Create a clan", + "description": "Create a new Clan. The creator of the Clan becomes its admin. Notice that if Player is creating a new Clan, he/she becomes a member of it, that means that if Player is member of some Clan it can not create a new one, before leaving the old one.\n\nAlso endpoint creates Clan's Stock, as well as Clan's SoulHome and Rooms. For the created Clan a set of default Items will be added to Stock and to one of the SoulHome Rooms.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | Player can be in one Clan only at one time => if Player already is in another Clan, he/she can not create a new one | \n\nThe **labels** enum values:\n\n| | | | |\n|-------------------------|----------------------------|----------------------|-----------------------|\n| 'eläinrakkaat' | 'maahanmuuttomyönteiset' | 'lgbtq+' | 'raittiit' |\n| 'kohteliaat' | 'kiusaamisenvastaiset' | 'urheilevat' | 'syvälliset' |\n| 'oikeudenmukaiset' | 'kaikkien kaverit' | 'itsenäiset' | 'retkeilijät' |\n| 'suomenruotsalaiset' | 'huumorintajuiset' | 'rikkaat' | 'ikiteinit' |\n| 'juoruilevat' | 'rakastavat' | 'oleilijat' | 'nörtit' |\n| 'musadiggarit' | 'tunteelliset' | 'gamerit' | 'animefanit' |\n| 'sinkut' | 'monikulttuuriset' | 'kauniit' | 'järjestelmälliset' |\n| 'epäjärjestelmälliset' | 'tasa-arvoiset' | 'somepersoonat' | 'kädentaitajat' |\n| 'muusikot' | 'taiteilijat' | 'spämmääjät' | 'kasvissyöjät' |\n| 'tasapainoiset' | | | |\n\n-------------------------------------------------------------------------------------------------------\n\nThe **language** enum values:\n\n| | | | |\n|---------------------|-------------------|---------------------|-----------------------|\n| 'None' | 'English' | 'Finnish' | 'Swedish' |\n| 'Mandarin Chinese' | 'Hindi' | 'Spanish' | 'French' |\n| 'Arabic' | 'Bengali' | 'Russian' | 'Portuguese' |\n| 'Urdu' | 'Indonesian' | 'German' | 'Japanese' |\n| 'Swahili' | 'Marathi' | | |\n\n-------------------------------------------------------------------------------------------------------\n\nThe **goal** enum values:\n\n| | | | |\n|-----------------|------------------|----------------|--------------|\n| 'None' | 'Fiilistely' | 'Grindaus' | 'Intohimoisuus' |\n| 'Keraily' | | | |\n\n-------------------------------------------------------------------------------------------------------\n\nThe **ageRange** enum values:\n\n| | | | |\n|---------------|---------------|---------------|-----------|\n| 'None' | 'Teenagers' | 'Toddlers' | 'Adults' |\n| 'All' | | | |" + } + }, + "/profile": { + "summary": "user profile", + "description": "", + "get": { + "tags": [ + "Profile" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Profile": { + "_id": "667ee778b3b5bf0f7a840ec9", + "username": "user1" + } + }, + "metaData": { + "dataKey": "Profile", + "modelName": "Profile", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Read logged-in user Profile data", + "description": "Read logged-in user Profile data\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only own |\n| Search | no | \n| Sort | no |\n| Pagination | no | " + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProfileUpdate" + } + } + }, + "required": true + }, + "tags": [ + "Profile" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update user Profile", + "description": "Update logged-in user Profile data. Notice that only fields needed to be updated should be specified." + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProfileCreate" + } + } + }, + "required": true + }, + "tags": [ + "Profile" + ], + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/201" + }, + "examples": { + "1": { + "value": { + "data": { + "Profile": { + "objectType": "ProfileDto", + "_id": "667ee778b3b5bf0f7a840ec9", + "username": "user6", + "Player": { + "objectType": "PlayerDto", + "_id": "667ee778b3b5bf0f7a840ecb", + "name": "User 6", + "backpackCapacity": 34, + "uniqueIdentifier": "6", + "profile_id": "667ee778b3b5bf0f7a840ec9" + } + } + }, + "metaData": { + "dataKey": "Profile", + "modelName": "Profile", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Created" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "operationId": "profile_create", + "summary": "Create profile", + "description": "Create a user profile with Player object associated with it. Notice, that it is also possible in some edge cases to create a Profile without Player object assosiated with it, however it is not recommended and API expects that for every Profile there is a Player object created. " + }, + "delete": { + "tags": [ + "Profile" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Delete Profile", + "description": "Delete logged-in user's Profile. Notice, that Profile deletion will lead removing all user data, such as Player and CustomCharacters. Since the Player object is assosiated with the Clan, user will be also removed from the Clan. Notice, that if there was nobody in the Clan the Clan with all assosiated objects will be removed. However, in case if the user was admin in this Clan and there are no other admins the user must first set at least one admin for this Clan, overwise the Profile will not be removed and 403 will be returned." + } + }, + "/player": { + "get": { + "tags": [ + "Player", + "release-09-02-2025" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200" + }, + "examples": { + "1": { + "value": { + "data": { + "Player": [ + { + "_id": "672388e8c7f8bb9dd570e83b", + "name": "user1", + "points": 110, + "uniqueIdentifier": "user1", + "above13": true, + "parentalAuth": true, + "profile_id": "672388e8c7f8bb9dd570e839", + "clan_id": "67238943c7f8bb9dd570e850", + "gameStatistics": { + "playedBattles": 0, + "wonBattles": 0, + "messages": [ + { + "date": "2024-10-31T18:05:02.641Z", + "count": 11 + } + ] + }, + "id": "672388e8c7f8bb9dd570e83b" + } + ] + }, + "metaData": { + "dataKey": "Player", + "modelName": "Player", + "dataType": "Array", + "dataCount": 1 + }, + "paginationData": { + "currentPage": 1, + "limit": 1, + "offset": 0, + "itemCount": 1, + "pageCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Read all players", + "description": "Read all created Players. Remember about the pagination\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | ", + "externalDocs": { + "url": "https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests)" + } + }, + "put": { + "requestBody": { + "description": "Player object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlayerUpdate" + }, + "examples": { + "Player": { + "$ref": "#/components/examples/PlayerWithId" + } + } + } + }, + "required": true + }, + "tags": [ + "Player", + "release-09-02-2025" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update a player", + "description": "Update the Player, which _id is specified in the body. Only Player, which belong to the logged-in Profile can be changed.\n\n| Feature / Requirement | Is / Has | \n| -------- | -------- | \n| Authentication | yes | \n| Authorization | only for Player owner | \n" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlayerCreate" + } + } + }, + "required": true + }, + "tags": [ + "Player", + "release-09-02-2025" + ], + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/201" + }, + "examples": { + "1": { + "value": { + "data": { + "Player": { + "objectType": "PlayerDto", + "_id": "6686cb3b71adebdb10f33ffb", + "name": "User 2", + "backpackCapacity": 654, + "uniqueIdentifier": 2, + "profile_id": "6686cb3b71adebdb10f33ff9", + "above13": true, + "parentalAuth": true, + "points": 0 + } + }, + "metaData": { + "dataKey": "Player", + "modelName": "Player", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Created" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/400_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Create a player for logged-in user", + "description": "Create a new Player. This is not recommended way of creating a new Player and it should be used only in edge cases. The recommended way is to create it via /profile POST endpoint.\n\nPlayer is representing an object, which holds data related to game player. This object can be used inside the game for example while joining a Clan. Notice, that the Profile object should not be used inside the game (except for logging-in). \n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | Player can be associated with only one Profile | \n" + } + }, + "/player/{_id}": { + "get": { + "tags": [ + "Player", + "release-09-02-2025" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Player": { + "_id": "672388e8c7f8bb9dd570e83b", + "name": "user1", + "points": 110, + "uniqueIdentifier": "user1", + "above13": true, + "parentalAuth": true, + "profile_id": "672388e8c7f8bb9dd570e839", + "clan_id": "67238943c7f8bb9dd570e850", + "gameStatistics": { + "playedBattles": 0, + "wonBattles": 0, + "messages": [ + { + "date": "2024-10-31T18:05:02.641Z", + "count": 11 + } + ] + }, + "id": "672388e8c7f8bb9dd570e83b" + } + }, + "metaData": { + "dataKey": "Player", + "modelName": "Player", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Get Player by _id", + "description": "Read Player data by its _id field\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | no |\n| Authorization | no |\n| Search | no | \n| Sort | no |\n| Pagination | no | " + }, + "delete": { + "tags": [ + "Player" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Delete Player", + "description": "Delete Player by its _id field. Notice that only Player, which belongs to loggen-in user Profile can be deleted. In case when the Player is the only admin in some Clan and the Clan has some other Players, the Player can not be removed. User should be asked to first determine at least one admin for the Clan.\n\nAlso, it is not recommended to delete the Player since it can itroduce unexpected behaviour for the user with Profile, but without Player. The better way to remove the Player is do it via /profile DELETE.\n\nPlayer removal basically means removing all data, which is related to the Player: CustomCharacters, Clan, except for the Profile data. In the case when the Profile does not has a Player, user can only login to the system, but can not play the game.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only for Player owner |" + }, + "parameters": [ + { + "examples": { + "1": { + "value": "6686cb3b71adebdb10f33ffb" + } + }, + "name": "_id", + "description": "player _id", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/clan/{_id}": { + "get": { + "tags": [ + "Clan" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Clan": { + "_id": "67961fbb1b3237ccb9628a44", + "name": "clan1", + "tag": "clan1", + "clanLogo": { + "logoType": "Heart", + "pieceColors": [ + "#FFFFFF", + "#000000" + ] + }, + "labels": [ + "eläinrakkaat" + ], + "gameCoins": 0, + "points": 0, + "admin_ids": [ + "67961be31b3237ccb9628a37" + ], + "playerCount": 1, + "itemCount": 0, + "stockCount": 0, + "isOpen": true, + "ageRange": "None", + "goal": "None", + "phrase": "Clan 1 is the best", + "language": "None", + "__v": 0, + "id": "67961fbb1b3237ccb9628a44" + } + }, + "metaData": { + "dataKey": "Clan", + "modelName": "Clan", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Get Clan by _id", + "description": "Read Clan data by its _id field\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | no |\n| Authorization | no |\n| Search | no | \n| Sort | no |\n| Pagination | no | " + }, + "delete": { + "tags": [ + "Clan" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Delete Clan", + "description": "Delete Clan its _id field. \n\nNotice that only Clan admins can delete the Clan.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only for Clan admins |" + }, + "parameters": [ + { + "examples": { + "_id": { + "value": "667462842425aea94d0f66cb" + } + }, + "name": "_id", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/clan/join": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClanJoinCreate" + } + } + }, + "required": true + }, + "tags": [ + "Clan" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Player requests join to clan", + "description": "Request to join a Clan. \n\nNotice that if the Clan is open the Player will be joined automatically without admin approval. \n\nNotice that if the Player was in another Clan then he/she will be removed from the old one and if in this Clan was no other Players, it will be removed.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no, but for closed Clans there should be an admin approval first | \n\n" + } + }, + "/clan/leave": { + "post": { + "tags": [ + "Clan" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Player requests leave the Clan", + "description": "Request to leave a Clan. \n\nNotice that Player can leave any Clan without admin approval.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no | \n\n" + } + }, + "/stock": { + "get": { + "tags": [ + "Stock" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200" + }, + "examples": { + "1": { + "value": { + "data": { + "Stock": [ + { + "_id": "66d74887c988e09f4c45870d", + "cellCount": 20, + "clan_id": "66d74887c988e09f4c45870a", + "__v": 0, + "id": "66d74887c988e09f4c45870d" + }, + { + "_id": "66d70d08941f1d7be5033a3f", + "cellCount": 20, + "clan_id": "66d70d08941f1d7be5033a3c", + "__v": 0, + "id": "66d70d08941f1d7be5033a3f" + } + ] + }, + "metaData": { + "dataKey": "Stock", + "modelName": "Stock", + "dataType": "Array", + "dataCount": 2 + }, + "paginationData": { + "currentPage": 1, + "limit": 20, + "offset": 0, + "itemCount": 2, + "pageCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Read all stocks", + "description": "Read all created Stocks of all Clans. Remember about the pagination\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | no |\n| Authorization | no |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | \n\n## Endpoint description\n\n### General description\n\nStock is a public place of a Clan, where Items can be stored. These Items, however, can not be stolen from the Clan by other Clans' members during raid. \n\n### Relations\n\nStock can belong to one Clan and Clan may have only one Stock. Stock may have many Items. Stock may belong to one Stock.\n\n### CRUD operations\n\nSince a Clan can have only one Stock, the Stock is created automatically whenever a Clan is created.\n\nStock data can be read by anybody without authentication, as well all existing Stocks list can be fetched.\n\nStock does not have any data, which can be updated by Clan members. The only field, which can be updated is a cellCount, which hold information about Stock capacity. The starting value of it is 30, but more cells can be bought from store later. The cellCount does not have a limit.\n\nStock is deleted automatically (and Items related to it) when the Clan to which it belongs to is also deleted.", + "externalDocs": { + "url": "https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests)" + } + } + }, + "/stock/{_id}": { + "get": { + "tags": [ + "Stock" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Stock": { + "objectType": "StockDto", + "_id": "66d74887c988e09f4c45870d", + "cellCount": 20, + "clan_id": "66d74887c988e09f4c45870a" + } + }, + "metaData": { + "dataKey": "Stock", + "modelName": "Stock", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Get Stock by _id", + "description": "Read Stock data by its _id field.\n\nNotice that everybody is able to read any Stock data.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | no |\n| Authorization | no |\n\n## Endpoint description\n\n### General description\n\nStock is a public place of a Clan, where Items can be stored. These Items, however, can not be stolen from the Clan by other Clans' members during raid. \n\n### Relations\n\nStock can belong to one Clan and Clan may have only one Stock. Stock may have many Items. Stock may belong to one Stock.\n\n### CRUD operations\n\nSince a Clan can have only one Stock, the Stock is created automatically whenever a Clan is created.\n\nStock data can be read by anybody without authentication, as well all existing Stocks list can be fetched.\n\nStock does not have any data, which can be updated by Clan members. The only field, which can be updated is a cellCount, which hold information about Stock capacity. The starting value of it is 30, but more cells can be bought from store later. The cellCount does not have a limit.\n\nStock is deleted automatically (and Items related to it) when the Clan to which it belongs to is also deleted." + }, + "parameters": [ + { + "examples": { + "1": { + "value": "66894fbd4a7b6c993aed1a18" + } + }, + "name": "_id", + "description": "Stock _id field", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/item/{_id}": { + "get": { + "tags": [ + "Item" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Item": { + "_id": "668a70ce91020196cb10d595", + "name": "Sofa_Taakka", + "recycling": "Mixed_waste", + "qualityLevel": "common", + "unityKey": "Sofa_Taakka", + "weight": 67, + "location": [ + 2, + 4 + ], + "isFurniture": true, + "stock_id": "668953cd4a7b6c993aed1a36", + "price": 23 + } + }, + "metaData": { + "dataKey": "Item", + "modelName": "Item", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Get Item by _id", + "description": "Read Item data by its _id field\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | no |\n| Authorization | no |\n\n-------------\n\nThe name field is an enum:\n\n| | | | |\n|------------------------|-----------------------|--------------------------|-----------------------|\n| 'Sofa_Taakka' | 'Mirror_Taakka' | 'Floorlamp_Taakka' | 'Toilet_Schrodinger' |\n| 'Sink_Schrodinger' | 'Closet_Taakka' | 'SofaTable_Taakka' | 'SideTable_Taakka' |\n| 'Carpet_Schrodinger' | 'Carpet_Rakkaus' | 'Mirror_Schrodinger' | 'Mirror_Rakkaus' |\n| 'ArmChair_Taakka' | 'Sofa_Rakkaus' | 'ArmChair_Rakkaus' | 'Closet_Rakkaus' |\n| 'Chair_Neuro' | 'Dresser_Neuro' | 'Stool_Neuro' | |\n\n-------------\n\nThe recycling field is an enum:\n\n| | | | |\n|-----------------------|-----------------------|------------|-------------------|\n| 'Mixed_waste' | 'Electrical_Equipment'| 'Wood' | 'Glass' |\n| 'Metal' | 'Landfill' | | |\n\n-------------\n\nThe qualityLevel field is an enum:\n\n| | | | |\n|------------|------------|------------|------------|\n| 'common' | 'rare' | 'epic' | |\n\n-------------\n\n## Endpoint description\n\n### General description\n\nItems are objects, which can be placed in SoulHomes' Rooms, Stocks and Shop. Item is an object, which has its value in the game and can be bought from the Shop, stolen from the Stock or placed in safe to SoulHome's Room.\n\nItems can be obtained only from Shop and then stored in Room or a Stock.\n\nItem can be a furniture or some other kind of object. The difference between furniture and not furniture is that a furniture can be placed only on a floor. Not furniture can be placed anywhere including on top of a furniture, walls, celling and floor. This data is used in game logic only and does not affect the API in any way.\n\n### Relations\n\nItem can belong to one Room. Room can have multiple Items.\n\nItem can belong to one Stock. Stock can have multiple Items.\n\nItem can belong to Shop. Shop can have multiple Items.\n\n### CRUD operations\n\nItem can not be created by Player. It can only be bought from Shop. API creates new Items automatically.\n\nItem can be read by anyone. One Item can be accessed via its _id field. Multiple Items can be accessed by requesting them within another endpoints via \"with\" or \"all\" queries (/stock/:stock_id?with=Item), since they are mostly required together with Stock, Room or Shop data.\n\nItem can not be directly updated by Players. However, Players may move Items from one place to another. They first can buy an Item from Shop and so update Item's place by moving it to the Clan's Stock. Then they can move it from SoulHome to Stock or vice versa. Item can be bought from Shop via /stock/buy enpoint (not yet implemented). Item can be moved from Room to Stock or from Stock to Room via /item/move POST endpoint.\n\nItem can not be deleted." + }, + "parameters": [ + { + "examples": { + "1": { + "value": "668a70ce91020196cb10d595" + } + }, + "name": "_id", + "description": "item _id field", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/soulhome": { + "description": "", + "get": { + "tags": [ + "SoulHome" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "SoulHome": { + "objectType": "SoulHomeDto", + "_id": "66d74887c988e09f4c458715", + "name": "clan2", + "clan_id": "66d74887c988e09f4c45870a" + } + }, + "metaData": { + "dataKey": "SoulHome", + "modelName": "SoulHome", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get SoulHome", + "description": "## Method description\n\nGet SoulHome data for the logged-in user. \n\nIf the logged-in user is a Clan member, the SoulHome for this Clan will be returned. \n\nIf the logged-in user is not belonging to any Clan the 404 error will be returned.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n\n\n## Endpoint description\n\n### General description\n\nSoulhome is a safe place for storing Clan Items (inside SoulHome's Rooms). However, it is possible to steal Items from the SoulHome rooms, but the access to CRUD operations mostly lies in hands of Clan members.\n\nSoulHome does have only one field \"name\", which is same as a Clan name.\n\n### Relations\n\nSoulHome can belong to one Clan and Clan may have only one SoulHome. SoulHome may have many Rooms. Room may belong to one SoulHome.\n\n### CRUD operations\n\nSoulHome must be created automatically when Clan is created. When SoulHome is created 30 Rooms for that SoulHome with default values must created." + } + }, + "/room": { + "get": { + "tags": [ + "Room" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Room": [ + { + "_id": "66d74887c988e09f4c458721", + "floorType": "default", + "wallType": "default", + "cellCount": 10, + "hasLift": false, + "soulHome_id": "66d74887c988e09f4c458715", + "isActive": false, + "id": "66d74887c988e09f4c458721" + } + ] + }, + "metaData": { + "dataKey": "Room", + "modelName": "Room", + "dataType": "Array", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get all Clan's Rooms", + "description": "## Method description\n\nGet all Rooms for the logged-in user. \n\nIf the logged-in user is a Clan member, the Rooms for this Clan will be returned. \n\nIf the logged-in user is not belonging to any Clan the 404 error will be returned.\n\nIf the pagination is required, it can be used, but by default it will return all 30 rooms at once.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n| Pagination | yes |\n| Sort | yes |\n| Search | yes |\n\n\n## Endpoint description\n\n### General description\n\nRoom is a place, which can safely store Items of a Clan. However, Items from the Room can be stolen. \n\nRoom is closely related to its SoulHome. SoulHome consists of Rooms. \n\nRoom has an automatic behavior. Room has two statuses active and deactivated. When the Room is becoming deactivated its isActive field is taking on the value false. This should be done automatically when the deactivationTimestamp field is expired.\n\n### Relations\n\nRoom can belong to one SoulHome. SoulHome may have many Rooms.\n\nRoom can have many Items. Item may belong to one Room.\n\n### CRUD operations\n\nRooms for a SoulHome must be created automatically, when a SoulHome is created. Therefore there is no enpoint for Room creation.\n\nRoom and all Rooms can be read by Clan members, to which the Room (its SoulHome) is belonging.\n\nRoom can be updated by Clan members, to which it (its SoulHome) belongs.\n\nRoom can be deleted only automatically, when the SoulHome, to which the Room belongs is deleted." + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoomUpdate" + } + } + }, + "required": true + }, + "tags": [ + "Room" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update Room by _id", + "description": "## Method description\n\nUpdate Room by its _id specified in the body.\n\nAny Clan member can update any Room, which (SoulHome) belongs to the Clan.\n\nIf the logged-in user is a Clan member and the Clan does have the requested Room, the Room for this Clan will be returned. \n\nIf the logged-in user is not belonging to any Clan, or Room in that Clan with provided _id is not found the 404 error will be returned.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n\n\n## Endpoint description\n\n### General description\n\nRoom is a place, which can safely store Items of a Clan. Items from the Room can not be stolen. \n\nRoom is closely related to its SoulHome. SoulHome consists of Rooms. \n\nRoom has an automatic behavior. Room has two statuses active and deactivated. When the Room is becoming deactivated its isActive field is taking on the value false. This should be done automatically when the deactivationTimestamp field is expired.\n\n### Relations\n\nRoom can belong to one SoulHome. SoulHome may have many Rooms.\n\nRoom can have many Items. Item may belong to one Room.\n\n### CRUD operations\n\nRooms for a SoulHome must be created automatically, when a SoulHome is created. Therefore there is no enpoint for Room creation.\n\nRoom and all Rooms can be read by Clan members, to which the Room (its SoulHome) is belonging.\n\nRoom can be updated by Clan members, to which it (its SoulHome) belongs.\n\nRoom can be deleted only automatically, when the SoulHome, to which the Room belongs is deleted." + } + }, + "/fleaMarket": { + "get": { + "tags": [ + "FleaMarket" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "ItemShop": { + "type": "array", + "items": { + "type": "object", + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "lastRestock": { + "type": "integer" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item_id": { + "type": "string" + }, + "isInVoting": { + "type": "boolean" + }, + "isSold": { + "type": "boolean" + } + } + } + }, + "__v": { + "type": "integer" + }, + "id": { + "type": "string" + } + } + } + } + } + }, + "metaData": { + "type": "object", + "properties": { + "dataKey": { + "type": "string" + }, + "modelName": { + "type": "string" + }, + "dataType": { + "type": "string" + }, + "dataCount": { + "type": "integer" + } + } + }, + "paginationData": { + "type": "object", + "properties": { + "currentPage": { + "type": "integer" + }, + "limit": { + "type": "integer" + }, + "offset": { + "type": "integer" + }, + "itemCount": { + "type": "integer" + }, + "pageCount": { + "type": "integer" + } + } + } + } + }, + "examples": { + "1": { + "value": { + "data": { + "FleaMarketItem": [ + { + "objectType": "FleaMarketItemDto", + "_id": "67696bbabdeca182c841e46b", + "name": "Closet_Rakkaus", + "weight": 45, + "recycling": "Wood", + "qualityLevel": "common", + "unityKey": "Closet_Rakkaus", + "status": "available", + "isFurniture": true, + "price": 130, + "clan_id": "6746e90e85763982c51af0d5" + }, + { + "objectType": "FleaMarketItemDto", + "_id": "6747092424a8bd9b779aa445", + "name": "Mirror_Rakkaus", + "weight": 10, + "recycling": "Glass", + "qualityLevel": "common", + "unityKey": "Mirror_Rakkaus", + "status": "shipping", + "isFurniture": false, + "price": 170, + "clan_id": "6746e90e85763982c51af0d5" + } + ] + }, + "metaData": { + "dataKey": "FleaMarketItem", + "modelName": "FleaMarketItem", + "dataType": "Array", + "dataCount": 2 + }, + "paginationData": { + "currentPage": 1, + "limit": 20, + "offset": 0, + "itemCount": 2, + "pageCount": 1 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get all flea market items", + "description": "Get all FleaMarketItems of the flea market\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | \n\nThe name field is an enum:\n\n| | | | |\n|------------------------|-----------------------|--------------------------|-----------------------|\n| 'Sofa_Taakka' | 'Mirror_Taakka' | 'Floorlamp_Taakka' | 'Toilet_Schrodinger' |\n| 'Sink_Schrodinger' | 'Closet_Taakka' | 'SofaTable_Taakka' | 'SideTable_Taakka' |\n| 'Carpet_Schrodinger' | 'Carpet_Rakkaus' | 'Mirror_Schrodinger' | 'Mirror_Rakkaus' |\n| 'ArmChair_Taakka' | 'Sofa_Rakkaus' | 'ArmChair_Rakkaus' | 'Closet_Rakkaus' |\n| 'Chair_Neuro' | 'Dresser_Neuro' | 'Stool_Neuro' | |\n\n-------------\n\nThe recycling field is an enum:\n\n| | | | |\n|-----------------------|-----------------------|------------|-------------------|\n| 'Mixed_waste' | 'Electrical_Equipment'| 'Wood' | 'Glass' |\n| 'Metal' | 'Landfill' | | |\n\n-------------\n\nThe qualityLevel field is an enum:\n\n| | | | |\n|------------|------------|------------|------------|\n| 'common' | 'rare' | 'epic' | |\n\n-------------\n\n## Endpoint description\n\n### General description\n\nThe FleaMarket is the place where the Clans can sell their own Items and other Clans can buy these Items. Items can be purchased by any Clan member using this Clan coins.\n\n\n### Logic\n\nThe FleeMarket contains FleeMarketItems. FleeMarketItem object has a status field which determines what can be done with it:\n\n- Available - Item can be purchased\n- Shipping - Item is being shipped = selling Clan members is voting if the Item should be sold or not\n- Booking - Item is booked = buying Clan is voting if the Item should be bought or not. Item can be booked for max. 10 min\n\n\n### Relations\n\nThe FleaMarketItem belongs to a selling Clan. The selling Clan can have many FleaMarketItems. FleaMarketItem can belong to one Clan only.\n\n\n### CRUD operations\n\nFleaMarketItem is added by Clan member by moving the Item from Stock to FleaMarket, which means the Item from Stock is copied to the FleaMarketItem collection and then removed from the Stock.\n\nFleaMarketItems can be read by any logged-in user.\n\nFleaMarketItem data can not be changed at the time and it is read-only.\n\nFleaMarketItem can not be removed from the FleaMarket at the time once it is put there.\n" + } + }, + "/fleaMarket/{_id}": { + "get": { + "tags": [ + "FleaMarket" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "ItemShop": { + "type": "object", + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "lastRestock": { + "type": "integer" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "item_id": { + "type": "string" + }, + "isInVoting": { + "type": "boolean" + }, + "isSold": { + "type": "boolean" + } + } + } + }, + "__v": { + "type": "integer" + }, + "id": { + "type": "string" + } + } + } + } + }, + "metaData": { + "type": "object", + "properties": { + "dataKey": { + "type": "string" + }, + "modelName": { + "type": "string" + }, + "dataType": { + "type": "string" + }, + "dataCount": { + "type": "integer" + } + } + } + } + }, + "examples": { + "1": { + "value": { + "data": { + "FleaMarketItem": { + "objectType": "FleaMarketItemDto", + "_id": "67696bbabdeca182c841e46b", + "name": "Closet_Rakkaus", + "weight": 45, + "recycling": "Wood", + "qualityLevel": "common", + "unityKey": "Closet_Rakkaus", + "status": "available", + "isFurniture": true, + "price": 130, + "clan_id": "6746e90e85763982c51af0d5" + } + }, + "metaData": { + "dataKey": "FleaMarketItem", + "modelName": "FleaMarketItem", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get flea market item data by _id", + "description": "Get an idividual FleaMarketItem by its mongo _id field.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | \n\n-----------\n\nThe name field is an enum:\n\n| | | | |\n|------------------------|-----------------------|--------------------------|-----------------------|\n| 'Sofa_Taakka' | 'Mirror_Taakka' | 'Floorlamp_Taakka' | 'Toilet_Schrodinger' |\n| 'Sink_Schrodinger' | 'Closet_Taakka' | 'SofaTable_Taakka' | 'SideTable_Taakka' |\n| 'Carpet_Schrodinger' | 'Carpet_Rakkaus' | 'Mirror_Schrodinger' | 'Mirror_Rakkaus' |\n| 'ArmChair_Taakka' | 'Sofa_Rakkaus' | 'ArmChair_Rakkaus' | 'Closet_Rakkaus' |\n| 'Chair_Neuro' | 'Dresser_Neuro' | 'Stool_Neuro' | |\n\n-------------\n\nThe recycling field is an enum:\n\n| | | | |\n|-----------------------|-----------------------|------------|-------------------|\n| 'Mixed_waste' | 'Electrical_Equipment'| 'Wood' | 'Glass' |\n| 'Metal' | 'Landfill' | | |\n\n-------------\n\nThe qualityLevel field is an enum:\n\n| | | | |\n|------------|------------|------------|------------|\n| 'common' | 'rare' | 'epic' | |\n\n-------------\n\n## Endpoint description\n\n### General description\n\nThe FleaMarket is the place where the Clans can sell their own Items and other Clans can buy these Items. Items can be purchased by any Clan member using this Clan coins.\n\n\n### Logic\n\nThe FleeMarket contains FleeMarketItems. FleeMarketItem object has a status field which determines what can be done with it:\n\n- Available - Item can be purchased\n- Shipping - Item is being shipped = selling Clan members is voting if the Item should be sold or not\n- Booking - Item is booked = buying Clan is voting if the Item should be bought or not. Item can be booked for max. 10 min\n\n\n### Relations\n\nThe FleaMarketItem belongs to a selling Clan. The selling Clan can have many FleaMarketItems. FleaMarketItem can belong to one Clan only.\n\n\n### CRUD operations\n\nFleaMarketItem is added by Clan member by moving the Item from Stock to FleaMarket, which means the Item from Stock is copied to the FleaMarketItem collection and then removed from the Stock.\n\nFleaMarketItems can be read by any logged-in user.\n\nFleaMarketItem data can not be changed at the time and it is read-only.\n\nFleaMarketItem can not be removed from the FleaMarket at the time once it is put there.\n" + }, + "parameters": [ + { + "examples": { + "1": { + "value": "668a70ce91020196cb10d595" + } + }, + "name": "_id", + "description": "FleaMarketItem _id to get", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/chat": { + "get": { + "tags": [ + "Chat" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200" + }, + "examples": { + "1": { + "value": { + "data": { + "Chat": [ + { + "objectType": "ChatDto", + "_id": "66d8611a184d5f0a7c0675b7", + "name": "chat1" + }, + { + "objectType": "ChatDto", + "_id": "66d85e3f4bed433708d5cb7f", + "name": "Chat 1" + } + ] + }, + "metaData": { + "dataKey": "Chat", + "modelName": "Chat", + "dataType": "Array", + "dataCount": 2 + }, + "paginationData": { + "currentPage": 1, + "limit": 20, + "offset": 0, + "itemCount": 2, + "pageCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Read all existing chats", + "description": "Read all created Chats. Remember about the pagination.\n\nNotice, that use of messages array is not advised and can be removed at some point in the future. For accessing messages of the Chat please use the /chat/:_id/message endpoint.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only for Players above 13 or with parents approval |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | ", + "externalDocs": { + "url": "https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests)" + } + }, + "put": { + "requestBody": { + "description": "Chat object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChatUpdate" + } + } + }, + "required": true + }, + "tags": [ + "Chat" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update a chat", + "description": "Update the Chat, which _id is specified in the body.\n\nNotice that currently anybody is able to change any Chat.\n\n| Feature / Requirement | Is / Has | \n| -------- | -------- | \n| Authentication | yes | \n| Authorization | only for Players above 13 or with parents approval | \n" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChatCreate" + } + } + }, + "required": true + }, + "tags": [ + "Chat" + ], + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/201" + }, + "examples": { + "1": { + "value": { + "data": { + "Chat": { + "objectType": "ChatDto", + "_id": "66d86147184d5f0a7c0675ca", + "name": "chat2" + } + }, + "metaData": { + "dataKey": "Chat", + "modelName": "Chat", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Created" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Create a chat", + "description": "Create a new Chat. The Chat is an object containing messages.\n\nNotice, that currently there is no restrictions on who can create a Chat.\n\nNotice that the Message objects are inner objects of Chat and can not be used enewhere else than in the Chat. There is also no separate collection for the Message in the DB.\n\n| Feature / Requirement | Is / Has | \n| -------- | -------- | \n| Authentication | yes | \n| Authorization | only for Players above 13 or with parents approval | \n" + } + }, + "/chat/{_id}": { + "get": { + "tags": [ + "Chat" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Chat": { + "objectType": "ChatDto", + "_id": "66d8611a184d5f0a7c0675b7", + "name": "chat1" + } + }, + "metaData": { + "dataKey": "Chat", + "modelName": "Chat", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get Chat by _id", + "description": "TEMPORARY DISABLED AND RETURNS 501\n\nRead Chat data by its _id field\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only for Players above 13 or with parents approval |\n| Search | no | \n| Sort | no |\n| Pagination | no | " + }, + "delete": { + "tags": [ + "Chat" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Delete Chat", + "description": "TEMPORARY DISABLED AND RETURNS 501\n\nDelete Chat by its _id field. \n\nNotice that currently anybody can delete any Chat.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only for Players above 13 or with parents approval |" + }, + "parameters": [ + { + "examples": { + "1": { + "value": "654fad58fd96261edd2e096f" + } + }, + "name": "_id", + "description": "Chat _id field", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/chat/{_id}/messages": { + "get": { + "tags": [ + "Chat" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200" + }, + "examples": { + "1": { + "value": { + "data": { + "Chat": [ + { + "id": 15, + "senderUsername": "user1", + "content": "message 15", + "feeling": 1 + } + ] + }, + "metaData": { + "dataKey": "Chat", + "modelName": "Chat", + "dataType": "Array", + "dataCount": 1 + }, + "paginationData": { + "currentPage": 1, + "limit": 20, + "offset": 0, + "itemCount": 1, + "pageCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Read all messages from the Chat", + "description": "Read all messages of specified Chat. Remember about the pagination\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only for Players above 13 or with parents approval |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | ", + "externalDocs": { + "url": "https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests)" + } + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MessageCreate" + } + } + }, + "required": true + }, + "tags": [ + "Chat" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "409": { + "$ref": "#/components/responses/409_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Create a message", + "description": "Create a new Message. Message represent the object of message sent by a Player.\n\nNotice that currently there are no authorization required.\n\nNotice, that the messages does not have an usual _id field generated by data base. Instead the Photon id should be used.\n\nNotice that the messages is contained in the array of a Chat collection.\n\n| Feature / Requirement | Is / Has | \n| -------- | -------- | \n| Authentication | yes |\n| Authorization | only for Players above 13 or with parents approval |\n" + }, + "parameters": [ + { + "examples": { + "1": { + "value": "66912712d191c865ab53da8a" + } + }, + "name": "_id", + "description": "Chat _id, with which the message is associated", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/customCharacter": { + "get": { + "tags": [ + "CustomCharacter", + "release-09-02-2025" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200" + }, + "examples": { + "1": { + "value": { + "data": { + "CustomCharacter": [ + { + "objectType": "CustomCharacterDto", + "_id": "67a854de7daa100af3fac4ac", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd52327a90a33d0985f6b", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd51827a90a33d0985f65", + "characterId": "202", + "defence": 3, + "hp": 2, + "size": 4, + "speed": 10, + "attack": 8, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd50f27a90a33d0985f5f", + "characterId": "201", + "defence": 5, + "hp": 2, + "size": 6, + "speed": 10, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd50a27a90a33d0985f59", + "characterId": "401", + "defence": 20, + "hp": 10, + "size": 10, + "speed": 10, + "attack": 50, + "level": 2, + "player_id": "679cd4db27a90a33d0985f4e" + } + ] + }, + "metaData": { + "dataKey": "CustomCharacter", + "modelName": "CustomCharacter", + "dataType": "Array", + "dataCount": 5 + }, + "paginationData": { + "currentPage": 1, + "limit": 20, + "offset": 0, + "itemCount": 5, + "pageCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Read all custom characters of the Player", + "description": "Read all custom characters. Remember about the pagination\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only own |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | ", + "externalDocs": { + "url": "https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests)" + } + }, + "put": { + "requestBody": { + "description": "CustomCharacter object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomCharacterUpdate" + } + } + }, + "required": true + }, + "tags": [ + "CustomCharacter", + "release-09-02-2025" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update a custom character", + "description": "Update the CustomCharacter, which _id is specified in the body.\n\nOnly the Player, that owns the CustomCharacter can change it. In case the Player does not own the CustomCharacter the 404 is returned.\n\n| Feature / Requirement | Is / Has | \n| -------- | -------- | \n| Authentication | yes | \n| Authorization | only for character owner |\n" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomCharacterCreate" + } + } + }, + "required": true + }, + "tags": [ + "CustomCharacter", + "release-09-02-2025" + ], + "responses": { + "201": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/201" + }, + "examples": { + "1": { + "value": { + "data": { + "CustomCharacter": { + "objectType": "CustomCharacterDto", + "_id": "67a854de7daa100af3fac4ac", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + } + }, + "metaData": { + "dataKey": "CustomCharacter", + "modelName": "CustomCharacter", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Created" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Create a custom character", + "description": "Create a new CustomCharacter. CustomCharacter represents a character of the Player. Player can have many CustomCharacters, CustomCharacter can belong to only one Player.\n\nNotice that the player:id field will be determined based on the logged-in player.\n\n| Feature / Requirement | Is / Has | \n| -------- | -------- | \n| Authentication | yes | \n| Authorization | only own |\n" + } + }, + "/customCharacter/{_id}": { + "get": { + "tags": [ + "CustomCharacter", + "release-09-02-2025" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "CustomCharacter": { + "objectType": "CustomCharacterDto", + "_id": "67a854de7daa100af3fac4ac", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + } + }, + "metaData": { + "dataKey": "CustomCharacter", + "modelName": "CustomCharacter", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "404": { + "$ref": "#/components/responses/400_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get CustomCharacter by id", + "description": "Read CustomCharacter data by its _id field.\n\nNotice that if the CustomCharacter does not belong to the logged-in Player 404 should be returned. \n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | only own |\n| Search | no | \n| Sort | no |\n| Pagination | no |" + }, + "parameters": [ + { + "examples": { + "1": { + "value": "66939de4db98c5ba6bb192f1" + } + }, + "name": "_id", + "description": "CustomCharacter _id field", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/room/{_id}": { + "get": { + "tags": [ + "Room" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/200_one" + }, + "examples": { + "1": { + "value": { + "data": { + "Room": { + "_id": "668d6003a9292e300e94c833", + "floorType": "floor1", + "wallType": "wall1", + "isActive": false, + "deactivationTimestamp": 34524523654, + "cellCount": 20, + "soulHome_id": "667ef139b3b5bf0f7a840f2d", + "hasLift": true + } + }, + "metaData": { + "dataKey": "Room", + "modelName": "Room", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "OK" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get Room by _id", + "description": "## Method description\n\nGet Room by its _id. \n\nIf the logged-in user is a Clan member and the Clan does have the requested Room, the Room for this Clan will be returned. \n\nIf the logged-in user is not belonging to any Clan, or Room in that Clan with provided _id is not found the 404 error will be returned.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n\n\n## Endpoint description\n\n### General description\n\nRoom is a place, which can safely store Items of a Clan. However, Items from the Room can be stolen.\n\nRoom is closely related to its SoulHome. SoulHome consists of Rooms. \n\nRoom has an automatic behavior. Room has two statuses active and deactivated. When the Room is becoming deactivated its isActive field is taking on the value false. This should be done automatically when the deactivationTimestamp field is expired.\n\n### Relations\n\nRoom can belong to one SoulHome. SoulHome may have many Rooms.\n\nRoom can have many Items. Item may belong to one Room.\n\n### CRUD operations\n\nRooms for a SoulHome must be created automatically, when a SoulHome is created. Therefore there is no enpoint for Room creation.\n\nRoom and all Rooms can be read by Clan members, to which the Room (its SoulHome) is belonging.\n\nRoom can be updated by Clan members, to which it (its SoulHome) belongs.\n\nRoom can be deleted only automatically, when the SoulHome, to which the Room belongs is deleted." + }, + "parameters": [ + { + "examples": { + "1": { + "value": "667ee778b3b5bf0f7a840ec9" + } + }, + "name": "_id", + "description": "Room _id", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/room/activate": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "required": [ + "room_ids" + ], + "type": "object", + "properties": { + "room_ids": { + "description": "List of Room _ids to activate", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "64df3aad42cbaf850a3f891f" + ] + }, + "durationS": { + "description": "Optional duration of room to be active in seconds", + "type": "number", + "example": 60 + } + } + } + } + }, + "required": true + }, + "tags": [ + "Room" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Activate the Room by _id", + "description": "## Method description\n\nActivate the specified Rooms.\n\nIf Room _id specified in the room_ids field does not belong to logged-in user's Clan (SoulHome), it will be ignored. However it will return 404 if non of the Room _ids does not belong to the Clan. \n\n\n## Endpoint description\n\n### General description\n\nRoom is a place, which can safely store Items of a Clan. However, Items from the Room can be stolen. \n\nRoom is closely related to its SoulHome. SoulHome consists of Rooms. \n\nRoom has an automatic behavior. Room has two statuses active and deactivated. When the Room is becoming deactivated its isActive field is taking on the value false. This should be done automatically when the deactivationTimestamp field is expired.\n\n### Relations\n\nRoom can belong to one SoulHome. SoulHome may have many Rooms.\n\nRoom can have many Items. Item may belong to one Room.\n\n### CRUD operations\n\nRooms for a SoulHome must be created automatically, when a SoulHome is created. Therefore there is no enpoint for Room creation.\n\nRoom and all Rooms can be read by Clan members, to which the Room (its SoulHome) is belonging.\n\nRoom can be updated by Clan members, to which it (its SoulHome) belongs.\n\nRoom can be deleted only automatically, when the SoulHome, to which the Room belongs is deleted." + } + }, + "/item/steal": { + "get": { + "tags": [ + "Item" + ], + "parameters": [ + { + "name": "steal_token", + "description": "", + "schema": { + "type": "string" + }, + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "SoulHome": { + "_id": "668c0e9f9470819cf38e371c", + "name": "clan1", + "clan_id": "667bfec6afb8211b4bd8dbff", + "Room": [ + { + "_id": "668d6003a9292e300e94c833", + "floorType": "floor1", + "wallType": "wall1", + "isActive": false, + "deactivationTimestamp": 34524523654, + "cellCount": 20, + "soulHome_id": "668c0e9f9470819cf38e371c", + "hasLift": true + } + ] + } + }, + "metaData": { + "dataKey": "SoulHome", + "modelName": "SoulHome", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "SoulHome and its Rooms" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get SoulHome data from which items can be stolen", + "description": "Based on the provided steal token, which contains the SoulHome _id from which Items can be stolen, the SoulHome data and its Rooms will be returned.\n\nYou can see the process flow from [this diagram](https://github.com/Alt-Org/Altzone-Server/tree/dev/doc/img/game_results)" + }, + "post": { + "requestBody": { + "description": "Items to be stolen", + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "steal_token": "some_token", + "item_ids": [ + "668a765091020196cb10d5a3", + "668a765091020196cb10d5a3" + ], + "room_id": "668a765091020196cb10d5a3" + } + } + } + } + }, + "required": true + }, + "tags": [ + "Item" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Item": [ + { + "_id": "668a70ce91020196cb10d595", + "name": "item1", + "weight": 67, + "recycling": "yleinen", + "unityKey": "unity1", + "filename": "file1", + "location": [ + 2, + 4 + ], + "isFurniture": true, + "stock_id": "668953cd4a7b6c993aed1a36", + "price": 23 + } + ] + }, + "metaData": { + "dataKey": "Item", + "modelName": "Item", + "dataType": "Array", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Array of Items, which were stolen" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Steal Items from another Clan", + "description": "Steal Items from the loser Clan's SoulHome. The stolen Items will be automatically added to a specified Room of the winners Clan's SoulHome.\n\nNotice that at first a steal token should be obtained by the winner player(s) from the /gameData/battle POST endpoint with body type \"result\", while informing about game result.\n\nRequests without the steal token or with an expired token will get 403 as a response.\n\nNotice that only found SoulHome Items will be stolen. It is possible that some other player already has stoled some of the specified Items, in this case these Items will be ignored since they can not be stolen twice. \n\nYou can see the process flow from [this diagram](https://github.com/Alt-Org/Altzone-Server/tree/dev/doc/img/game_results)\n\n## Endpoint description\n\n### General description\n\nItems are objects, which can be placed in SoulHomes' Rooms, Stocks and Shop. Item is an object, which has its value in the game and can be bought from the Shop, stolen from the Stock or placed in safe to SoulHome's Room.\n\nItems can be obtained only from Shop and then stored in Room or a Stock.\n\nItem can be a furniture or some other kind of object. The difference between furniture and not furniture is that a furniture can be placed only on a floor. Not furniture can be placed anywhere including on top of a furniture, walls, celling and floor. This data is used in game logic only and does not affect the API in any way.\n\n### Relations\n\nItem can belong to one Room. Room can have multiple Items.\n\nItem can belong to one Stock. Stock can have multiple Items.\n\nItem can belong to Shop. Shop can have multiple Items.\n\n### CRUD operations\n\nItem can not be created by Player. It can only be bought from Shop. API creates new Items automatically.\n\nItem can be read by anyone. One Item can be accessed via its _id field. Multiple Items can be accessed by requesting them within another endpoints via \"with\" or \"all\" queries (/stock/:stock_id?with=Item), since they are mostly required together with Stock, Room or Shop data.\n\nItem can not be directly updated by Players. However, Players may move Items from one place to another. They first can buy an Item from Shop and so update Item's place by moving it to the Clan's Stock. Then they can move it from SoulHome to Stock or vice versa. Item can be bought from Shop via /stock/buy enpoint (not yet implemented). Item can be moved from Room to Stock or from Stock to Room via /item/move POST endpoint.\n\nItem can not be deleted." + } + }, + "/gameData/battle": { + "post": { + "requestBody": { + "content": { + "application/json": { + "examples": { + "result": { + "value": { + "type": "result", + "team1": [ + "667bfec6afb8211b4bd8dbff", + "597bfec6afb8211b4bd8db64" + ], + "team2": [ + "397bfec6adb8211b4bd8dbe0", + "207bfec6adb8211b4bd8dba1" + ], + "duration": 120, + "winnerTeam": 1 + } + } + } + } + }, + "required": true + }, + "tags": [ + "GameData" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "result": { + "value": { + "steal_token": "temporary_token_to_use_for_/room/steal", + "soulHome_id": "667ee778b3b5bf0f7a840ec9", + "room_ids": [ + "668d6003a9292e300e94c833" + ] + } + } + } + } + }, + "description": "" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Inform API about battle", + "description": "Enpoint for notifying the API about battle events or any other data.\n\nNotice, that the field type is required and determines the type of the data.\n\nNotice that the type also determines shape of the body. Examples, for each type can be found in request examples section.\n\n## Type field\n\n### result\n\nResult of the battle, all players of the battle should send this data.\n\nNotice that team1 and team2 should hold game's player's _id fields.\n\nAs a response for winners an access token will be returned, which can be used when stealing Items from losed Clan's SoulHome. Notice that the steal token will expire after some period of time. Losers will get 403 error = they can not get the steal token.\n\nThe steal token can be used only by the winner's Clan's members for the loser's Clan Stock.\n\nYou can see the process flow from [this diagram](https://github.com/Alt-Org/Altzone-Server/tree/dev/doc/img/game_results)" + } + }, + "/item/move": { + "post": { + "requestBody": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "item_id": "397bfec6adb8211b4bd8dbe0", + "moveTo": "Stock", + "destination_id": "667bfec6afb8211b4bd8dbff" + } + } + } + } + }, + "required": true + }, + "tags": [ + "Item" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Move Item", + "description": "Move Item from Stock to Room or from Room to Stock, based on the _moveTo_ field, which can have only two values: \"Stock\" or \"Room\"\n\nNotice that Clan members can move only own Clan Items and a member is trying to move other Clan's Item the 404 will be returned.\n\nNotice that if an Item need to be moved to a Stock then there is no need to specify the destination_id field, since Clan can have only one Stock.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | no |\n\n## Endpoint description\n\n### General description\n\nItems are objects, which can be placed in SoulHomes' Rooms, Stocks and Shop. Item is an object, which has its value in the game and can be bought from the Shop, stolen from the Stock or placed in safe to SoulHome's Room.\n\nItems can be obtained only from Shop and then stored in Room or a Stock.\n\nItem can be a furniture or some other kind of object. The difference between furniture and not furniture is that a furniture can be placed only on a floor. Not furniture can be placed anywhere including on top of a furniture, walls, celling and floor. This data is used in game logic only and does not affect the API in any way.\n\n### Relations\n\nItem can belong to one Room. Room can have multiple Items.\n\nItem can belong to one Stock. Stock can have multiple Items.\n\nItem can belong to Shop. Shop can have multiple Items.\n\n### CRUD operations\n\nItem can not be created by Player. It can only be bought from Shop. API creates new Items automatically.\n\nItem can be read by anyone. One Item can be accessed via its _id field. Multiple Items can be accessed by requesting them within another endpoints via \"with\" or \"all\" queries (/stock/:stock_id?with=Item), since they are mostly required together with Stock, Room or Shop data.\n\nItem can not be directly updated by Players. However, Players may move Items from one place to another. They first can buy an Item from Shop and so update Item's place by moving it to the Clan's Stock. Then they can move it from SoulHome to Stock or vice versa. Item can be bought from Shop via /stock/buy enpoint (not yet implemented). Item can be moved from Room to Stock or from Stock to Room via /item/move POST endpoint.\n\nItem can not be deleted." + } + }, + "/fleaMarket/buy": { + "post": { + "requestBody": { + "description": "Item to buy", + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "item_id": "66d8611a184d5f0a7c0675b7" + } + } + } + } + }, + "required": true + }, + "tags": [ + "FleaMarket" + ], + "responses": { + "201": { + "$ref": "#/components/responses/201" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Buy an Item from the flea market", + "description": "Buy an Item from the flea market. This will start a voting in the Clan for which Item is being purchased. Voting duration is 10 min at max and the min approval percentage is 51. During the voting an Item is in \"Booked\" status and can not be bought by other players.\n\nNotice that if a FleaMarketItem has already \"Booked\" status 403 will be returned.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | yes, only buying Clan members |\n\n\n## Endpoint description\n\n### General description\n\nThe FleaMarket is the place where the Clans can sell their own Items and other Clans can buy these Items. Items can be purchased by any Clan member using this Clan coins.\n\n\n### Logic\n\nThe FleeMarket contains FleeMarketItems. FleeMarketItem object has a status field which determines what can be done with it:\n\n- Available - Item can be purchased\n- Shipping - Item is being shipped = selling Clan members is voting if the Item should be sold or not\n- Booking - Item is booked = buying Clan is voting if the Item should be bought or not. Item can be booked for max. 10 min\n\n\n### Relations\n\nThe FleaMarketItem belongs to a selling Clan. The selling Clan can have many FleaMarketItems. FleaMarketItem can belong to one Clan only.\n\n\n### CRUD operations\n\nFleaMarketItem is added by Clan member by moving the Item from Stock to FleaMarket, which means the Item from Stock is copied to the FleaMarketItem collection and then removed from the Stock.\n\nFleaMarketItems can be read by any logged-in user.\n\nFleaMarketItem data can not be changed at the time and it is read-only.\n\nFleaMarketItem can not be removed from the FleaMarket at the time once it is put there.\n" + } + }, + "/auth/signIn": { + "post": { + "requestBody": { + "description": "Profile credentials", + "content": { + "application/json": { + "schema": { + "required": [ + "username", + "password" + ], + "type": "object", + "properties": { + "username": { + "description": "The username of the profile", + "type": "string", + "example": "user1" + }, + "password": { + "description": "The password of the profile", + "type": "string", + "example": "myPassword" + } + } + } + } + }, + "required": true + }, + "tags": [ + "Auth" + ], + "responses": { + "201": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "objectType": "ProfileDto", + "_id": "651a716b5129c6e54cb7d7c9", + "username": "user1", + "__v": 0, + "Player": { + "objectType": "PlayerDto", + "_id": "651a716b5129c6e54cb7d7cb", + "name": "User1", + "backpackCapacity": 456, + "uniqueIdentifier": "3", + "profile_id": "651a716b5129c6e54cb7d7c9", + "points": 10, + "__v": 0, + "clan_id": "651a72c35129c6e54cb7d7de" + }, + "Clan": { + "objectType": "ClanDto", + "itemCount": 0, + "isOpen": true, + "_id": "651a72c35129c6e54cb7d7de", + "name": "User1 clan", + "tag": "sometage", + "gameCoins": 645, + "admin_ids": [ + "651a716b5129c6e54cb7d7cb" + ], + "labels": [ + "eläinrakkaat", + "itsenäiset" + ], + "points": 20, + "__v": 0, + "playerCount": 2, + "stockCount": 1 + }, + "accessToken": "your_token", + "tokenExpires": 1725799544 + } + } + } + } + }, + "description": "Successful login with the profile data" + }, + "400": { + "$ref": "#/components/responses/400" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Log in to the system", + "description": "After the profile with player was created, the user can log in to the system and get a JWT token to access resources.\n\nIf the user provides the correct credentials, the access token will be returned, which should be used as a Bearer token in the Authorization header.\n\nIf the user provides wrong credentials, a 401 status will be returned." + } + }, + "/clan/exclude": { + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClanExclude" + } + } + }, + "required": true + }, + "tags": [ + "Clan" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Exclude Player from Clan", + "description": "Request exclude the player from clan. \n\nNotice that only Clan admin can remove the Player\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | yes, only clan admin | \n\n" + } + }, + "/gameAnalytics/logFile": { + "post": { + "requestBody": { + "description": "File that needs to be uploaded", + "content": { + "multipart/form-data": {} + }, + "required": true + }, + "tags": [ + "GameAnalytics" + ], + "parameters": [ + { + "name": "Secret", + "description": "secret_string", + "schema": { + "type": "string" + }, + "in": "header", + "required": true + }, + { + "name": "Battle-Id", + "description": "Id of the battle to which log file belongs to", + "schema": { + "type": "string" + }, + "in": "header", + "required": false + } + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Upload a game analytics log file", + "description": "Enpoint uploads a log file and save on the server.\n\nThe file will be saved to the folder with name corresponding to the date when it was uploaded, i.e. 1-9-2024.\n\nFile name must be unique and therefore its name will contain date, time, Player _id and a random string, i.e. 1-9-2024_14-45-12_667eedc9b3b5bf0f7a840ef1_123456.log\n\nNotice that the request must have a Secret header which holds a password for such requests.\n\nNotice that if the Battle-Id header is not defined the current timestamp will be used instead.\n\nNotice that the request must be in multipart/form-data format, where field name containing the file is \"logFile\"" + } + }, + "/fleaMarket/sell": { + "post": { + "requestBody": { + "description": "Item to sell", + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "item_id": "66d8611a184d5f0a7c0675b7" + } + } + } + } + }, + "required": true + }, + "tags": [ + "FleaMarket" + ], + "responses": { + "201": { + "$ref": "#/components/responses/201" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Sell an Item on the flea market", + "description": "Sell an Item on the flea market. This will start a voting in the Clan from which Item is being moved to the flee marked. Voting min approval percentage is 51. During the voting an Item is in \"Shipping\" status and can not be bought by other players.\n\nNotice that if a FleaMarketItem has already \"Shipping\" status 403 will be returned.\n\n| Feature / Requirement | Is / Has |\n| -------- | -------- |\n| Authentication | yes |\n| Authorization | yes, only selling Clan members |\n\n## Endpoint description\n\n### General description\n\nThe FleaMarket is the place where the Clans can sell their own Items and other Clans can buy these Items. Items can be purchased by any Clan member using this Clan coins.\n\n\n### Logic\n\nThe FleeMarket contains FleeMarketItems. FleeMarketItem object has a status field which determines what can be done with it:\n\n- Available - Item can be purchased\n- Shipping - Item is being shipped = selling Clan members is voting if the Item should be sold or not\n- Booking - Item is booked = buying Clan is voting if the Item should be bought or not. Item can be booked for max. 10 min\n\n\n### Relations\n\nThe FleaMarketItem belongs to a selling Clan. The selling Clan can have many FleaMarketItems. FleaMarketItem can belong to one Clan only.\n\n\n### CRUD operations\n\nFleaMarketItem is added by Clan member by moving the Item from Stock to FleaMarket, which means the Item from Stock is copied to the FleaMarketItem collection and then removed from the Stock.\n\nFleaMarketItems can be read by any logged-in user.\n\nFleaMarketItem data can not be changed at the time and it is read-only.\n\nFleaMarketItem can not be removed from the FleaMarket at the time once it is put there." + } + }, + "/voting": { + "get": { + "tags": [ + "Voting" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Voting": [ + { + "objectType": "VotingDto", + "_id": "67696bbabdeca182c841e46e", + "organizer": { + "player_id": "67333bcf860c6e1a98eb8ee6", + "clan_id": "6746e90e85763982c51af0d5" + }, + "endsOn": "2024-12-23T14:05:06.541Z", + "type": "selling_item", + "minPercentage": 51, + "votes": [ + { + "player_id": "67333bcf860c6e1a98eb8ee6", + "choice": "accept" + } + ], + "entity_id": "67696d0fbdeca182c841e484" + } + ] + }, + "metaData": { + "dataKey": "Voting", + "modelName": "Voting", + "dataType": "Array", + "dataCount": 1 + } + } + } + } + } + }, + "description": "All active votings" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get all votings", + "description": "Get all active votings of the logged user clan." + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "voting_id": "667eedc9b3b5bf0f7a840ef1", + "choice": "accept" + } + } + } + } + }, + "required": true + }, + "tags": [ + "Voting" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Send a vote", + "description": "Send a vote.\n\nThe minimum acceptance percentage refering to the min percentage of a group members that need to accept some option for the voting to be concluded. For example Clan members are voting whenever they want to sell an Item or not and the min percentage might be 51 => if 51% of all this Clan members accept to sell the Item then the Item can be sold and otherwise if the 51% of Clan members reject to sell the Item it will not be sold. Same logic can be applied if there are more than 2 options available.\n\nVoting endpoint is served for different kinds of votings. The \"type\" field is an enum and determines what value the \"choice\" field may have.\n\n| type | options |\n| ------------- | ------------------ |\n| selling_item: | \"accept\", \"reject\" |\n| buying_item: | \"accept\", \"reject\" |\n\n\n## selling_item\n\nPlayer votes whenever he/she wants that an item is going for sale to the flea market. The voter must be a member of the Clan from which item is going to sale, otherwise 403 will be returned. The min acceptance percentage is 51%. Notice that during the voting process there will be sent different notifications via MQTT:\n- new voting started\n- somebody has voted\n- voting ended\n\n## buying_item\n\nPlayer votes whenever he/she wants that an item should be bought from the flea market or not. The voter must be a member of the Clan for which item is going to be bought, otherwise 403 will be returned. The min acceptance percentage is 51%. The time limit for the voting is 10 mins. Notice that during the voting process there will be sent different notifications via MQTT:\n- new voting started\n- somebody has voted\n- voting ended\n- error if time limit expired" + } + }, + "/voting/{_id}": { + "get": { + "tags": [ + "Voting" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Voting": { + "objectType": "VotingDto", + "_id": "67696bbabdeca182c841e46e", + "organizer": { + "player_id": "67333bcf860c6e1a98eb8ee6", + "clan_id": "6746e90e85763982c51af0d5" + }, + "endsOn": "2024-12-23T14:05:06.541Z", + "type": "selling_item", + "minPercentage": 51, + "votes": [ + { + "player_id": "67333bcf860c6e1a98eb8ee6", + "choice": "accept" + } + ], + "entity_id": "67696bcdbdeca182c841e47a" + } + }, + "metaData": { + "dataKey": "Voting", + "modelName": "Voting", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Success, response with body " + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get voting data by _id", + "description": "Get data of the current voting state.\n\nNotice that it can return 403 in case the logged-in player does not have permission to access the voting, for example if the player tries to access a voting that is an internal for other Clan." + }, + "parameters": [ + { + "examples": { + "1": { + "value": "668a70ce91020196cb10d595" + } + }, + "name": "_id", + "description": "voting _id", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/dailyTasks": { + "get": { + "tags": [ + "DailyTasks", + "release-09-02-2025" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "DailyTask": [ + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3501", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 17 taistelua", + "type": "play_battle", + "points": 92, + "coins": 46, + "amount": 17, + "amountLeft": 17, + "timeLimitMinutes": 34 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3502", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 2 taistelua", + "type": "play_battle", + "points": 71, + "coins": 35, + "amount": 2, + "amountLeft": 2, + "timeLimitMinutes": 4 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3503", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 9 taistelua", + "type": "play_battle", + "points": 32, + "coins": 16, + "amount": 9, + "amountLeft": 9, + "timeLimitMinutes": 18 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3504", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 16 taistelua", + "type": "win_battle", + "points": 50, + "coins": 25, + "amount": 16, + "amountLeft": 16, + "timeLimitMinutes": 32 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3505", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 20 viestiä chattiin", + "type": "write_chat_message", + "points": 23, + "coins": 11, + "amount": 20, + "amountLeft": 20, + "timeLimitMinutes": 40 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3506", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 4 viestiä chattiin", + "type": "write_chat_message", + "points": 68, + "coins": 34, + "amount": 4, + "amountLeft": 4, + "timeLimitMinutes": 8 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3507", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 3 viestiä chattiin", + "type": "write_chat_message", + "points": 91, + "coins": 45, + "amount": 3, + "amountLeft": 3, + "timeLimitMinutes": 6 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3508", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 19 taistelua", + "type": "win_battle", + "points": 83, + "coins": 41, + "amount": 19, + "amountLeft": 19, + "timeLimitMinutes": 38 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3509", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 15 taistelua", + "type": "play_battle", + "points": 55, + "coins": 27, + "amount": 15, + "amountLeft": 15, + "timeLimitMinutes": 30 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350a", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 5 viestiä chattiin", + "type": "write_chat_message", + "points": 21, + "coins": 10, + "amount": 5, + "amountLeft": 5, + "timeLimitMinutes": 10 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350b", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 10 viestiä chattiin", + "type": "write_chat_message", + "points": 91, + "coins": 45, + "amount": 10, + "amountLeft": 10, + "timeLimitMinutes": 20 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350c", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 5 viestiä chattiin", + "type": "write_chat_message", + "points": 70, + "coins": 35, + "amount": 5, + "amountLeft": 5, + "timeLimitMinutes": 10 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350d", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 2 viestiä chattiin", + "type": "write_chat_message", + "points": 21, + "coins": 10, + "amount": 2, + "amountLeft": 2, + "timeLimitMinutes": 4 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350e", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 6 taistelua", + "type": "win_battle", + "points": 77, + "coins": 38, + "amount": 6, + "amountLeft": 6, + "timeLimitMinutes": 12 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350f", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 3 viestiä chattiin", + "type": "write_chat_message", + "points": 38, + "coins": 19, + "amount": 3, + "amountLeft": 3, + "timeLimitMinutes": 6 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3512", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 13 taistelua", + "type": "play_battle", + "points": 93, + "coins": 46, + "amount": 13, + "amountLeft": 13, + "timeLimitMinutes": 26 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3513", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 13 taistelua", + "type": "win_battle", + "points": 10, + "coins": 5, + "amount": 13, + "amountLeft": 13, + "timeLimitMinutes": 26 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3514", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 5 taistelua", + "type": "win_battle", + "points": 17, + "coins": 8, + "amount": 5, + "amountLeft": 5, + "timeLimitMinutes": 10 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3510", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 2 taistelua", + "type": "win_battle", + "points": 51, + "coins": 25, + "amount": 2, + "amountLeft": 2, + "timeLimitMinutes": 4 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3511", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 17 taistelua", + "type": "play_battle", + "points": 100, + "coins": 50, + "amount": 17, + "amountLeft": 17, + "timeLimitMinutes": 34 + } + ] + }, + "metaData": { + "dataKey": "DailyTask", + "modelName": "DailyTask", + "dataType": "Array", + "dataCount": 20 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get Player's tasks", + "description": "Returns a list of logged-in Player's tasks. \n\nThe period query works as follows:\n\ntoday - all tasks for today (completed and uncomleted)\n\nweek - all tasks for the current week (completed and uncomleted) including daily tasks.\n\nmonth - all tasks for the current month (completed and uncompleted), including weekly and daily tasks.\n\nYou can find the a json file of player tasks [here](https://github.com/Alt-Org/Altzone-Server/blob/dev/src/playerTasks/playerTasks.json)\n\n| Feature | Has |\n| --------------- | ----------------------- |\n| Authentication | yes |\n| Authorization | only Player's own tasks |\n| Search | yes | \n| Sort | yes |\n| Pagination | yes | \n\n## General description\n\nThe daily task is a predefined task for an individual player to perform.\n\nThere are tasks for each day, each two weeks and each month.\n\nPlayer is getting points for each completed task and each task brings different amount of points and coins.\n\nThese points and coins are going to the player's clan. The points are used to determine top clans in the game and the coins are used to purchase items from the flee market of the game." + }, + "parameters": [ + { + "name": "period", + "description": "Period of time for the tasks", + "schema": { + "enum": [ + "today", + "week", + "month" + ], + "type": "string" + }, + "in": "query", + "required": false + } + ] + }, + "/leaderboard/player": { + "get": { + "tags": [ + "Leaderboard" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Player": [ + { + "_id": "6686cb3b71adebdb10f33ffb", + "name": "User 2", + "backpackCapacity": 654, + "uniqueIdentifier": 2, + "profile_id": "6686cb3b71adebdb10f33ff9", + "above13": true, + "parentalAuth": true, + "points": 20, + "gameStatistics": { + "messages": { + "date": 1728399672, + "count": 2 + }, + "playedBattles": 1, + "wonBattles": 1, + "diamondsAmount": 1, + "startedVotings": 1, + "participatedVotings": 1 + } + }, + { + "_id": "2096cb3b71adebdb10f33ea6", + "name": "User 1", + "backpackCapacity": 654, + "uniqueIdentifier": 2, + "profile_id": "2086cb3b71adebdb10f33ff0", + "above13": true, + "parentalAuth": true, + "points": 10, + "gameStatistics": { + "messages": { + "date": 1728399672, + "count": 2 + }, + "playedBattles": 0, + "wonBattles": 1, + "diamondsAmount": 0, + "startedVotings": 1, + "participatedVotings": 1 + } + } + ] + }, + "metaData": { + "dataKey": "Player", + "modelName": "Player", + "dataType": "Array", + "dataCount": 1 + }, + "paginationData": { + "currentPage": 1, + "limit": 2, + "offset": 0, + "itemCount": 1, + "pageCount": 1 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Get player's leaderboard", + "description": "Leaderboard of players. Top Players are defined by the amount of points that he/she has.\n\nNotice that the leaderboards data is updated once every 12 hours." + } + }, + "/leaderboard/clan": { + "get": { + "tags": [ + "Leaderboard" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Clan": [ + { + "_id": "667eedc9b3b5bf0f7a840ef1", + "name": "User2 clan", + "tag": "tag2", + "gameCoins": 90, + "points": 10, + "admin_ids": [ + "666720806cc90102f60bd325" + ], + "playerCount": 1, + "itemCount": 0, + "stockCount": 0, + "isOpen": true, + "id": "667eedc9b3b5bf0f7a840ef1" + }, + { + "_id": "667bfec6afb8211b4bd8dbff", + "name": "User1 clan", + "tag": "tag1", + "gameCoins": 4, + "admin_ids": [ + "665df7026bf5b8f670569ea4" + ], + "playerCount": 1, + "itemCount": 0, + "stockCount": 0, + "isOpen": true, + "points": 10, + "id": "667bfec6afb8211b4bd8dbff" + } + ] + }, + "metaData": { + "dataKey": "Clan", + "modelName": "Clan", + "dataType": "Array", + "dataCount": 2 + }, + "paginationData": { + "currentPage": 1, + "limit": 2, + "offset": 0, + "itemCount": 2, + "pageCount": 1 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + {} + ], + "summary": "Get clans leaderboard", + "description": "Leaderboard of clans. Top Clans are defined by the amount of points that each Clan has.\n\nNotice that the leaderboards data is updated once every 12 hours." + } + }, + "/profile/info": { + "get": { + "tags": [ + "Profile" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Profile": { + "objectType": "ProfileDto", + "_id": "6747050be5ef6e3ffc920192", + "username": "user2", + "Player": { + "objectType": "PlayerDto", + "_id": "6747050be5ef6e3ffc920194", + "name": "user2", + "points": 0, + "backpackCapacity": 90, + "uniqueIdentifier": "user2", + "above13": true, + "parentalAuth": true, + "gameStatistics": { + "objectType": "GameStatisticsDto" + }, + "profile_id": "6747050be5ef6e3ffc920192", + "clan_id": "6746e90e85763982c51af0d5", + "Clan": { + "objectType": "ClanDto", + "_id": "6746e90e85763982c51af0d5", + "name": "clan1", + "tag": "clan1", + "labels": [ + "eläinrakkaat" + ], + "gameCoins": 0, + "points": 0, + "admin_ids": [ + "67333bcf860c6e1a98eb8ee6" + ], + "playerCount": 3, + "itemCount": 0, + "stockCount": 0, + "ageRange": "None", + "goal": "None", + "phrase": "Clan 1 is the best", + "language": "None", + "isOpen": true + } + } + } + }, + "metaData": { + "dataKey": "Profile", + "modelName": "Profile", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "The logged-in profile info" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get basic info about logged-in user", + "description": "Get basic info of the logged-in user:\n\n- Profile\n- Player\n- Clan" + } + }, + "/leaderboard/clan/position": { + "get": { + "tags": [ + "Leaderboard" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Object": { + "position": 1 + } + }, + "metaData": { + "dataKey": "Object", + "modelName": "Object", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Clan's position object" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "logged-in user's clan on the leaderboard", + "description": "Get the logged-in user's clan position on the leaderboard.\n\nNote that if the logged-in user is not in any clan the 404 will be returned" + } + }, + "/clan/items": { + "get": { + "tags": [ + "Clan" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Item": { + "stockItems": [ + { + "objectType": "ItemDto", + "_id": "6746e90f85763982c51af0da", + "name": "Carpet_Rakkaus", + "weight": 6, + "recycling": "Mixed_waste", + "qualityLevel": "common", + "unityKey": "Carpet_Rakkaus", + "price": 100, + "location": [ + 1, + 1 + ], + "isFurniture": false, + "stock_id": "6746e90f85763982c51af0d8" + } + ], + "soulHomeItems": [ + { + "objectType": "ItemDto", + "_id": "6746e90f85763982c51af11f", + "name": "Carpet_Rakkaus", + "weight": 6, + "recycling": "Mixed_waste", + "qualityLevel": "common", + "unityKey": "Carpet_Rakkaus", + "price": 100, + "location": [ + 1, + 2 + ], + "isFurniture": false, + "room_id": "6746e90f85763982c51af0e2" + }, + { + "objectType": "ItemDto", + "_id": "6746e90f85763982c51af11e", + "name": "Sofa_Rakkaus", + "weight": 27, + "recycling": "Mixed_waste", + "qualityLevel": "common", + "unityKey": "Sofa_Rakkaus", + "price": 130, + "location": [ + 1, + 1 + ], + "isFurniture": true, + "room_id": "6746e90f85763982c51af0e2" + }, + { + "objectType": "ItemDto", + "_id": "6746e90f85763982c51af120", + "name": "Chair_Neuro", + "weight": 10, + "recycling": "Mixed_waste", + "qualityLevel": "epic", + "unityKey": "Chair_Neuro", + "price": 170, + "location": [ + 1, + 3 + ], + "isFurniture": true, + "room_id": "6746e90f85763982c51af0e2" + } + ] + } + }, + "metaData": { + "dataKey": "Item", + "modelName": "Item", + "dataType": "Object", + "dataCount": 3 + } + } + } + } + } + }, + "description": "Found items of the clan into two separate arrays for stock and soulhome." + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "403": { + "$ref": "#/components/responses/403_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get items of the logged-in user clan", + "description": "Get items of the logged-in user clan.\n\nNotice that it will return 403 if the logged-in player is not in any clan." + } + }, + "/customCharacter/battleCharacters": { + "get": { + "tags": [ + "CustomCharacter", + "release-09-02-2025" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "CustomCharacter": [ + { + "objectType": "CustomCharacterDto", + "_id": "679cd50f27a90a33d0985f5f", + "characterId": "201", + "defence": 5, + "hp": 2, + "size": 6, + "speed": 10, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd51827a90a33d0985f65", + "characterId": "202", + "defence": 3, + "hp": 2, + "size": 4, + "speed": 10, + "attack": 8, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd52327a90a33d0985f6b", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + } + ] + }, + "metaData": { + "dataKey": "CustomCharacter", + "modelName": "CustomCharacter", + "dataType": "Array", + "dataCount": 3 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get logged-in player chosen CustomCharacters", + "description": "Get logged-in player chosen CustomCharacters for a battle" + } + }, + "/dailyTasks/:_id": { + "get": { + "tags": [ + "DailyTasks", + "release-09-02-2025" + ], + "responses": { + "200": { + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get daily task by _id", + "description": "Get specific daily task by _id" + }, + "delete": { + "tags": [ + "DailyTasks", + "release-09-02-2025" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Delete daily task by _id", + "description": "Delete task by specified _id.\n\nNotice that a new task will be generated to replace the old one." + } + }, + "/dailyTasks/reserve/:_id": { + "put": { + "tags": [ + "DailyTasks", + "release-09-02-2025" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Object": { + "_id": "67a85c1c0a8da114b5bf3501", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 17 taistelua", + "type": "play_battle", + "points": 92, + "coins": 46, + "amount": 17, + "amountLeft": 17, + "timeLimitMinutes": 34, + "__v": 0, + "player_id": "67a85b8b0a8da114b5bf348f", + "startedAt": "2025-02-09T08:02:08.170Z", + "id": "67a85c1c0a8da114b5bf3501" + } + }, + "metaData": { + "dataKey": "Object", + "modelName": "Object", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Reserve a daily task", + "description": "Reserve a daily task for the loged-in player.\n\nReserved task can not be taken by other clan members.\n\nNotice that clan members will get a notification about the task was reserved" + } + }, + "/item": { + "put": { + "requestBody": { + "description": "Update item", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ItemUpdate" + } + } + }, + "required": true + }, + "tags": [ + "Item", + "release-09-02-2025" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update item", + "description": "Update item by specified _id" + } + } + }, + "components": { + "schemas": { + "200": { + "description": "Found object(s). The response objects has three fields: data, metaData and paginationData.\nThe data has the requested data. It has an object or array, which key is a collection name.\n\nThe metaData contains additional data, which can be used for parsing the data object: \ndataKey - collection name, in data object,\ndataType - type of object in data object.\n\nThe paginationData is the data for pagination. Only on GET requests, when reading many objects\n", + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "type": "object" + } + }, + "metaData": { + "type": "object", + "properties": { + "dataKey": { + "description": "collection name", + "type": "string" + }, + "modelName": { + "description": "model name, usually same as dataKey", + "type": "string" + }, + "dataType": { + "description": "Object or Array", + "type": "string" + }, + "dataCount": { + "description": "1 for Object dataType and length if Array", + "type": "integer" + } + } + }, + "paginationData": { + "type": "object", + "properties": { + "currentPage": { + "description": "The current page number", + "type": "integer" + }, + "limit": { + "description": "The limit of items per page", + "type": "integer" + }, + "offset": { + "description": "The offset of items", + "type": "integer" + }, + "itemCount": { + "description": "The total number of items", + "type": "integer" + }, + "pageCount": { + "description": "The total number of pages", + "type": "integer" + } + } + } + } + }, + "201": { + "description": "Created object. The response objects has two fields: data, metaData.\n\nThe data has the created object data. It has an object inside, which key is a collection name.\n\nThe metaData contains additional data, which can be used for parsing the data object: \ndataKey - collection name, in data object,\ndataType - type of object in the data object.", + "required": [ + "data", + "metaData" + ], + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "metaData": { + "type": "object", + "properties": { + "dataKey": { + "description": "collection name", + "type": "string" + }, + "modelName": { + "description": "model name", + "type": "string" + }, + "dataType": { + "description": "always has Object value", + "type": "string" + }, + "dataCount": { + "description": "always has 1 value", + "type": "integer" + } + } + } + } + }, + "APIError": { + "description": "API error", + "type": "object", + "properties": { + "statusCode": { + "description": "The HTTP status code", + "type": "integer", + "example": 404 + }, + "message": { + "description": "The error message", + "type": "string", + "example": "Cannot GET /api/profile" + }, + "error": { + "description": "The error name", + "type": "string", + "example": "Not Found" + } + }, + "x-last-modified": 1718798371474 + }, + "APIConflictError": { + "description": "API error", + "required": [], + "type": "object", + "properties": { + "statusCode": { + "description": "The HTTP status code", + "type": "integer", + "example": 400 + }, + "message": { + "description": "An array of error messages", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "password must be a string" + ] + }, + "error": { + "description": "The error name", + "type": "string", + "example": "Bad Request" + } + } + }, + "ProfileCreate": { + "type": "object", + "properties": { + "username": { + "description": "The username for the Profile, unique", + "type": "string", + "example": "user1" + }, + "password": { + "description": "The password for the Profile", + "type": "string", + "example": "my_password" + }, + "Player": { + "type": "object", + "properties": { + "name": { + "description": "The name of the player", + "type": "string", + "example": "PlayerOne" + }, + "backpackCapacity": { + "description": "The capacity of the player’s backpack", + "type": "integer", + "example": 50 + }, + "uniqueIdentifier": { + "description": "A unique identifier for the player", + "type": "string", + "example": "player-12345" + }, + "above13": { + "description": "Indicates if the player is above 13 years old", + "type": "boolean", + "example": true + }, + "parentalAuth": { + "description": "Indicates if parental authorization is required", + "type": "boolean", + "example": false + }, + "battleCharacter_ids": { + "description": "An array of up to 3 battle character MongoDB IDs", + "maxItems": 3, + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "60c72b2f5f1b2c001c8e4d60", + "60c72b2f5f1b2c001c8e4d61" + ] + }, + "currentAvatarId": { + "description": "The current avatar ID of the player", + "type": "integer", + "example": 101 + } + } + } + } + }, + "ClanUpdate": { + "required": [ + "_id" + ], + "type": "object", + "properties": { + "_id": { + "description": "The _id of the clan to be updated", + "type": "string", + "example": "667462842425aea94d0f66cb" + }, + "isOpen": { + "description": "whenever the clan is open or closed", + "type": "boolean", + "example": true + }, + "admin_idsToDelete": { + "description": "List of admin _ids to delete", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "64df3aad42cbaf850a3f891f" + ] + }, + "admin_idsToAdd": { + "description": "List of admin _ids to add", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "64df3aad42cbaf850a3f891f" + ] + }, + "labels": { + "description": "labels that describes the clan, notice that it is an enum", + "default": [], + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "eläinrakkaat", + "itsenäiset" + ] + }, + "ageRange": { + "description": "the age range of the Clan, notice it is an enum", + "default": "None", + "type": "string", + "example": "Adults" + }, + "goal": { + "description": "the goal of the Clan, notice it is an enum", + "default": "None", + "type": "string", + "example": "Grindaus" + }, + "phrase": { + "description": "the motto phrase of the Clan", + "type": "string", + "example": "Adults" + }, + "language": { + "description": "the language that Clan primarly uses, notice it is an enum", + "default": "None", + "type": "string", + "example": "Spanish" + }, + "clanLogo": { + "required": [ + "logoType", + "pieceColors" + ], + "type": "object", + "properties": { + "logoType": { + "description": "Type of the logo", + "enum": [ + "Heart" + ], + "type": "string", + "example": "Heart" + }, + "pieceColors": { + "description": "List of piece colors in hexadecimal format.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "#FF5733", + "#33FF57", + "#3357FF" + ] + } + } + } + } + }, + "JoinClanReq": { + "description": "Clan joining request by Player", + "required": [ + "clan_id", + "player_id" + ], + "type": "object", + "properties": { + "clan_id": { + "description": "which Clan to join", + "type": "string" + }, + "player_id": { + "description": "who want to join the Clan", + "type": "string" + }, + "join_message": { + "description": "optional for open Clans", + "type": "string" + } + }, + "example": { + "clan_id": "667462842425aea94d0f66cb", + "player_id": "666720806cc90102f60bd325", + "join_message": "User 2 wants to join" + } + }, + "ProfileUpdate": { + "type": "object", + "properties": { + "username": { + "description": "The username for the Profile, unique", + "type": "string", + "example": "user1" + }, + "password": { + "description": "The password for the Profile", + "type": "string", + "example": "my_password" + } + } + }, + "200_one": { + "description": "Found object. The response objects has two fields: data and metaData.\nThe data has the requested data. It has an object inside, which key is a collection name.\n\nThe metaData contains additional data, which can be used for parsing the data object: \ndataKey - collection name, in data object,\ndataType - type of object in data object.", + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "metaData": { + "type": "object", + "properties": { + "dataKey": { + "description": "collection name", + "type": "string" + }, + "modelName": { + "description": "model name", + "type": "string" + }, + "dataType": { + "description": "always has Object value", + "type": "string" + }, + "dataCount": { + "description": "always has 1 value", + "type": "integer" + } + } + } + } + }, + "PlayerCreate": { + "description": "Create a new player", + "required": [ + "name", + "backpackCapacity", + "uniqueIdentifier" + ], + "type": "object", + "properties": { + "name": { + "description": "The name of the player", + "type": "string", + "example": "PlayerOne" + }, + "backpackCapacity": { + "description": "The capacity of the player’s backpack", + "type": "integer", + "example": 50 + }, + "uniqueIdentifier": { + "description": "A unique identifier for the player", + "type": "string", + "example": "player-12345" + }, + "above13": { + "description": "Indicates if the player is above 13 years old", + "type": "boolean", + "example": true + }, + "parentalAuth": { + "description": "Indicates if parental authorization is required", + "type": "boolean", + "example": false + }, + "battleCharacter_ids": { + "description": "An array of up to 3 battle character MongoDB IDs", + "maxItems": 3, + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "60c72b2f5f1b2c001c8e4d60", + "60c72b2f5f1b2c001c8e4d61" + ] + }, + "currentAvatarId": { + "description": "The current avatar ID of the player", + "type": "integer", + "example": 101 + }, + "profile_id": { + "description": "The MongoDB ID of the player’s profile", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d62" + } + } + }, + "PlayerUpdate": { + "description": "Update an existing player", + "required": [ + "_id" + ], + "type": "object", + "properties": { + "_id": { + "description": "The unique MongoDB ID of the player", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d63" + }, + "name": { + "description": "The updated name of the player", + "type": "string", + "example": "UpdatedPlayerOne" + }, + "backpackCapacity": { + "description": "The updated backpack capacity", + "type": "integer", + "example": 60 + }, + "uniqueIdentifier": { + "description": "The updated unique identifier for the player", + "type": "string", + "example": "updated-player-12345" + }, + "above13": { + "description": "Updated indicator if the player is above 13 years old", + "type": "boolean", + "example": true + }, + "parentalAuth": { + "description": "Updated indicator if parental authorization is required", + "type": "boolean", + "example": false + }, + "battleCharacter_ids": { + "description": "Updated list of up to 3 battle character MongoDB IDs", + "maxItems": 3, + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "60c72b2f5f1b2c001c8e4d64", + "60c72b2f5f1b2c001c8e4d65", + "73972b2f5f1b2c001c8e4a30" + ] + }, + "currentAvatarId": { + "description": "Updated current avatar ID", + "type": "integer", + "example": 202 + }, + "clan_id": { + "description": "The MongoDB ID of the player’s clan", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d66" + }, + "clan_idToDelete": { + "description": "The MongoDB ID of the clan to be removed", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d67" + } + } + }, + "ClanCreate": { + "required": [ + "name", + "tag", + "labels", + "phrase" + ], + "type": "object", + "properties": { + "name": { + "description": "name of the clan, unique", + "type": "string", + "example": "my_clan" + }, + "isOpen": { + "description": "whenever the clan is open or closed", + "default": true, + "type": "boolean", + "example": true + }, + "labels": { + "description": "labels that describes the clan, notice that it is an enums array", + "default": [], + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "eläinrakkaat", + "itsenäiset" + ] + }, + "ageRange": { + "description": "the age range of the Clan, notice it is an enum", + "default": "None", + "type": "string", + "example": "Adults" + }, + "goal": { + "description": "the goal of the Clan, notice it is an enum", + "default": "None", + "type": "string", + "example": "Grindaus" + }, + "phrase": { + "description": "the motto phrase of the Clan", + "type": "string", + "example": "Adults" + }, + "language": { + "description": "the language that Clan primarly uses, notice it is an enum", + "default": "None", + "type": "string", + "example": "Spanish" + }, + "clanLogo": { + "required": [ + "logoType", + "pieceColors" + ], + "type": "object", + "properties": { + "logoType": { + "description": "Type of the logo", + "enum": [ + "Heart" + ], + "type": "string", + "example": "Heart" + }, + "pieceColors": { + "description": "List of piece colors in hexadecimal format.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "#FF5733", + "#33FF57", + "#3357FF" + ] + } + } + } + } + }, + "ClanJoinCreate": { + "required": [ + "clan_id", + "player_id" + ], + "type": "object", + "properties": { + "clan_id": { + "description": "the Clan _id which player want to join", + "type": "string", + "example": "667bfec6afb8211b4bd8dbff" + }, + "player_id": { + "description": "the Player _id who want to join", + "type": "string", + "example": "666720806cc90102f60bd325" + }, + "join_message": { + "description": "optional message for joining request (for closed Clans only)", + "type": "string", + "example": "User 2 wants to join" + } + } + }, + "ClanJoinUpdate": { + "required": [ + "_id" + ], + "type": "object", + "properties": { + "_id": { + "description": "the request _id, to be updated", + "type": "string", + "example": "666720806cc90102f60bd325" + }, + "clan_id": { + "description": "the Clan _id which player want to join", + "type": "string", + "example": "667bfec6afb8211b4bd8dbff" + }, + "player_id": { + "description": "the Player _id who want to join", + "type": "string", + "example": "666720806cc90102f60bd325" + }, + "join_message": { + "description": "optional message for joining request (for closed Clans only)", + "type": "string", + "example": "User 2 wants to join" + } + } + }, + "RoomUpdate": { + "type": "object", + "properties": { + "_id": { + "description": "The _id of the Room, readonly", + "type": "string", + "example": "668d6003a9292e300e94c833" + }, + "floorType": { + "description": "The type of the floor in the room", + "type": "string", + "example": "floor1" + }, + "wallType": { + "description": "The type of the wall in the room", + "type": "string", + "example": "wall1" + }, + "isActive": { + "description": "Indicates whether the room is active or deactivated", + "type": "boolean", + "example": false + }, + "deactivationTimestamp": { + "description": "Indicates when the Room will be deactivated", + "type": "number", + "example": 1721927762 + }, + "hasLift": { + "description": "Indicates whether the room has lift or staicases", + "type": "boolean", + "example": false + } + } + }, + "ChatCreate": { + "description": "Create a new Chat", + "type": "object", + "properties": { + "name": { + "description": "The name of the chat", + "type": "string", + "example": "Chat 1" + } + } + }, + "ChatUpdate": { + "description": "Update an existing Chat", + "type": "object", + "properties": { + "_id": { + "description": "The _id of the Chat, readonly", + "type": "string", + "example": "66912712d191c865ab53da8a" + }, + "name": { + "description": "The name of the chat", + "type": "string", + "example": "Chat 1" + }, + "messages": { + "description": "List of messages in the chat", + "type": "array", + "items": { + "type": "object" + }, + "example": [] + } + } + }, + "MessageCreate": { + "description": "", + "type": "object", + "properties": { + "id": { + "description": "The photon ID of the message", + "type": "integer", + "example": 15 + }, + "senderUsername": { + "description": "The username of the message sender", + "type": "string", + "example": "user1" + }, + "content": { + "description": "The content of the message", + "type": "string", + "example": "message 15" + }, + "feeling": { + "description": "The feeling associated with the message (enum from 1-3)", + "type": "integer", + "example": 1 + } + } + }, + "CustomCharacterCreate": { + "description": "Create new CustomCharacter", + "required": [ + "characterId", + "level" + ], + "type": "object", + "properties": { + "characterId": { + "description": "The CharacterId enum value, which determines what type of the character is", + "enum": [ + 101, + 201, + 202, + 301, + 401, + 501, + 502, + 601, + 603, + 701 + ], + "type": "string", + "example": 201 + }, + "level": { + "description": "The level of the custom character", + "type": "integer", + "example": 201 + } + } + }, + "CustomCharacterUpdate": { + "description": "Update an existing custom character", + "required": [ + "_id" + ], + "type": "object", + "properties": { + "_id": { + "description": "The unique MongoDB ID of the custom character", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d60" + }, + "characterId": { + "description": "Optional updated CharacterId enum value", + "enum": [ + 101, + 201, + 202, + 301, + 401, + 501, + 502, + 601, + 603, + 701 + ], + "type": "string", + "example": 201 + }, + "defence": { + "description": "Optional updated defence value", + "type": "integer", + "example": 50 + }, + "hp": { + "description": "Optional updated HP value", + "type": "integer", + "example": 150 + }, + "size": { + "description": "Optional updated size value", + "type": "integer", + "example": 180 + }, + "attack": { + "description": "Optional updated attack value", + "type": "integer", + "example": 75 + }, + "speed": { + "description": "Optional updated speed value", + "type": "integer", + "example": 30 + }, + "level": { + "description": "Optional updated level value", + "type": "integer", + "example": 10 + } + } + }, + "ErrorAuthentication": { + "title": "Error on Authentication", + "description": "Error happen on authentication", + "type": "object", + "properties": { + "response": { + "type": "string", + "example": "AUTHENTICATION_FAILED" + }, + "status": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 401 + }, + "message": { + "nullable": true, + "description": "Error message explaining the error reason", + "type": "string", + "example": "Could not authenticate the user" + }, + "name": { + "description": "Name of the error", + "type": "string", + "example": "" + }, + "reason": { + "description": "Why the error happen", + "enum": [ + "AUTHENTICATION_FAILED", + "NOT_AUTHENTICATED", + "INVALID_AUTH_TOKEN" + ], + "type": "string", + "example": "AUTHENTICATION_FAILED" + }, + "field": { + "nullable": true, + "description": "On which field the error happen", + "type": "string" + }, + "value": { + "nullable": true, + "type": "string" + }, + "additional": { + "nullable": true, + "description": "Additional data, which can be useful. For unexpected errors this field will include the error happen", + "type": "string" + }, + "statusCode": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 401 + }, + "objectType": { + "description": "Type of the object. All errors are of type APIError", + "type": "string", + "example": "APIError" + } + } + }, + "APIErrorReason": { + "description": "Enum with all possible APIError reasons", + "enum": [ + "NOT_FOUND", + "BAD_REQUEST", + "NOT_UNIQUE", + "REQUIRED", + "NOT_ALLOWED", + "VALIDATION", + "NOT_STRING", + "NOT_NUMBER", + "NOT_BOOLEAN", + "NOT_ARRAY", + "NOT_OBJECT", + "NOT_DATE", + "WRONG_ENUM", + "LESS_THAN_MIN", + "MORE_THAN_MAX", + "NOT_AUTHENTICATED", + "INVALID_AUTH_TOKEN", + "AUTHENTICATION_FAILED", + "NOT_AUTHORIZED", + "TOO_MANY_REQUESTS", + "MISCONFIGURED", + "NOT_AVAILABLE", + "UNEXPECTED" + ], + "type": "string" + }, + "ErrorValidation": { + "title": "Error on Validation", + "description": "Error happen, because some of the fields are not valid", + "type": "object", + "properties": { + "response": { + "type": "string", + "example": "NOT_STRING" + }, + "status": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 400 + }, + "message": { + "nullable": true, + "description": "Error message explaining the error reason", + "type": "string", + "example": "name must be a string" + }, + "name": { + "description": "Name of the error", + "type": "string", + "example": "" + }, + "reason": { + "description": "Why the error happen", + "enum": [ + "BAD_REQUEST", + "REQUIRED", + "NOT_ALLOWED", + "VALIDATION", + "NOT_STRING", + "NOT_NUMBER", + "NOT_BOOLEAN", + "NOT_ARRAY", + "NOT_OBJECT", + "NOT_DATE", + "WRONG_ENUM", + "LESS_THAN_MIN", + "MORE_THAN_MAX" + ], + "type": "string", + "example": "NOT_STRING" + }, + "field": { + "nullable": true, + "description": "On which field the error happen", + "type": "string", + "example": "name" + }, + "value": { + "nullable": true, + "type": "string", + "example": 1 + }, + "additional": { + "nullable": true, + "description": "Additional data, which can be useful. For unexpected errors this field will include the error happen", + "type": "string", + "example": "isString" + }, + "statusCode": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 400 + }, + "objectType": { + "description": "Type of the object. All errors are of type APIError", + "type": "string", + "example": "APIError" + } + } + }, + "ErrorNotFound": { + "title": "Error on Not Found", + "description": "Error happen if the requested object(s) can not be found", + "type": "object", + "properties": { + "response": { + "type": "string", + "example": "NOT_FOUND" + }, + "status": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 404 + }, + "message": { + "nullable": true, + "description": "Error message explaining the error reason", + "type": "string", + "example": "Could not find any objects with specified id" + }, + "name": { + "description": "Name of the error", + "type": "string", + "example": "" + }, + "reason": { + "description": "Why the error happen", + "enum": [ + "NOT_FOUND" + ], + "type": "string", + "example": "NOT_FOUND" + }, + "field": { + "nullable": true, + "description": "On which field the error happen", + "type": "string", + "example": "_id" + }, + "value": { + "nullable": true, + "type": "string", + "example": "64df3aad42cbaf850a3f891f" + }, + "additional": { + "nullable": true, + "description": "Additional data, which can be useful. For unexpected errors this field will include the error happen", + "type": "string" + }, + "statusCode": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 404 + }, + "objectType": { + "description": "Type of the object. All errors are of type APIError", + "type": "string", + "example": "APIError" + } + } + }, + "ErrorNotUnique": { + "title": "Error on Not Unique", + "description": "Error happen if an unique value already exists in DB", + "type": "object", + "properties": { + "response": { + "type": "string", + "example": "NOT_UNIQUE" + }, + "status": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 409 + }, + "message": { + "nullable": true, + "description": "Error message explaining the error reason", + "type": "string", + "example": "Field \"name\" with value \"John\" already exists" + }, + "name": { + "description": "Name of the error", + "type": "string", + "example": "" + }, + "reason": { + "description": "Why the error happen", + "enum": [ + "NOT_UNIQUE" + ], + "type": "string", + "example": "NOT_UNIQUE" + }, + "field": { + "nullable": true, + "description": "On which field the error happen", + "type": "string", + "example": "name" + }, + "value": { + "nullable": true, + "type": "string", + "example": "John" + }, + "additional": { + "nullable": true, + "description": "Additional data, which can be useful. For unexpected errors this field will include the error happen", + "type": "string" + }, + "statusCode": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 409 + }, + "objectType": { + "description": "Type of the object. All errors are of type APIError", + "type": "string", + "example": "APIError" + } + } + }, + "ErrorAuthorization": { + "title": "Error on Authorization", + "description": "Logged-in user does not have a permission to execute the action", + "type": "object", + "properties": { + "response": { + "type": "string", + "example": "NOT_AUTHORIZED" + }, + "status": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 403 + }, + "message": { + "nullable": true, + "description": "Error message explaining the error reason", + "type": "string", + "example": "The logged-in user has no permission to execute create_request action" + }, + "name": { + "description": "Name of the error", + "type": "string", + "example": "" + }, + "reason": { + "description": "Why the error happen", + "enum": [ + "NOT_AUTHORIZED" + ], + "type": "string", + "example": "NOT_AUTHORIZED" + }, + "field": { + "nullable": true, + "description": "On which field the error happen", + "type": "string" + }, + "value": { + "nullable": true, + "type": "string" + }, + "additional": { + "nullable": true, + "description": "Additional data, which can be useful. For unexpected errors this field will include the error happen", + "type": "string", + "example": "create_request" + }, + "statusCode": { + "format": "int32", + "description": "HTTP status code of the error", + "type": "integer", + "example": 403 + }, + "objectType": { + "description": "Type of the object. All errors are of type APIError", + "type": "string", + "example": "APIError" + } + } + }, + "ErrorServer": { + "title": "Error on Server", + "description": "Error happen on server side", + "type": "object", + "properties": { + "response": { + "type": "string", + "example": "UNEXPECTED" + }, + "status": { + "format": "int32", + "description": "HTTP status code of the error", + "enum": [ + 500, + 503 + ], + "type": "integer", + "example": 500 + }, + "message": { + "nullable": true, + "description": "Error message explaining the error reason", + "type": "string", + "example": "Unexpected error happen" + }, + "name": { + "description": "Name of the error", + "type": "string", + "example": "" + }, + "reason": { + "description": "Why the error happen", + "enum": [ + "MISCONFIGURED", + "NOT_AVAILABLE", + "UNEXPECTED" + ], + "type": "string", + "example": "UNEXPECTED" + }, + "field": { + "nullable": true, + "description": "On which field the error happen", + "type": "string" + }, + "value": { + "nullable": true, + "type": "string" + }, + "additional": { + "nullable": true, + "description": "Additional data, which can be useful. For unexpected errors this field will include the error happen", + "type": "string" + }, + "statusCode": { + "format": "int32", + "description": "HTTP status code of the error", + "enum": [ + 500, + 503 + ], + "type": "integer", + "example": 500 + }, + "objectType": { + "description": "Type of the object. All errors are of type APIError", + "type": "string", + "example": "APIError" + } + } + }, + "ClanExclude": { + "required": [ + "player_id" + ], + "type": "object", + "properties": { + "player_id": { + "description": "the Player _id which need to be excluded from the clan", + "type": "string", + "example": "666720806cc90102f60bd325" + } + } + }, + "ItemUpdate": { + "description": "Update an existing item", + "required": [ + "_id", + "location" + ], + "type": "object", + "properties": { + "_id": { + "description": "MongoDB ID of the item", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d70" + }, + "location": { + "description": "An array containing exactly 2 numeric values representing coordinates", + "maxItems": 2, + "minItems": 2, + "type": "array", + "items": { + "type": "number" + }, + "example": [ + 2, + 3 + ] + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "description": "Found object(s). The response objects has three fields: data, metaData and paginationData.\nThe data has the requested data. It has an object or array, which key is a collection name.\n\nThe metaData contains additional data, which can be used for parsing the data object: \ndataKey - collection name, in data object,\ndataType - type of object in data object.\n\nThe paginationData is the data for pagination. Only on GET requests, when reading many objects\n", + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "metaData": { + "type": "object", + "properties": { + "dataKey": { + "description": "The key in the data object", + "type": "string", + "example": "Clan" + }, + "modelName": { + "description": "The name of the model class in data object", + "type": "string", + "example": "Clan" + }, + "dataType": { + "description": "The type of the data: Array or Object", + "type": "string", + "example": "Array" + }, + "dataCount": { + "description": "The count of data items(dataType is Array)", + "type": "integer", + "example": 1 + } + } + }, + "paginationData": { + "type": "object", + "properties": { + "currentPage": { + "description": "The current page number", + "type": "integer", + "example": 1 + }, + "limit": { + "description": "The limit of items per page", + "type": "integer", + "example": 20 + }, + "offset": { + "description": "The offset of items", + "type": "integer", + "example": 0 + }, + "itemCount": { + "description": "The total number of items", + "type": "integer", + "example": 1 + }, + "pageCount": { + "description": "The total number of pages", + "type": "integer", + "example": 1 + } + } + } + } + } + } + }, + "description": "Success request, response with body. [Here is more about GET requests](https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests))" + }, + "201": { + "content": { + "application/json": { + "schema": { + "description": "Created object. The response objects has two fields: data, metaData.\n\nThe data has the created object data. It has an object inside, which key is a collection name.\n\nThe metaData contains additional data, which can be used for parsing the data object: \ndataKey - collection name, in data object,\ndataType - type of object in data object.", + "required": [], + "type": "object" + } + } + }, + "description": "Created, response for POST requests with body" + }, + "204": { + "description": "Successful request, response with no body" + }, + "400": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/APIConflictError" + }, + "example": { + "statusCode": 400, + "message": [ + "password must be a string" + ], + "error": "Bad Request" + } + } + }, + "description": "Validation error. Some of the fields are not specified, have wrong data types or any over validation problem", + "x-last-modified": 1718798714047 + }, + "200_one": { + "content": { + "application/json": { + "schema": { + "description": "Found object. The response objects has two fields: data and metaData.\nThe data has the requested data. It has an object inside, which key is a collection name.\n\nThe metaData contains additional data, which can be used for parsing the data object: \ndataKey - collection name, in data object,\ndataType - type of object in data object.", + "type": "object", + "properties": { + "data": { + "type": "object" + }, + "metaData": { + "type": "object", + "properties": { + "dataKey": { + "description": "The key in the data object", + "type": "string", + "example": "Clan" + }, + "modelName": { + "description": "The name of the model class in data object", + "type": "string", + "example": "Clan" + }, + "dataType": { + "description": "The type of the data: Array or Object", + "type": "string", + "example": "Object" + }, + "dataCount": { + "description": "The count of data items(dataType is Array)", + "type": "integer", + "example": 1 + } + } + } + } + } + } + }, + "description": "Success request, response with body. [Here is more about GET requests](https://github.com/Alt-Org/Altzone-Server/wiki/3.-Data-fetching-(GET-requests))" + }, + "400_New": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "statusCode": { + "format": "int32", + "description": "HTTP status code of the response", + "type": "integer", + "example": 400 + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorValidation" + } + } + } + } + } + }, + "description": "Validation error. Some of the fields are not specified, have wrong data types or any over validation problem" + }, + "401_New": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "statusCode": { + "format": "int32", + "description": "HTTP status code of the response", + "type": "integer", + "example": 401 + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorAuthentication" + } + } + } + } + } + }, + "description": "Not authenticated. The Authorization header is not specified or the token is expired. [Here is more about auth](https://github.com/Alt-Org/Altzone-Server/wiki/2.-Authentication-and-authorization)" + }, + "403_New": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "statusCode": { + "format": "int32", + "description": "HTTP status code of the response", + "type": "integer", + "example": 403 + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorAuthorization" + } + } + } + } + } + }, + "description": "No permission. The logged-in user has no permission to execute the action. [Here is more about auth](https://github.com/Alt-Org/Altzone-Server/wiki/2.-Authentication-and-authorization)" + }, + "404_New": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "statusCode": { + "format": "int32", + "description": "HTTP status code of the response", + "type": "integer", + "example": 404 + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorNotFound" + } + } + } + } + } + }, + "description": "Not found. No object(s) found" + }, + "409_New": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "statusCode": { + "format": "int32", + "description": "HTTP status code of the response", + "type": "integer", + "example": 409 + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorNotUnique" + } + } + } + } + } + }, + "description": "Some of the fields are not unique " + }, + "500_New": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "statusCode": { + "format": "int32", + "description": "HTTP status code of the response", + "type": "integer", + "example": 500 + }, + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ErrorServer" + } + } + } + } + } + }, + "description": "Unexpected error happened. [Please create a new issue here](https://github.com/Alt-Org/Altzone-Server/issues) and specify the endpoint, HTTP method and description if u have any" + } + }, + "parameters": { + "_id": { + "deprecated": false, + "name": "_id", + "description": "_id of the object", + "in": "path", + "required": true, + "x-last-modified": 1718961163935 + } + }, + "examples": { + "BattleCharacterNoId": { + "value": { + "characterClass_id": "6480a26287b5e6ba2a0f630a", + "customCharacter_id": "6480a27887b5e6ba2a0f630d" + } + }, + "BattleCharacterWithId": { + "value": { + "_id": "648acf3a409da618287a1ca1", + "unityKey": "somekey", + "name": "My custom1", + "resistance": 56, + "speed": 10, + "attack": 28, + "defence": 10, + "characterClassName": "my char", + "gestaltCycle": 1, + "characterClass_id": "648acec6409da618287a1c8e", + "customCharacter_id": "648acf23409da618287a1c98" + } + }, + "CharacterClassNoId": { + "value": { + "name": "my char", + "gestaltCycle": 1, + "speed": 23, + "resistance": 45, + "attack": 10, + "defence": 12 + } + }, + "CharacterClassWithId": { + "value": { + "_id": "648095322a99de2e3bdee480", + "name": "my char", + "gestaltCycle": 1, + "speed": 23, + "resistance": 45, + "attack": 10, + "defence": 12 + } + }, + "ClanNoId": { + "value": { + "name": "clan", + "gameCoins": 260, + "tag": "some tag" + } + }, + "ClanWithId": { + "value": { + "_id": "648091def1bdcdb2a19af6da", + "name": "clan", + "gameCoins": 260, + "tag": "some tag" + } + }, + "CustomCharacterNoId": { + "value": { + "unityKey": "somekey", + "name": "My custom1", + "speed": 10, + "resistance": 56, + "attack": 28, + "defence": 10, + "characterClass_id": "6480a26287b5e6ba2a0f630a", + "player_id": "64809d1336b0779ede245fc1" + } + }, + "CustomCharacterWithId": { + "value": { + "_id": "647f520fa8a94ef3c91cb0e3", + "unityKey": "somekey", + "name": "My custom1", + "speed": 10, + "resistance": 56, + "attack": 28, + "defence": 10, + "characterClass_id": "6480a26287b5e6ba2a0f630a", + "player_id": "64809d1336b0779ede245fc1" + } + }, + "FurnitureNoId": { + "value": { + "name": "furn1", + "shape": "shape1", + "weight": 12, + "material": "mat1", + "recycling": "rec1", + "unityKey": "unity1", + "filename": "file1.txt", + "clan_id": "64809d0a36b0779ede245fbf" + } + }, + "FurnitureWithId": { + "value": { + "_id": "648ad033409da618287a1ca5", + "name": "furn1", + "shape": "shape1", + "weight": 12, + "material": "mat1", + "recycling": "rec1", + "unityKey": "unity1", + "filename": "file1", + "clan_id": "648acf02409da618287a1c91" + } + }, + "PlayerNoId": { + "value": { + "name": "Anna", + "backpackCapacity": 20, + "uniqueIdentifier": "1", + "clan_id": "64809d0a36b0779ede245fbf" + } + }, + "PlayerWithId": { + "value": { + "_id": "648acf12409da618287a1c95", + "name": "Anna", + "backpackCapacity": 23, + "uniqueIdentifier": "1", + "clan_id": "648acf02409da618287a1c91" + } + }, + "RaidRoomNoId": { + "value": { + "type": 0, + "rowCount": 4, + "colCount": 6, + "player_id": "64809d1336b0779ede245fc1", + "clan_id": "64809d0a36b0779ede245fbf" + } + }, + "RaidRoomWithId": { + "value": { + "_id": "647f53b5a8a94ef3c91cb104", + "type": 0, + "rowCount": 4, + "colCount": 6, + "player_id": "64809d1336b0779ede245fc1", + "clan_id": "64809d0a36b0779ede245fbf" + } + } + }, + "securitySchemes": { + "JWTAuth": { + "scheme": "bearer", + "bearerFormat": "JWT", + "type": "http", + "description": "Example of header: \nAuthorization: Bearer access_token" + } + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "tags": [ + { + "name": "release-09-02-2025", + "description": "Release made on 09.02.2025" + }, + { + "name": "Profile", + "description": "profile" + }, + { + "name": "Clan", + "description": "clan" + }, + { + "name": "Player", + "description": "player" + }, + { + "name": "SoulHome", + "description": "soulhome" + }, + { + "name": "Room", + "description": "room" + }, + { + "name": "Stock", + "description": "stock" + }, + { + "name": "Item", + "description": "item" + }, + { + "name": "CustomCharacter", + "description": "CustomCharacter" + }, + { + "name": "Auth", + "description": "Authentication related features" + }, + { + "name": "Chat", + "description": "chats and their messages " + }, + { + "name": "GameAnalytics", + "description": "Various functionality for game analytics" + }, + { + "name": "FleaMarket", + "description": "Flea market, place where Clans can sell own items or buy other's." + }, + { + "name": "Voting", + "description": "In-game votings" + }, + { + "name": "Leaderboard", + "description": "Leaderboards of different categories" + }, + { + "name": "DailyTasks", + "description": "In-game tasks for Player to do daily, weekly, monthly" + } + ], + "externalDocs": { + "description": "GitHub wikipages", + "url": "https://github.com/Alt-Org/Altzone-Server/wiki" + } +} \ No newline at end of file diff --git a/swagger/swagger.json b/swagger/swagger.json index 6c6a7022..df3c4f37 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -2080,24 +2080,81 @@ "1": { "value": { "data": { - "CustomCharacter": { - "objectType": "CustomCharacterDto", - "_id": "66939de4db98c5ba6bb192f1", - "unityKey": "somekey12", - "name": "My custom5", - "speed": 37, - "resistance": 40, - "attack": 55, - "defence": 14, - "hp": 120, - "player_id": "665df7026bf5b8f670569ea4" - } + "CustomCharacter": [ + { + "objectType": "CustomCharacterDto", + "_id": "67a854de7daa100af3fac4ac", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd52327a90a33d0985f6b", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd51827a90a33d0985f65", + "characterId": "202", + "defence": 3, + "hp": 2, + "size": 4, + "speed": 10, + "attack": 8, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd50f27a90a33d0985f5f", + "characterId": "201", + "defence": 5, + "hp": 2, + "size": 6, + "speed": 10, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd50a27a90a33d0985f59", + "characterId": "401", + "defence": 20, + "hp": 10, + "size": 10, + "speed": 10, + "attack": 50, + "level": 2, + "player_id": "679cd4db27a90a33d0985f4e" + } + ] }, "metaData": { "dataKey": "CustomCharacter", "modelName": "CustomCharacter", - "dataType": "Object", - "dataCount": 1 + "dataType": "Array", + "dataCount": 5 + }, + "paginationData": { + "currentPage": 1, + "limit": 20, + "offset": 0, + "itemCount": 5, + "pageCount": 1 } } } @@ -2194,15 +2251,15 @@ "data": { "CustomCharacter": { "objectType": "CustomCharacterDto", - "_id": "66939de4db98c5ba6bb192f1", - "unityKey": "somekey12", - "name": "My custom5", - "speed": 37, - "resistance": 40, - "attack": 55, - "defence": 14, - "characterClass_id": "66939d9f9fdbf76f01d5dbd5", - "player_id": "665df7026bf5b8f670569ea4" + "_id": "67a854de7daa100af3fac4ac", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" } }, "metaData": { @@ -2255,15 +2312,15 @@ "data": { "CustomCharacter": { "objectType": "CustomCharacterDto", - "_id": "66939de4db98c5ba6bb192f1", - "unityKey": "somekey12", - "name": "My custom5", - "speed": 37, - "resistance": 40, - "attack": 55, - "defence": 14, - "hp": 120, - "player_id": "665df7026bf5b8f670569ea4" + "_id": "67a854de7daa100af3fac4ac", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" } }, "metaData": { @@ -3233,10 +3290,10 @@ } ] }, - "/playerTasks": { + "/dailyTasks": { "get": { "tags": [ - "PlayerTasks" + "DailyTasks" ], "responses": { "200": { @@ -3246,81 +3303,254 @@ "1": { "value": { "data": { - "PlayerTask": { - "daily": [ - { - "id": 21, - "title": { - "fi": "Pelaa 3 taistelua" - }, - "content": { - "fi": "Sun pitää pelata tänään 3 taistelua" - }, - "amount": 3, - "type": "play_battle", - "coins": 30, - "points": 60 - }, - { - "id": 22, - "title": { - "fi": "Voita 5 taistelua" - }, - "content": { - "fi": "Sun pitää voittaa tänään 5 taistelua" - }, - "amount": 5, - "type": "win_battle", - "coins": 250, - "points": 500 - }, - { - "id": 23, - "title": { - "fi": "Lähetä 10 viestiä chattiin" - }, - "content": { - "fi": "Sun pitää lähettää tänään 10 viestiä chattiin" - }, - "amount": 10, - "type": "write_chat_message", - "coins": 45, - "points": 90 - }, - { - "id": 24, - "title": { - "fi": "Aloita taistelu eri hahmolla" - }, - "content": { - "fi": "Sun pitää aloittaa taistelu eri hahmolla" - }, - "amount": 3, - "type": "start_battle_with_new_character", - "coins": 30, - "points": 60 - }, - { - "id": 25, - "title": { - "fi": "Äänestä 2 kertaa" - }, - "content": { - "fi": "Sun pitää äänestää tänään 2 kertaa" - }, - "amount": 2, - "type": "vote", - "coins": 20, - "points": 40 - } - ] - } + "DailyTask": [ + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3501", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 17 taistelua", + "type": "play_battle", + "points": 92, + "coins": 46, + "amount": 17, + "amountLeft": 17, + "timeLimitMinutes": 34 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3502", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 2 taistelua", + "type": "play_battle", + "points": 71, + "coins": 35, + "amount": 2, + "amountLeft": 2, + "timeLimitMinutes": 4 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3503", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 9 taistelua", + "type": "play_battle", + "points": 32, + "coins": 16, + "amount": 9, + "amountLeft": 9, + "timeLimitMinutes": 18 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3504", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 16 taistelua", + "type": "win_battle", + "points": 50, + "coins": 25, + "amount": 16, + "amountLeft": 16, + "timeLimitMinutes": 32 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3505", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 20 viestiä chattiin", + "type": "write_chat_message", + "points": 23, + "coins": 11, + "amount": 20, + "amountLeft": 20, + "timeLimitMinutes": 40 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3506", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 4 viestiä chattiin", + "type": "write_chat_message", + "points": 68, + "coins": 34, + "amount": 4, + "amountLeft": 4, + "timeLimitMinutes": 8 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3507", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 3 viestiä chattiin", + "type": "write_chat_message", + "points": 91, + "coins": 45, + "amount": 3, + "amountLeft": 3, + "timeLimitMinutes": 6 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3508", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 19 taistelua", + "type": "win_battle", + "points": 83, + "coins": 41, + "amount": 19, + "amountLeft": 19, + "timeLimitMinutes": 38 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3509", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 15 taistelua", + "type": "play_battle", + "points": 55, + "coins": 27, + "amount": 15, + "amountLeft": 15, + "timeLimitMinutes": 30 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350a", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 5 viestiä chattiin", + "type": "write_chat_message", + "points": 21, + "coins": 10, + "amount": 5, + "amountLeft": 5, + "timeLimitMinutes": 10 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350b", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 10 viestiä chattiin", + "type": "write_chat_message", + "points": 91, + "coins": 45, + "amount": 10, + "amountLeft": 10, + "timeLimitMinutes": 20 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350c", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 5 viestiä chattiin", + "type": "write_chat_message", + "points": 70, + "coins": 35, + "amount": 5, + "amountLeft": 5, + "timeLimitMinutes": 10 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350d", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 2 viestiä chattiin", + "type": "write_chat_message", + "points": 21, + "coins": 10, + "amount": 2, + "amountLeft": 2, + "timeLimitMinutes": 4 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350e", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 6 taistelua", + "type": "win_battle", + "points": 77, + "coins": 38, + "amount": 6, + "amountLeft": 6, + "timeLimitMinutes": 12 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf350f", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Lähetä 3 viestiä chattiin", + "type": "write_chat_message", + "points": 38, + "coins": 19, + "amount": 3, + "amountLeft": 3, + "timeLimitMinutes": 6 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3512", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 13 taistelua", + "type": "play_battle", + "points": 93, + "coins": 46, + "amount": 13, + "amountLeft": 13, + "timeLimitMinutes": 26 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3513", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 13 taistelua", + "type": "win_battle", + "points": 10, + "coins": 5, + "amount": 13, + "amountLeft": 13, + "timeLimitMinutes": 26 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3514", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 5 taistelua", + "type": "win_battle", + "points": 17, + "coins": 8, + "amount": 5, + "amountLeft": 5, + "timeLimitMinutes": 10 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3510", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Voita 2 taistelua", + "type": "win_battle", + "points": 51, + "coins": 25, + "amount": 2, + "amountLeft": 2, + "timeLimitMinutes": 4 + }, + { + "objectType": "DailyTaskDto", + "_id": "67a85c1c0a8da114b5bf3511", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 17 taistelua", + "type": "play_battle", + "points": 100, + "coins": 50, + "amount": 17, + "amountLeft": 17, + "timeLimitMinutes": 34 + } + ] }, "metaData": { - "dataKey": "PlayerTask", - "modelName": "PlayerTask", - "dataType": "Object", - "dataCount": 1 + "dataKey": "DailyTask", + "modelName": "DailyTask", + "dataType": "Array", + "dataCount": 20 } } } @@ -3335,6 +3565,9 @@ "401": { "$ref": "#/components/responses/401_New" }, + "404": { + "$ref": "#/components/responses/404_New" + }, "500": { "$ref": "#/components/responses/500_New" } @@ -3785,6 +4018,256 @@ "summary": "Get items of the logged-in user clan", "description": "Get items of the logged-in user clan.\n\nNotice that it will return 403 if the logged-in player is not in any clan." } + }, + "/customCharacter/battleCharacters": { + "get": { + "tags": [ + "CustomCharacter" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "CustomCharacter": [ + { + "objectType": "CustomCharacterDto", + "_id": "679cd50f27a90a33d0985f5f", + "characterId": "201", + "defence": 5, + "hp": 2, + "size": 6, + "speed": 10, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd51827a90a33d0985f65", + "characterId": "202", + "defence": 3, + "hp": 2, + "size": 4, + "speed": 10, + "attack": 8, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + }, + { + "objectType": "CustomCharacterDto", + "_id": "679cd52327a90a33d0985f6b", + "characterId": "401", + "defence": 10, + "hp": 3, + "size": 8, + "speed": 4, + "attack": 7, + "level": 1, + "player_id": "679cd4db27a90a33d0985f4e" + } + ] + }, + "metaData": { + "dataKey": "CustomCharacter", + "modelName": "CustomCharacter", + "dataType": "Array", + "dataCount": 3 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get logged-in player chosen CustomCharacters", + "description": "Get logged-in player chosen CustomCharacters for a battle" + } + }, + "/dailyTasks/:_id": { + "get": { + "tags": [ + "DailyTasks" + ], + "responses": { + "200": { + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Get daily task by _id", + "description": "Get specific daily task by _id" + }, + "delete": { + "tags": [ + "DailyTasks" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Delete daily task by _id", + "description": "Delete task by specified _id.\n\nNotice that a new task will be generated to replace the old one." + } + }, + "/dailyTasks/reserve/:_id": { + "put": { + "tags": [ + "DailyTasks" + ], + "responses": { + "200": { + "content": { + "application/json": { + "examples": { + "1": { + "value": { + "data": { + "Object": { + "_id": "67a85c1c0a8da114b5bf3501", + "clan_id": "67a85c1c0a8da114b5bf34ac", + "title": "Pelaa 17 taistelua", + "type": "play_battle", + "points": 92, + "coins": 46, + "amount": 17, + "amountLeft": 17, + "timeLimitMinutes": 34, + "__v": 0, + "player_id": "67a85b8b0a8da114b5bf348f", + "startedAt": "2025-02-09T08:02:08.170Z", + "id": "67a85c1c0a8da114b5bf3501" + } + }, + "metaData": { + "dataKey": "Object", + "modelName": "Object", + "dataType": "Object", + "dataCount": 1 + } + } + } + } + } + }, + "description": "Success, response with body" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Reserve a daily task", + "description": "Reserve a daily task for the loged-in player.\n\nReserved task can not be taken by other clan members.\n\nNotice that clan members will get a notification about the task was reserved" + } + }, + "/item": { + "put": { + "requestBody": { + "description": "Update item", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ItemUpdate" + } + } + }, + "required": true + }, + "tags": [ + "Item" + ], + "responses": { + "204": { + "$ref": "#/components/responses/204" + }, + "400": { + "$ref": "#/components/responses/400_New" + }, + "401": { + "$ref": "#/components/responses/401_New" + }, + "404": { + "$ref": "#/components/responses/404_New" + }, + "500": { + "$ref": "#/components/responses/500_New" + } + }, + "security": [ + { + "JWTAuth": [] + } + ], + "summary": "Update item", + "description": "Update item by specified _id" + } } }, "components": { @@ -3947,24 +4430,46 @@ "type": "object", "properties": { "name": { - "description": "The name of the Player, unique", + "description": "The name of the player", "type": "string", - "example": "User 1" + "example": "PlayerOne" }, "backpackCapacity": { - "description": "The capacity of the Player's backpack", + "description": "The capacity of the player’s backpack", "type": "integer", - "example": 453 + "example": 50 }, "uniqueIdentifier": { - "description": "The identifier for the player, unique", + "description": "A unique identifier for the player", "type": "string", - "example": "1" + "example": "player-12345" }, "above13": { - "description": "Is Player age 13 or above", + "description": "Indicates if the player is above 13 years old", "type": "boolean", "example": true + }, + "parentalAuth": { + "description": "Indicates if parental authorization is required", + "type": "boolean", + "example": false + }, + "battleCharacter_ids": { + "description": "An array of up to 3 battle character MongoDB IDs", + "maxItems": 3, + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "60c72b2f5f1b2c001c8e4d60", + "60c72b2f5f1b2c001c8e4d61" + ] + }, + "currentAvatarId": { + "description": "The current avatar ID of the player", + "type": "integer", + "example": 101 } } } @@ -4145,79 +4650,127 @@ } }, "PlayerCreate": { - "description": "", + "description": "Create a new player", + "required": [ + "name", + "backpackCapacity", + "uniqueIdentifier" + ], "type": "object", "properties": { "name": { - "description": "The name of the Player, unique", + "description": "The name of the player", "type": "string", - "example": "User 1" - }, - "uniqueIdentifier": { - "description": "The identifier for the Player, unique", - "type": "string", - "example": "1" + "example": "PlayerOne" }, "backpackCapacity": { - "description": "The capacity of the Player's backpack", + "description": "The capacity of the player’s backpack", "type": "integer", - "example": 34 + "example": 50 }, - "profile_id": { - "description": "The id of the associated Profile", + "uniqueIdentifier": { + "description": "A unique identifier for the player", "type": "string", - "example": "6686cac271adebdb10f33fee" + "example": "player-12345" }, "above13": { - "description": "Is Player age 13 or above, default null", + "description": "Indicates if the player is above 13 years old", "type": "boolean", "example": true }, "parentalAuth": { - "description": "Is Player got parents approval, default null", + "description": "Indicates if parental authorization is required", "type": "boolean", - "example": true + "example": false + }, + "battleCharacter_ids": { + "description": "An array of up to 3 battle character MongoDB IDs", + "maxItems": 3, + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "60c72b2f5f1b2c001c8e4d60", + "60c72b2f5f1b2c001c8e4d61" + ] + }, + "currentAvatarId": { + "description": "The current avatar ID of the player", + "type": "integer", + "example": 101 + }, + "profile_id": { + "description": "The MongoDB ID of the player’s profile", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d62" } } }, "PlayerUpdate": { - "description": "", + "description": "Update an existing player", + "required": [ + "_id" + ], "type": "object", "properties": { "_id": { - "description": "The _id of the Player, readonly", + "description": "The unique MongoDB ID of the player", "type": "string", - "example": "6686cb3b71adebdb10f33ffb" + "example": "60c72b2f5f1b2c001c8e4d63" }, "name": { - "description": "The name of the Player, unique", - "type": "string", - "example": "User 1" - }, - "uniqueIdentifier": { - "description": "The identifier for the Player, unique", + "description": "The updated name of the player", "type": "string", - "example": "1" + "example": "UpdatedPlayerOne" }, "backpackCapacity": { - "description": "The capacity of the Player's backpack", + "description": "The updated backpack capacity", "type": "integer", - "example": 34 + "example": 60 }, - "profile_id": { - "description": "The id of the associated Profile", + "uniqueIdentifier": { + "description": "The updated unique identifier for the player", "type": "string", - "example": "6686cac271adebdb10f33fee" + "example": "updated-player-12345" }, "above13": { - "description": "Is Player age 13 or above", + "description": "Updated indicator if the player is above 13 years old", "type": "boolean", "example": true }, "parentalAuth": { - "description": "Is Player got parents approval, default null", + "description": "Updated indicator if parental authorization is required", "type": "boolean", - "example": true + "example": false + }, + "battleCharacter_ids": { + "description": "Updated list of up to 3 battle character MongoDB IDs", + "maxItems": 3, + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "60c72b2f5f1b2c001c8e4d64", + "60c72b2f5f1b2c001c8e4d65", + "73972b2f5f1b2c001c8e4a30" + ] + }, + "currentAvatarId": { + "description": "Updated current avatar ID", + "type": "integer", + "example": 202 + }, + "clan_id": { + "description": "The MongoDB ID of the player’s clan", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d66" + }, + "clan_idToDelete": { + "description": "The MongoDB ID of the clan to be removed", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d67" } } }, @@ -4456,101 +5009,95 @@ } }, "CustomCharacterCreate": { - "description": "", + "description": "Create new CustomCharacter", "required": [ - "unityKey", - "name", - "speed", - "resistance", - "attack", - "defence", - "hp" + "characterId", + "level" ], "type": "object", "properties": { - "unityKey": { - "description": "The Unity key of the custom character", - "type": "string", - "example": "somekey12" - }, - "name": { - "description": "The name of the custom character", + "characterId": { + "description": "The CharacterId enum value, which determines what type of the character is", + "enum": [ + 101, + 201, + 202, + 301, + 401, + 501, + 502, + 601, + 603, + 701 + ], "type": "string", - "example": "My custom5" - }, - "speed": { - "description": "The speed attribute of the custom character", - "type": "integer", - "example": 37 - }, - "resistance": { - "description": "The resistance attribute of the custom character", - "type": "integer", - "example": 40 + "example": 201 }, - "attack": { - "description": "The attack attribute of the custom character", - "type": "integer", - "example": 55 - }, - "defence": { - "description": "The defence attribute of the custom character", + "level": { + "description": "The level of the custom character", "type": "integer", - "example": 14 - }, - "hp": { - "description": "the HP of the Character", - "type": "number", - "example": 120 + "example": 201 } } }, "CustomCharacterUpdate": { - "description": "", + "description": "Update an existing custom character", "required": [ "_id" ], "type": "object", "properties": { "_id": { - "description": "The CustomCharacter _id to update", + "description": "The unique MongoDB ID of the custom character", "type": "string", - "example": "somekey12" + "example": "60c72b2f5f1b2c001c8e4d60" }, - "unityKey": { - "description": "The Unity key of the custom character", + "characterId": { + "description": "Optional updated CharacterId enum value", + "enum": [ + 101, + 201, + 202, + 301, + 401, + 501, + 502, + 601, + 603, + 701 + ], "type": "string", - "example": "somekey12" + "example": 201 }, - "name": { - "description": "The name of the custom character", - "type": "string", - "example": "My custom5" + "defence": { + "description": "Optional updated defence value", + "type": "integer", + "example": 50 }, - "speed": { - "description": "The speed attribute of the custom character", + "hp": { + "description": "Optional updated HP value", "type": "integer", - "example": 37 + "example": 150 }, - "resistance": { - "description": "The resistance attribute of the custom character", + "size": { + "description": "Optional updated size value", "type": "integer", - "example": 40 + "example": 180 }, "attack": { - "description": "The attack attribute of the custom character", + "description": "Optional updated attack value", "type": "integer", - "example": 55 + "example": 75 }, - "defence": { - "description": "The defence attribute of the custom character", + "speed": { + "description": "Optional updated speed value", "type": "integer", - "example": 14 + "example": 30 }, - "hp": { - "description": "reference, The ID of the character class", - "type": "number", - "example": 120 + "level": { + "description": "Optional updated level value", + "type": "integer", + "example": 10 } } }, @@ -4993,6 +5540,34 @@ "example": "666720806cc90102f60bd325" } } + }, + "ItemUpdate": { + "description": "Update an existing item", + "required": [ + "_id", + "location" + ], + "type": "object", + "properties": { + "_id": { + "description": "MongoDB ID of the item", + "type": "string", + "example": "60c72b2f5f1b2c001c8e4d70" + }, + "location": { + "description": "An array containing exactly 2 numeric values representing coordinates", + "maxItems": 2, + "minItems": 2, + "type": "array", + "items": { + "type": "number" + }, + "example": [ + 2, + 3 + ] + } + } } }, "responses": { @@ -5517,7 +6092,7 @@ "description": "Leaderboards of different categories" }, { - "name": "PlayerTasks", + "name": "DailyTasks", "description": "In-game tasks for Player to do daily, weekly, monthly" } ],