diff --git a/README.md b/README.md
index c5eb299..98ed500 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,19 @@
# PoKeMoNg
+ * [About](#about)
+ + [🗂️DCM](#dcm)
+ + [🧬UML Class diagram](#uml-class-diagram)
+ + [🗺NoSQL Schema Versioning Strategy](#nosql-schema-versioning-strategy)
+ - [Schema Versioning Pattern](#schema-versioning-pattern)
+ - [Incremental Document Migration](#incremental-document-migration)
+ * [Prep steps](#prep-steps)
+ + [♨️Java version](#java-version)
+ + [🔐Database connection](#database-connection)
+ * [Running the application in dev mode](#running-the-application-in-dev-mode)
+ + [🏴☠️SwaggerUI](#swaggerui)
+ + [🩺API testing tools](#api-testing-tools)
+ + [📱Front end (later)](#front-end-later)
+
This is a [Quarkus](https://quarkus.io/) / [MongoDB](https://mongodb.com/) app for educational purposes.
Instructions are [here](https://clientserveur-courses.clubinfo-clermont.fr/Notation.html) for reference.
@@ -14,15 +28,82 @@ This application is a RESTful service designed to emulate a basic `Pokemong` man
perform
CRUD operations on `Pokemongs`, `Trainers`, `Moves`, and `Types`.
-### 🗂️ DCM
+### 🗂️DCM
-### 🧬 UML Class diagram
-
-
+### 🧬UML Class diagram
+
+```mermaid
+classDiagram
+
+class Trainer {
+ + id: ObjectId
+ + name: string
+ + dob: date
+ + wins: int
+ + losses: int
+}
+
+class Pokemong {
+ + id: ObjectId
+ + nickname: string?
+ + dob: date
+ + level: int
+ + pokedexId: int
+ + evoStage: int
+ + evoTrack: PokemongName[]
+}
+
+class Move {
+ + id: ObjectId
+ + name: string
+ + category: MoveCategoryName
+ + power: int
+ + accuracy: int
+}
+
+class Type {
+ + id: ObjectId
+ + name: TypeName
+ + weakAgainst: TypeName[]
+ + effectiveAgainst: TypeName[]
+}
+
+class TypeName {
+ <>
+ + FIRE
+ + WATER
+ + ...
+}
+
+class PokemongName {
+ <>
+ + BULBASAUR
+ + IVYSAUR
+ + ...
+}
+
+class MoveCategoryName {
+ <>
+ + PHYSICAL
+ + SPECIAL
+ + STATUS
+}
+
+Trainer --> "0..*" Trainer: pastOpponents
+Trainer --> "0..*" Pokemong: pokemongs
+Pokemong --> "0..1" Trainer: trainer
+Pokemong --> "0..4" Move: moveSet
+Pokemong --> "1..2" Type: types
+Move --> Type: type
+
+Type ..> TypeName
+Pokemong ..> PokemongName
+Move ..> MoveCategoryName
+```
-### NoSQL Schema Versioning Strategy
+### 🗺NoSQL Schema Versioning Strategy
This application uses MongoDB, a NoSQL database, which provides flexibility in our data model. While this flexibility
has
@@ -73,7 +154,7 @@ However, note that this strategy increases write operations to the database, whi
## Prep steps
-### ♨️ Java version
+### ♨️Java version
This project is set up to use `Java 17`.
@@ -94,7 +175,7 @@ settings to use `JDK 17` for `Gradle` tasks
-### 🔐 Database connection
+### 🔐Database connection
Note that the DB connection properties are not included -- your `src/main/resources/application.properties` should look
like this :
@@ -131,7 +212,7 @@ You can run the application in dev mode using:
## API testing
-### 🧪 Sample dataset
+### 🧪Sample dataset
You can find a sample dataset at `docs/sample-dataset/`. Each JSON file contains a collection.
@@ -140,7 +221,7 @@ To load the `moves` collection into an existing MongoDB cluster, you may use [Mo
mongoimport --uri=mongodb+srv://:@..mongodb.net/ --collection=moves --file=./docs/sample-dataset/moves.json
```
-### 🏴☠️ SwaggerUI
+### 🏴☠️SwaggerUI
Thanks to this project's OpenAPI specs, you can explore the API in a lot of ways.
A popular choice is SwaggerUI -- after you run the app, just go to http://localhost:8080/q/swagger-ui and have fun.
@@ -148,14 +229,14 @@ A popular choice is SwaggerUI -- after you run the app, just go to http://localh
⚠️ Unfortunately, Swagger or Quarkus or SmallRye adds the field `id` to all request examples, but in fact ***you should
NOT include id** when you POST or UPDATE a new document.* The app takes care of it for you. Same thing for the field `species` with `Pokemong` documents.
-### 🩺 API testing tools
+### 🩺API testing tools
You can use an API testing tool such as [Postman](https://www.postman.com/)
or [Insomnia](https://insomnia.rest/) to test this app.
If you use Postman, you can even import `docs/postman_collection.json`, designed to work with the `🧪 Sample dataset`.
-### 📱 Front end (later)
+### 📱Front end (later)
Moving forward, the front end part of this app -- a different project -- might also come into play for trying out this
API.
\ No newline at end of file
diff --git a/docs/DB.md b/docs/DB.md
index f7dfcb2..6ced79a 100644
--- a/docs/DB.md
+++ b/docs/DB.md
@@ -64,7 +64,7 @@
* => referencing
- [x] pokemongs.types: one-to-few [1;2]
* => embedding
- - [x] pokemongs.moveSet: one-to-few [1;4] but will also need to be queried independently
+ - [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]
diff --git a/docs/mcd.png b/docs/mcd.png
index 20e3532..5c35faf 100644
Binary files a/docs/mcd.png and b/docs/mcd.png differ
diff --git a/src/main/java/fr/uca/iut/services/PokemongService.java b/src/main/java/fr/uca/iut/services/PokemongService.java
index a3c0743..085d300 100644
--- a/src/main/java/fr/uca/iut/services/PokemongService.java
+++ b/src/main/java/fr/uca/iut/services/PokemongService.java
@@ -93,8 +93,8 @@ public class PokemongService extends GenericService {
if (moveSet == null) {
errors.add("pokemong move set was null");
} else {
- if (moveSet.size() == 0 || moveSet.size() > 4) {
- errors.add("pokemong move set was empty or had more than 4 moves");
+ if (moveSet.size() > 4) {
+ errors.add("pokemong move set had more than 4 moves");
}
for (PokemongMove move : moveSet) {
String moveId = move.getId();
diff --git a/src/main/resources/META-INF/openapi.yaml b/src/main/resources/META-INF/openapi.yaml
index ab5d825..ba0cc4b 100644
--- a/src/main/resources/META-INF/openapi.yaml
+++ b/src/main/resources/META-INF/openapi.yaml
@@ -344,7 +344,6 @@ components:
$ref: '#/components/schemas/Type'
moveSet:
type: array
- minItems: 1
maxItems: 4
items:
$ref: '#/components/schemas/PokemongMove'