One to One with Where Clause

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,
},
},
},
....
it is work normal but just error of typescript of where clause in relation (systemDevice, this one to one). how to fix? i know for one to one relation, we can not use where clause. but it is work haha, so i have no touch it. but i want to fix the type error?
No description
1 Reply
Tomato
TomatoOP2d ago
No description

Did you find this page helpful?