package app import ( "database/sql" "time" "code.tnxs.net/taxnexus/lib/api/workflow/workflow_models" "github.com/google/uuid" ) func unMarshalAppLog(s *workflow_models.AppLog) *AppLog { if s.ID == "" { s.ID = uuid.New().String() } createdDate, e0 := time.Parse(dateTimeFormat, s.CreatedDate) sourceTimestamp, e1 := time.Parse(dateTimeFormat, s.SourceTimestamp) return &AppLog{ AccountID: s.AccountID, CompanyID: s.CompanyID, CreatedByID: s.CreatedByID, ID: s.ID, Message: s.Message, ObjectID: s.ObjectID, ObjectType: s.ObjectType, Severity: s.Severity, Source: s.Source, CreatedDate: sql.NullTime{ Time: createdDate, Valid: e0 == nil, }, SourceTimestamp: sql.NullTime{ Time: sourceTimestamp, Valid: e1 == nil, }, } } func (obj *AppLog) marshalToSwagger() *workflow_models.AppLog { return &workflow_models.AppLog{ ID: obj.ID, AccountID: obj.AccountID, CompanyID: obj.CompanyID, CreatedByID: obj.CreatedByID, CreatedDate: obj.CreatedDate.Time.Format(dateTimeFormat), Message: obj.Message, ObjectType: obj.ObjectType, ObjectID: obj.ObjectID, Severity: obj.Severity, Source: obj.Source, SourceTimestamp: obj.SourceTimestamp.Time.Format(dateTimeFormat), } }