Skip to content

Bulk update back-end #3679

Open
Open
@adrianthedev

Description

@adrianthedev

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Triage

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions