qa: Managers can view team and manage theirs todo list
This commit is contained in:
parent
b94beb363b
commit
cd64fc90bf
13 changed files with 526 additions and 24 deletions
|
|
@ -12,19 +12,36 @@ export class QATodo {
|
|||
this.id_team = id_team;
|
||||
this.id_exercice = id_exercice;
|
||||
}
|
||||
|
||||
async delete(team) {
|
||||
const res = await fetch(team?`api/teams/${team.id}/todo/${this.id}`:`api/teams/${this.id_team}/todo/${this.id}`, {
|
||||
method: 'DELETE',
|
||||
headers: {'Accept': 'application/json'}
|
||||
});
|
||||
if (res.status < 300) {
|
||||
return true;
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getQATodo() {
|
||||
const res = await fetch(`api/qa_work.json`, {headers: {'Accept': 'application/json'}})
|
||||
export async function getQATodo(team) {
|
||||
const res = await fetch(team?`api/teams/${team.id}/qa_work.json`:`api/qa_work.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
return (await res.json()).map((t) => new QATodo(t));
|
||||
const data = await res.json();
|
||||
if (data === null) {
|
||||
return []
|
||||
} else {
|
||||
return data.map((t) => new QATodo(t));
|
||||
}
|
||||
} else {
|
||||
throw new Error((await res.json()).errmsg);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getQAWork() {
|
||||
const res = await fetch(`api/qa_mywork.json`, {headers: {'Accept': 'application/json'}})
|
||||
export async function getQAWork(team) {
|
||||
const res = await fetch(team?`api/teams/${team.id}/qa_mywork.json`:`api/qa_mywork.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
const data = await res.json()
|
||||
if (data) {
|
||||
|
|
@ -37,8 +54,8 @@ export async function getQAWork() {
|
|||
}
|
||||
}
|
||||
|
||||
export async function getQAView() {
|
||||
const res = await fetch(`api/qa_myexercices.json`, {headers: {'Accept': 'application/json'}})
|
||||
export async function getQAView(team) {
|
||||
const res = await fetch(team?`api/teams/${team.id}/qa_myexercices.json`:`api/qa_myexercices.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
const data = await res.json()
|
||||
if (data) {
|
||||
|
|
@ -51,8 +68,8 @@ export async function getQAView() {
|
|||
}
|
||||
}
|
||||
|
||||
export async function getExerciceTested() {
|
||||
const res = await fetch(`api/qa_exercices.json`, {headers: {'Accept': 'application/json'}})
|
||||
export async function getExerciceTested(team) {
|
||||
const res = await fetch(team?`api/teams/${team.id}/qa_exercices.json`:`api/qa_exercices.json`, {headers: {'Accept': 'application/json'}})
|
||||
if (res.status == 200) {
|
||||
return await res.json();
|
||||
} else {
|
||||
|
|
|
|||
Reference in a new issue