Skip to content

Commit

Permalink
Added a last_used column for the api_key
Browse files Browse the repository at this point in the history
  • Loading branch information
jzbahrai committed Jan 22, 2024
1 parent 66d72b5 commit 150f516
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@ class ApiKey(BaseModel, Versioned):
created_by = db.relationship("User")
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey("users.id"), index=True, nullable=False)
compromised_key_info = db.Column(JSONB(none_as_null=True), nullable=True, default={})
last_used_timestamp = db.Column(db.DateTime, index=False, unique=False, nullable=True, default=None)

__table_args__ = (
Index(
Expand Down
1 change: 1 addition & 0 deletions tests/app/dao/test_api_key_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_save_api_key_should_create_new_api_key_and_history(sample_service):
assert len(all_api_keys) == 1
assert all_api_keys[0] == api_key
assert api_key.version == 1
assert api_key.last_used_timestamp is None

all_history = api_key.get_history_model().query.all()
assert len(all_history) == 1
Expand Down

0 comments on commit 150f516

Please sign in to comment.