|
@@ -10,10 +10,10 @@ import (
|
|
|
|
|
|
// limit consts
|
|
|
const (
|
|
|
- node_l = 0
|
|
|
- networks_l = 1
|
|
|
- users_l = 2
|
|
|
- clients_l = 3
|
|
|
+ nodesLimit = iota
|
|
|
+ networksLimit
|
|
|
+ usersLimit
|
|
|
+ clientsLimit
|
|
|
)
|
|
|
|
|
|
func checkFreeTierLimits(limitChoice int, next http.Handler) http.HandlerFunc {
|
|
@@ -23,20 +23,20 @@ func checkFreeTierLimits(limitChoice int, next http.Handler) http.HandlerFunc {
|
|
|
}
|
|
|
|
|
|
if logic.Free_Tier { // check that free tier limits not exceeded
|
|
|
- if limitChoice == networks_l {
|
|
|
+ if limitChoice == networksLimit {
|
|
|
currentNetworks, err := logic.GetNetworks()
|
|
|
if (err != nil && !database.IsEmptyRecord(err)) || len(currentNetworks) >= logic.Networks_Limit {
|
|
|
logic.ReturnErrorResponse(w, r, errorResponse)
|
|
|
return
|
|
|
}
|
|
|
- } else if limitChoice == users_l {
|
|
|
+ } else if limitChoice == usersLimit {
|
|
|
users, err := logic.GetUsers()
|
|
|
if (err != nil && !database.IsEmptyRecord(err)) || len(users) >= logic.Users_Limit {
|
|
|
errorResponse.Message = "free tier limits exceeded on users"
|
|
|
logic.ReturnErrorResponse(w, r, errorResponse)
|
|
|
return
|
|
|
}
|
|
|
- } else if limitChoice == clients_l {
|
|
|
+ } else if limitChoice == clientsLimit {
|
|
|
clients, err := logic.GetAllExtClients()
|
|
|
if (err != nil && !database.IsEmptyRecord(err)) || len(clients) >= logic.Clients_Limit {
|
|
|
errorResponse.Message = "free tier limits exceeded on external clients"
|