From e3c5a93f4f6ff6000a66595be24b82b5a0e9d436 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 1 Sep 2023 11:16:36 +0200 Subject: [PATCH] chore(api tokens): remove updated date from tokens as it can't be updated anyway --- pkg/db/fixtures/api_tokens.yml | 3 --- pkg/migration/20230831155832.go | 3 +-- pkg/models/api_routes.go | 2 +- pkg/models/api_tokens.go | 2 -- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/pkg/db/fixtures/api_tokens.yml b/pkg/db/fixtures/api_tokens.yml index 1a0f38b4a..fae073256 100644 --- a/pkg/db/fixtures/api_tokens.yml +++ b/pkg/db/fixtures/api_tokens.yml @@ -7,7 +7,6 @@ expires_at: 2099-01-01 00:00:00 owner_id: 1 created: 2023-09-01 07:00:00 - updated: 2023-09-01 07:00:00 # token in plaintext is tk_2eef46f40ebab3304919ab2e7e39993f75f29d2e - id: 2 title: 'test token 2' @@ -18,7 +17,6 @@ expires_at: 2023-01-01 00:00:00 owner_id: 1 created: 2023-09-01 07:00:00 - updated: 2023-09-01 07:00:00 # token in plaintext is tk_a5e6f92ddbad68f49ee2c63e52174db0235008c8 - id: 3 title: 'test token 3' @@ -29,5 +27,4 @@ expires_at: 2099-01-01 00:00:00 owner_id: 2 created: 2023-09-01 07:00:00 - updated: 2023-09-01 07:00:00 # token in plaintext is tk_5e29ae2ae079781ff73b0a3e0fe4d75a0b8dcb7c diff --git a/pkg/migration/20230831155832.go b/pkg/migration/20230831155832.go index 0eb616345..19157c767 100644 --- a/pkg/migration/20230831155832.go +++ b/pkg/migration/20230831155832.go @@ -31,9 +31,8 @@ type apiTokens20230831155832 struct { TokenLastEight string `xorm:"not null index varchar(8)" json:"-"` Permissions map[string][]string `xorm:"json not null" json:"permissions"` ExpiresAt time.Time `xorm:"not null" json:"expires_at"` - Created time.Time `xorm:"created not null" json:"created"` - Updated time.Time `xorm:"updated not null" json:"updated"` OwnerID int64 `xorm:"bigint not null" json:"-"` + Created time.Time `xorm:"created not null" json:"created"` } func (apiTokens20230831155832) TableName() string { diff --git a/pkg/models/api_routes.go b/pkg/models/api_routes.go index 4336a8b8f..fba08dcd9 100644 --- a/pkg/models/api_routes.go +++ b/pkg/models/api_routes.go @@ -121,7 +121,7 @@ func CollectRoutesForAPITokenUsage(route echo.Route) { // @tags api // @Produce json // @Security JWTKeyAuth -// @Success 200 {array} routes.APITokenRoute "The list of all routes." +// @Success 200 {array} models.APITokenRoute "The list of all routes." // @Router /routes [get] func GetAvailableAPIRoutesForToken(c echo.Context) error { return c.JSON(http.StatusOK, apiTokenRoutes) diff --git a/pkg/models/api_tokens.go b/pkg/models/api_tokens.go index b1a4c98ef..c3952b7b7 100644 --- a/pkg/models/api_tokens.go +++ b/pkg/models/api_tokens.go @@ -51,8 +51,6 @@ type APIToken struct { // A timestamp when this api key was created. You cannot change this value. Created time.Time `xorm:"created not null" json:"created"` - // A timestamp when this api key was last updated. You cannot change this value. - Updated time.Time `xorm:"updated not null" json:"updated"` OwnerID int64 `xorm:"bigint not null" json:"-"`