Skip to content

Commit

Permalink
feat: move service types to pkg (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
CristhianF7 committed Feb 15, 2024
1 parent bf1ef84 commit de2802a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions internal/db/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ package db
import (
"fmt"

"github.com/kubefirst/kubefirst-api/internal/types"
pkgtypes "github.com/kubefirst/kubefirst-api/pkg/types"
"github.com/kubefirst/kubefirst-api/pkg/types"
log "github.com/rs/zerolog/log"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
Expand All @@ -19,7 +18,7 @@ import (
// CreateClusterServiceList adds an entry for a cluster to the service list
func (mdbcl *MongoDBClient) CreateClusterServiceList(clusterName string) error {
filter := bson.D{{Key: "cluster_name", Value: clusterName}}
var result pkgtypes.Cluster
var result types.Cluster
err := mdbcl.ServicesCollection.FindOne(mdbcl.Context, filter).Decode(&result)
if err != nil {
// This error means your query did not match any documents.
Expand Down
3 changes: 1 addition & 2 deletions internal/environments/defaultEnvironments.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/kubefirst/kubefirst-api/internal/constants"
"github.com/kubefirst/kubefirst-api/internal/db"
"github.com/kubefirst/kubefirst-api/internal/env"
internalTypes "github.com/kubefirst/kubefirst-api/internal/types"
"github.com/kubefirst/kubefirst-api/pkg/types"

log "github.com/rs/zerolog/log"
Expand Down Expand Up @@ -101,7 +100,7 @@ func CreateDefaultEnvironments(mgmtCluster types.Cluster) error {
}

// Update list
err = db.Client.InsertClusterServiceListEntry(clusterName, &internalTypes.Service{
err = db.Client.InsertClusterServiceListEntry(clusterName, &types.Service{
Name: "Metaphor",
Default: true,
Description: "A multi-environment demonstration space for frontend application best practices that's easy to apply to other projects.",
Expand Down
7 changes: 3 additions & 4 deletions internal/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/kubefirst/kubefirst-api/internal/db"
"github.com/kubefirst/kubefirst-api/internal/env"
"github.com/kubefirst/kubefirst-api/internal/gitShim"
"github.com/kubefirst/kubefirst-api/internal/types"
"github.com/kubefirst/kubefirst-api/pkg/providerConfigs"
pkgtypes "github.com/kubefirst/kubefirst-api/pkg/types"
utils "github.com/kubefirst/kubefirst-api/pkg/utils"
Expand Down Expand Up @@ -211,7 +210,7 @@ func CreateService(cl *pkgtypes.Cluster, serviceName string, appDef *pkgtypes.Gi
}

// Update list
err = db.Client.InsertClusterServiceListEntry(clusterName, &types.Service{
err = db.Client.InsertClusterServiceListEntry(clusterName, &pkgtypes.Service{
Name: serviceName,
Default: false,
Description: appDef.Description,
Expand Down Expand Up @@ -400,7 +399,7 @@ func AddDefaultServices(cl *pkgtypes.Cluster) error {
fullDomainName = cl.DomainName
}

defaults := []types.Service{
defaults := []pkgtypes.Service{
{
Name: cl.GitProvider,
Default: true,
Expand Down Expand Up @@ -450,7 +449,7 @@ func AddDefaultServices(cl *pkgtypes.Cluster) error {
}

if cl.CloudProvider == "k3d" {
defaults = append(defaults, types.Service{
defaults = append(defaults, pkgtypes.Service{
Name: "Metaphor",
Default: true,
Description: "A multi-environment demonstration space for frontend application best practices that's easy to apply to other projects.",
Expand Down
File renamed without changes.

0 comments on commit de2802a

Please sign in to comment.