Bootstrap copied BFF and local accounts with public Sendico contracts (#34)
This commit is contained in:
1 parent
67dc5b5b1e
commit
7062672a87
556 files changed
+42291
-777
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package mzap
|
||||
|
||||
import (
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/model"
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/mutil/mask"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func AccRef(accountRef bson.ObjectID) zap.Field {
|
||||
return ObjRef("account_ref", accountRef)
|
||||
}
|
||||
|
||||
func Email(email string) zap.Field {
|
||||
return MaskEmail("email", email)
|
||||
}
|
||||
|
||||
func MaskEmail(field, email string) zap.Field {
|
||||
return zap.String(field, mask.Email(email))
|
||||
}
|
||||
|
||||
func MaskEmails(field string, emails []string) zap.Field {
|
||||
return zap.Strings(field, mask.Emails(emails))
|
||||
}
|
||||
|
||||
func Login(account *model.Account) zap.Field {
|
||||
return Email(account.Login)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package mzap
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func ErrorType(err error) zap.Field {
|
||||
if err == nil {
|
||||
return zap.String("error_type", "")
|
||||
}
|
||||
return zap.String("error_type", reflect.TypeOf(err).String())
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package mzap
|
||||
|
||||
import (
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/db/storable"
|
||||
"git.sendico.io/tech/sxchnge/bff/pkg/model"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func ObjRef(name string, objRef bson.ObjectID) zap.Field {
|
||||
return zap.String(name, objRef.Hex())
|
||||
}
|
||||
|
||||
func StorableRef(obj storable.Storable) zap.Field {
|
||||
return ObjRef(obj.Collection()+"_ref", *obj.GetID())
|
||||
}
|
||||
|
||||
func OrgRef(orgRef bson.ObjectID) zap.Field {
|
||||
return ObjRef("organization_ref", orgRef)
|
||||
}
|
||||
|
||||
func OrganizationRef(obj model.OrganizationBound) zap.Field {
|
||||
return OrgRef(obj.GetOrganizationRef())
|
||||
}
|
||||
|
||||
func PermissionRef(permissionRef bson.ObjectID) zap.Field {
|
||||
return ObjRef("permission_ref", permissionRef)
|
||||
}
|
||||
Reference in new issue
Block a user