Compare commits
2 Commits
d3040c0268
...
55f4a665f8
| Author | SHA1 | Date | |
|---|---|---|---|
| 55f4a665f8 | |||
| c09e2655b9 |
@@ -1,59 +1,9 @@
|
||||
# DoItEarlier
|
||||
# Do it earlier
|
||||
|
||||
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 22.0.4.
|
||||
Une application *todo list* destinée à un usage personnel. Ses fonctionnalités sont fortement inspirées par Todoist, dont l'abonnement payant m'a poussé à créer ma propre version.
|
||||
|
||||
## Development server
|
||||
# Stack
|
||||
|
||||
To start a local development server, run:
|
||||
Application web réalisée en angular 22.0.4 et node.js 24.18.0.
|
||||
|
||||
```bash
|
||||
ng serve
|
||||
```
|
||||
|
||||
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
||||
|
||||
```bash
|
||||
ng generate component component-name
|
||||
```
|
||||
|
||||
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
||||
|
||||
```bash
|
||||
ng generate --help
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
To build the project run:
|
||||
|
||||
```bash
|
||||
ng build
|
||||
```
|
||||
|
||||
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
|
||||
|
||||
```bash
|
||||
ng test
|
||||
```
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
For end-to-end (e2e) testing, run:
|
||||
|
||||
```bash
|
||||
ng e2e
|
||||
```
|
||||
|
||||
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
||||
Elle utilise une API maison interrogeant une base de données privée self-hosted.
|
||||
|
||||
@@ -14,4 +14,10 @@ export class BaseService {
|
||||
protected post<T>(url: string, body: T): Observable<T> {
|
||||
return this.http.post<T>(this.baseAddress + url, body);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected delete<T>(url: string): Observable<T> {
|
||||
return this.http.delete<T>(`${this.baseAddress}${url}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,10 @@ export class TaskService extends BaseService {
|
||||
return this.get<Task[]>("task");
|
||||
}
|
||||
|
||||
public addTask(name: string, dueDate: string | null, priority: string | null, status: string | null): Observable<Task> {
|
||||
public addTask(name: string,
|
||||
dueDate: string | null,
|
||||
priority: string | null,
|
||||
status: string | null): Observable<Task> {
|
||||
let body: Task = {
|
||||
name_task: name,
|
||||
date_task: new Date(dueDate!),
|
||||
@@ -19,4 +22,8 @@ export class TaskService extends BaseService {
|
||||
}
|
||||
return this.post<Task>("task/add", body);
|
||||
}
|
||||
|
||||
public deleteTask(id_task: number): Observable<void> {
|
||||
return this.delete<void>(`task/delete?id=${id_task}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,16 @@
|
||||
Section tâches
|
||||
</h2>
|
||||
<div>
|
||||
<div>
|
||||
@for (task of tasks(); track task.id_task) {
|
||||
<p>
|
||||
{{ task.name_task }}
|
||||
</p>
|
||||
}
|
||||
|
||||
<button (click)="deleteTask(task.id_task)">Supprimer la tâche </button>
|
||||
}
|
||||
</div>
|
||||
<br/>
|
||||
<button (click)="toggleTaskForm()">
|
||||
Ajouter une tâche
|
||||
</button>
|
||||
|
||||
@@ -49,17 +49,32 @@ export class Home {
|
||||
//#endregion
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.taskService.getTasks().subscribe((response: Task[]): void => {
|
||||
this.taskService.getTasks().subscribe({
|
||||
next: (response: Task[]) => {
|
||||
this.tasks.set(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`Récupération des tâches impossible\nErreur:${error.error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
this.groupService.getGroups().subscribe((response: Group[]): void => {
|
||||
this.groupService.getGroups().subscribe({
|
||||
next: (response: Group[]) => {
|
||||
this.groups.set(response);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`Récupération des groupes impossible\nErreur:${error.error.message}`);
|
||||
}
|
||||
});
|
||||
|
||||
this.projectService.getProjects().subscribe((response: Project[]): void => {
|
||||
this.projectService.getProjects().subscribe({
|
||||
next: (response: Project[]) => {
|
||||
this.projects.set(response);
|
||||
})
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`Récupération des projets impossible\nErreur:${error.error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public toggleTaskForm(): void {
|
||||
@@ -75,10 +90,33 @@ export class Home {
|
||||
this.newTaskForm.controls.priority.value,
|
||||
this.newTaskForm.controls.status.value);
|
||||
|
||||
response.subscribe(response => {
|
||||
response.subscribe({
|
||||
next: (response) => {
|
||||
this.tasks.update(values => {
|
||||
return [...values, response];
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`L'ajout de tâche est impossible\nErreur:${error.error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* deleteTask
|
||||
*/
|
||||
public deleteTask(id_task: number) {
|
||||
let response: Observable<void> = this.taskService.deleteTask(id_task);
|
||||
|
||||
response.subscribe({
|
||||
next: () => {
|
||||
this.tasks.update((tasks) => {
|
||||
return tasks.filter(((task) => task.id_task != id_task));
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`La suppression de tâche est impossible\nErreur:${error.error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -92,10 +130,15 @@ export class Home {
|
||||
public submitGroup() {
|
||||
let response: Observable<Group> = this.groupService.addGroup(this.newGroupForm.controls.name.value!);
|
||||
|
||||
response.subscribe(response => {
|
||||
response.subscribe({
|
||||
next: (response) => {
|
||||
this.groups.update(values => {
|
||||
return [...values, response];
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`L'ajout d'un groupe est impossible\nErreur:${error.error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -109,10 +152,15 @@ export class Home {
|
||||
public submitProject() {
|
||||
let response: Observable<Project> = this.projectService.addProject(this.newProjectForm.controls.name.value!);
|
||||
|
||||
response.subscribe(response => {
|
||||
response.subscribe({
|
||||
next: (response) => {
|
||||
this.projects.update(values => {
|
||||
return [...values, response];
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`L'ajout d'un projet est impossible\nErreur:${error.error.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user