Remove platform tenancy from SXCHNGE customer BFF (#34)
This commit is contained in:
1 parent
7062672a87
commit
981e84a4b4
244 files changed
+651
-17130
No files matched your search
@@ -3,7 +3,6 @@ package model
|
||||
import (
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/db/storable"
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/mservice"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
||||
@@ -21,14 +20,8 @@ type AccountBase struct {
|
||||
storable.Base `bson:",inline" json:",inline"`
|
||||
ArchivableBase `bson:",inline" json:",inline"`
|
||||
Describable `bson:",inline" json:",inline"`
|
||||
LastName string `bson:"lastName" json:"lastName"`
|
||||
AvatarURL *string `bson:"avatarUrl,omitempty" json:"avatarUrl,omitempty"`
|
||||
Metadata *AccountMetadata `bson:"metadata,omitempty" json:"-"`
|
||||
|
||||
// INN is the account owner's taxpayer identifier. It is the canonical source
|
||||
// of the INN for personal (account-owned) payouts, flowing into
|
||||
// customer.tax_identifier.
|
||||
INN string `bson:"inn,omitempty" json:"inn,omitempty"`
|
||||
LastName string `bson:"lastName" json:"lastName"`
|
||||
AvatarURL *string `bson:"avatarUrl,omitempty" json:"avatarUrl,omitempty"`
|
||||
}
|
||||
|
||||
func (*AccountBase) Collection() string {
|
||||
@@ -51,7 +44,6 @@ func (a *Account) Copy() *Account {
|
||||
return nil
|
||||
}
|
||||
copied := *a
|
||||
copied.Metadata = a.Metadata.Copy()
|
||||
return &copied
|
||||
}
|
||||
|
||||
@@ -74,37 +66,4 @@ func (a *Account) MatchPassword(password string) bool {
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func AnonymousUserName(orgRef bson.ObjectID) string {
|
||||
return "anonymous@" + orgRef.Hex()
|
||||
}
|
||||
|
||||
func AccountIsAnonymous(account *UserDataBase, orgRef bson.ObjectID) bool {
|
||||
if account == nil {
|
||||
return false
|
||||
}
|
||||
return AnonymousUserName(orgRef) == account.Login
|
||||
}
|
||||
|
||||
type AccountBound interface {
|
||||
GetAccountRef() bson.ObjectID
|
||||
}
|
||||
|
||||
type AccountBoundStorable interface {
|
||||
storable.Storable
|
||||
OrganizationBound
|
||||
GetAccountRef() *bson.ObjectID
|
||||
}
|
||||
|
||||
const (
|
||||
AccountRefField = "accountRef"
|
||||
)
|
||||
|
||||
type AccountBoundBase struct {
|
||||
storable.Base `bson:",inline" json:",inline"`
|
||||
OrganizationBoundBase `bson:",inline" json:",inline"`
|
||||
AccountRef *bson.ObjectID `bson:"accountRef,omitempty" json:"accountRef,omitempty"`
|
||||
}
|
||||
|
||||
func (a *AccountBoundBase) GetAccountRef() *bson.ObjectID {
|
||||
return a.AccountRef
|
||||
}
|
||||
const AccountRefField = "accountRef"
|
||||
Reference in new issue
Block a user