cooperation_contract_undertaker.go 1.7 KB
package transform

import (
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)

func TransformToCooperationContractUndertakerDomainModelFromPgModels(cooperationContractUndertakerModel *models.CooperationContractUndertaker) (*domain.CooperationContractUndertaker, error) {
	return &domain.CooperationContractUndertaker{
		CooperationContractUndertakerId: cooperationContractUndertakerModel.CooperationContractUndertakerId,
		CooperationContractNumber:       cooperationContractUndertakerModel.CooperationContractNumber,
		Undertaker: &domain.Undertaker{
			UserId:             cooperationContractUndertakerModel.UserId,
			UserBaseId:         cooperationContractUndertakerModel.UserBaseId,
			Org:                cooperationContractUndertakerModel.Org,
			Orgs:               cooperationContractUndertakerModel.Orgs,
			Department:         cooperationContractUndertakerModel.Department,
			Roles:              cooperationContractUndertakerModel.Roles,
			UserInfo:           cooperationContractUndertakerModel.UserInfo,
			UserType:           cooperationContractUndertakerModel.UserType,
			Referrer:           cooperationContractUndertakerModel.Referrer,
			Salesman:           cooperationContractUndertakerModel.Salesman,
			Status:             cooperationContractUndertakerModel.Status,
			Company:            cooperationContractUndertakerModel.Company,
			ContractAttachment: cooperationContractUndertakerModel.ContractAttachment,
		},
		CreatedAt: cooperationContractUndertakerModel.CreatedAt,
		UpdatedAt: cooperationContractUndertakerModel.UpdatedAt,
		DeletedAt: cooperationContractUndertakerModel.DeletedAt,
	}, nil
}