Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssignmentSubmit에 데이터를 전달하는 구조를 개선한다. #766

Open
woowahan-pjs opened this issue Oct 1, 2024 · 0 comments
Labels

Comments

@woowahan-pjs
Copy link
Contributor

  • AssignmentSubmit으로 이동하기 전 useNavigatestate에 저장하는 값은 아래 두 경우 모두 같은 Mission을 사용한다.
    • MyMissionItem: fetchMyMissions()를 통해 Mission[]을 반환한다.
    • MissionView: fetchMissionRequirements()를 통해 Mission을 반환한다.
  • 실제 서버에서는 API마다 다른 타입을 사용하며, Mission에 정의된 모든 프로퍼티와 1:1로 일치하지 않는다.
  • AssignmentSubmit의 잠재적인 문제를 해결하고 향후 프로젝트 전체에 적용할 수 있는 구조를 고민한다.

Mission

export type Mission = {
  id: number;
  title: string;
  description: string;
  submittable: boolean;
  submitted: boolean;
  submissionMethod: keyof typeof MISSION_SUBMISSION_METHOD;
  startDateTime: ISO8601DateString;
  endDateTime: ISO8601DateString;
  status: MissionStatus;
  testable: boolean;
  judgment: Judgment;
};

fetchMyMissions() 호출 시 서버 반환 타입

data class MyMissionAndJudgementResponse(
    val id: Long,
    val title: String,
    val startDateTime: LocalDateTime,
    val endDateTime: LocalDateTime,
    val submittable: Boolean,
    val submissionMethod: SubmissionMethod,
    val status: MissionStatus,
    val submitted: Boolean,
    val testable: Boolean,
    val judgment: LastJudgmentResponse?,
)

fetchMissionRequirements() 호출 시 서버 반환 타입

data class MyMissionResponse(
    val id: Long,
    val title: String,
    val startDateTime: LocalDateTime,
    val endDateTime: LocalDateTime,
    val description: String,
    val submittable: Boolean,
    val submissionMethod: SubmissionMethod,
    val status: MissionStatus,
    val submitted: Boolean,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant