Co-authored-by: alexis.drai@etu.uca.fr <alexis.drai@etu.uca.fr> Reviewed-on: #12main
parent
c817ccd5a7
commit
a5c36ea01b
@ -1,427 +1,447 @@
|
|||||||
{
|
{
|
||||||
"info": {
|
"info": {
|
||||||
"_postman_id": "11aa7a76-83a4-4b92-940f-528e29b66df8",
|
"_postman_id": "11aa7a76-83a4-4b92-940f-528e29b66df8",
|
||||||
"name": "PoKeMoNg",
|
"name": "PoKeMoNg",
|
||||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
||||||
"_exporter_id": "25802734"
|
"_exporter_id": "25802734"
|
||||||
},
|
},
|
||||||
"item": [
|
"item": [
|
||||||
{
|
{
|
||||||
"name": "move",
|
"name": "move",
|
||||||
"item": [
|
"item": [
|
||||||
{
|
{
|
||||||
"name": "Create 1 move",
|
"name": "Create 1 move",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
"header": [
|
"header": [
|
||||||
{
|
{
|
||||||
"key": "Content-Type",
|
"key": "Content-Type",
|
||||||
"value": "application/json",
|
"value": "application/json",
|
||||||
"type": "text"
|
"type": "text"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\r\n \"name\": \"Bubble beam\",\r\n \"category\": \"PHYSICAL\",\r\n \"power\": 10,\r\n \"accuracy\": 85,\r\n \"type\": \r\n {\r\n \"name\": \"WATER\",\r\n \"weakAgainst\": [\"GRASS\"],\r\n \"effectiveAgainst\": [\"FIRE\", \"GROUND\"]\r\n },\r\n \"schemaVersion\": 2\r\n}",
|
"raw": "{\r\n \"name\": \"Bubble beam\",\r\n \"category\": \"PHYSICAL\",\r\n \"power\": 10,\r\n \"accuracy\": 85,\r\n \"type\": \r\n {\r\n \"name\": \"WATER\",\r\n \"weakAgainst\": [\"GRASS\"],\r\n \"effectiveAgainst\": [\"FIRE\", \"GROUND\"]\r\n },\r\n \"schemaVersion\": 2\r\n}",
|
||||||
"options": {
|
"options": {
|
||||||
"raw": {
|
"raw": {
|
||||||
"language": "json"
|
"language": "json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/move",
|
"raw": "http://localhost:8080/move",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"move"
|
"move"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Get all moves",
|
"name": "Get all moves",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/move",
|
"raw": "http://localhost:8080/move",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"move"
|
"move"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Get 1 move",
|
"name": "Get 1 move",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/move/60a64f7eae945a6e60b0e917",
|
"raw": "http://localhost:8080/move/60a64f7eae945a6e60b0e917",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"move",
|
"move",
|
||||||
"60a64f7eae945a6e60b0e917"
|
"60a64f7eae945a6e60b0e917"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Update 1 move",
|
"name": "Update 1 move",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "PUT",
|
"method": "PUT",
|
||||||
"header": [],
|
"header": [],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\r\n \"schemaVersion\": 2,\r\n \"name\": \"Ember UPDATED\",\r\n \"category\": \"SPECIAL\",\r\n \"power\": 40,\r\n \"accuracy\": 100,\r\n \"type\": {\r\n \"name\": \"FIRE\",\r\n \"weakAgainst\": [\r\n \"WATER\",\r\n \"GROUND\"\r\n ],\r\n \"effectiveAgainst\": [\r\n \"GRASS\"\r\n ]\r\n }\r\n}",
|
"raw": "{\r\n \"schemaVersion\": 2,\r\n \"name\": \"Ember UPDATED\",\r\n \"category\": \"SPECIAL\",\r\n \"power\": 40,\r\n \"accuracy\": 100,\r\n \"type\": {\r\n \"name\": \"FIRE\",\r\n \"weakAgainst\": [\r\n \"WATER\",\r\n \"GROUND\"\r\n ],\r\n \"effectiveAgainst\": [\r\n \"GRASS\"\r\n ]\r\n }\r\n}",
|
||||||
"options": {
|
"options": {
|
||||||
"raw": {
|
"raw": {
|
||||||
"language": "json"
|
"language": "json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/move/60a64f7eae945a6e60b0e917",
|
"raw": "http://localhost:8080/move/60a64f7eae945a6e60b0e917",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"move",
|
"move",
|
||||||
"60a64f7eae945a6e60b0e917"
|
"60a64f7eae945a6e60b0e917"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Delete 1 move",
|
"name": "Delete 1 move",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "DELETE",
|
"method": "DELETE",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/move/60a64f7eae945a6e60b0e913",
|
"raw": "http://localhost:8080/move/60a64f7eae945a6e60b0e913",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"move",
|
"move",
|
||||||
"60a64f7eae945a6e60b0e913"
|
"60a64f7eae945a6e60b0e913"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pokemong",
|
"name": "pokemong",
|
||||||
"item": [
|
"item": [
|
||||||
{
|
{
|
||||||
"name": "Create 1 pkmn",
|
"name": "Create 1 pkmn",
|
||||||
"protocolProfileBehavior": {
|
"protocolProfileBehavior": {
|
||||||
"disabledSystemHeaders": {
|
"disabledSystemHeaders": {
|
||||||
"content-type": true
|
"content-type": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"request": {
|
"request": {
|
||||||
"method": "POST",
|
"method": "POST",
|
||||||
"header": [
|
"header": [
|
||||||
{
|
{
|
||||||
"key": "Content-Type",
|
"key": "Content-Type",
|
||||||
"value": "application/json"
|
"value": "application/json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\r\n \"nickname\": \"Blappity-bloop\",\r\n \"dob\": \"2023-05-07\",\r\n \"level\": 1,\r\n \"pokedexId\": 172,\r\n \"evoStage\": 1,\r\n \"evoTrack\": [\"PICHU\", \"PIKACHU\", \"RAICHU\"],\r\n \"types\": [\r\n {\r\n \"name\": \"ELECTRIC\",\r\n \"weakAgainst\": [\"GROUND\", \"ROCK\"],\r\n \"effectiveAgainst\": [\"WATER\", \"FLYING\"]\r\n }\r\n ],\r\n \"moveSet\": \r\n [\r\n {\r\n \"id\": \"60a64f7eae945a6e60b0e917\",\r\n \"name\": \"Ember\"\r\n }\r\n ],\r\n \"schemaVersion\": 1\r\n}"
|
"raw": "{\r\n \"nickname\": \"Blappity-bloop\",\r\n \"dob\": \"2023-05-07\",\r\n \"level\": 1,\r\n \"pokedexId\": 172,\r\n \"evoStage\": 1,\r\n \"evoTrack\": [\"PICHU\", \"PIKACHU\", \"RAICHU\"],\r\n \"types\": [\r\n {\r\n \"name\": \"ELECTRIC\",\r\n \"weakAgainst\": [\"GROUND\", \"ROCK\"],\r\n \"effectiveAgainst\": [\"WATER\", \"FLYING\"]\r\n }\r\n ],\r\n \"moveSet\": \r\n [\r\n {\r\n \"id\": \"60a64f7eae945a6e60b0e917\",\r\n \"name\": \"Ember\"\r\n }\r\n ],\r\n \"schemaVersion\": 1\r\n}"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/pokemong",
|
"raw": "http://localhost:8080/pokemong",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"pokemong"
|
"pokemong"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Get all pkmn",
|
"name": "Get all pkmn",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/pokemong",
|
"raw": "http://localhost:8080/pokemong",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"pokemong"
|
"pokemong"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Get 1 pkmn",
|
"name": "Get 1 pkmn",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/pokemong/60a64f7eae945a6e60b0e911",
|
"raw": "http://localhost:8080/pokemong/60a64f7eae945a6e60b0e911",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"pokemong",
|
"pokemong",
|
||||||
"60a64f7eae945a6e60b0e911"
|
"60a64f7eae945a6e60b0e911"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Update 1 pkmn",
|
"name": "Update 1 pkmn",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "PUT",
|
"method": "PUT",
|
||||||
"header": [
|
"header": [
|
||||||
{
|
{
|
||||||
"key": "Content-Type",
|
"key": "Content-Type",
|
||||||
"value": "application/json"
|
"value": "application/json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"mode": "raw",
|
"mode": "raw",
|
||||||
"raw": "{\n \"schemaVersion\": 1,\n \"nickname\": \"Sparky UPDATED\",\n \"dob\": \"1994-02-18\",\n \"level\": 15,\n \"pokedexId\": 1,\n \"evoStage\": 1,\n \"evoTrack\": [\n \"BULBASAUR\",\n \"IVYSAUR\",\n \"VENUSAUR\"\n ],\n \"trainer\": \"60a64f7eae945a6e60b0e914\",\n \"types\": [\n {\n \"name\": \"GRASS\",\n \"weakAgainst\": [\n \"FIRE\"\n ],\n \"effectiveAgainst\": [\n \"WATER\",\n \"GROUND\"\n ]\n }\n ],\n \"moveSet\": [\n {\n \"id\": \"60a64f7eae945a6e60b0e912\",\n \"name\": \"Vine Whip\"\n }\n ]\n}"
|
"raw": "{\n \"schemaVersion\": 1,\n \"nickname\": \"Sparky UPDATED\",\n \"dob\": \"1994-02-18\",\n \"level\": 15,\n \"pokedexId\": 1,\n \"evoStage\": 1,\n \"evoTrack\": [\n \"BULBASAUR\",\n \"IVYSAUR\",\n \"VENUSAUR\"\n ],\n \"trainer\": \"60a64f7eae945a6e60b0e914\",\n \"types\": [\n {\n \"name\": \"GRASS\",\n \"weakAgainst\": [\n \"FIRE\"\n ],\n \"effectiveAgainst\": [\n \"WATER\",\n \"GROUND\"\n ]\n }\n ],\n \"moveSet\": [\n {\n \"id\": \"60a64f7eae945a6e60b0e912\",\n \"name\": \"Vine Whip\"\n }\n ]\n}"
|
||||||
},
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/pokemong/60a64f7eae945a6e60b0e911",
|
"raw": "http://localhost:8080/pokemong/60a64f7eae945a6e60b0e911",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"pokemong",
|
"pokemong",
|
||||||
"60a64f7eae945a6e60b0e911"
|
"60a64f7eae945a6e60b0e911"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Delete 1 pkmn",
|
"name": "Delete 1 pkmn",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "DELETE",
|
"method": "DELETE",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/pokemong/60a64f7eae945a6e60b0e916",
|
"raw": "http://localhost:8080/pokemong/60a64f7eae945a6e60b0e916",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"pokemong",
|
"pokemong",
|
||||||
"60a64f7eae945a6e60b0e916"
|
"60a64f7eae945a6e60b0e916"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Get all pkmn by nickname",
|
"name": "Get many pkmn by nickname",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/pokemong/nickname/sparky",
|
"raw": "http://localhost:8080/pokemong/nickname/sparky",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"pokemong",
|
"pokemong",
|
||||||
"nickname",
|
"nickname",
|
||||||
"sparky"
|
"sparky"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Gat all pkmn by date interval",
|
"name": "Get many pkmn by date interval",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"header": [],
|
"header": [],
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/pokemong/dob/1995-01-01/1999-01-01",
|
"raw": "http://localhost:8080/pokemong/dob/1995-01-01/1999-01-01",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"pokemong",
|
"pokemong",
|
||||||
"dob",
|
"dob",
|
||||||
"1995-01-01",
|
"1995-01-01",
|
||||||
"1999-01-01"
|
"1999-01-01"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
},
|
"name": "Get mapping of all pkmn count by evo stage",
|
||||||
{
|
"request": {
|
||||||
"name": "trainer",
|
"method": "GET",
|
||||||
"item": [
|
"header": [],
|
||||||
{
|
"url": {
|
||||||
"name": "Create 1 trainer",
|
"raw": "http://localhost:8080/pokemong/count-by-evo-stage",
|
||||||
"request": {
|
"protocol": "http",
|
||||||
"method": "POST",
|
"host": [
|
||||||
"header": [],
|
"localhost"
|
||||||
"body": {
|
],
|
||||||
"mode": "raw",
|
"port": "8080",
|
||||||
"raw": "{\r\n \"schemaVersion\": 1,\r\n \"name\": \"Bloop\",\r\n \"dob\": \"1997-02-18\",\r\n \"wins\": 1,\r\n \"losses\": 50,\r\n \"pastOpponents\": [\r\n \"60a64f7eae945a6e60b0e915\"\r\n ],\r\n \"pokemongs\": [\r\n {\r\n \"id\": \"60a64f7eae945a6e60b0e911\",\r\n \"nickname\": \"Sparky UPDATED\",\r\n \"species\": \"IVYSAUR\"\r\n }\r\n ]\r\n}",
|
"path": [
|
||||||
"options": {
|
"pokemong",
|
||||||
"raw": {
|
"count-by-evo-stage"
|
||||||
"language": "json"
|
]
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
"response": []
|
||||||
"url": {
|
}
|
||||||
"raw": "http://localhost:8080/trainer",
|
]
|
||||||
"protocol": "http",
|
},
|
||||||
"host": [
|
{
|
||||||
"localhost"
|
"name": "trainer",
|
||||||
],
|
"item": [
|
||||||
"port": "8080",
|
{
|
||||||
"path": [
|
"name": "Create 1 trainer",
|
||||||
"trainer"
|
"request": {
|
||||||
]
|
"method": "POST",
|
||||||
}
|
"header": [],
|
||||||
},
|
"body": {
|
||||||
"response": []
|
"mode": "raw",
|
||||||
},
|
"raw": "{\r\n \"schemaVersion\": 1,\r\n \"name\": \"Bloop\",\r\n \"dob\": \"1997-02-18\",\r\n \"wins\": 1,\r\n \"losses\": 50,\r\n \"pastOpponents\": [\r\n \"60a64f7eae945a6e60b0e915\"\r\n ],\r\n \"pokemongs\": [\r\n {\r\n \"id\": \"60a64f7eae945a6e60b0e911\",\r\n \"nickname\": \"Sparky UPDATED\",\r\n \"species\": \"IVYSAUR\"\r\n }\r\n ]\r\n}",
|
||||||
{
|
"options": {
|
||||||
"name": "Get all trainers",
|
"raw": {
|
||||||
"request": {
|
"language": "json"
|
||||||
"method": "GET",
|
}
|
||||||
"header": [],
|
}
|
||||||
"url": {
|
},
|
||||||
"raw": "http://localhost:8080/trainer",
|
"url": {
|
||||||
"protocol": "http",
|
"raw": "http://localhost:8080/trainer",
|
||||||
"host": [
|
"protocol": "http",
|
||||||
"localhost"
|
"host": [
|
||||||
],
|
"localhost"
|
||||||
"port": "8080",
|
],
|
||||||
"path": [
|
"port": "8080",
|
||||||
"trainer"
|
"path": [
|
||||||
]
|
"trainer"
|
||||||
}
|
]
|
||||||
},
|
}
|
||||||
"response": []
|
},
|
||||||
},
|
"response": []
|
||||||
{
|
},
|
||||||
"name": "Get 1 trainer",
|
{
|
||||||
"request": {
|
"name": "Get all trainers",
|
||||||
"method": "GET",
|
"request": {
|
||||||
"header": [],
|
"method": "GET",
|
||||||
"url": {
|
"header": [],
|
||||||
"raw": "http://localhost:8080/trainer/60a64f7eae945a6e60b0e914",
|
"url": {
|
||||||
"protocol": "http",
|
"raw": "http://localhost:8080/trainer",
|
||||||
"host": [
|
"protocol": "http",
|
||||||
"localhost"
|
"host": [
|
||||||
],
|
"localhost"
|
||||||
"port": "8080",
|
],
|
||||||
"path": [
|
"port": "8080",
|
||||||
"trainer",
|
"path": [
|
||||||
"60a64f7eae945a6e60b0e914"
|
"trainer"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Update 1 trainer",
|
"name": "Get 1 trainer",
|
||||||
"request": {
|
"request": {
|
||||||
"method": "PUT",
|
"method": "GET",
|
||||||
"header": [],
|
"header": [],
|
||||||
"body": {
|
"url": {
|
||||||
"mode": "raw",
|
"raw": "http://localhost:8080/trainer/60a64f7eae945a6e60b0e914",
|
||||||
"raw": "{\r\n \"schemaVersion\": 1,\r\n \"name\": \"Brock\",\r\n \"dob\": \"1994-02-18\",\r\n \"wins\": 60,\r\n \"losses\": 60,\r\n \"pastOpponents\": [\r\n \"60a64f7eae945a6e60b0e914\"\r\n ],\r\n \"pokemongs\": [\r\n {\r\n \"id\": \"60a64f7eae945a6e60b0e911\",\r\n \"nickname\": \"Sparky UPDATED\",\r\n \"species\": \"IVYSAUR\"\r\n }\r\n ]\r\n}",
|
"protocol": "http",
|
||||||
"options": {
|
"host": [
|
||||||
"raw": {
|
"localhost"
|
||||||
"language": "json"
|
],
|
||||||
}
|
"port": "8080",
|
||||||
}
|
"path": [
|
||||||
},
|
"trainer",
|
||||||
"url": {
|
"60a64f7eae945a6e60b0e914"
|
||||||
"raw": "http://localhost:8080/trainer/60a64f7eae945a6e60b0e915",
|
]
|
||||||
"protocol": "http",
|
}
|
||||||
"host": [
|
},
|
||||||
"localhost"
|
"response": []
|
||||||
],
|
},
|
||||||
"port": "8080",
|
{
|
||||||
"path": [
|
"name": "Update 1 trainer",
|
||||||
"trainer",
|
"request": {
|
||||||
"60a64f7eae945a6e60b0e915"
|
"method": "PUT",
|
||||||
]
|
"header": [],
|
||||||
}
|
"body": {
|
||||||
},
|
"mode": "raw",
|
||||||
"response": []
|
"raw": "{\r\n \"schemaVersion\": 1,\r\n \"name\": \"Brock\",\r\n \"dob\": \"1994-02-18\",\r\n \"wins\": 60,\r\n \"losses\": 60,\r\n \"pastOpponents\": [\r\n \"60a64f7eae945a6e60b0e914\"\r\n ],\r\n \"pokemongs\": [\r\n {\r\n \"id\": \"60a64f7eae945a6e60b0e911\",\r\n \"nickname\": \"Sparky UPDATED\",\r\n \"species\": \"IVYSAUR\"\r\n }\r\n ]\r\n}",
|
||||||
},
|
"options": {
|
||||||
{
|
"raw": {
|
||||||
"name": "Delete 1 trainer",
|
"language": "json"
|
||||||
"request": {
|
}
|
||||||
"method": "DELETE",
|
}
|
||||||
"header": [],
|
},
|
||||||
"url": {
|
"url": {
|
||||||
"raw": "http://localhost:8080/trainer/60a64f7eae945a6e60b0e914",
|
"raw": "http://localhost:8080/trainer/60a64f7eae945a6e60b0e915",
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"host": [
|
"host": [
|
||||||
"localhost"
|
"localhost"
|
||||||
],
|
],
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"path": [
|
"path": [
|
||||||
"trainer",
|
"trainer",
|
||||||
"60a64f7eae945a6e60b0e914"
|
"60a64f7eae945a6e60b0e915"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response": []
|
"response": []
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
}
|
"name": "Delete 1 trainer",
|
||||||
]
|
"request": {
|
||||||
|
"method": "DELETE",
|
||||||
|
"header": [],
|
||||||
|
"url": {
|
||||||
|
"raw": "http://localhost:8080/trainer/60a64f7eae945a6e60b0e914",
|
||||||
|
"protocol": "http",
|
||||||
|
"host": [
|
||||||
|
"localhost"
|
||||||
|
],
|
||||||
|
"port": "8080",
|
||||||
|
"path": [
|
||||||
|
"trainer",
|
||||||
|
"60a64f7eae945a6e60b0e914"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
@ -1,87 +0,0 @@
|
|||||||
# About the database schema
|
|
||||||
|
|
||||||
## Collections
|
|
||||||
|
|
||||||
### trainers collection
|
|
||||||
|
|
||||||
* _id: ObjectId
|
|
||||||
* name: string
|
|
||||||
* (_indexed_: would often be queried in a dashboard situation)
|
|
||||||
* dob: date
|
|
||||||
* wins: int
|
|
||||||
* losses: int
|
|
||||||
* pastOpponents: array of ObjectId (references to other trainers)
|
|
||||||
* (_indexed_: reflexivity would make deep queries quite slow, so it seems worthwhile)
|
|
||||||
* pokemongs: array of ObjectId (references to owned pokemongs) + denormalizing on "nickname" and "species"
|
|
||||||
* (_indexed_: to improve speed when querying non-denormalized fields)
|
|
||||||
|
|
||||||
### pokemongs collection
|
|
||||||
|
|
||||||
* _id: ObjectId
|
|
||||||
* nickname: string?
|
|
||||||
* dob: date
|
|
||||||
* level: int
|
|
||||||
* pokedexId: int
|
|
||||||
* evoStage: int
|
|
||||||
* (_indexed_: "species" is calculated as evoTrack[evoStage], and would often be queried)
|
|
||||||
* evoTrack: array of strings (therefore "species" is evoTrack[evoStage], and "evoBase" is evoTrack[0])
|
|
||||||
* (_indexed_: "species" is calculated as evoTrack[evoStage], and would be queried often)
|
|
||||||
* trainer: ObjectId? (reference to a trainer) (but can be "wild" instead, if ref is null)
|
|
||||||
* (_indexed_: could be queried often in a dashboard situation)
|
|
||||||
* types: embedded type, or array of embedded types
|
|
||||||
* (_indexed_: would often be queried in a dashboard situation)
|
|
||||||
* moveSet: array of ObjectId (references to known moves) + denormalizing on "name"
|
|
||||||
|
|
||||||
### moves collection
|
|
||||||
|
|
||||||
* _id: ObjectId
|
|
||||||
* name: string
|
|
||||||
* (_indexed_: would often be queried in a dashboard situation)
|
|
||||||
* category: string (can be "physical", "special", or "status")
|
|
||||||
* power: int
|
|
||||||
* (_indexed_: would often be used in sorts, in a dashboard situation)
|
|
||||||
* accuracy: int
|
|
||||||
* type: embedded type
|
|
||||||
* (_indexed_: would often be queried in a dashboard situation)
|
|
||||||
|
|
||||||
### types collection
|
|
||||||
|
|
||||||
* _id: ObjectId
|
|
||||||
* name: string
|
|
||||||
* (_indexed_: would often be queried in a dashboard situation)
|
|
||||||
* weakAgainst: array of strings (denormalized type names)
|
|
||||||
* effectiveAgainst: array of strings (denormalized type names)
|
|
||||||
|
|
||||||
## Relationships
|
|
||||||
|
|
||||||
- Trainer
|
|
||||||
- [x] trainers.pastOpponents: one-to-many and reflexive
|
|
||||||
* => referencing
|
|
||||||
- [x] trainers.pokemongs: one-to-many
|
|
||||||
* => referencing + denormalizing on "nickname" and "species"
|
|
||||||
- Pokemong
|
|
||||||
- [x] pokemongs.trainer: many-to-one
|
|
||||||
* => referencing
|
|
||||||
- [x] pokemongs.types: one-to-few [1;2]
|
|
||||||
* => embedding
|
|
||||||
- [x] pokemongs.moveSet: one-to-few [0;4] but will also need to be queried independently
|
|
||||||
* => referencing + denormalizing on "name"
|
|
||||||
- Move
|
|
||||||
- [x] moves.type: one-to-one [1;1]
|
|
||||||
* => embedding
|
|
||||||
- Type
|
|
||||||
- [x] types.weakAgainst & types.effectiveAgainst: one-to-few, but reflexive
|
|
||||||
* => denormalizing on "name"
|
|
||||||
|
|
||||||
## Cascades
|
|
||||||
|
|
||||||
- Pokemong
|
|
||||||
- [x] delete ~> trainer.pokemongs
|
|
||||||
- [x] update ~> trainer.pokemongs (denormalizing on "nickname" and "species")
|
|
||||||
- [x] create ~> trainer.pokemongs
|
|
||||||
- Trainer
|
|
||||||
- [x] delete ~> pokemong.trainer
|
|
||||||
- [x] create ~> pokemong.trainer
|
|
||||||
- Move
|
|
||||||
- [x] delete ~> pokemong.moveSet
|
|
||||||
- [x] update ~> pokemong.moveSet (denormalizing on "name")
|
|
@ -0,0 +1,46 @@
|
|||||||
|
package fr.uca.iut;
|
||||||
|
|
||||||
|
import fr.uca.iut.entities.GenericEntity;
|
||||||
|
import fr.uca.iut.repositories.GenericRepository;
|
||||||
|
import fr.uca.iut.repositories.MoveRepository;
|
||||||
|
import fr.uca.iut.repositories.PokemongRepository;
|
||||||
|
import fr.uca.iut.repositories.TrainerRepository;
|
||||||
|
import io.quarkus.runtime.StartupEvent;
|
||||||
|
import jakarta.enterprise.context.ApplicationScoped;
|
||||||
|
import jakarta.enterprise.event.Observes;
|
||||||
|
import jakarta.inject.Inject;
|
||||||
|
import org.bson.Document;
|
||||||
|
|
||||||
|
@ApplicationScoped
|
||||||
|
public class Startup {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MoveRepository moveRepository;
|
||||||
|
@Inject
|
||||||
|
PokemongRepository pokemongRepository;
|
||||||
|
@Inject
|
||||||
|
TrainerRepository trainerRepository;
|
||||||
|
|
||||||
|
void onStart(@Observes StartupEvent ev) {
|
||||||
|
createIndex(moveRepository);
|
||||||
|
createIndex(pokemongRepository);
|
||||||
|
createIndex(trainerRepository);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createIndex(GenericRepository<? extends GenericEntity> repository) {
|
||||||
|
try {
|
||||||
|
repository.createIndexes();
|
||||||
|
printIndexes(repository);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("Error creating indexes for repository: " + repository.getClass());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printIndexes(GenericRepository<? extends GenericEntity> repository) {
|
||||||
|
System.out.println("indexes for " + repository.getClass());
|
||||||
|
for (Document index : repository.getCollection().listIndexes()) {
|
||||||
|
System.out.println(index.toJson());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue