Closed rwx-yxu closed 1 year ago
I will be assuming the User has made a query that has returned data (either Heart or Personal) in a table format. When this table component is being generated, i'm thinking a simple button can be added onto the end of the table row, that may either have data associated with it or grabs data from the row it is on, and when clicked it uses that data (user_id/document_id) to delete the row. I think this will look quite streamlined.
Or, when the user click on some data/row, a modal appears with maybe the same form they used when inputting the data (for consistency) that is prepopulated with that data. And an Update and Delete button is there.
In terms of components, I don't think I will need anything massive, rather the allowance of a button in however we decide to show/display the data.
Prerequisite component assume would be a grid table of that lists out the data.
<button @click="deleteDocument">Delete</button>
import { firebaseStore } from "@/firebase/database";
import { doc, getDoc } from "firebase/firestore";
const doc_ref = doc(firebaseStore, "collection_name", "test_document_id");
const docSnap = await getDoc(doc_ref);
docSnap.exists()
returns True if document is found
deleteDoc(docSnap.ref)
Deletes document
async function deleteDocument(doc_id){
const doc_ref = doc(firebaseStore, "hcm", doc_id);
const docSnap = await getDoc(doc_ref);
if( docSnap.exists() ){
deleteDoc(docSnap.ref);
}
}
Do not need to send confirmation email to user. Spec page 4 heading 8
Delete buttons should only appear on data that the user has added only.
Done
Summary
The user wants to delete their experimental data from the repository.
Basic Path
Alternative Paths
Step 4: If the system is unable to verify the user’s credentials against the stored data, the system displays a message and repeats step 2. Step 3: If the data does not exist, the system displays a message and repeats step 2.
Exception Paths
The user can cancel the operation before step 7.
Preconditions
The data exists in the repository.
Postconditions
The data no longer exists in the repository.