|
|
|
@ -20,26 +20,24 @@ export class WorkService {
|
|
|
|
|
return this.http.get(`${this.API_URL}/works`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//je veux return un work en fonction d'un link passé en param getWorksByUser
|
|
|
|
|
getWorkByLink(link: string): Observable<any> {
|
|
|
|
|
return this.http.get(`${this.API_URL}/work/${link}`);
|
|
|
|
|
//je veux return les works d'un user id
|
|
|
|
|
getWorksByUserId(user_id: string): Observable<any> {
|
|
|
|
|
return this.http.get(`${this.API_URL}/works/${user_id}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//je veux return le link du dernier work d'un user (en l'occurence celui connecté)
|
|
|
|
|
getLinkLastWorkByIdUser(id_user: string): Observable<any> {
|
|
|
|
|
return this.http.get(`${this.API_URL}/work/${id_user}`);
|
|
|
|
|
getLastWorkByUserId(user_id: string): Observable<any> {
|
|
|
|
|
return this.http.get(`${this.API_URL}/work/${user_id}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
postWork(form: NgForm): void {
|
|
|
|
|
let body = {link: crypto.randomUUID(), id_user: 1, id_language: 1, code: form.value.content, saveDate: new Date()}
|
|
|
|
|
let body = {link: crypto.randomUUID(), user_id: 1, id_language: 1, code: form.value.content, saveDate: new Date()}
|
|
|
|
|
this.http.post<any>(`${this.API_URL}/works`, body).subscribe();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
postWorkCode(code: string): void {
|
|
|
|
|
let body = {link: crypto.randomUUID(), id_user: 1, id_language: 1, code: code}
|
|
|
|
|
let body = {link: crypto.randomUUID(), user_id: 1, id_language: 1, code: code}
|
|
|
|
|
this.http.post<any>(`${this.API_URL}/works`, body).subscribe();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getIdLastWorkByUserId(id_user: string): string { return ""}
|
|
|
|
|
}
|