feat: review model to retrieve all the questions with a single query

- update initial data
- add description field to the axe
This commit is contained in:
2022-11-02 11:16:17 +01:00
parent 075a508bb5
commit 3c4928ae61
20 changed files with 269 additions and 155 deletions

View File

@@ -1,9 +1,9 @@
import {Axe} from "~/repositories/models/axe.model";
import {RestResponse} from "~/repositories/models/rest-response.model";
import {$axios} from "~/utils/api";
import {AxeWithQuestions} from "~/repositories/models/axe.model";
export default {
findAll() {
return $axios.get<RestResponse<Axe>>("/axes");
return $axios.get<RestResponse<AxeWithQuestions>>("/axes/search/me");
}
}

View File

@@ -1,8 +1,19 @@
import {RestLinks} from "~/repositories/models/rest-response.model";
import {Question} from "~/repositories/models/question.model";
export interface Axe extends RestLinks {
identifier: number;
shortTitle: string;
description: string;
title: string;
color: string;
}
export interface AxeWithQuestions extends RestLinks {
identifier: number;
shortTitle: string;
description: string;
title: string;
color: string;
questions: Question[];
}

View File

@@ -5,19 +5,6 @@ export interface Score {
axeIdentifier: number;
}
export interface Quiz extends RestLinks {
id: number;
createdDate: string;
scores: Score[];
}
export interface Response {
axeId: number;
questionId: number;
score?: number;
comment?: string;
}
export interface ResponseWithQuestion extends RestLinks {
axeIdentifier: number;
question: string;
@@ -25,6 +12,22 @@ export interface ResponseWithQuestion extends RestLinks {
comment: string;
}
export interface Quiz extends RestLinks {
id: number;
createdDate: string;
scores: Score[];
_embedded: {
responses: ResponseWithQuestion[]
};
}
export interface Response {
axeId: number;
questionId: number;
score?: number;
comment?: string;
}
export interface QuizRate {
score?: number;
comment?: string;