fixed doc env vars + mongo v2 migration

This commit is contained in:
Stephan D
2026-01-31 00:26:42 +01:00
parent cbb7bd8ba6
commit 1aa7e287fb
356 changed files with 1705 additions and 1729 deletions

View File

@@ -20,7 +20,7 @@ import (
"github.com/tech/sendico/pkg/mutil/mzap"
"github.com/tech/sendico/server/interface/middleware"
"github.com/tech/sendico/server/internal/mutil/flrstring"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/v2/bson"
"go.uber.org/zap"
)
@@ -120,7 +120,7 @@ func (s *service) CreateAccount(
ctx context.Context,
org *model.Organization,
acct *model.Account,
roleDescID primitive.ObjectID,
roleDescID bson.ObjectID,
) error {
if org == nil {
return merrors.InvalidArgument("Organization must not be nil")
@@ -128,7 +128,7 @@ func (s *service) CreateAccount(
if acct == nil || len(acct.Login) == 0 {
return merrors.InvalidArgument("Account must have a non-empty login")
}
if roleDescID == primitive.NilObjectID {
if roleDescID == bson.NilObjectID {
return merrors.InvalidArgument("Role description must be provided")
}
// 1) Create the account
@@ -152,7 +152,7 @@ func (s *service) CreateAccount(
func (s *service) DeleteAccount(
ctx context.Context,
org *model.Organization,
accountRef primitive.ObjectID,
accountRef bson.ObjectID,
) error {
// Check if this is the only member in the organization
if len(org.Members) <= 1 {
@@ -178,7 +178,7 @@ func (s *service) DeleteAccount(
func (s *service) RemoveAccountFromOrganization(
ctx context.Context,
org *model.Organization,
accountRef primitive.ObjectID,
accountRef bson.ObjectID,
) error {
if org == nil {
return merrors.InvalidArgument("Organization must not be nil")
@@ -233,7 +233,7 @@ func (s *service) JoinOrganization(
ctx context.Context,
org *model.Organization,
account *model.Account,
roleDescID primitive.ObjectID,
roleDescID bson.ObjectID,
) error {
if slices.Contains(org.Members, account.ID) {
s.logger.Debug("Account is already a member", mzap.StorableRef(org), mzap.StorableRef(account))
@@ -260,7 +260,7 @@ func (s *service) JoinOrganization(
return nil
}
func (s *service) deleteOrganizationRoles(ctx context.Context, orgRef primitive.ObjectID) error {
func (s *service) deleteOrganizationRoles(ctx context.Context, orgRef bson.ObjectID) error {
s.logger.Info("Deleting roles for organization", mzap.ObjRef("organization_ref", orgRef))
// Get all roles for the organization
@@ -282,7 +282,7 @@ func (s *service) deleteOrganizationRoles(ctx context.Context, orgRef primitive.
return nil
}
func (s *service) deleteOrganizationPolicies(ctx context.Context, orgRef primitive.ObjectID) error {
func (s *service) deleteOrganizationPolicies(ctx context.Context, orgRef bson.ObjectID) error {
s.logger.Info("Deleting policies for organization", mzap.ObjRef("organization_ref", orgRef))
// Get all policies for the organization
@@ -323,7 +323,7 @@ func (s *service) DeleteOrganization(
}
// 10. Finally, delete the organization itself
if err := s.orgDB.Delete(ctx, primitive.NilObjectID, org.ID); err != nil {
if err := s.orgDB.Delete(ctx, bson.NilObjectID, org.ID); err != nil {
s.logger.Warn("Failed to delete organization", zap.Error(err), mzap.StorableRef(org))
return nil, err
}
@@ -342,7 +342,7 @@ func (s *service) DeleteOrganization(
func (s *service) DeleteAll(
ctx context.Context,
org *model.Organization,
accountRef primitive.ObjectID,
accountRef bson.ObjectID,
) error {
s.logger.Info("Starting complete deletion (organization + account)",
mzap.StorableRef(org), mzap.ObjRef("account_ref", accountRef))