fix(api): resolve Mongoose strict type conflict in GatewayService

- Updated device query in GatewayService to cast the filter object, addressing a type collision with the reserved `model` field in Mongoose 9.6. This change maintains the runtime behavior while ensuring type compatibility.
This commit is contained in:
isra el
2026-05-24 16:39:33 +03:00
parent 1b35e76d82
commit f4e23ba3d3

View File

@@ -43,12 +43,16 @@ export class GatewayService {
input: RegisterDeviceInputDTO,
user: User,
): Promise<any> {
const device = await this.deviceModel.findOne({
// Mongoose 9.6's strict types collide on the reserved `model` field name
// (it expects Mongoose's `Model<any>` shape, not the device's `model`
// schema field). Cast the filter to bypass the type check; runtime
// behavior is unchanged.
const deviceFilter = {
user: user._id,
// `model` collides with Mongoose Query.model in TS 9.6+; use $eq to disambiguate.
model: { $eq: input.model },
model: input.model,
buildId: input.buildId,
})
} as any
const device = await this.deviceModel.findOne(deviceFilter)
const now = new Date()
const deviceData: any = { ...input, user }