Get relationship with sum()

I know that I can get additional column with select() when I use sum() function. But, Can I get relationships too?

Route.js Model

class Route extends Model {



    lines () {
        return this.hasMany('App/Models/RouteLine')
    }

}

RouteLine.js Model 

class RouteLine extends Model {
    route () {
        return this.belongsTo('App/Models/Route')
    }
}

This is my query.

const routes = await RouteLine
            .query()
            .select('id', 'checkpoint_id')
            .with('route')
            .whereHas('route', (builder) => {
                build.whereBetween('day', [dateStart, dateEnd])
            })
            .sum('quant as quant')
            .groupBy('checkpoint_id')

I think Relationships, starting from the Querying Data section is what you need.

I updated the post. I think that my models are correctly defined.

I only want to translate this sql sentence to adonis lucid query without use DB.raw:

const routes = await Database
        .raw('select route_lines.* , routes.day, sum(quant) as suma from route_lines, routes ' +
            'where routes.id = route_lines.route_id ' +
            'and routes.day between ? and ? group by checkpoint_id', [dateStart, dateEnd]);