Two month of work

This commit is contained in:
2026-02-17 10:35:03 +01:00
parent 0ffbeeedff
commit d9fd3d1ccb
158 changed files with 5637 additions and 1512 deletions
+59
View File
@@ -0,0 +1,59 @@
import axios, { AxiosError } from 'axios';
import { Note, PipelineItem } from '@/types';
import { toast } from 'vue-sonner';
const API_URL = '/api/notes';
export default {
/**
* Retrieves all notes
* @returns Promise<Note<PipelineItem>[] | null>
*/
async getAllNotes(modelType: string, notableId: number): Promise<Note<PipelineItem>[] | null> {
try {
const response = await axios.get<Note<PipelineItem>[]>(`${API_URL}/${modelType}/${notableId}`)
return response.data;
} catch (error) {
toast.error('Fehler beim Laden der Notizen', { description: (error as AxiosError).message })
console.error(error)
}
return null
},
/**
* Creates a new note
* @param note - The note data to create
* @returns Promise<Note>
*/
async createNote(note: Partial<Note>): Promise<Note> {
const response = await axios.post<Note>(API_URL, note);
return response.data;
},
/**
* Update an existing note
* @param note - The Note object to update
* @returns
*/
async updateNote(note: Partial<Note>): Promise<Note> {
const response = await axios.put<Note>(`${API_URL}/${note.id}`, note);
return response.data;
},
/**
* Deletes a note by ID
* @param noteId - The id of the note to delete
* @returns boolean - True if the note was deleted, false otherwise
*/
async deleteNote(noteId: number): Promise<boolean> {
try {
const response = await axios.delete(`${API_URL}/${noteId}`);
return true;
} catch (error) {
toast.error('Fehler beim LÖschen der Notiz', { description: (error as AxiosError).message })
console.error(error)
return false;
}
},
};