mirror of
http://git.whoc.org.uk/git/password-manager.git
synced 2024-11-14 07:49:02 +01:00
flask backend: fix access_date population
Enables saving updates to access_date and ensures it is populated
This commit is contained in:
parent
c55bb5eff2
commit
a25b3aaa22
@ -438,6 +438,11 @@ class message(HandlerMixin):
|
|||||||
result['oldestUsedEncryptedVersion'] = oldest_encryption_version
|
result['oldestUsedEncryptedVersion'] = oldest_encryption_version
|
||||||
result['versions'] = record_versions
|
result['versions'] = record_versions
|
||||||
result['currentVersion'] = record.current_record_version.reference
|
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})
|
return jsonify({'result': result})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -104,8 +104,12 @@ class RecordVersion(db.Model):
|
|||||||
self.version = self.record.version
|
self.version = self.record.version
|
||||||
self.previous_version_key = recordVersionData['previousVersionKey']
|
self.previous_version_key = recordVersionData['previousVersionKey']
|
||||||
self.update_date = datetime.datetime.utcnow()
|
self.update_date = datetime.datetime.utcnow()
|
||||||
|
self.access_date = datetime.datetime.utcnow()
|
||||||
|
|
||||||
self.record.update(someData['record'], self)
|
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.data = data['data']
|
||||||
self.api_version = data['version']
|
self.api_version = data['version']
|
||||||
self.update_date = datetime.datetime.now()
|
self.update_date = datetime.datetime.now()
|
||||||
|
self.access_date = datetime.datetime.now()
|
||||||
self.current_record_version = record_version
|
self.current_record_version = record_version
|
||||||
self.version += 1
|
self.version += 1
|
||||||
|
|
||||||
|
def access(self):
|
||||||
|
self.access_date = datetime.datetime.now()
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user