I am working on a service in a sprint boot microservice application. The consumer for my service can be another service, as well as a UI component.
The are 5 entities in my service, each entity having it's own set of CRUD APIs. Four of these entities have two datetime fields - event_start_date_time and event_end_date_time, where I store date and time without timezone (as it is assumed that the consumer will send datetime in UTC). For ex:
2020-01-01T00:00:00
In one of the entities though, only date is needed - start_date and end_date. However, for the sake of consistency, like in other entities, I have been instructed to use datetime here as well. So if the user wants to book something from 2020-01-01 to 2020-01-05, it should be represented like this -
2020-01-01T00:00:00
2020-01-05T23:59:59
Now my question is, should I expect from the consumer to send the data in above format (appending 00:00:00 and 23:59:59 to the dates)? Or should my service handle this?
If the consumer does this, then he can add some other time as well, like instead of 00:00:00 and 23:59:59, might put 00:00:05 and 14:00:00. My service can ignore consumer's time input and add correct one itself, but then it would be like discrediting the actual data that consumer has sent.
If my service is to handle it, then the API will only have date and I will be appending time part to it. But this way, it will not be consistent with the other 4 entities.
What can be the best way to do it?
Any other way to do is appreciated as well, just remember that it has to be date and time both.
Thanks.