1414import com .mtvs .devlinkbackend .team .dto .request .TeamRegistRequestDTO ;
1515import com .mtvs .devlinkbackend .team .entity .Team ;
1616import com .mtvs .devlinkbackend .team .service .TeamService ;
17+ import com .mtvs .devlinkbackend .user .command .model .entity .User ;
18+ import com .mtvs .devlinkbackend .user .query .service .UserViewService ;
1719import org .springframework .stereotype .Service ;
1820import org .springframework .transaction .annotation .Transactional ;
1921
@@ -28,18 +30,24 @@ public class ProjectService {
2830 private final SupportService supportService ;
2931 private final ProjectViewRepository projectViewRepository ;
3032 private final TeamService teamService ;
33+ private final UserViewService userViewService ;
3134
32- public ProjectService (ProjectRepository projectRepository , SupportService supportService , ProjectViewRepository projectViewRepository , TeamService teamService ) {
35+ public ProjectService (ProjectRepository projectRepository , SupportService supportService , ProjectViewRepository projectViewRepository , TeamService teamService , UserViewService userViewService ) {
3336 this .projectRepository = projectRepository ;
3437 this .supportService = supportService ;
3538 this .projectViewRepository = projectViewRepository ;
3639 this .teamService = teamService ;
40+ this .userViewService = userViewService ;
3741 }
3842
3943 @ Transactional
40- public ProjectSingleResponseDTO registProject (ProjectRegistRequestDTO projectRegistRequestDTO ) {
44+ public ProjectSingleResponseDTO registProject (ProjectRegistRequestDTO projectRegistRequestDTO , String accountId ) {
45+ User user = userViewService .findUserByEpicAccountId (accountId );
46+ if (user == null )
47+ throw new IllegalArgumentException ("잘못된 userId 매핑" );
48+
4149 Project project = projectRepository .save (new Project (
42- projectRegistRequestDTO .getUserId (),
50+ user .getUserId (),
4351 projectRegistRequestDTO .getTitle (),
4452 projectRegistRequestDTO .getContent (),
4553 projectRegistRequestDTO .getWorkType (),
0 commit comments