avniproject / avni-server

Backend APIs for Avni
https://avniproject.org
GNU Affero General Public License v3.0
7 stars 25 forks source link

SubjectType edit triggers Subjects lastModifiedDateTime modification #689

Open 1t5j0y opened 8 months ago

1t5j0y commented 8 months ago

Context

If registration sync concepts are configured for a subject type, there is a batch job to update last modified date time for subjects of this subject type so that it will get synced to users.

Problem

Any subject type edit, even when not configuring registration sync concepts is triggering the batch job.

Issues:

PUT /web/subjectType/ needs some cleanup.

Investigation done as part of #686

  1. isSyncRegistrationConcept1Usable and isSyncRegistrationConcept2Usable are supposed to be system managed properties but are present in the external contract and writeable via them. When these are set to 'false', any update to the subject type triggers the sync attribute job and modifies last_modified_date_time for all subjects of that subject type.
  2. The value of the 'usable' fields needs to be managed better i.e. currently false and null have the same meaning to us but cause different behaviour (point 1). -- Solutions: Either make the fields boolean or manage the value correctly i.e. usable should always be null when there is no corresponding sync registration concept.
  3. Logic is split across controller and service layer making it hard to write tests for.