Together-100Devs / Together

Together is a group calendar application using the MERN stack intended to bring discord communities closer!
https://together.cyclic.app/
MIT License
167 stars 112 forks source link

Update Event model to contain a status field #408

Closed Caleb-Cohen closed 12 months ago

Caleb-Cohen commented 1 year ago

Related Issues Project: Admin Dashboard Depends on: TBD*

Description Add status to Events.js model status should be a string with default of pending & required of true Create a function to update all current event objects to have status field. Set as active.

Acceptance Criteria

*Ticket on hold to discuss how to test without messing with production data.

guel-codes commented 1 year ago

I might have this done. But wanted to get clarification about the function that was mentioned. Are you looking for a function to update the documents that are already in the database with the status field? If so, I have a script that we should be able to use for that to do it all at once.

Caleb-Cohen commented 1 year ago

I might have this done. But wanted to get clarification about the function that was mentioned. Are you looking for a function to update the documents that are already in the database with the status field? If so, I have a script that we should be able to use for that to do it all at once.

Good question. This was part of the reason why it's on hold. I'm unfamiliar with in what order this should be done.

guel-codes commented 1 year ago

Since the status field isn't actually being used yet. We could update existing events first and then right after that merge this in. We can discuss this more, but you could create temporary user in mongo with access to that specific collection then I can use that connection string to insert the field with the default pending value.

Caleb-Cohen commented 1 year ago

Since the status field isn't actually being used yet. We could update existing events first and then right after that merge this in. We can discuss this more, but you could create temporary user in mongo with access to that specific collection then I can use that connection string to insert the field with the default pending value.

How would the existing events be updated? You mentioned a script, is that script executed outside of the codebase?

guel-codes commented 1 year ago

Yea it would run outside of the current codebase. I have a Python script that can connect to the database, query for all docs where the status field is missing(currently all of them) and then add the status field with the default value.

Caleb-Cohen commented 1 year ago

Yea it would run outside of the current codebase. I have a Python script that can connect to the database, query for all docs where the status field is missing(currently all of them) and then add the status field with the default value.

Ok, I think we should start with that then. Is there any sort of testing that needs to be done prior to attempting this on production data, can we backup the DB?

guel-codes commented 1 year ago

We can test it on a fake collection to make sure it works as it should. There are also back up option in Mongo so we can take a snapshot before we run the script to preserve the data at that point in time.

Caleb-Cohen commented 1 year ago

We can test it on a fake collection to make sure it works as it should. There are also back up option in Mongo so we can take a snapshot before we run the script to preserve the data at that point in time.

Hey there, can we setup a time this week to address this?