How to change 2 fields in a database row?

I have a row in Database that returns:

    id: 1,
    title: 'Marathon 1',
    video_code: 'xptowwwz',
    description: 'Essa é uma maratona legal pra caramba',
    file_id: 1,
    times_selected: null,
    created_by: 1,
    audited_by: null,
    is_published: false,
    created_at: 2020-01-29T17:04:51.000Z,
    updated_at: 2020-01-29T20:04:55.000Z

and I want to change :

audited_by :,
is_published: true 

But without receiving it via .json through Insomnia.

Here’s the code I have so far:

  async update({ params, request, auth }) {
    const admin = await auth.authenticator('adminAuth').getUser()

    const marathon = await Database.table('marathons').where({

How do I get this job done?

Thanks a lot!


If you have marathons as model, then you can do something like this:

let marathon = await Marathon.find(
marathon.audited_by =
marathon.is_published: true

And with using DB directly

await Database.table('marathons')
  .where({ id: })
    is_published: true
1 Like