update task interface

This commit is contained in:
Chneemann 2024-03-25 09:40:24 +01:00
parent 59006cd65b
commit 6bdb99fc06
2 changed files with 8 additions and 7 deletions

View file

@ -1,9 +1,10 @@
export interface Task { export interface Task {
id?: string;
title: string; title: string;
description: string; description: string;
category: string; category: string;
status: string; status: string;
subtasksTitle: string; subtasksTitle: string[];
subtasksDone: boolean; subtasksDone: boolean[];
assigned: number; assigned: number[];
} }

View file

@ -6,6 +6,7 @@ import {
onSnapshot, onSnapshot,
updateDoc, updateDoc,
} from '@angular/fire/firestore'; } from '@angular/fire/firestore';
import { Task } from '../interfaces/task.interface';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -13,8 +14,8 @@ import {
export class TaskService { export class TaskService {
firestore: Firestore = inject(Firestore); firestore: Firestore = inject(Firestore);
allTasks: any[] = []; allTasks: Task[] = [];
filteredTasks: any[] = []; filteredTasks: Task[] = [];
unsubTask; unsubTask;
@ -26,8 +27,7 @@ export class TaskService {
return onSnapshot(this.getTaskRef(), (list) => { return onSnapshot(this.getTaskRef(), (list) => {
this.allTasks = []; this.allTasks = [];
list.forEach((element) => { list.forEach((element) => {
const taskData = element.data(); const taskData = { ...(element.data() as Task), id: element.id };
taskData['id'] = element.id;
this.allTasks.push(taskData); this.allTasks.push(taskData);
}); });
}); });