company_translator.go
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
}