import { Request , Response } from "express" ; import { sendJSONresponse } from "../common/Utils" ; import { Device } from "../models/DeviceModel" ; import * as winston from "winston" ; import { Error } from "mongoose" ; import { ISavedDevice } from "./Interfaces/IPusherController" ; export class Pusher { unregister ( req , res ) { Device . findOneAndRemove ( { deviceID : req . body . deviceID } ) . then ( ( savedDevice ) => { sendJSONresponse ( res , 200 , { status : true , message : "Successfully unregistered" , response : savedDevice , } ) ; } ) . catch ( ( error ) => { winston . info ( "Error unregistering " , error ) ; sendJSONresponse ( res , 500 , { status : false , message : "Failed to remove" , error , } ) ; } ) ; } }