ddd-by-examples / library

A comprehensive Domain-Driven Design example with problem space strategic analysis and various tactical patterns.
MIT License
4.92k stars 726 forks source link

[FIX] Hateoas consistency and tests fixes #39

Closed kwedrowicz closed 5 years ago

kwedrowicz commented 5 years ago

First of all, thanks @pilloPl for great DDD example in practice 💪

During the project study, I found that not all tests are passing (which brokes CI). Guilty was double wrapping in HATEOAS compatible classes in PatronProfileController.

Actual patronProfile endpoint result:

{
  "entity": {
    "_links": {
      "holds": {
        "href": "http://localhost:8080/profiles/d969e595-1bc2-40ec-996c-90c6a396a3bd/holds/"
      },
      "checkouts": {
        "href": "http://localhost:8080/profiles/d969e595-1bc2-40ec-996c-90c6a396a3bd/checkouts/"
      },
      "self": {
        "href": "http://localhost:8080/profiles/d969e595-1bc2-40ec-996c-90c6a396a3bd"
      }
    },
    "patronId": "d969e595-1bc2-40ec-996c-90c6a396a3bd"
  }
}

Expected result:

{
  "_links": {
    "holds": {
      "href": "http://localhost:8080/profiles/d969e595-1bc2-40ec-996c-90c6a396a3bd/holds/"
    },
    "checkouts": {
      "href": "http://localhost:8080/profiles/d969e595-1bc2-40ec-996c-90c6a396a3bd/checkouts/"
    },
    "self": {
      "href": "http://localhost:8080/profiles/d969e595-1bc2-40ec-996c-90c6a396a3bd"
    }
  },
  "patronId": "d969e595-1bc2-40ec-996c-90c6a396a3bd"
}

Small fix applied 😄

pilloPl commented 5 years ago

Thank you so much!