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:
commit
516f7ef01f
@ -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
|
||||
|
@ -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()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user