advweb-grp1 / advanced-web-final-year-project

Final year advanced web develop unit project
MIT License
1 stars 0 forks source link

core/pinia #42

Closed rwx-yxu closed 1 year ago

rwx-yxu commented 1 year ago

Create the pinia store for hcm. I have also introducted a new flag for .env files called DEV which determines which collection to use ie: 'hcm' if DEV is false and 'hcm_dev' if DEV is true. This makes it easier to switch between collections when working on local or live firestores.

The pinia store fetch collection stores the query snap shot. This means that you will have to use .data() to get the underlying fields. This is to preserve the need to easily get the id of the document in the future.

rwx-yxu commented 1 year ago

build failing because I probs need to add in the dev flag to the workflows.

rwx-yxu commented 1 year ago

Actual error:

Missing or insufficient permissions.

rwx-yxu commented 1 year ago

coming from main.js I think when the app loads to get the hcm data for the data store.

rwx-yxu commented 1 year ago

I am going to put pull requests on hcm_dev and when we merge in main, I will use hcm db

rwx-yxu commented 1 year ago

noticed that register has been set up in a weird way where user collection has another collection inside it just to store one thing which is the user info.

rwx-yxu commented 1 year ago

I am not particularly satisfied with the reasoning provided by @AymanReh since you can use the query function to search on fields. No need to get all docs and do for each filtering.

    const booksRef = collection(db, 'books');
    const q = query(booksRef, where('author', '==', 'J.K. Rowling'));
    const querySnapshot = await getDocs(q);
    querySnapshot.forEach((doc) => {
      this.books.push(doc.data());
    });
rwx-yxu commented 1 year ago

Making register change to have the firebase auth id to a field rather than a collection since the current implementation just makes to sense at all and it is not useful at all.

github-actions[bot] commented 1 year ago

Visit the preview URL for this PR (updated for commit 711ccae):

https://adv-web-grp1--pr42-core-pinia-pgjnlvj6.web.app

(expires Mon, 24 Apr 2023 22:27:05 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: e45f8bd17b7de44787580bea572e36aa09784b8c