organization_translator.go 1021 字节
package translator

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
	"time"
)

type OrganizationTranslator struct {
}

type OrganizationDetail struct {
	OrgId     int64     `json:"orgId"`
	CompanyId int64     `json:"companyId"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	DeletedAt time.Time `json:"deletedAt"`
	OrgCode   string    `json:"orgCode"`
	OrgName   string    `json:"orgName"`
	Ext       struct {
	} `json:"ext"`
	IsOrg     bool `json:"isOrg"`
	OrgStatus int  `json:"orgStatus"`
}

func (translator *OrganizationTranslator) ToOrganizationFromRepresentation(organization *OrganizationDetail) (*domain.Org, error) {
	return &domain.Org{
		OrgId:   organization.OrgId,
		OrgName: organization.OrgName,
		Company: &domain.Company{
			CompanyId:   organization.CompanyId,
			CompanyLogo: "",
			CompanyName: "",
		},
	}, nil
}

func NewOrganizationTranslator() (*OrganizationTranslator, error) {
	return &OrganizationTranslator{}, nil
}