mirror of
https://github.com/vernu/textbee.git
synced 2026-06-11 01:09:42 -04:00
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:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user