@@ -21,16 +21,20 @@ type IScoutListUsecase interface {
21
21
type scoutListUsecase struct {
22
22
scoutListRepo repositories.IScoutListRepository
23
23
userRepo repositories.IUserRepository
24
+ tagRepo repositories.ITagRepository
25
+ memberRepo repositories.IMemberRepository
24
26
communityRepo repositories.ICommunityRepository
25
27
messageRepo repositories.MessageRepository
26
28
}
27
29
28
- func NewScoutListUsecase (repo repositories.IScoutListRepository , userRepo repositories.IUserRepository , communityRepo repositories.ICommunityRepository , messageRepo repositories.MessageRepository ) IScoutListUsecase {
30
+ func NewScoutListUsecase (repo repositories.IScoutListRepository , userRepo repositories.IUserRepository , communityRepo repositories.ICommunityRepository , messageRepo repositories.MessageRepository , tagRepo repositories. ITagRepository , memberRepo repositories. IMemberRepository ) IScoutListUsecase {
29
31
return & scoutListUsecase {
30
32
scoutListRepo : repo ,
31
33
userRepo : userRepo ,
32
34
communityRepo : communityRepo ,
33
35
messageRepo : messageRepo ,
36
+ tagRepo : tagRepo ,
37
+ memberRepo : memberRepo ,
34
38
}
35
39
}
36
40
@@ -76,6 +80,22 @@ func (u *scoutListUsecase) GetWithCommunityDetails(ctx context.Context, UserUUID
76
80
return nil , fmt .Errorf ("failed to get unread count for user %s: %w" , scoutlist .User_UUID .String (), err )
77
81
}
78
82
83
+ // Mem1 の取得
84
+ mem1 , err := u .memberRepo .FindByID (ctx , detail .Mem1 )
85
+ if err != nil {
86
+ return nil , fmt .Errorf ("failed to get unread member1 %s: %w" , detail .Mem1 , err )
87
+ }
88
+
89
+ // Tags の取得
90
+ tagNames := make ([]string , 0 , len (detail .Tags ))
91
+ for _ , tagID := range detail .Tags {
92
+ tag , err := u .tagRepo .FindTagByID (ctx , tagID )
93
+ if err != nil {
94
+ return nil , fmt .Errorf ("failed to find tag by ID (%d): %w" , tagID , err )
95
+ }
96
+ tagNames = append (tagNames , tag .Name )
97
+ }
98
+
79
99
response := models.ScoutListResponse {
80
100
ID : scoutlist .ID ,
81
101
Status : scoutlist .Status ,
@@ -84,6 +104,8 @@ func (u *scoutListUsecase) GetWithCommunityDetails(ctx context.Context, UserUUID
84
104
DetailInfo : models.DetailInfo {
85
105
Name : detail .Name ,
86
106
Img : detail .Img ,
107
+ Mem1 : mem1 .Name ,
108
+ Tags : tagNames ,
87
109
},
88
110
}
89
111
responses = append (responses , response )
0 commit comments