@@ -3,6 +3,7 @@ package bot
33import (
44 "context"
55
6+ "github.com/traP-jp/anshin-techo-backend/internal/repository"
67 "github.com/traPtitech/go-traq"
78 "github.com/traPtitech/traq-ws-bot/payload"
89)
@@ -14,6 +15,14 @@ type MockService struct {
1415 PostMessageFunc func (ctx context.Context , channelID string , content string ) error
1516 PostDirectMessageFunc func (ctx context.Context , userID string , content string ) error
1617
18+ NotifyTicketCreatedFunc func (ctx context.Context , ticket * repository.Ticket ) error
19+ NotifyTicketUpdatedFunc func (ctx context.Context , ticket * repository.Ticket ) error
20+ NotifyNoteCreatedFunc func (ctx context.Context , noteType string , contentPreview string , authorID string , shouldMention bool ) error
21+ NotifyReviewCreatedFunc func (ctx context.Context , noteTitle string , noteAuthorID string , reviewerID string , comment string ) error
22+ SendDeadlineReminderFunc func (ctx context.Context , ticket * repository.Ticket , daysOverdue int ) error
23+ SendWaitingSentReminderFunc func (ctx context.Context , ticket * repository.Ticket ) error
24+ GetUserIDByNameFunc func (ctx context.Context , name string ) (string , error )
25+
1726 // イベントハンドラの記録用
1827 MessageCreatedHandler func (messageID , channelID , userID , content string )
1928 MessageStampsUpdatedHandler func (messageID string , stamps []payload.MessageStamp )
@@ -36,6 +45,15 @@ func NewMockService() *MockService {
3645 PostDirectMessageFunc : func (_ context.Context , _ string , _ string ) error {
3746 return nil
3847 },
48+
49+ NotifyTicketCreatedFunc : func (_ context.Context , _ * repository.Ticket ) error { return nil },
50+ NotifyTicketUpdatedFunc : func (_ context.Context , _ * repository.Ticket ) error { return nil },
51+ NotifyNoteCreatedFunc : func (_ context.Context , _ string , _ string , _ string , _ bool ) error { return nil },
52+ NotifyReviewCreatedFunc : func (_ context.Context , _ string , _ string , _ string , _ string ) error { return nil },
53+ SendDeadlineReminderFunc : func (_ context.Context , _ * repository.Ticket , _ int ) error { return nil },
54+ SendWaitingSentReminderFunc : func (_ context.Context , _ * repository.Ticket ) error { return nil },
55+ GetUserIDByNameFunc : func (_ context.Context , _ string ) (string , error ) { return "user-id" , nil },
56+
3957 MessageCreatedHandler : func (_ , _ , _ , _ string ) {},
4058 MessageStampsUpdatedHandler : func (_ string , _ []payload.MessageStamp ) {},
4159 }
@@ -57,6 +75,34 @@ func (m *MockService) PostDirectMessage(ctx context.Context, userID string, cont
5775 return m .PostDirectMessageFunc (ctx , userID , content )
5876}
5977
78+ func (m * MockService ) NotifyTicketCreated (ctx context.Context , ticket * repository.Ticket ) error {
79+ return m .NotifyTicketCreatedFunc (ctx , ticket )
80+ }
81+
82+ func (m * MockService ) NotifyTicketUpdated (ctx context.Context , ticket * repository.Ticket ) error {
83+ return m .NotifyTicketUpdatedFunc (ctx , ticket )
84+ }
85+
86+ func (m * MockService ) NotifyNoteCreated (ctx context.Context , noteType string , contentPreview string , authorID string , shouldMention bool ) error {
87+ return m .NotifyNoteCreatedFunc (ctx , noteType , contentPreview , authorID , shouldMention )
88+ }
89+
90+ func (m * MockService ) NotifyReviewCreated (ctx context.Context , noteTitle string , noteAuthorID string , reviewerID string , comment string ) error {
91+ return m .NotifyReviewCreatedFunc (ctx , noteTitle , noteAuthorID , reviewerID , comment )
92+ }
93+
94+ func (m * MockService ) SendDeadlineReminder (ctx context.Context , ticket * repository.Ticket , daysOverdue int ) error {
95+ return m .SendDeadlineReminderFunc (ctx , ticket , daysOverdue )
96+ }
97+
98+ func (m * MockService ) SendWaitingSentReminder (ctx context.Context , ticket * repository.Ticket ) error {
99+ return m .SendWaitingSentReminderFunc (ctx , ticket )
100+ }
101+
102+ func (m * MockService ) GetUserIDByName (ctx context.Context , name string ) (string , error ) {
103+ return m .GetUserIDByNameFunc (ctx , name )
104+ }
105+
60106func (m * MockService ) OnMessageCreated (handler func (messageID , channelID , userID , content string )) {
61107 m .MessageCreatedHandler = handler
62108}
0 commit comments