← Back to team overview

dhis2-devs team mailing list archive

Re: POST 'created', 'lastUpdated' in /api/metadata

 

Hi Mahendra

One issue we are seeing quite often is that people don't update the
lastUpdated field, they simply get the payload, do their updates, and send
it back (without updateing lastUpdated)

Would it be ok to check for both null AND to see if the new lastUpdated is
> old lastUpdated, we do want the field to be updated, to reflect updates..
since it is in use for filtering etc

Are you OK with that?

--
Morten

On Mon, Dec 22, 2014 at 11:41 AM, Mahendra Kariya <
mahendra.kariya@xxxxxxxxxxxxxxxx> wrote:

> Hi Lars/Morten,
>
> Please find attached the patch.
>
> It has two changes.
>
>    1. In BaseIdentifiableObject.setAutoFields(), it sets the last updated
>    time to current time only if the value from payload is null.
>    2. In AttributeValue, we have added two more columns viz. "created"
>    and "lastupdated". In DefaultIdentifiableObjectImporter, we are setting the
>    values of both fields to current date, if their values in the payload is
>    null.
>
> Please review and try to merge to trunk ASAP.
>
>
> Thanks.
>
>
>
> On Mon, Dec 22, 2014 at 10:55 AM, Mahendra Kariya <
> mahendra.kariya@xxxxxxxxxxxxxxxx> wrote:
>
>> Hi,
>>
>> We are developing an offline client for DHIS which syncs to the server
>> whenever the internet connection is available. To sync the metadata (like
>> org units, etc) created or updated on the offline client, we want DHIS to
>> save the "lastUpdated" and "created" fields from the payload of POST
>> request to /api/metadata. This will help us resolve merge conflicts during
>> sync.
>>
>> Currently, this is not supported. Irrespective of the value of
>> "lastUpdated" and "created" fields in the payload, DHIS is always taking
>> server time.
>>
>> We are planning to implement this in DHIS and send a patch. Let us know
>> your thoughts.
>>
>
>

Follow ups