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

@@ -2,11 +2,11 @@ package srequest
import (
"github.com/tech/sendico/pkg/model"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/v2/bson"
)
type ChangePolicies struct {
RoleRef primitive.ObjectID `json:"roleRef"`
RoleRef bson.ObjectID `json:"roleRef"`
Add *[]model.RolePolicy `json:"add,omitempty"`
Remove *[]model.RolePolicy `json:"remove,omitempty"`
}

View File

@@ -1,8 +1,8 @@
package srequest
import "go.mongodb.org/mongo-driver/bson/primitive"
import "go.mongodb.org/mongo-driver/v2/bson"
type ChangeRole struct {
AccountRef primitive.ObjectID `json:"accountRef"`
NewRoleDescriptionRef primitive.ObjectID `json:"newRoleDescriptionRef"`
AccountRef bson.ObjectID `json:"accountRef"`
NewRoleDescriptionRef bson.ObjectID `json:"newRoleDescriptionRef"`
}

View File

@@ -1,7 +1,7 @@
package srequest
import "go.mongodb.org/mongo-driver/bson/primitive"
import "go.mongodb.org/mongo-driver/v2/bson"
type FileUpload struct {
ObjRef primitive.ObjectID `json:"objRef"`
ObjRef bson.ObjectID `json:"objRef"`
}

View File

@@ -6,7 +6,7 @@ import (
"github.com/tech/sendico/pkg/ledgerconv"
"github.com/tech/sendico/pkg/merrors"
"github.com/tech/sendico/pkg/model"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/v2/bson"
)
type LedgerAccountType string
@@ -28,13 +28,13 @@ const (
)
type CreateLedgerAccount struct {
AccountType LedgerAccountType `json:"accountType"`
Currency string `json:"currency"`
AllowNegative bool `json:"allowNegative,omitempty"`
Role model.AccountRole `json:"role"`
Describable model.Describable `json:"describable"`
OwnerRef *primitive.ObjectID `json:"ownerRef,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
AccountType LedgerAccountType `json:"accountType"`
Currency string `json:"currency"`
AllowNegative bool `json:"allowNegative,omitempty"`
Role model.AccountRole `json:"role"`
Describable model.Describable `json:"describable"`
OwnerRef *bson.ObjectID `json:"ownerRef,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func (r *CreateLedgerAccount) Validate() error {

View File

@@ -1,19 +1,19 @@
package srequest
import "go.mongodb.org/mongo-driver/bson/primitive"
import "go.mongodb.org/mongo-driver/v2/bson"
type Reorder struct {
ParentRef primitive.ObjectID `json:"parentRef"`
From int `json:"from"`
To int `json:"to"`
ParentRef bson.ObjectID `json:"parentRef"`
From int `json:"from"`
To int `json:"to"`
}
type ReorderX struct {
ObjectRef primitive.ObjectID `json:"objectRef"`
To int `json:"to"`
ObjectRef bson.ObjectID `json:"objectRef"`
To int `json:"to"`
}
type ReorderXDefault struct {
ReorderX `json:",inline"`
ParentRef primitive.ObjectID `json:"parentRef"`
ParentRef bson.ObjectID `json:"parentRef"`
}

View File

@@ -1,13 +1,13 @@
package srequest
import "go.mongodb.org/mongo-driver/bson/primitive"
import "go.mongodb.org/mongo-driver/v2/bson"
type GroupItemChange struct {
GroupRef primitive.ObjectID `json:"groupRef"`
ItemRef primitive.ObjectID `json:"itemRef"`
GroupRef bson.ObjectID `json:"groupRef"`
ItemRef bson.ObjectID `json:"itemRef"`
}
type RemoveItemFromGroup struct {
GroupItemChange `json:",inline"`
TargetItemRef primitive.ObjectID `json:"targetItemRef"`
TargetItemRef bson.ObjectID `json:"targetItemRef"`
}

View File

@@ -1,20 +1,20 @@
package srequest
import "go.mongodb.org/mongo-driver/bson/primitive"
import "go.mongodb.org/mongo-driver/v2/bson"
// TaggableSingle is used for single tag operations (add/remove tag)
type TaggableSingle struct {
ObjectRef primitive.ObjectID `json:"objectRef"`
TagRef primitive.ObjectID `json:"tagRef"`
ObjectRef bson.ObjectID `json:"objectRef"`
TagRef bson.ObjectID `json:"tagRef"`
}
// TaggableMultiple is used for multiple tag operations (add tags, set tags)
type TaggableMultiple struct {
ObjectRef primitive.ObjectID `json:"objectRef"`
TagRefs []primitive.ObjectID `json:"tagRefs"`
ObjectRef bson.ObjectID `json:"objectRef"`
TagRefs []bson.ObjectID `json:"tagRefs"`
}
// TaggableObject is used for object-only operations (remove all tags, get tags)
type TaggableObject struct {
ObjectRef primitive.ObjectID `json:"objectRef"`
ObjectRef bson.ObjectID `json:"objectRef"`
}

View File

@@ -2,11 +2,11 @@ package srequest
import (
"github.com/tech/sendico/pkg/model"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/v2/bson"
)
type CreateWallet struct {
Description model.Describable `json:"description"`
Asset model.ChainAssetKey `json:"asset"`
OwnerRef *primitive.ObjectID `json:"ownerRef,omitempty"`
OwnerRef *bson.ObjectID `json:"ownerRef,omitempty"`
}

View File

@@ -6,7 +6,7 @@ import (
"github.com/tech/sendico/pkg/api/http/response"
"github.com/tech/sendico/pkg/mlogger"
"github.com/tech/sendico/pkg/model"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/v2/bson"
)
type accountData struct {
@@ -26,7 +26,7 @@ func _createAccount(account *model.Account, isAnonymous bool) *accountData {
}
}
func _toAccount(account *model.Account, orgRef primitive.ObjectID) *accountData {
func _toAccount(account *model.Account, orgRef bson.ObjectID) *accountData {
return _createAccount(account, model.AccountIsAnonymous(&account.UserDataBase, orgRef))
}
@@ -45,7 +45,7 @@ type accountsResponse struct {
Accounts []accountData `json:"accounts"`
}
func Accounts(logger mlogger.Logger, accounts []model.Account, orgRef primitive.ObjectID, accessToken *TokenData) http.HandlerFunc {
func Accounts(logger mlogger.Logger, accounts []model.Account, orgRef bson.ObjectID, accessToken *TokenData) http.HandlerFunc {
// Convert each account to its public representation.
publicAccounts := make([]accountData, len(accounts))
for i, a := range accounts {