parent
37245451a3
commit
bc3e3a61e5
|
@ -2,12 +2,25 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ReMarshalAccount converts microservice Models object to swagger
|
||||||
|
func ReMarshalAccount(p interface{}) crm_models.Account {
|
||||||
|
// reflect input and set to crm_models type
|
||||||
|
t := reflect.ValueOf(&p).Elem()
|
||||||
|
s := crm_models.Account{}
|
||||||
|
r := reflect.ValueOf(&s).Elem()
|
||||||
|
for i := 0; i < t.NumField(); i++ {
|
||||||
|
r.Field(i).Set(t.Field(i))
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
// UnMarshalAccount decodes swagger to a first class object
|
// UnMarshalAccount decodes swagger to a first class object
|
||||||
func UnMarshalAccount(s *crm_models.Account) *Account { //nolint:funlen // too bad
|
func UnMarshalAccount(s *crm_models.Account) *Account { //nolint:funlen // too bad
|
||||||
if s.ID == "" {
|
if s.ID == "" {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
"code.tnxs.net/taxnexus/lib/api/crm/crm_models"
|
||||||
|
@ -77,6 +78,18 @@ func UnMarshalContact(s *crm_models.Contact) *Contact {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReMarshalContact converts microservice Models object to swagger
|
||||||
|
func ReMarshalContact(p interface{}) crm_models.Contact {
|
||||||
|
// reflect input and set to crm_models type
|
||||||
|
t := reflect.ValueOf(&p).Elem()
|
||||||
|
s := crm_models.Contact{}
|
||||||
|
r := reflect.ValueOf(&s).Elem()
|
||||||
|
for i := 0; i < t.NumField(); i++ {
|
||||||
|
r.Field(i).Set(t.Field(i))
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
// MarshalToSwagger encodes first class object
|
// MarshalToSwagger encodes first class object
|
||||||
func (obj *Contact) MarshalToSwagger() *crm_models.Contact {
|
func (obj *Contact) MarshalToSwagger() *crm_models.Contact {
|
||||||
return &crm_models.Contact{
|
return &crm_models.Contact{
|
||||||
|
|
|
@ -2,12 +2,26 @@ package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"reflect"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
|
"code.tnxs.net/taxnexus/lib/api/ops/ops_models"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ReMarshalPaymentMethod converts microservice Models object to swagger
|
||||||
|
func ReMarshalPaymentMethod(p interface{}) ops_models.PaymentMethod {
|
||||||
|
// reflect input and set to crm_models type
|
||||||
|
t := reflect.ValueOf(&p).Elem()
|
||||||
|
s := ops_models.PaymentMethod{}
|
||||||
|
r := reflect.ValueOf(&s).Elem()
|
||||||
|
for i := 0; i < t.NumField(); i++ {
|
||||||
|
r.Field(i).Set(t.Field(i))
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnMarshalPaymentMethod converts swagger to first class object
|
||||||
func UnMarshalPaymentMethod(s *ops_models.PaymentMethod) *PaymentMethod {
|
func UnMarshalPaymentMethod(s *ops_models.PaymentMethod) *PaymentMethod {
|
||||||
if s.ID == "" {
|
if s.ID == "" {
|
||||||
s.ID = uuid.New().String()
|
s.ID = uuid.New().String()
|
||||||
|
|
Loading…
Reference in New Issue