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 }