sheltermanager / asm3

Animal Shelter Manager
GNU General Public License v3.0
109 stars 67 forks source link

json/xml_animals service methods #1576

Open bobintetley opened 3 days ago

bobintetley commented 3 days ago

One customer raised an issue with the current mechanism for retrieving images. When you're doing the service call to animal_image and passing an animalid and seq, if a new image is added or the preferred image changes, the seq value will return different images. They think this is an issue because our CDN is caching the images against their seq values and returning the old ones.

The CDN should be caching according to the cache control header we set, which is 24 hours for the client and 1 hour for the server.

It would be better if these calls included an attribute on each animal that contained a list of all the photo URLs as service calls to the media_image method. Add a method to the media.py module to get all the photo URLs for all the IDs in a list of animals and add it as a new PHOTOURLS attribute to the animal list. This one method can then wrap the calls in service.py that do this. One of the parameters should be the media type so that the same method can work for other records like lost and found animals if necessary (with the default being media.ANIMAL).