2021-01-14 06:36:35 +00:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"code.tnxs.net/taxnexus/lib/api/regs/regs_models"
|
|
|
|
)
|
|
|
|
|
2021-01-18 03:13:54 +00:00
|
|
|
// UnMarshalTransaction encodes first class object
|
2021-01-14 06:36:35 +00:00
|
|
|
func UnMarshalTransaction(s *regs_models.Transaction) *Transaction {
|
|
|
|
createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate)
|
|
|
|
lastModfiedDate, e1 := time.Parse(dateTimeFormat, s.LastModifiedDate)
|
|
|
|
return &Transaction{
|
|
|
|
ID: s.ID,
|
|
|
|
AccountID: s.AccountID,
|
|
|
|
CreatedByID: s.CreatedByID,
|
|
|
|
LastModifiedByID: s.LastModifiedByID,
|
|
|
|
TaxTransactionID: s.TaxTransactionID,
|
|
|
|
TaxTypeID: s.TaxTypeID,
|
|
|
|
TenantID: s.TenantID,
|
|
|
|
Valid: s.Valid,
|
|
|
|
CreatedDate: sql.NullTime{
|
|
|
|
Time: createdDate,
|
|
|
|
Valid: e0 == nil,
|
|
|
|
},
|
|
|
|
LastModifiedDate: sql.NullTime{
|
|
|
|
Time: lastModfiedDate,
|
|
|
|
Valid: e1 == nil,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2021-01-18 03:13:54 +00:00
|
|
|
|
|
|
|
// MarshalToSwagger encodes first class object
|
2021-01-14 06:36:35 +00:00
|
|
|
func (obj *Transaction) MarshalToSwagger() *regs_models.Transaction {
|
|
|
|
return ®s_models.Transaction{
|
|
|
|
ID: obj.ID,
|
|
|
|
AccountID: obj.AccountID,
|
|
|
|
CreatedByID: obj.CreatedByID,
|
|
|
|
CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat),
|
|
|
|
LastModifiedByID: obj.LastModifiedByID,
|
|
|
|
LastModifiedDate: obj.LastModifiedDate.Time.Format(dateTimeFormat),
|
|
|
|
TaxTransactionID: obj.TaxTransactionID,
|
|
|
|
TaxTypeID: obj.TaxTypeID,
|
|
|
|
TenantID: obj.TenantID,
|
|
|
|
Valid: obj.Valid,
|
|
|
|
}
|
|
|
|
}
|