Using the objects retrieved at the time of request validation

by Manish Shrestha   Last Updated September 21, 2018 09:05 AM

I hope the question title already answers the subject here. Lets say I have a number of ids that needs to be validated in a request.


request uri: [POST] /album/{album_id}/song

Request payload:

  "song_title": "hello world",
  "genre_id": 2,
  "artist_id": [100, 102],
  "lyrics_by_id": 201

Now, as we know we would definitely have to validate those ids, for which we run some queries over there.

Is there a way out, where we can use those objects or data retrieved from database in order to use it in the rest of the code?

Related Questions

Have objects delivered in terms of code reuse?

Updated July 10, 2017 19:05 PM

Implementing functional/reusable code

Updated August 02, 2017 21:05 PM