cooperation_application.go 2.8 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 TransformToCooperationApplicationDomainModelFromPgModels(
	cooperationApplicationModel *models.CooperationApplication,
	cooperationProject *models.CooperationProject) (*domain.CooperationApplication, error) {
	return &domain.CooperationApplication{
		CooperationApplicationId:                cooperationApplicationModel.CooperationApplicationId,
		CooperationApplicationApplicant:         cooperationApplicationModel.CooperationApplicationApplicant,
		CooperationApplicationAttachment:        cooperationApplicationModel.CooperationApplicationAttachment,
		CooperationApplicationDescription:       cooperationApplicationModel.CooperationApplicationDescription,
		CooperationApplicationStatus:            cooperationApplicationModel.CooperationApplicationStatus,
		CooperationApplicationVerifier:          cooperationApplicationModel.CooperationApplicationVerifier,
		CooperationApplicationVerifyDescription: cooperationApplicationModel.CooperationApplicationVerifyDescription,
		CooperationApplicationVerifyTime:        cooperationApplicationModel.CooperationApplicationVerifyTime,
		CooperationApplyTime:                    cooperationApplicationModel.CooperationApplyTime,
		CooperationProject: &domain.CooperationProject{
			CooperationProjectId:             cooperationProject.CooperationProjectId,
			CooperationProjectNumber:         cooperationProject.CooperationProjectNumber,
			CooperationProjectDescription:    cooperationProject.CooperationProjectDescription,
			CooperationProjectName:           cooperationProject.CooperationProjectName,
			CooperationProjectPublishTime:    cooperationProject.CooperationProjectPublishTime,
			CooperationProjectPublisher:      cooperationProject.CooperationProjectPublisher,
			CooperationProjectSponsor:        cooperationProject.CooperationProjectSponsor,
			CooperationProjectUndertakerType: cooperationProject.CooperationProjectUndertakerType,
			Org:                              cooperationProject.Org,
			Company:                          cooperationProject.Company,
			Operator:                         cooperationProject.Operator,
			OperateTime:                      cooperationProject.OperateTime,
			Status:                           cooperationProject.Status,
			UpdatedAt:                        cooperationProject.UpdatedAt,
			DeletedAt:                        cooperationProject.DeletedAt,
			CreatedAt:                        cooperationProject.CreatedAt,
		},
		Org:       cooperationApplicationModel.Org,
		Company:   cooperationApplicationModel.Company,
		CreatedAt: cooperationApplicationModel.CreatedAt,
		DeletedAt: cooperationApplicationModel.DeletedAt,
		UpdatedAt: cooperationApplicationModel.UpdatedAt,
	}, nil
}