sublinks / sublinks-api

MIT License
68 stars 17 forks source link

The updatedAt property of SlurFilter is immutable #373

Closed lazyguru closed 1 month ago

lazyguru commented 2 months ago

Seeing this error in the logs:

HHH000502: The [updatedAt] property of the [com.sublinks.sublinksapi.slurfilter.entities.SlurFilter] entity was modified, but it won't be updated because the property is immutable.
rohit-satya commented 2 months ago

@lazyguru Please assign this issue to me

rohit-satya commented 2 months ago

@lazyguru Please review above PR

Pdzly commented 1 month ago

grafik

After investigating it, this function in the SlurFIlterService is the source of this error. ( Used in the sitecontroller for updating and creating the sites slur filter )

I dont know WHY this code would ever edit the updatedAt attribute? but the error wont show up if i comment out the usage in the edit site endpoint.

Additionally, the updated_at attribute wont get updated

Pdzly commented 1 month ago

Ahhh found out why. The @UpdatedTimestamp updates the attribute.

Ashwinn11 commented 1 month ago

why updatable is false here? In SlurFilterService , we are updating regex attribute. Whenever a attribute is modified , the updatedAt should be updated right?

lazyguru commented 1 month ago

Because the ORM is allowed to update it, but the field itself should not be modifiable by code or user action (eg, the user should not be able to influence the value to be something other than the current timestamp)

Ashwinn11 commented 1 month ago

Removing @UpdateTimeStamp for UpdatedAt attribute should work. Is this issue specific for SlurFilterService ?