1515import com .example .Veco .domain .external .repository .ExternalCustomRepository ;
1616import com .example .Veco .domain .external .repository .ExternalRepository ;
1717import com .example .Veco .domain .github .service .GitHubIssueService ;
18- import com .example .Veco .domain .goal .converter .GoalConverter ;
19- import com .example .Veco .domain .goal .dto .request .GoalReqDTO ;
20- import com .example .Veco .domain .goal .dto .response .GoalResDTO ;
2118import com .example .Veco .domain .goal .entity .Goal ;
2219import com .example .Veco .domain .goal .repository .GoalRepository ;
2320import com .example .Veco .domain .mapping .Assignment ;
2825import com .example .Veco .domain .member .error .MemberErrorStatus ;
2926import com .example .Veco .domain .member .error .MemberHandler ;
3027import com .example .Veco .domain .member .repository .MemberRepository ;
31- import com .example .Veco .domain .slack .exception .SlackException ;
32- import com .example .Veco .domain .slack .exception .code .SlackErrorCode ;
33- import com .example .Veco .domain .slack .util .SlackUtil ;
28+ import com .example .Veco .domain .slack .service .SlackCommandService ;
3429import com .example .Veco .domain .team .dto .NumberSequenceResponseDTO ;
3530import com .example .Veco .domain .team .entity .Team ;
3631import com .example .Veco .domain .team .exception .TeamException ;
5146import java .time .format .DateTimeParseException ;
5247import java .util .ArrayList ;
5348import java .util .List ;
54- import java .util .Optional ;
5549import java .util .stream .Collectors ;
5650
5751@ Slf4j
@@ -72,11 +66,11 @@ public class ExternalService {
7266 private final AssigneeRepository assigneeRepository ;
7367
7468 // 유틸
75- private final SlackUtil slackUtil ;
7669 private final CommentRoomRepository commentRoomRepository ;
7770 private final GitHubIssueService gitHubIssueService ;
7871 private final GitHubInstallationRepository githubInstallationRepository ;
7972 private final CommentRepository commentRepository ;
73+ private final SlackCommandService slackCommandService ;
8074
8175 @ Transactional
8276 public ExternalResponseDTO .CreateResponseDTO createExternal (Long teamId ,
@@ -124,22 +118,7 @@ public ExternalResponseDTO.CreateResponseDTO createExternal(Long teamId,
124118 if (request .getExtServiceType () == ExtServiceType .GITHUB ){
125119 gitHubIssueService .createGitHubIssue (request );
126120 } else if (request .getExtServiceType () == ExtServiceType .SLACK ){
127- // accessToken, DefaultChannelId, message
128- // 연동 정보 조회
129- com .example .Veco .domain .external .entity .ExternalService externalService =
130- linkRepository .findLinkByWorkspaceAndExternalService_ServiceType (
131- team .getWorkSpace (), ExtServiceType .SLACK )
132- .orElseThrow (() -> new SlackException (SlackErrorCode .NOT_LINKED ))
133- .getExternalService ();
134-
135- String message = team .getName () + "에서 " +
136- external .getTitle () + "을(를) 생성했습니다." ;
137-
138- slackUtil .PostSlackMessage (
139- externalService .getAccessToken (),
140- externalService .getSlackDefaultChannelId (),
141- message
142- );
121+ slackCommandService .sendSlackMessage (team , external );
143122 }
144123
145124 return ExternalConverter .createResponseDTO (external );
0 commit comments