company_translator.go 1.0 KB
package translator

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

type CompanyTranslator struct {
}

type CompanyDetail struct {
	CompanyId     int64 `json:"companyId"`
	CompanyConfig struct {
		SystemName string `json:"systemName"`
		Theme      string `json:"theme"`
	} `json:"companyConfig"`
	CompanyInfo struct {
		CompanyName      string    `json:"companyName"`
		Scale            string    `json:"scale"`
		IndustryCategory string    `json:"industryCategory"`
		RegisteredTime   time.Time `json:"registeredTime"`
	} `json:"companyInfo"`
	Status    int       `json:"status"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

func (translator *CompanyTranslator) ToCompanyFromRepresentation(company *CompanyDetail) (*domain.Company, error) {
	return &domain.Company{
		CompanyId:   company.CompanyId,
		CompanyName: company.CompanyInfo.CompanyName,
	}, nil
}

func NewCompanyTranslator() (*CompanyTranslator, error) {
	return &CompanyTranslator{}, nil
}