cooperation_project.go 2.4 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 TransformToCooperationProjectDomainModelFromPgModels(
	cooperationProjectModel *models.CooperationProject,
	cooperationMode *models.CooperationMode) (*domain.CooperationProject, error) {
	return &domain.CooperationProject{
		CooperationProjectId:          cooperationProjectModel.CooperationProjectId,
		CooperationProjectNumber:      cooperationProjectModel.CooperationProjectNumber,
		CooperationProjectDescription: cooperationProjectModel.CooperationProjectDescription,
		CooperationProjectName:        cooperationProjectModel.CooperationProjectName,
		CooperationProjectPublishTime: cooperationProjectModel.CooperationProjectPublishTime,
		CooperationProjectPublisher:   cooperationProjectModel.CooperationProjectPublisher,
		CooperationProjectSponsor:     cooperationProjectModel.CooperationProjectSponsor,
		CooperationMode: &domain.CooperationMode{
			CooperationModeId:     cooperationMode.CooperationModeId,
			CooperationModeNumber: cooperationMode.CooperationModeNumber,
			CooperationModeName:   cooperationMode.CooperationModeName,
			Status:                cooperationMode.Status,
			Org:                   cooperationMode.Org,
			Company:               cooperationMode.Company,
			Remarks:               cooperationMode.Remarks,
			Operator:              cooperationMode.Operator,
			OperateTime:           cooperationMode.OperateTime,
			UpdatedAt:             cooperationMode.UpdatedAt,
			DeletedAt:             cooperationMode.DeletedAt,
			CreatedAt:             cooperationMode.CreatedAt,
		},
		Department:                        cooperationProjectModel.Department,
		CooperationProjectUndertakerTypes: cooperationProjectModel.CooperationProjectUndertakerTypes,
		Org:                               cooperationProjectModel.Org,
		Company:                           cooperationProjectModel.Company,
		Operator:                          cooperationProjectModel.Operator,
		OperateTime:                       cooperationProjectModel.OperateTime,
		Status:                            cooperationProjectModel.Status,
		UpdatedAt:                         cooperationProjectModel.UpdatedAt,
		DeletedAt:                         cooperationProjectModel.DeletedAt,
		CreatedAt:                         cooperationProjectModel.CreatedAt,
	}, nil
}