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

            Line data    Source code
       1              : // Package education は、学歴に関するユースケース(アプリケーションロジック)を提供します。
       2              : // ドメイン層のエンティティやリポジトリを操作し、アプリケーション全体で再利用可能なビジネスフローを実装します。
       3              : package education
       4              : 
       5              : import (
       6              :         "context"
       7              : 
       8              :         "resume/internal/domain/entity"
       9              : )
      10              : 
      11              : // CreateUserEducation は、指定されたユーザーIDに紐づく 学歴情報 を登録します。
      12              : // トランザクション内で UserEducation を参照し、並び順 を返します。
      13              : func (uc *Interactor) CreateUserEducation(
      14              :         ctx context.Context,
      15              :         in CreateInput,
      16            0 : ) (CreateOutput, error) {
      17            0 :         edu := &entity.UserEducation{
      18            0 :                 UserID:            in.UserID,
      19            0 :                 InstitutionName:   in.InstitutionName,
      20            0 :                 FacultyName:       in.FacultyName,
      21            0 :                 DepartmentName:    in.DepartmentName,
      22            0 :                 DegreeTypeID:      in.DegreeTypeID,
      23            0 :                 EducationStatusID: in.EducationStatusID,
      24            0 :                 EventDate:         in.EventDate,
      25            0 :                 Description:       in.Description,
      26            0 :                 IsPublic:          in.IsPublic,
      27            0 :         }
      28            0 :         var saved *entity.UserEducation
      29            0 :         err := uc.tx.Do(ctx, func(txCtx context.Context) error {
      30            0 :                 count, err := uc.ueRepo.CountByUserID(txCtx, in.UserID)
      31            0 :                 if err != nil {
      32            0 :                         return err
      33            0 :                 }
      34            0 :                 edu.SortOrder = count
      35            0 : 
      36            0 :                 res, err := uc.ueRepo.Create(txCtx, edu)
      37            0 :                 if err != nil {
      38            0 :                         return err
      39            0 :                 }
      40            0 :                 saved = res
      41            0 :                 return nil
      42              :         })
      43            0 :         if err != nil {
      44            0 :                 return CreateOutput{}, err
      45            0 :         }
      46            0 :         return CreateOutput{
      47            0 :                 Education: saved,
      48            0 :         }, err
      49              : }
        

Generated by: LCOV version 2.3.1-1