1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-12-21 14:57:50 +01:00

Merge pull request #105 from jokajak/access_date_fix

flask backend: fix access_date population
This commit is contained in:
Giulio Cesare Solaroli 2016-06-05 11:49:05 +02:00
commit 516f7ef01f
2 changed files with 13 additions and 0 deletions

View File

@ -438,6 +438,11 @@ class message(HandlerMixin):
result['oldestUsedEncryptedVersion'] = oldest_encryption_version
result['versions'] = record_versions
result['currentVersion'] = record.current_record_version.reference
record.current_record_version.access()
record.access()
db.session.add(record)
db.session.add(record_version)
db.session.commit()
return jsonify({'result': result})
@login_required

View File

@ -104,8 +104,12 @@ class RecordVersion(db.Model):
self.version = self.record.version
self.previous_version_key = recordVersionData['previousVersionKey']
self.update_date = datetime.datetime.utcnow()
self.access_date = datetime.datetime.utcnow()
self.record.update(someData['record'], self)
def access(self):
self.access_date = datetime.datetime.now()
# ------------------------------------------------------------------------------
@ -144,9 +148,13 @@ class Record(db.Model):
self.data = data['data']
self.api_version = data['version']
self.update_date = datetime.datetime.now()
self.access_date = datetime.datetime.now()
self.current_record_version = record_version
self.version += 1
def access(self):
self.access_date = datetime.datetime.now()
# ------------------------------------------------------------------------------