Optional/Default value for Relational `Extras`

I have a couple cases where a default/optional value for "extras" in the relational query builder could come in handy. I only really want to run this if the user is logged in. ATM I have the following solution

        extras(fields, operators) {
            return {
                authedUserTicketId:
                    sql<string>`(SELECT (ticket_id) from ${members} where event_id = ${
                        fields.id
                    } and user_id = ${authedUser?.user.id || null})`.as(
                        'authed_user_membership'
                    )
            };
        },


If there is no auth user it just sets the user_id to null but its not exactly ideal. Is there any plans or current way to optionally add this statement within the same return block?
Was this page helpful?