LCOV - code coverage report
Current view: top level - usecase/contact - assembler.go Coverage Total Hit
Test: coverage.lcov Lines: 0.0 % 59 0
Test Date: 2026-04-14 06:42:22 Functions: - 0 0

            Line data    Source code
       1              : // Package contact は 連絡先に関するユースケース(アプリケーションロジック)を提供します
       2              : // ドメイン層のエンティティやリポジトリを操作し、アプリケーション全体で利用可能なビジネスフローを実装します
       3              : package contact
       4              : 
       5              : import (
       6              :         "resume/internal/domain/entity"
       7              :         "resume/internal/shared/util"
       8              : )
       9              : 
      10            0 : func resolveRelationshipTypeKey(relationshipTypeID uint64) string {
      11            0 :         switch relationshipTypeID {
      12            0 :         case entity.RelationshipTypeSelfID:
      13            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeSelfCode)
      14            0 :         case entity.RelationshipTypeHusbandID:
      15            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeHusbandCode)
      16            0 :         case entity.RelationshipTypeWifeID:
      17            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeWifeCode)
      18            0 :         case entity.RelationshipTypeSonID:
      19            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeSonCode)
      20            0 :         case entity.RelationshipTypeDaughterID:
      21            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeDaughterCode)
      22            0 :         case entity.RelationshipTypeFatherID:
      23            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeFatherCode)
      24            0 :         case entity.RelationshipTypeMotherID:
      25            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeMotherCode)
      26            0 :         case entity.RelationshipTypeFatherInLawID:
      27            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeFatherInLawCode)
      28            0 :         case entity.RelationshipTypeMotherInLawID:
      29            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeMotherInLawCode)
      30            0 :         case entity.RelationshipTypeStepFatherID:
      31            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeStepFatherCode)
      32            0 :         case entity.RelationshipTypeStepMotherID:
      33            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeStepMotherCode)
      34            0 :         case entity.RelationshipTypeAdoptiveFatherID:
      35            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeAdoptiveFatherCode)
      36            0 :         case entity.RelationshipTypeAdoptiveMotherID:
      37            0 :                 return util.ToCamel("master.relationship_type." + entity.RelationshipTypeAdoptiveMotherCode)
      38            0 :         default:
      39            0 :                 return ""
      40              :         }
      41              : }
      42              : 
      43              : // ToUserContactOutput は entity.UserContact を UserContractOutput に変換します。
      44            0 : func ToUserContactOutput(e *entity.UserContact) UserContactOutput {
      45            0 :         return UserContactOutput{
      46            0 :                 ID:                       e.ID,
      47            0 :                 UserID:                   e.UserID,
      48            0 :                 RelationshipTypeID:       e.RelationshipTypeID,
      49            0 :                 RelationshipTypeLabelKey: resolveRelationshipTypeKey(e.RelationshipTypeID),
      50            0 :                 DisplayName:              e.DisplayName,
      51            0 :                 Email:                    e.Email,
      52            0 :                 Phone:                    e.Phone,
      53            0 :                 Note:                     e.Note,
      54            0 :                 SortOrder:                e.SortOrder,
      55            0 :                 CreatedAt:                e.CreatedAt.Format("2006-01-02 15:04:05"),
      56            0 :                 UpdatedAt:                e.UpdatedAt.Format("2006-01-02 15:04:05"),
      57            0 :                 DeletedAt: func() string {
      58            0 :                         if e.DeletedAt.Valid {
      59            0 :                                 return e.DeletedAt.Time.Format("2006-01-02 15:04:05")
      60            0 :                         }
      61            0 :                         return ""
      62              :                 }(),
      63              :         }
      64              : }
      65              : 
      66              : // ToListUserContactOutput は entity.UserContact のリストを UserContactOutput のリストに変換します。
      67            0 : func ToListUserContactOutput(es []*entity.UserContact) []UserContactOutput {
      68            0 :         out := make([]UserContactOutput, 0, len(es))
      69            0 :         for _, e := range es {
      70            0 :                 out = append(out, ToUserContactOutput(e))
      71            0 :         }
      72            0 :         return out
      73              : }
      74              : 
      75              : // ToExistsUserContactOutput は 連絡先有無のプリミティブを出力DTOに変換します
      76            0 : func ToExistsUserContactOutput(exists bool) ExistsUserContactOutput {
      77            0 :         return ExistsUserContactOutput{
      78            0 :                 Exist: exists,
      79            0 :         }
      80            0 : }
        

Generated by: LCOV version 2.3.1-1