Basic New Task
Some checks failed
Build BAB Application Deployment Artifact / build (push) Failing after 2m7s

This commit is contained in:
2024-04-03 13:28:35 -04:00
parent 923d09d713
commit deb6a0b8ed
11 changed files with 426 additions and 101 deletions

View File

@@ -2,12 +2,9 @@ import { defineStore } from 'pinia';
import { AppwriteIds, databases, ID } from 'src/boot/appwrite';
import type { Models } from 'appwrite';
export enum TASKSTATUS {
READY = 'ready',
COMPLETE = 'complete',
WAITING = 'waiting',
}
export interface Task extends Models.Document {
export const TASKSTATUS = ['ready', 'complete', 'waiting', 'archived'];
export interface Task extends Partial<Models.Document> {
title: string;
description: string;
required_skills: string[];
@@ -16,9 +13,8 @@ export interface Task extends Models.Document {
duration: number;
volunteers: string[];
volunteers_required: number;
status: TASKSTATUS;
depends_on: string;
completed: boolean;
status: string;
depends_on: string[];
boat: string;
} // TODO: convert some of these strings into objects.
@@ -59,7 +55,7 @@ export const useTaskStore = defineStore('tasks', {
);
this.taskTags = response.documents as TaskTag[];
} catch (error) {
console.error('Failed to fetch tasks', error);
console.error('Failed to fetch task tags', error);
}
},
async fetchSkillTags() {
@@ -71,7 +67,7 @@ export const useTaskStore = defineStore('tasks', {
);
this.skillTags = response.documents as SkillTag[];
} catch (error) {
console.error('Failed to fetch tasks', error);
console.error('Failed to fetch skill tags', error);
}
},
async addTask(task: Task) {
@@ -87,6 +83,15 @@ export const useTaskStore = defineStore('tasks', {
console.error('Failed to add task:', error);
}
},
// TODO: Enhance this store to include offline caching, and subscription notification when items change on the server.
filterTasks(searchQuery: string) {
const result = this.tasks.filter((task) =>
task.title.toLowerCase().includes(searchQuery.toLowerCase())
);
console.log(result);
return result;
},
},
// Add more actions as needed (e.g., updateTask, deleteTask)
getters: {