cooperation_application.go 3.0 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,
			Department:                        cooperationProject.Department,
			CooperationProjectUndertakerTypes: cooperationProject.CooperationProjectUndertakerTypes,
			Org:                               cooperationProject.Org,
			Attachment:                        cooperationProject.Attachment,
			Company:                           cooperationProject.Company,
			Operator:                          cooperationProject.Operator,
			OperateTime:                       cooperationProject.OperateTime,
			Status:                            cooperationProject.Status,
			UpdatedAt:                         cooperationProject.UpdatedAt,
			DeletedAt:                         cooperationProject.DeletedAt,
			CreatedAt:                         cooperationProject.CreatedAt,
		},
		Org:        cooperationApplicationModel.Org,
		IsCanceled: cooperationApplicationModel.IsCanceled,
		Company:    cooperationApplicationModel.Company,
		CreatedAt:  cooperationApplicationModel.CreatedAt,
		DeletedAt:  cooperationApplicationModel.DeletedAt,
		UpdatedAt:  cooperationApplicationModel.UpdatedAt,
	}, nil
}