Skip to content

Commit

Permalink
Merge pull request #1995 from slntopp/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
coddmeistr authored Feb 10, 2025
2 parents df016b3 + 9cc35d8 commit 26af7b1
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 219 deletions.
3 changes: 3 additions & 0 deletions cmd/billing/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ func main() {

migrations.MigrateOldInvoicesInstancesToNew(log, graph.GetEnsureCollection(log, ctx, db, schema.INVOICES_COL))

migrations.MigrateOldInvoicesToNew(log, graph.GetEnsureCollection(log, ctx, db, schema.INVOICES_COL),
graph.GetEnsureCollection(log, ctx, db, schema.TRANSACTIONS_COL), invoicesFile, instancesFile)

host := fmt.Sprintf("0.0.0.0:%s", port)

handler = cors.New(cors.Options{
Expand Down
13 changes: 13 additions & 0 deletions cmd/services_registry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ func main() {
manager := invoices_manager.NewInvoicesManager(bClient, graph.NewInvoicesController(log, db), authInterceptor)
payments.RegisterGateways(whmcsData, graph.NewAccountsController(log, db), graph.NewCurrencyController(log, db), manager, whmcsTaxExcluded)

// Migrate
migrateToV2 := viper.GetBool("MIGRATE_TO_V2")
if migrateToV2 {
iCtrl := graph.NewInstancesController(log.Named("Main"), db, rabbitmq.NewRabbitMQConnection(conn))
sCtrl := graph.NewServicesController(log.Named("Main"), db, rabbitmq.NewRabbitMQConnection(conn))
bpCtrl := graph.NewBillingPlansController(log.Named("Main"), db)
addCtrl := graph.NewAddonsController(log.Named("Main"), db)
descCtrl := graph.NewDescriptionsController(log.Named("Main"), db)
graph.MigrateInstancesToNewAddons(log, iCtrl, sCtrl, bpCtrl, addCtrl, descCtrl)
} else {
log.Debug("Need MIGRATE_TO_V2 set to 'true' to start instances migration to V2")
}

log.Debug("Opening every sp syncer")
ctrl := graph.NewServicesProvidersController(log.Named("Main"), db)
sps, err := ctrl.List(context.Background(), schema.ROOT_NAMESPACE_KEY, true)
Expand Down
3 changes: 3 additions & 0 deletions pkg/graph/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"errors"
"fmt"
"github.com/slntopp/nocloud/pkg/graph/migrations"
"google.golang.org/protobuf/types/known/structpb"

"github.com/arangodb/go-driver"
Expand Down Expand Up @@ -91,6 +92,8 @@ func NewAccountsController(logger *zap.Logger, db driver.Database) AccountsContr

nsController := NewNamespacesController(log, col.Database())

migrations.UpdateNumericCurrencyToDynamic(log, col)

return &accountsController{log: log, col: col, cred: cred, ns_ctrl: nsController}
}

Expand Down
Loading

0 comments on commit 26af7b1

Please sign in to comment.