Skip to content

Conversation

@soheeparklee
Copy link
Contributor

@soheeparklee soheeparklee commented Dec 23, 2024

#️⃣연관된 이슈

ex) #이슈번호, #이슈번호

📝작업 내용

종료된 할일을 포함해 모든 목표, 할 일, 인증을 가져옵니다.

  • 제 임의로 정하기에는 고민인 부분들이 있어 아직 머지하지 말고 회의까지 기다려야 할 것 같습니다. 현석님의 의견먼저 듣고 싶어서 pr올립니다.

스크린샷 (선택)

응답값 입니다.
{
    "statusCode": 200,
    "data": [
        {
            "goalId": 3,
            "goalTitle": "테스트1",
            "goalColor": "#FFAB76",
            "progress": 0.0,
            "todos": [
                {
                    "todoId": 35,
                    "goalTitle": "테스트1",
                    "goalColor": "#FFAB76",
                    "todoTitle": "가가거겨",
                    "startDate": "2024-12-13",
                    "endDate": "2024-12-14",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "",
                    "createdAt": "2024-12-13T02:50:18",
                    "completes": [
                        {
                            "completeId": 61,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-13T02:50:18",
                            "startDate": "2024-12-13"
                        },
                        {
                            "completeId": 62,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-13T02:50:18",
                            "startDate": "2024-12-14"
                        }
                    ]
                },
                {
                    "todoId": 49,
                    "goalTitle": "테스트1",
                    "goalColor": "#FFAB76",
                    "todoTitle": "dfdfd",
                    "startDate": "2024-12-27",
                    "endDate": "2024-12-28",
                    "todoStatus": "인증",
                    "todoLink": "",
                    "todoPic": "https://slid-todo.s3.ap-northeast-2.amazonaws.com/a86c689d-307a-4778-ba53-9e3a304391f7_캡처했던 화면 velog6.PNG",
                    "createdAt": "2024-12-14T14:34:09",
                    "completes": [
                        {
                            "completeId": 84,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-14T14:34:09",
                            "startDate": "2024-12-14"
                        },
                        {
                            "completeId": 85,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-14T14:34:09",
                            "startDate": "2024-12-15"
                        }
                    ]
                },
                {
                    "todoId": 87,
                    "goalTitle": "테스트1",
                    "goalColor": "#FFAB76",
                    "todoTitle": "ddddd",
                    "startDate": "2024-12-27",
                    "endDate": "2024-12-28",
                    "todoStatus": "진행",
                    "todoLink": "https://www.youtube.com/",
                    "todoPic": "",
                    "createdAt": "2024-12-23T01:44:33",
                    "completes": [
                        {
                            "completeId": 211,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T01:44:33",
                            "startDate": "2024-12-27"
                        },
                        {
                            "completeId": 212,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T01:44:33",
                            "startDate": "2024-12-28"
                        }
                    ]
                },
                {
                    "todoId": 88,
                    "goalTitle": "테스트1",
                    "goalColor": "#FFAB76",
                    "todoTitle": "할일 생성한다",
                    "startDate": "2024-12-26",
                    "endDate": "2024-12-27",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "https://slid-todo.s3.ap-northeast-2.amazonaws.com/5aa1a915-c2f0-4d21-bcea-fffc1d1cd56a_캡처했던 화면 velog6.PNG",
                    "createdAt": "2024-12-23T04:11:37",
                    "completes": [
                        {
                            "completeId": 213,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T04:11:37",
                            "startDate": "2024-12-26"
                        },
                        {
                            "completeId": 214,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T04:11:37",
                            "startDate": "2024-12-27"
                        }
                    ]
                }
            ]
        },
        {
            "goalId": 4,
            "goalTitle": "테스트2",
            "goalColor": "#B18AE0",
            "progress": 0.0,
            "todos": [
                {
                    "todoId": 79,
                    "goalTitle": "테스트2",
                    "goalColor": "#B18AE0",
                    "todoTitle": "이리와",
                    "startDate": "2024-12-24",
                    "endDate": "2024-12-25",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "",
                    "createdAt": "2024-12-19T04:08:14",
                    "completes": [
                        {
                            "completeId": 186,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-19T04:08:15",
                            "startDate": "2024-12-24"
                        },
                        {
                            "completeId": 187,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-19T04:08:15",
                            "startDate": "2024-12-25"
                        }
                    ]
                }
            ]
        },
        {
            "goalId": 5,
            "goalTitle": "생성 테스트 1",
            "goalColor": "#A8D8F0",
            "progress": 0.0,
            "todos": [
                {
                    "todoId": 78,
                    "goalTitle": "생성 테스트 1",
                    "goalColor": "#A8D8F0",
                    "todoTitle": "힝구",
                    "startDate": "2024-12-24",
                    "endDate": "2024-12-25",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "",
                    "createdAt": "2024-12-18T07:47:00",
                    "completes": [
                        {
                            "completeId": 184,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-18T07:47:00",
                            "startDate": "2024-12-24"
                        },
                        {
                            "completeId": 185,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-18T07:47:00",
                            "startDate": "2024-12-25"
                        }
                    ]
                },
                {
                    "todoId": 91,
                    "goalTitle": "생성 테스트 1",
                    "goalColor": "#A8D8F0",
                    "todoTitle": "ddd",
                    "startDate": "2024-12-26",
                    "endDate": "2024-12-27",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "https://slid-todo.s3.ap-northeast-2.amazonaws.com/c4660c8e-2266-4c46-a0c3-b44499f6a00e_캡처했던 화면 velog6.PNG",
                    "createdAt": "2024-12-23T09:27:08",
                    "completes": [
                        {
                            "completeId": 224,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T09:27:08",
                            "startDate": "2024-12-26"
                        },
                        {
                            "completeId": 225,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T09:27:08",
                            "startDate": "2024-12-27"
                        }
                    ]
                }
            ]
        },
        {
            "goalId": 7,
            "goalTitle": "수정 테스트 9",
            "goalColor": "#F49696",
            "progress": 0.0,
            "todos": [
                {
                    "todoId": 30,
                    "goalTitle": "수정 테스트 9",
                    "goalColor": "#F49696",
                    "todoTitle": "todoStatus",
                    "startDate": "2024-12-11",
                    "endDate": "2024-12-15",
                    "todoStatus": "인증",
                    "todoLink": "asd",
                    "todoPic": "",
                    "createdAt": "2024-12-11T13:55:32",
                    "completes": [
                        {
                            "completeId": 46,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-11T13:55:33",
                            "startDate": "2024-12-11"
                        },
                        {
                            "completeId": 47,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-11T13:55:33",
                            "startDate": "2024-12-12"
                        },
                        {
                            "completeId": 48,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-11T13:55:33",
                            "startDate": "2024-12-13"
                        },
                        {
                            "completeId": 49,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-11T13:55:33",
                            "startDate": "2024-12-14"
                        },
                        {
                            "completeId": 50,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-11T13:55:33",
                            "startDate": "2024-12-15"
                        }
                    ]
                }
            ]
        },
        {
            "goalId": 12,
            "goalTitle": "수정 테스트 12",
            "goalColor": "#B18AE0",
            "progress": 0.0,
            "todos": []
        },
        {
            "goalId": 22,
            "goalTitle": "생성테스트12",
            "goalColor": "#B18AE0",
            "progress": 0.0,
            "todos": [
                {
                    "todoId": 53,
                    "goalTitle": "생성테스트12",
                    "goalColor": "#B18AE0",
                    "todoTitle": "할일생성테스트1",
                    "startDate": "2024-12-14",
                    "endDate": "2024-12-15",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "",
                    "createdAt": "2024-12-14T15:13:13",
                    "completes": [
                        {
                            "completeId": 86,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-14T15:13:13",
                            "startDate": "2024-12-14"
                        },
                        {
                            "completeId": 87,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-14T15:13:13",
                            "startDate": "2024-12-15"
                        }
                    ]
                },
                {
                    "todoId": 55,
                    "goalTitle": "생성테스트12",
                    "goalColor": "#B18AE0",
                    "todoTitle": "할일생성테스트1",
                    "startDate": "2024-12-14",
                    "endDate": "2024-12-15",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "",
                    "createdAt": "2024-12-14T14:39:30",
                    "completes": [
                        {
                            "completeId": 88,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-14T14:39:31",
                            "startDate": "2024-12-14"
                        },
                        {
                            "completeId": 89,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-14T14:39:31",
                            "startDate": "2024-12-15"
                        }
                    ]
                }
            ]
        },
        {
            "goalId": 69,
            "goalTitle": "생성 테스트 12",
            "goalColor": "#B18AE0",
            "progress": 0.0,
            "todos": [
                {
                    "todoId": 86,
                    "goalTitle": "생성 테스트 12",
                    "goalColor": "#B18AE0",
                    "todoTitle": "dfdf",
                    "startDate": "2024-12-25",
                    "endDate": "2024-12-26",
                    "todoStatus": "진행",
                    "todoLink": "",
                    "todoPic": "",
                    "createdAt": "2024-12-23T01:43:21",
                    "completes": [
                        {
                            "completeId": 209,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T01:43:21",
                            "startDate": "2024-12-25"
                        },
                        {
                            "completeId": 210,
                            "completePic": null,
                            "note": null,
                            "completeLink": null,
                            "completeStatus": "진행",
                            "createdAt": "2024-12-23T01:43:21",
                            "startDate": "2024-12-26"
                        }
                    ]
                }
            ]
        },
        {
            "goalId": 70,
            "goalTitle": "아아",
            "goalColor": "#B18AE0",
            "progress": 0.0,
            "todos": []
        }
    ],
    "timestamp": "2024-12-23T17:33:09.220768"
}

💬리뷰 요구사항(선택)

  1. 페이지네이션이나 무한스크롤을 구현할지 안 할지 따로 이야기를 안 나눴어서, 우선은 그냥 리스트로 응답받았는데 회의 때 어떻게 할지 정해야 할 것 같습니다.

  2. 코드가 대시보드에서 목표 조회와 상당히 비슷합니다.
    차이점을 설명하자면, 할 일 가져올 때 날짜를 확인하는 것이 제 API에는 구현되지 않고, 그냥 모든 할일을 가져온다는 차이가 있습니다.
    그래서 2번 이상 사용되는 코드는 따로 메소드로 뺐고, 다른 클라스에서도 이용되다보니 public으로 만들었습니다.

  3. 목표에 대해 조회하는 만큼, 목표 콘트롤러, 서비스에 들어가는게 맞다고 생각해 api/v1/goals/all로 URL만들었습니다.

  4. 목표와 할 일을 다 가져와서 정렬하는 기준이 필요할 것 같습니다. 일단 제가 생각해 본 기준으로는

  • 목표의 progress가 낮은 순
  • completeStatus가 "진행" 인 순
  • todo의 startDate가 가장 최신인 순
    등이 있을 것 같은데 이 부분도 회의 때 이야기 나누면 좋겠습니다.

@soheeparklee soheeparklee self-assigned this Dec 23, 2024
@soheeparklee soheeparklee linked an issue Dec 23, 2024 that may be closed by this pull request
1 task
Copy link
Member

@bbbbooo bbbbooo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다.

페이지네이션이나 무한스크롤을 구현할지 안 할지 따로 이야기를 안 나눴어서, 우선은 그냥 리스트로 응답받았는데 회의 때 어떻게 할지 정해야 할 것 같습니다.

음.. 대부분의 페이징 처리가 무한스크롤로 돼있어서 아마 무한스크롤로 해도 무관할 듯 싶습니다. 프론트분들께 한번 물어보는 것도 좋을거같아요

목표와 할 일을 다 가져와서 정렬하는 기준이 필요할 것 같습니다. 일단 제가 생각해 본 기준으로는
목표의 progress가 낮은 순
completeStatus가 "진행" 인 순
todo의 startDate가 가장 최신인 순
등이 있을 것 같은데 이 부분도 회의 때 이야기 나누면 좋겠습니다.

이 부분은 잘 이해가 안되는데 무엇때문에 기준을 나누는걸까요? 정렬 자체는 쿼리에서 하면 될 듯 싶어서 여쭤봅니다.

return Response.ok(goalService.deleteGoal(userId, goalId));
}

@Transactional
Copy link
Member

@bbbbooo bbbbooo Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

소희님은 컨트롤러에 @Transactional 많이 쓰시나요? 이 글 참고해보시면 좋을 것 같습니다!

저는 서비스 클래스에 @Transactional 붙이고 조회하는 메소드는 readOnly = true 옵션을 활성화해요.

@Transactional
public class TodoServiceImpl implements TodoService {

    private static final String COMPLETE = "인증";

    private final TodoRepository todoRepository;
    private final GoalRepository goalRepository;
    private final CompleteRepository completeRepository;

    private final StorageService storageService;

    @Transactional(readOnly = true)
    @Override
    public Slice<ReadTodosResponse> findTodoList(int userId, ReadTodoRequest request) {
        List<Goal> goals = goalRepository.findByUser_UserId(userId);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다~ 서비스 클래스로 옮겨두었습니다.

@soheeparklee soheeparklee merged commit 382a2ec into develop Dec 25, 2024
1 check passed
@soheeparklee soheeparklee deleted the feature/goal-detail branch December 27, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

목표 상세 조회

3 participants