From f4e23ba3d36cfa709a9e9afce7703c4b66d281e4 Mon Sep 17 00:00:00 2001 From: isra el Date: Sun, 24 May 2026 16:39:33 +0300 Subject: [PATCH] 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. --- api/src/gateway/gateway.service.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/src/gateway/gateway.service.ts b/api/src/gateway/gateway.service.ts index 5cb1220..a60fc9e 100644 --- a/api/src/gateway/gateway.service.ts +++ b/api/src/gateway/gateway.service.ts @@ -43,12 +43,16 @@ export class GatewayService { input: RegisterDeviceInputDTO, user: User, ): Promise { - const device = await this.deviceModel.findOne({ + // Mongoose 9.6's strict types collide on the reserved `model` field name + // (it expects Mongoose's `Model` 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 }