Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • s3206149/mod4-wp-2023-2024-pokemon
  • s3281744/mod4-wp-2023-2024-pokemon
  • s3128989/mod4-wp-2023-2024-pokemon
  • s3263797/m-4-pokemon
  • s3203255/mod4-wp-2023-2024-pokemon
  • s2854961/mod-4-wp-2023-2024-pokemons
  • s3192016/pokemon-practical-sessions
  • s3126080/mod4-wp-2023-2024-pokemon
  • s3165442/poke-mon
  • s3187152/mod4-wp-2023-2024-pokemon
  • s3209105/mod4-wp-2023-2024-pokemon
  • s3362779/mod4-wp-2023-2024-pokemon
  • s3173011/mod-4-wp-3-2023-2024-pokemon
  • s3174506/mod4-wp-2023-2024-pokemon
  • s3216926/mod-4-wp-2023-2024-pokemon-2nd
  • s3211770/mod4-wp-2023-2024-pokemon
  • s2936011/mod4-wp-2023-2024-pokemon
  • s3234312/mod4-wp-2023-2024-pokemon
  • s3362264/mod4-wp-2023-2024-pokemon
  • s3204766/mod4-wp-2023-2024-pokemon
  • s3363775/mod4-wp-2023-2024-pokemon
  • s3142906/mod4-wp-2023-2024-pokemon
  • s3298892/mod4-wp-2023-2024-pokemon
  • s3125866/mod-4-wp-2023-2024-pokemon-update
  • s2900556/mod-4-wp-2023-2024-pokemontut-3
  • s3196801/mod4-wp-2023-2024-pokemon
  • s2507919/mod4-wp-2023-2024-pokemon
  • Marius/mod-4-pokemon
  • s2948486/mod4-wp-2023-2024-pokemon
  • s3193748/mod4-wp-2023-2024-pokemon
  • s3199800/mod4-wp-2023-2024-pokemon
  • s3152340/mod4-wp-2023-2024-pokemon
  • s3194108/mod4-wp-2023-2024-pokemon
  • s3364518/mod4-wp-2023-2024-pokemon
  • s3200205/mod4-wp-2023-2024-pokemon
  • s3187667/pokemon-server
  • s3259633/mod4-wp-2023-2024-pokemon
  • s3137279/mod4-wp-2023-2024-pokemon
  • s3213552/mod4-wp-2023-2024-pokemon
  • s3200779/mod4-wp-2023-2024-pokemon
  • s3148157/mod4-wp-2023-2024-pokemon
  • s3196372/mod4-wp-2023-2024-pokemon
  • s3126714/mod4-wp-2023-2024-pokemon
  • s3286029/pracitcal-2
  • s3262499/mod4-wp-2023-2024-pokemon
  • s3290387/mod4-wp-2023-2024-pokemon
  • s3202798/mod4-wp-2023-2024-pokemon
  • s3210715/mod4-wp-2023-2024-pokemon
  • s3198308/mod4-wp-2023-2024-pokemon
  • s3211614/mod4-wp-2023-2024-pokemon
  • s3193691/mod4-wp-2023-2024-pokemon
  • s3273733/mod4-wp-2023-2024-pokemon
  • s3210898/mod4-wp-2023-2024-pokemon
  • s3133931/mod4-wp-2023-2024-pokemon
  • s3199479/mod4-wp-2023-2024-pokemon
  • s3190285/mod4-wp-2023-2024-pokemon
  • s3002896/mod4-wp-2023-2024-pokemon
  • s3166244/mod4-wp-2023-2024-pokemon
  • s3165582/mod4-wp-2023-2024-pokemon
  • s3147851/mod-4-wp-2023-2024-pokemon
  • web-programming-sessions/mod4-wp-2023-2024-pokemon
  • s3309630/mod4-wp-2023-2024-pokemon
  • s2914980/mod4-wp-2023-2024-pokemon
  • s3000885/mod4-wp-2023-2024-pokemon
  • s3209539/mod-4-pokemon-project
  • s3203573/kai-poke-mon
  • s3138127/mod-4-wp-2023-2024-pokemon-daniel
  • s3106586/mod4-wp-2023-2024-pokemon
  • s3183394/mod4-wp-2023-2024-pokemon
  • s3245748/mod4-wp-2023-2024-pokemon
  • s3252159/dm-mod-4-wp-2023-2024-pokemon
  • s2695154/mod4-wp-2023-2024-pokemon
  • s3171825/mod4-wp-2023-2024-pokemon
  • s3200183/mod4-wp-2023-2024-pokemon
  • s3000087/mod4-wp-2023-2024-pokemon
  • s3127168/mod4-wp-2023-2024-pokemon
  • s3137333/mod4-wp-2023-2024-pokemon
  • s3128830/mod4-wp-2023-2024-pokemon
  • s3102378/mod4-wp-2023-2024-pokemon
  • s3202224/mod4-wp-2023-2024-pokemon
  • s2590654/mod4-wp-2023-2024-pokemon
  • s3154882/mod4-wp-2023-2024-pokemon
  • s2958732/mod4-wp-2023-2024-pokemon
  • s3161293/mod4-wp-2023-2024-pokemon
  • s3133656/mod4-wp-2023-2024-pokemon
  • s3157385/mod-4-wp-2023-2024-pokemon-ali
  • s3192393/mod4-wp-2023-2024-pokemon
  • s3192016/mod4-wp-2023-2024-pokemon
  • s3211347/mod4-wp-2023-2024-pokemon
  • s3152790/mod4-wp-2023-2024-pokemon
  • s2959380/mod4-wp-2023-2024-pokemon
  • s3362906/mod4-wp-2023-2024-pokemon
  • s2964546/mod4-wp-2023-2024-pokemon
  • s3214915/mod4-wp-2023-2024-pokemon
  • s2219174/mod4-wp-2023-2024-pokemon
  • s3161595/mod4-wp-2023-2024-pokemon
  • s3207803/mod4-wp-2023-2024-pokemon
  • s3209334/mod4-wp-2023-2024-pokemon
  • s3191915/mod4-wp-2023-2024-pokemon
  • s3192253/mod4-wp-2023-2024-pokemon
  • s3137090/mod4-wp-2023-2024-pokemon
  • s3190536/mod4-wp-2023-2024-pokemon2
  • s3138585/mod4-wp-2023-2024-pokemon
  • s3186792/mod4-wp-2023-2024-pokemon
  • s2998491/mod4-wp-2023-2024-pokemon
  • s3145786/mod4-wp-2023-2024-pokemon
  • s3231046/mod4-wp-2023-2024-pokemon
  • s3125866/mod4-wp-2023-2024-pokemon
  • s3140458/mod4-wp-2023-2024-pokemon
  • s3133346/mod4-wp-2023-2024-pokemon
  • s3274519/mod4-wp-2023-2024-pokemon
  • s3216551/mod4-wp-2023-2024-pokemon
  • s3237478/mod4-wp-2023-2024-pokemon
  • s2985063/mod4-wp-2023-2024-pokemon
  • s3251942/mod4-wp-2023-2024-pokemon
  • s3305155/mod-4-wp-2023-2024-pokemon-david-sastre-madueno
  • s2675072/mod4-wp-2023-2024-pokemon
  • s3136027/mod4-wp-2023-2024-pokemon
  • s3186156/mod4-wp-2023-2024-pokemon
  • s3277305/mod4-wp-2023-2024-pokemon
  • s3242404/mod4-wp-2023-2024-pokemon
  • s3205967/mod4-wp-2023-2024-pokemon
  • s3173011/mod4-wp-2023-2024-pokemon
  • s3159736/mod4-wp-2023-2024-pokemon
  • s3207269/wplab-2
  • s3195945/mod4-wp-2023-2024-pokemon
  • s3151913/mod4-wp-2023-2024-pokemon
  • s3135136/mod4-wp-2023-2024-pokemon
  • s3216926/mod4-wp-2023-2024-pokemon
  • s3161218/mod4-wp-2023-2024-pokemon
  • s2921103/mod4-wp-2023-2024-pokemon
  • s3175561/mod4-wp-2023-2024-pokemon
  • SimeonNikolov/mod4-wp-2023-2024-pokemon
  • s3200329/mod4-wp-2023-2024-pokemon
  • s3148726/mod4-wp-2023-2024-pokemon
  • s2960796/mod4-wp-2023-2024-pokemon
  • s3098117/mod4-wp-2023-2024-pokemon
  • s3180794/mod4-wp-2023-2024-pokemon
  • s3179176/mod4-wp-2023-2024-pokemon
  • s3170268/mod4-wp-2023-2024-pokemon
  • s3126188/mod4-wp-2023-2024-pokemon
  • s3166449/pokemon-sarah-vonk
  • s3191567/mod4-wp-2023-2024-pokemon
  • s3271498/mod4-wp-2023-2024-pokemon
  • s3173089/mod4-wp-2023-2024-pokemon
  • s3172716/mod4-wp-2023-2024-pokemon
  • s3188981/mod4-wp-2023-2024-pokemon
  • s3184609/mod-4-lab-1-pokemon
  • s3144569/mod4-wp-2023-2024-pokemon
  • s3181340/poke-app-lab-06-05
  • s2900556/mod4-wp-2023-2024-pokemon
  • s3177858/mod4-wp-2023-2024-pokemon
  • s3209180/mod4-wp-2023-2024-pokemon
  • s3199495/mod4-wp-2023-2024-pokemon
  • s3163660/mod4-wp-2023-2024-pokemon
  • s3172708/mod4-wp-2023-2024-pokemon
  • s3206068/mod4-wp-2023-2024-pokemon
  • s3210774/mod4-wp-2023-2024-pokemon
  • s3200175/mod4-wp-2023-2024-pokemon
  • s3127141/mod4-wp-2023-2024-pokemon
  • s2995522/pokemon-practical-2-module-4
  • s3156621/mod4-wp-2023-2024-pokemon
  • s3126099/mod4-wp-2023-2024-pokemon
  • s3128121/mod4-wp-2023-2024-pokemon
  • s3233405/mod4-wp-2023-2024-pokemon
  • s3087921/mod4-wp-2023-2024-pokemon
  • s3202119/mod4-wp-2023-2024-pokemon
  • claudenirmf/mod4-wp-2023-2024-pokemon
168 results
Show changes
Commits on Source (8)
Showing
with 643 additions and 188 deletions
# Pokemon Trainer Database # Pokemon Trainer Database
The [Pokemon Trainer Database](https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon) is a sample web The [PokeApp](https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon) is a sample web
application designed to teach web development concepts at application designed to teach web development concepts at
the [Data & Information module](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/study-programme/#modules-technical-computer-science) the [Data & Information module](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/study-programme/#modules-technical-computer-science)
of the [Technical Computer Science](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/) of the [Technical Computer Science](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/)
...@@ -10,13 +10,16 @@ The contents of this repository are licensed ...@@ -10,13 +10,16 @@ The contents of this repository are licensed
under [Creative Commons Attribution 4.0 International (CC-BY-4.0)](./LICENSE). Viewers are welcome to reuse its contents under [Creative Commons Attribution 4.0 International (CC-BY-4.0)](./LICENSE). Viewers are welcome to reuse its contents
and to submit their own contributions. and to submit their own contributions.
## Repository structure ![](./design/models/Class%20Diagram.png)
- `/`: **NOTE: this diagram has been simplified in the implementation and several fields have been omitted.**
## Class Diagram ## Support files
## External resources - `/design`: this folder different files to support the design of the PokeApp including an [OpenAPI specification](./design/open-api.yaml) containing all routes and various [HTTP request files](./design/requests) to be executed directly from IntelliJ's HTTP client.
- `./meetings/practical-session-3.md`: [this file](./meetings/practical-session-3.md) contains different guides and tips to help you work on the practical session (e.g., how to checkout a new remote branch, or how to run HTTP requests).
## Credits
The following datasets and resources have been used in the development this project. The following datasets and resources have been used in the development this project.
...@@ -34,3 +37,5 @@ The following datasets and resources have been used in the development this proj ...@@ -34,3 +37,5 @@ The following datasets and resources have been used in the development this proj
- GitHub: [@claudenirmf](https://github.com/claudenirmf) - GitHub: [@claudenirmf](https://github.com/claudenirmf)
- LinkedIn: [@claudenir-fonseca](https://www.linkedin.com/in/claudenir-fonseca/) - LinkedIn: [@claudenir-fonseca](https://www.linkedin.com/in/claudenir-fonseca/)
- E-mail: [c.moraisfonseca@utwente.nl](c.moraisfonseca@utwente.nl) - E-mail: [c.moraisfonseca@utwente.nl](c.moraisfonseca@utwente.nl)
Additional contributions are welcome in the forms of issues and merge requests.
openapi: 3.0.3
info:
title: Example OpenAPI document
description: Example OpenAPI document
version: 1.0.0
servers:
- url: 'https://example.com'
paths:
'/api/pokemon':
get:
description: Retrieves pokemon resources.
responses:
200:
description: OK
\ No newline at end of file
No preview for this file type
...@@ -2,19 +2,19 @@ openapi: "3.0.3" ...@@ -2,19 +2,19 @@ openapi: "3.0.3"
externalDocs: externalDocs:
url: https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon url: https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon
info: info:
title: Pokémon Trainer Database API title: PokeApp API
version: "1.0" version: "1.0"
license: license:
name: Creative Commons Attribution 4.0 International (CC-BY-4.0) name: Creative Commons Attribution 4.0 International (CC-BY-4.0)
url: https://creativecommons.org/licenses/by/4.0/deed.en url: https://creativecommons.org/licenses/by/4.0/deed.en
description: The [Pokémon Trainer Database API](https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon) is a REST API part of a sample web application designed to teach web development concepts at the [Data & Information module](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/study-programme/#modules-technical-computer-science) of the [Technical Computer Science](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/) program of the [University of Twente](https://utwente.nl/en). description: The [PokeApp API](https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon) is a REST API part of a sample web application designed to teach web development concepts at the [Data & Information module](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/study-programme/#modules-technical-computer-science) of the [Technical Computer Science](https://www.utwente.nl/en/education/bachelor/programmes/technical-computer-science/) program of the [University of Twente](https://utwente.nl/en).
contact: contact:
name: Claudenir M. Fonseca name: Claudenir M. Fonseca
url: https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon/issues url: https://gitlab.utwente.nl/claudenirmf/mod4-wp-2023-2024-pokemon/issues
email: c.moraisfonseca@utwente.nl email: c.moraisfonseca@utwente.nl
servers: servers:
- description: Local Deployment - description: Local Deployment
url: http://localhost:8080/pokemon_war_exploded url: http://localhost:8080/pokemon/api
tags: tags:
- name: Trainer - name: Trainer
description: Routes for managing data about trainers. description: Routes for managing data about trainers.
...@@ -28,9 +28,40 @@ paths: ...@@ -28,9 +28,40 @@ paths:
description: Retrieves a collection of resources. description: Retrieves a collection of resources.
tags: tags:
- Trainer - Trainer
parameters:
- name: pageNumber
description: Returns the desired page.
in: query
schema:
type: number
- name: pageSize
description: Returns the desired number of resources.
in: query
schema:
type: number
responses: responses:
200: 200:
description: OK description: OK
content:
application/json:
example:
{
"meta": {
"total": 1,
"pageNumber": 1,
"pageSize": 1
},
"data": [
{
"id": "1",
"name": "Red",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"profileUrl": "https://archives.bulbagarden.net/media/upload/thumb/d/d3/Lets_Go_Pikachu_Eevee_Red.png/500px-Lets_Go_Pikachu_Eevee_Red.png"
}
]
}
post: post:
description: Creates a resource on the route's collection. description: Creates a resource on the route's collection.
tags: tags:
...@@ -39,10 +70,30 @@ paths: ...@@ -39,10 +70,30 @@ paths:
content: content:
'application/json': 'application/json':
schema: schema:
type: object $ref: '#/components/schemas/Trainer'
examples:
full:
description: Complete POST example
value: {
"name": "Red",
"profileUrl": "https://archives.bulbagarden.net/media/upload/thumb/d/d3/Lets_Go_Pikachu_Eevee_Red.png/500px-Lets_Go_Pikachu_Eevee_Red.png"
}
min:
description: Minimum POST example
value: { }
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example:
{
"id": "1",
"name": "Red",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"profileUrl": "https://archives.bulbagarden.net/media/upload/thumb/d/d3/Lets_Go_Pikachu_Eevee_Red.png/500px-Lets_Go_Pikachu_Eevee_Red.png"
}
400: 400:
description: Bad request description: Bad request
405: 405:
...@@ -63,6 +114,16 @@ paths: ...@@ -63,6 +114,16 @@ paths:
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example:
{
"id": "1",
"name": "Red",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"profileUrl": "https://archives.bulbagarden.net/media/upload/thumb/d/d3/Lets_Go_Pikachu_Eevee_Red.png/500px-Lets_Go_Pikachu_Eevee_Red.png"
}
404: 404:
description: Not found description: Not found
put: put:
...@@ -82,10 +143,31 @@ paths: ...@@ -82,10 +143,31 @@ paths:
content: content:
'application/json': 'application/json':
schema: schema:
type: object $ref: '#/components/schemas/Trainer'
examples:
full:
description: Complete PUT example
value: {
"id": "1",
"name": "New Red Name",
"profileUrl": null
}
min:
description: Minimum PUT example
value: { "id": "1" }
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example:
{
"id": "1",
"name": "New Red Name",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"profileUrl": null
}
400: 400:
description: Bad request description: Bad request
404: 404:
...@@ -122,6 +204,26 @@ paths: ...@@ -122,6 +204,26 @@ paths:
responses: responses:
200: 200:
description: OK description: OK
content:
application/json:
example:
{
"meta": {
"total": 1,
"pageNumber": 1,
"pageSize": 1
},
"data": [
{
"id": "1",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"name": "My Pikachu",
"pokemonType": "513",
"trainerId": "1"
}
]
}
post: post:
description: Creates a resource on the route's collection. description: Creates a resource on the route's collection.
tags: tags:
...@@ -130,10 +232,32 @@ paths: ...@@ -130,10 +232,32 @@ paths:
content: content:
'application/json': 'application/json':
schema: schema:
type: object $ref: '#/components/schemas/Pokemon'
examples:
full:
value: {
"name": "My Pikachu",
"pokemonType": "513",
"trainerId": "1"
}
description: Complete POST example
min:
value: { }
description: Minimum POST example
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example:
{
"id": "1",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"name": "My Pikachu",
"pokemonType": "513",
"trainerId": "1"
}
400: 400:
description: Bad request description: Bad request
405: 405:
...@@ -154,6 +278,17 @@ paths: ...@@ -154,6 +278,17 @@ paths:
responses: responses:
200: 200:
description: OK description: OK
content:
application/json:
example:
{
"id": "1",
"name": "My Pikachu",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"pokemonType": "513",
"trainerId": "1"
}
404: 404:
description: Not found description: Not found
put: put:
...@@ -168,15 +303,40 @@ paths: ...@@ -168,15 +303,40 @@ paths:
type: string type: string
minLength: 1 minLength: 1
required: true required: true
requestBody: requestBody:
content: content:
'application/json': 'application/json':
schema: schema:
type: object $ref: '#/components/schemas/Pokemon'
examples:
full:
value: {
"id": "1",
"name": "It's Blue's charmander",
"pokemonType": "4",
"trainerId": "2"
}
description: Complete PUT example
min:
value: {
"id": "1"
}
description: Minimum PUT example
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example:
{
"id": "1",
"created": "24/04/2024",
"lastUpDate": "2024-05-12T23:12:01.660866Z",
"name": "It's Blue's charmander",
"pokemonType": "4",
"trainerId": "2"
}
400: 400:
description: Bad request description: Bad request
404: 404:
...@@ -210,9 +370,67 @@ paths: ...@@ -210,9 +370,67 @@ paths:
description: Retrieves a collection of resources. description: Retrieves a collection of resources.
tags: tags:
- Pokémon Type - Pokémon Type
parameters:
- name: pageNumber
description: Returns the desired page.
in: query
schema:
type: number
- name: pageSize
description: Returns the desired number of resources.
in: query
schema:
type: number
- name: sortBy
description: Returns resources sorted according the desired attribute.
in: query
schema:
type: string
enum:
- id
- pokedexNumber
- lastUpDate
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example: {
"meta": {
"total": 1,
"pageNumber": 1,
"pageSize": 1
},
"data": [
{
"id": "1",
"name": "Abomasnow",
"created": "24/04/2024",
"lastUpDate": "24/04/2024",
"pokedexNumber": 460,
"generation": 4,
"japaneseName": "Yukinoohユキノオー",
"classification": "Frosted Tree Pokémon",
"abilities": [
"Snow Warning",
"Soundproof"
],
"baseHeight": 2.2,
"baseWeight": 135.5,
"baseHp": 90,
"baseAttack": 132,
"baseSpAttack": 132,
"baseDefense": 105,
"baseSpDefense": 105,
"baseSpeed": 30,
"captureRate": 60,
"isLegendary": false,
"imgUrl": "./images/abomasnow.png",
"primaryType": "grass",
"secondaryType": "ice"
}
]
}
post: post:
description: Creates a resource on the route's collection. description: Creates a resource on the route's collection.
tags: tags:
...@@ -221,10 +439,48 @@ paths: ...@@ -221,10 +439,48 @@ paths:
content: content:
'application/json': 'application/json':
schema: schema:
$ref: '#/components/schemas/Trainer' $ref: '#/components/schemas/PokemonType'
examples:
partial:
value: {
"id": "804",
"name": "New Pokemon Type",
"pokedexNumber": 999
}
description: Partial POST example
min:
value: { }
description: Minimum POST example
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example:
{
"id": "804",
"name": "New Pokemon Type",
"created": null,
"lastUpDate": "2024-05-13T08:07:50.212596Z",
"pokedexNumber": 999,
"generation": 0,
"japaneseName": null,
"classification": null,
"abilities": null,
"baseHeight": 0.0,
"baseWeight": 0.0,
"baseHp": 0,
"baseAttack": 0,
"baseSpAttack": 0,
"baseDefense": 0,
"baseSpDefense": 0,
"baseSpeed": 0,
"captureRate": 0,
"isLegendary": false,
"imgUrl": null,
"primaryType": null,
"secondaryType": null
}
400: 400:
description: Bad request description: Bad request
405: 405:
...@@ -245,6 +501,33 @@ paths: ...@@ -245,6 +501,33 @@ paths:
responses: responses:
200: 200:
description: OK description: OK
content:
'application/json':
example:
{
"id": "804",
"name": "Modified Pokemon Type",
"created": "2024-05-13T08:04:03.186221Z",
"lastUpDate": "2024-05-13T08:04:03.186308Z",
"pokedexNumber": 1000,
"generation": 0,
"japaneseName": null,
"classification": "The most powerful pokemon",
"abilities": null,
"baseHeight": 0.0,
"baseWeight": 0.0,
"baseHp": 0,
"baseAttack": 0,
"baseSpAttack": 0,
"baseDefense": 0,
"baseSpDefense": 0,
"baseSpeed": 0,
"captureRate": 0,
"isLegendary": false,
"imgUrl": null,
"primaryType": null,
"secondaryType": null
}
404: 404:
description: Not found description: Not found
put: put:
...@@ -264,7 +547,17 @@ paths: ...@@ -264,7 +547,17 @@ paths:
content: content:
'application/json': 'application/json':
schema: schema:
type: object $ref: '#/components/schemas/PokemonType'
examples:
partial:
value: {
"name": "Modified Pokemon Type",
"pokedexNumber": 1000
}
description: Partial PUT example
min:
value: { }
description: Minimum PUT example
responses: responses:
200: 200:
description: OK description: OK
...@@ -305,44 +598,29 @@ components: ...@@ -305,44 +598,29 @@ components:
id: id:
type: string type: string
minLength: 1 minLength: 1
type: created:
type: string type: string
enum: format: date-time
- trainer lastUpdate:
meta: type: string
type: object format: date-time
properties: name:
creation: type: string
type: string minLength: 1
format: date-time profileUrl:
lastUpdate: type: string
type: string format: uri
format: date-time pokemon:
data: type: array
type: object items:
properties: type: string
name: minLength: 1
type: string party:
minLength: 1 type: array
profileUrl: items:
type: string type: string
format: uri minLength: 1
pokemon:
type: array
items:
type: string
minLength: 1
party:
type: array
items:
type: string
minLength: 1
links:
additionalProperties:
type: array
items:
type: string
format: uri
Pokemon: Pokemon:
description: Schema describing the overall shape of pokemon resources. description: Schema describing the overall shape of pokemon resources.
type: object type: object
...@@ -350,50 +628,22 @@ components: ...@@ -350,50 +628,22 @@ components:
id: id:
type: string type: string
minLength: 1 minLength: 1
type: created:
type: string type: string
enum: format: date-time
- pokemon lastUpdate:
meta: type: string
type: object format: date-time
properties: name:
creation: type: string
type: string minLength: 1
format: date-time pokemonType:
lastUpdate: type: string
type: string minLength: 1
format: date-time trainerId:
data: type: string
type: object minLength: 1
properties:
name:
type: string
minLength: 1
height:
type: number
weight:
type: number
hp:
type: number
attack:
type: number
spAttack:
type: number
defense:
type: number
spDefense:
type: number
speed:
type: number
pokemonType:
type: string
minLength: 1
links:
additionalProperties:
type: array
items:
type: string
format: uri
PokemonType: PokemonType:
description: Schema describing the overall shape of pokemon type resources. description: Schema describing the overall shape of pokemon type resources.
type: object type: object
...@@ -401,96 +651,101 @@ components: ...@@ -401,96 +651,101 @@ components:
id: id:
type: string type: string
minLength: 1 minLength: 1
type: created:
type: string
format: date-time
lastUpdate:
type: string
format: date-time
name:
type: string
minLength: 1
pokedexNumber:
type: number
minimum: 0
generation:
type: number
minimum: 0
japaneseName:
type: string
classification:
type: string
abilities:
type: array
items:
type: string
minLength: 1
baseHeight:
type: number
minimum: 0
baseWeight:
type: number
minimum: 0
baseHp:
type: number
minimum: 0
baseAttack:
type: number
minimum: 0
baseSpAttack:
type: number
minimum: 0
baseDefense:
type: number
minimum: 0
baseSpDefense:
type: number
minimum: 0
baseSpeed:
type: number
minimum: 0
captureRate:
type: number
minimum: 0
isLegendary:
type: boolean
imgUrl:
type: string
format: uri
primaryType:
type: string
enum:
- bug
- dark
- dragon
- electric
- fairy
- fighting
- fire
- flying
- ghost
- grass
- ground
- ice
- normal
- poison
- psychic
- rock
- steel
- water
secondaryType:
type: string type: string
enum: enum:
- pokemonType - bug
meta: - dark
type: object - dragon
properties: - electric
creation: - fairy
type: string - fighting
format: date-time - fire
lastUpdate: - flying
type: string - ghost
format: date-time - grass
data: - ground
type: object - ice
properties: - normal
name: - poison
type: string - psychic
minLength: 1 - rock
pokedexNumber: - steel
type: number - water
minimum: 0
generation:
type: number
minimum: 0
japaneseName:
type: string
classification:
type: string
abilities:
type: array
items:
type: string
minLength: 1
baseHeight:
type: number
minimum: 0
baseWeight:
type: number
minimum: 0
baseHp:
type: number
minimum: 0
baseAttack:
type: number
minimum: 0
baseSpAttack:
type: number
minimum: 0
baseDefense:
type: number
minimum: 0
baseSpDefense:
type: number
minimum: 0
baseSpeed:
type: number
minimum: 0
captureRate:
type: number
minimum: 0
isLegendary:
type: boolean
imgUrl:
type: string
format: uri
primaryType:
type: string
enum:
- BUG
- DARK
- DRAGON
- ELECTRIC
- FAIRY
- FIGHTING
- FIRE
- FLYING
- GHOST
- GRASS
- GROUND
- ICE
- NORMAL
- POISON
- PSYCHIC
- ROCK
- STEEL
- WATER
links:
additionalProperties:
type: array
items:
type: string
format: uri
###
GET http://localhost:8080/pokemon/api/pokemonTypes
###
GET http://localhost:8080/pokemon/api/pokemonTypes?pageSize=1&pageNumber=1
###
GET http://localhost:8080/pokemon/api/pokemonTypes/1
###
POST http://localhost:8080/pokemon/api/pokemonTypes
Content-Type: application/json
{}
###
# Run this after creating a new pokemon type
PUT http://localhost:8080/pokemon/api/pokemonTypes/802
Content-Type: application/json
{
"id": "802",
"name": "Modified Pokemon Type"
}
###
# Run this after creating a new pokemon type
DELETE http://localhost:8080/pokemon/api/pokemonTypes/802
###
GET http://localhost:8080/pokemon/api/pokemon
###
# Run rhis after implementing pagination
GET http://localhost:8080/pokemon/api/pokemon?pageSize=1&pageNumber=1
###
# Run rhis after implementing sorting
GET http://localhost:8080/pokemon/api/pokemon?sortBy=name
###
# If you run this before creating a pokemon, it should return a 404 error
GET http://localhost:8080/pokemon/api/pokemon/1
###
POST http://localhost:8080/pokemon/api/pokemon
Content-Type: application/json
{
"name": "My new pokemon",
"pokemonType": "1",
"trainerId": "1"
}
###
# Run this after creating a new pokemon
PUT http://localhost:8080/pokemon/api/pokemon/1
Content-Type: application/json
{
"id": "1",
"name": "My modified pokemon",
"pokemonType": "1",
"trainerId": "2"
}
###
# Run this after creating a new pokemon
DELETE http://localhost:8080/pokemon/api/pokemon/1
###
GET http://localhost:8080/pokemon/api/trainers
###
GET http://localhost:8080/pokemon/api/trainers?pageSize=1&pageNumber=1
###
GET http://localhost:8080/pokemon/api/trainers/1
###
POST http://localhost:8080/pokemon/api/trainers
Content-Type: application/json
{}
###
# Run this after creating a new trainer
PUT http://localhost:8080/pokemon/api/trainers/5
Content-Type: application/json
{
"id": "5",
"name": "Ash Ketchum"
}
###
# Run this after creating a new trainer
DELETE http://localhost:8080/pokemon/api/trainers/5
## Class Diagram ## Class Diagram
![](/design/models/Class%20Diagram.png) NOTE: this diagram has been simplified in the implementation and several fields have been omitted.
![](./models/Class%20Diagram.png)
meetings/http-client.animated.gif

2.1 MiB

meetings/intellij-git-checkout-branch.png

223 KiB

meetings/intellij-git-fetch-remote.png

94.1 KiB

meetings/intellij-git-push.png

142 KiB

meetings/intellij-git-remote.png

75.6 KiB

meetings/open-api.png

1.68 MiB

# Practical Session 3 - Guides and Tips
## Changing the application name on Tomcat
As we are using IntelliJ to build and send our application to the Tomcat server, we need to change the _Running Configurations_ in order to set the base route this application. For example, when using `/pokemon` as the base route, all other routes will be affected like `/pokemon/pokemonTypes.html` and `/pokemon/api/pokemonTypes`. To change this, please set the field _Application context_ under the tab _Deployment_ to `/pokemon`.
![](./running-configurations.png)
## Checkout new branch
In order to retrieve the code for the exercises of the practical session, perform the step below on your git client. Here we'll be using IntelliJ's git client:
1. Find or list the remote list of your git client
![](./intellij-git-remote.png)
2. Fetch from the remote repository containing the original project all updates
![](./intellij-git-fetch-remote.png)
3. Checkout the branch `practical-session-3` and start working on it
![](./intellij-git-checkout-branch.png)
4. After committing your changes, push the branch to the upstream (i.e., to your fork on GitLab)
![](./intellij-git-push.png)
5. On GitLab, open a new Merge Request
Work on implementing the issues tagged as both `feature-request` and `practical-session-3`
## Running HTTP request on IntelliJ
With IntelliJ, you can create files ending with `.http` to write and run requests directly from the IDE. You can find sample files [here](./../design/requests) and the full documentation [here](https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html).
![](./http-client.animated.gif)
## REST API documentations with OpenAPI
OpenAPI is a standard for documenting REST APIs in JSON (or YAML). On IntelliJ, you can open the [our OpenAPI specification](./../design/open-api.yaml) and check all routes implemented or to be implemented, including examples.
![](./open-api.png)
meetings/running-configurations.png

537 KiB

...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>nl.utwente.mod4</groupId> <groupId>nl.utwente.mod4</groupId>
<artifactId>pokemon</artifactId> <artifactId>pokemon</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<name>mod4-wp-2023-2024-pokemon</name> <name>pokemon</name>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>
......
package nl.utwente.mod4.pokemon;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;
import nl.utwente.mod4.pokemon.dao.PokemonTypeDao;
import nl.utwente.mod4.pokemon.dao.TrainerDao;
import java.io.IOException;
@WebListener
public class InitializationListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
System.out.println("Initializing PokeApp...");
try {
PokemonTypeDao.INSTANCE.load();
TrainerDao.INSTANCE.load();
} catch (IOException e) {
System.err.println("Error while loading data.");
e.printStackTrace();
}
System.out.println("PokeApp initialized.");
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
System.out.println("Shutting down PokeApp...");
try {
PokemonTypeDao.INSTANCE.save();
TrainerDao.INSTANCE.save();
} catch (IOException e) {
System.err.println("Error while saving data.");
e.printStackTrace();
}
System.out.println("PokeApp shutdown.");
}
}