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

Bulk update back-end #3679

Open
adrianthedev opened this issue Feb 21, 2025 · 1 comment
Open

Bulk update back-end #3679

adrianthedev opened this issue Feb 21, 2025 · 1 comment
Labels
High Impact Task Something to get done

Comments

@adrianthedev
Copy link
Collaborator

adrianthedev commented Feb 21, 2025

Context

We'd like to enable users to bulk-update records from the Index page.
We need a back-end for it.

Approach

Create a BulkUpdateController which will take in a payload and update those records accordingly.

  • execute field validation from the model (Rails should do it for us)
  • accepted params should be verified
    • fields marked as disabled should not be updated
  • ensure the values are updated through fill_field method for every field

Possible payload this controller action can take:

{
  payload: [
    {
      param: "user_12o3211o3i3h" # or just the id
      resource_type: Avo::Resources::User,
      body: {
        first_name: "John",
        age: 33
      }
    },
    {
      param: "user_k3k6no2i" # or just the id
      resource_type: Avo::Resources::User,
      body: {
        first_name: "John",
        age: 33
      }
    },
    {
      param: 123
      resource_type: Avo::Resources::Post,
      body: {
        title: "What a great day",
        body: "# Lorem ipsum"
        user_id: "user_12o3211o3i3h"
      }
    }
  ]
}

Approach video: https://www.loom.com/share/f41a28048b8d4b80a3296e80d85fab41?sid=f1ba9ce6-41e2-48c0-9d3b-b4734169317f

@Nevelito
Copy link
Contributor

Comment for assignment, I will give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Impact Task Something to get done
Projects
Status: No status
Development

No branches or pull requests

2 participants