|
|
@@ -265,22 +265,22 @@ func (simple *Simple) Bind(binder *binding.Binder) {
|
|
|
},
|
|
|
}), entity_crud.WithGetByIDCallbacks(&entity_crud.GetByIDCallbacks[Info]{
|
|
|
OnSuccessReturn: func(e entity.Entity, i *infrastructure.Infrastructure, output Info) (Info, error) {
|
|
|
- if strutils.IsStringNotEmpty(output.Name) {
|
|
|
- encryptedName, err := encoding.AESEncrypt(output.Name, simple.AESKey)
|
|
|
+ if strutils.IsStringNotEmpty(output.Phone) {
|
|
|
+ decryptedPhone, err := encoding.AESDecrypt(output.Phone, simple.AESKey)
|
|
|
if err != nil {
|
|
|
return Info{}, errors.New(err.Error())
|
|
|
}
|
|
|
|
|
|
- output.Name = encryptedName
|
|
|
+ output.Phone = decryptedPhone
|
|
|
}
|
|
|
|
|
|
if strutils.IsStringNotEmpty(output.Email) {
|
|
|
- encryptedEmail, err := encoding.AESEncrypt(output.Email, simple.AESKey)
|
|
|
+ decryptedEmail, err := encoding.AESDecrypt(output.Email, simple.AESKey)
|
|
|
if err != nil {
|
|
|
return Info{}, errors.New(err.Error())
|
|
|
}
|
|
|
|
|
|
- output.Email = encryptedEmail
|
|
|
+ output.Email = decryptedEmail
|
|
|
}
|
|
|
|
|
|
return output, nil
|