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

Improve Action update behavior, and add the ability to delete an action #67

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

jhodapp
Copy link
Member

@jhodapp jhodapp commented Sep 26, 2024

Description

This PR improves Actions update behavior, and add the ability to delete an action.

NOTE Make sure to rerun the scripts/rebuild_db.sh script and re-seed the DB with cargo run --bin seed_db

GitHub Issue: None

Changes

  • Improve Action UPDATE behavior
  • Add ability to DELETE an Action by its Id

Testing Strategy

  1. Make sure to rerun the scripts/rebuild_db.sh script and re-seed the DB with cargo run --bin seed_db
  2. Using RAPidoc, add an Action and then try and delete it

Concerns

None

@jhodapp jhodapp added enhancement Improves existing functionality or feature feature work Specifically implementing a new feature labels Sep 26, 2024
@jhodapp jhodapp self-assigned this Sep 26, 2024
status_changed_at timestamptz
created_at timestamp [not null, default: `now()`]
updated_at timestamp [not null, default: `now()`]
status_changed_at timestamptz [not null, default: `now()`]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to be clear, I think this will set status_changed_at to "now" when we first create an action. Which might be somewhat misleading for newly created actions. TBH that seems reasonable to me but want to make sure that was your intention.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great question to double check. Yes, this is intentional. It's because we don't have a non-state option for Status. If we did, I'd leave this as something we could leave unset. The way I tweaked things in this PR and the frontend one for actions is the "not_started" enum is chosen by default, so it is being set.

Thoughts?

("id" = i32, Path, description = "Action id to delete")
),
responses(
(status = 200, description = "Successfully deleted a certain Action by its id", body = [i32]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I read the function as returning

{
  "data": {
    "id": {id}
  }
}

If that is the case maybe we could either:

  • Define a data structure that reflects that and use it as a schema for body = here or
  • Just return the full deleted object

I want to say I've seen the latter but I don't have strong feelings about it.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can update this later if you're cool with that, but this is how all of our deletes work today, so I'm just copying them. I'd much rather return the entire thing which is what I do on the frontend anyway.

@jhodapp jhodapp changed the title Tweak actions update behavior, and add the ability to delete an action Improve actions update behavior, and add the ability to delete an action Sep 26, 2024
@jhodapp jhodapp changed the title Improve actions update behavior, and add the ability to delete an action Improve Action update behavior, and add the ability to delete an action Sep 26, 2024
@jhodapp jhodapp merged commit 3a880e8 into main Sep 27, 2024
4 checks passed
@jhodapp jhodapp deleted the fix_up_action_behavior branch September 27, 2024 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves existing functionality or feature feature work Specifically implementing a new feature
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants