Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement soft deletes for crash notes #1540

Merged
merged 8 commits into from
Sep 6, 2024

Conversation

roseeichelmann
Copy link
Contributor

@roseeichelmann roseeichelmann commented Sep 3, 2024

Associated issues

Closes cityofaustin/atd-data-tech#18788

Users cant delete recommendations only edit, so we dont need to implement soft-deletes for them.

Testing

URL to test:
Local

Steps to test:

  1. Check out this branch, start your local db, apply the migrations and metadata.
  2. Go to a crash, add a note and delete your note. Make sure you can still find the note in the crash_notes table but the is_deleted column will say true.
  3. Run the down migrations

Ship list

  • Check migrations for any conflicts with latest migrations in master branch
  • Confirm Hasura role permissions for necessary access
  • Code reviewed
  • Product manager approved

Copy link
Member

@chiaberry chiaberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted my note, found it in the db table and tested the down migration

Copy link
Member

@johnclary johnclary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works perfectly! So nice to have this in place—thank you!

I would like your feedback on a suggestion I made about the styling of the delete confirmation modal.

Also—I noticed this modal closes immediately, regardless of if the delete mutation resolved. I will open a backlog issue to hook the modal close into the mutation request , just like @chiaberry did in cityofaustin/atd-moped#1399

@@ -286,7 +286,7 @@ function Crash(props) {
notes={crashRecord?.crash?.crash_notes}
INSERT_NOTE={INSERT_NOTE}
UPDATE_NOTE={UPDATE_NOTE}
DELETE_NOTE={DELETE_NOTE}
SOFT_DELETE_NOTE={SOFT_DELETE_NOTE}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i love this kind of detail!

@@ -30,7 +30,7 @@ const Notes = ({
// declare mutation functions
const [addNote] = useMutation(INSERT_NOTE);
const [editNote] = useMutation(UPDATE_NOTE);
const [deleteNote] = useMutation(DELETE_NOTE);
const [deleteNote] = useMutation(SOFT_DELETE_NOTE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-09-05 at 11 09 23 AM

It's not quite right that we show the "Are you sure?" text and note text with the same styling. What do you think about not showing the note text at all in the modal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i am very down to remove the note text completely!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, Rose! 🚢

Copy link
Contributor

@mddilley mddilley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally, and I could add, edit, and soft delete crash notes. I see the is_deleted column update as expected in the database too. Such an improvement and some nice code details along the way!! 🚀 🚢

@@ -12,7 +12,7 @@ const Notes = ({
notes,
INSERT_NOTE,
UPDATE_NOTE,
DELETE_NOTE,
SOFT_DELETE_NOTE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@roseeichelmann roseeichelmann merged commit c9c9e01 into master Sep 6, 2024
8 checks passed
@roseeichelmann roseeichelmann deleted the 18788_soft_deletes_notes_recs branch September 6, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement soft deletes for crash notes and recommendations
4 participants