Commit ·
7f1e85c
1
Parent(s): 2b594ee
Type Corrected.
Browse files
frontend/app/routes/my-applications.$id.tsx
CHANGED
|
@@ -51,7 +51,7 @@ export default function MyApplicationDetailsRoute() {
|
|
| 51 |
|
| 52 |
return (
|
| 53 |
<main className="container mx-auto p-4 flex flex-col gap-4">
|
| 54 |
-
<ApplicationCard application={application} aid={application.
|
| 55 |
{application.answers.map((answer: DetailedApplication["answers"][number]) => (
|
| 56 |
<QuestionCard
|
| 57 |
key={answer.question_id}
|
|
|
|
| 51 |
|
| 52 |
return (
|
| 53 |
<main className="container mx-auto p-4 flex flex-col gap-4">
|
| 54 |
+
<ApplicationCard application={application} aid={application.assessment_id || ""} jid={application.job_id || ""} isStatic />
|
| 55 |
{application.answers.map((answer: DetailedApplication["answers"][number]) => (
|
| 56 |
<QuestionCard
|
| 57 |
key={answer.question_id}
|
frontend/app/services/useGetMyApplicationByID.ts
CHANGED
|
@@ -1,14 +1,40 @@
|
|
| 1 |
import { useQuery } from "@tanstack/react-query";
|
| 2 |
import { HTTPManager } from "~/managers/HTTPManager";
|
| 3 |
-
import type {
|
| 4 |
-
import type { DetailedApplication } from "./useGetJobAssessmentApplicationByID";
|
| 5 |
|
| 6 |
export const GET_JOB_ASSESSMENT_APPLICATION_BY_ID_KEY = "job-assessment-application-by-id";
|
| 7 |
|
| 8 |
-
export type DetailedMyApplication =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
export const useGetMyApplicationByID = ({ id }: { id: string }) =>
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
})
|
|
|
|
|
|
| 1 |
import { useQuery } from "@tanstack/react-query";
|
| 2 |
import { HTTPManager } from "~/managers/HTTPManager";
|
| 3 |
+
import type { User } from "./useGetMyUser";
|
|
|
|
| 4 |
|
| 5 |
export const GET_JOB_ASSESSMENT_APPLICATION_BY_ID_KEY = "job-assessment-application-by-id";
|
| 6 |
|
| 7 |
+
export type DetailedMyApplication = {
|
| 8 |
+
id: string;
|
| 9 |
+
job_id: string;
|
| 10 |
+
assessment_id: string;
|
| 11 |
+
user_id: string;
|
| 12 |
+
answers: Array<{
|
| 13 |
+
question_id: string;
|
| 14 |
+
text: string;
|
| 15 |
+
options: Array<string>;
|
| 16 |
+
question_text: string;
|
| 17 |
+
weight: number;
|
| 18 |
+
skill_categories: Array<string>;
|
| 19 |
+
type: "text_based" | "choose_one" | "choose_many";
|
| 20 |
+
question_options: Array<{ text: string; value: string }>;
|
| 21 |
+
correct_options: Array<string>;
|
| 22 |
+
rationale: string;
|
| 23 |
+
}>;
|
| 24 |
+
assessment_details: {
|
| 25 |
+
id: string;
|
| 26 |
+
title: string;
|
| 27 |
+
passing_score: number;
|
| 28 |
+
created_at: string | null;
|
| 29 |
+
};
|
| 30 |
+
score: number;
|
| 31 |
+
passing_score: number;
|
| 32 |
+
user: User;
|
| 33 |
+
};
|
| 34 |
|
| 35 |
+
export const useGetMyApplicationByID = ({ id }: { id: string }) =>
|
| 36 |
+
useQuery({
|
| 37 |
+
queryKey: [GET_JOB_ASSESSMENT_APPLICATION_BY_ID_KEY, id],
|
| 38 |
+
queryFn: async () =>
|
| 39 |
+
HTTPManager.get<DetailedMyApplication>(`/applications/my-applications/${id}`).then((response) => response.data),
|
| 40 |
+
});
|