hoanghm / Proact

2 stars 0 forks source link

Create converter classes for UserMission, Mission #59

Closed ogallagher closed 3 months ago

ogallagher commented 4 months ago

Based on the expected attributes of UserTask and Task in the db architecture, create Firebase converter class(es) for parsing and serializing.

As of ~2024-07-01, Task is often called Mission, especially in the context of user-facing text.

As of 2024-07-07, UserMission is replaced with User.missions.

ogallagher commented 4 months ago

Renamed UserTask to UserMission and Task to Mission.

ogallagher commented 4 months ago

Custom user and user missions db fetch validation

Restarted application in 257ms.
[firestore] found db user id=NdarW4HYFSbzhaU9xnLG
[firestore] found db user username=sample_user for firebase auth user
[test_missions] user = {"missions":["yQJmoiTWk5qAiTT04sQS","Sj0LX8jBSyoHK3q3eiFH"],"email":"sample_user@gmail.com","occupation":"Fiction Writer","username":"sample_user","vaultedId":"a0Zt4yVpfZVsf3xL3hwdmWnFstF2","location":"St. Louis","others":["I like smoking dank"],"interests":["Growing peppers on my balcony","Playing guitar","Lifting weights"],"onboarded":false,"questionnaire":[]}
[test_missions] fetched user User[username=sample_user email=sample_user@gmail.com] with mission ids yQJmoiTWk5qAiTT04sQS,Sj0LX8jBSyoHK3q3eiFH
[firestore] fetch missions for user User[username=sample_user email=sample_user@gmail.com] to depth 2
[firestore] fetch missions yQJmoiTWk5qAiTT04sQS,Sj0LX8jBSyoHK3q3eiFH to depth 2
[firestore] fetch missions rHjI3l1JmkIiX2XLmNI6,fvUzFikk2ea5ZMUXn1nb,vYKQXtH9CaGqHadayi4B,DsC7MM65sqYIrYW4ih4H,5x7ZTDofwB25GiIIEeOl to depth 1
[firestore] fetch missions 5PmKX3G2IRVfAeR4RiEI,KgIzJ39Sldk24WHL9NcW,1zL8zMcMGYFfnchAD8PW,4qjGttc6anNhbLQ2JZCA,S45pl60bpiW7Poj6pYCN to depth 1
[test_missions] fetched user missions recursively
[test_missions] missions[0] = Mission[type=project title="Reduce St. Louis's Urban Heat Island Effect"]
[test_missions] 0: {
                  "steps": [
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Research local initiatives addressing urban heat in St Louis Connect with organizations like the St Louis Green New Deal or the Missouri Botanical Garden ",
                      "description": "Research local initiatives addressing urban heat in St. Louis. Connect with organizations like the St. Louis Green New Deal or the Missouri Botanical Garden.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Plant heat tolerant native trees and shrubs around your home especially on the south and west sides Consider planting a variety of species for diversity",
                      "description": "Plant heat-tolerant native trees and shrubs around your home, especially on the south and west sides. Consider planting a variety of species for diversity and wildlife habitat.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Advocate for increased green spaces and tree canopy in your neighborhood by engaging with local council members or community groups Share your knowledge and experiences",
                      "description": "Advocate for increased green spaces and tree canopy in your neighborhood by engaging with local council members or community groups. Share your knowledge and experiences with others.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Share your knowledge about urban heat mitigation through your writing Incorporate these themes into your fiction highlighting the impact on communities and potential solutions ",
                      "description": "Share your knowledge about urban heat mitigation through your writing. Incorporate these themes into your fiction, highlighting the impact on communities and potential solutions.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Organize a local event to raise awareness about urban heat featuring guest speakers workshops and hands on activities like tree planting or urban gardening ",
                      "description": "Organize a local event to raise awareness about urban heat, featuring guest speakers, workshops, and hands-on activities like tree planting or urban gardening.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    }
                  ],
                  "id": null,
                  "type": "project",
                  "status": "not started",
                  "title": "Reduce St. Louis's Urban Heat Island Effect",
                  "description": "St. Louis faces a significant urban heat island effect, making summers hotter and impacting air quality. This mission focuses on reducing your impact and raising awareness.",
                  "deadline": null,
                  "styleId": null,
                  "metrics": []
                }
[test_missions] missions[1] = Mission[type=project title="Promote Sustainable Music Practices"]
[test_missions] 1: {
                  "steps": [
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Research sustainable practices for musicians including eco friendly instruments recycled or upcycled materials for stage props and reducing travel emissions by carpooling or using public",
                      "description": "Research sustainable practices for musicians, including eco-friendly instruments, recycled or upcycled materials for stage props, and reducing travel emissions by carpooling or using public transport.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Start a blog or podcast focused on sustainable music practices interviewing local artists and highlighting their efforts to minimize their environmental footprint ",
                      "description": "Start a blog or podcast focused on sustainable music practices, interviewing local artists and highlighting their efforts to minimize their environmental footprint.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Organize a Green Gig event showcasing local musicians who are committed to sustainable practices with eco friendly merchandise and catering options ",
                      "description": "Organize a 'Green Gig' event showcasing local musicians who are committed to sustainable practices, with eco-friendly merchandise and catering options.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Partner with local music venues to implement sustainable practices such as composting reducing single use plastics and using energy efficient lighting ",
                      "description": "Partner with local music venues to implement sustainable practices, such as composting, reducing single-use plastics, and using energy-efficient lighting.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    },
                    {
                      "steps": [],
                      "id": null,
                      "type": "step",
                      "status": "not started",
                      "title": "Encourage other musicians and music enthusiasts to adopt eco friendly practices by sharing your experiences and resources through social media and your writing ",
                      "description": "Encourage other musicians and music enthusiasts to adopt eco-friendly practices by sharing your experiences and resources through social media and your writing.",
                      "deadline": null,
                      "styleId": null,
                      "metrics": []
                    }
                  ],
                  "id": null,
                  "type": "project",
                  "status": "not started",
                  "title": "Promote Sustainable Music Practices",
                  "description": "The music industry generates significant waste and has a large carbon footprint. This mission aims to reduce your impact and advocate for eco-friendly practices in the St. Louis music scene.",
                  "deadline": null,
                  "styleId": null,
                  "metrics": []
                }