diff --git a/src/mongo.go b/src/mongo.go index 020e149..4e523ce 100644 --- a/src/mongo.go +++ b/src/mongo.go @@ -31,18 +31,18 @@ type Application struct { ShortDescription string `bson:"shortDescription" json:"shortDescription"` User string `bson:"user" json:"user"` Token string `bson:"token" json:"token"` - TotalRequests uint64 `bson:"totalRequests" json:"totalRequests"` + RequestCount uint64 `bson:"requestCount" json:"requestCount"` CreatedAt time.Time `bson:"createdAt" json:"createdAt"` } type Token struct { - ID string `bson:"_id" json:"id"` - Name string `bson:"name" json:"name"` - Token string `bson:"token" json:"token"` - TotalRequests uint64 `bson:"totalRequests" json:"totalRequests"` - Application string `bson:"application" json:"application"` - CreatedAt time.Time `bson:"createdAt" json:"createdAt"` - LastUsedAt time.Time `bson:"lastUsedAt" json:"lastUsedAt"` + ID string `bson:"_id" json:"id"` + Name string `bson:"name" json:"name"` + Token string `bson:"token" json:"token"` + RequestCount uint64 `bson:"requestCount" json:"requestCount"` + Application string `bson:"application" json:"application"` + CreatedAt time.Time `bson:"createdAt" json:"createdAt"` + LastUsedAt time.Time `bson:"lastUsedAt" json:"lastUsedAt"` } func (c *MongoDB) Connect() error { diff --git a/src/util.go b/src/util.go index 905f9f4..67bf49c 100644 --- a/src/util.go +++ b/src/util.go @@ -330,6 +330,7 @@ func Authenticate(ctx *fiber.Ctx) (bool, error) { bson.M{ "application": token.Application, "timestamp": GetStartOfHour(), + "token": token.ID, }, bson.M{ "$setOnInsert": bson.M{