I have a Postgres DB and using ObjectionJS as my ORM.
I have the following ObjectionJS code to patch two columns of a user_system
table.
public static async DeleteSystem(systemId: number, context: Context): Promise<UserSystem> {
const system = await UserSystem.query().context(context).patch({
state: PointInTimeState.inactive,
receiveNotifications: false
}).where({
system_id: systemId
}).throwIfNotFound().debug()
//("as any" for now because the system variable is a number at this point (i.e NOT of type Promise<UserSystem> as in the signature)
return system as any
}
Questions
- Is there a way in which I could return all the Rows that were not affected by this patch?
- If so, how, without having to write two separate queries (to update and then requery new data) to the back end ?