return await this.db?.query.systemUser.findFirst({
where(fields, operators) {
return operators.and(operators.eq(fields.id, userId));
},
with: {
systemDevice: {
where: and(eq(this.table.systemDevice.id, systemDeviceId),isNull(this.table.systemDevice.deleted_at)),
columns: {
user_agent: true,
user_ip: true,
},
},
systemRole: {
columns: {
name: true,
},
},
},
....
return await this.db?.query.systemUser.findFirst({
where(fields, operators) {
return operators.and(operators.eq(fields.id, userId));
},
with: {
systemDevice: {
where: and(eq(this.table.systemDevice.id, systemDeviceId),isNull(this.table.systemDevice.deleted_at)),
columns: {
user_agent: true,
user_ip: true,
},
},
systemRole: {
columns: {
name: true,
},
},
},
....