0

当我更新销毁中的状态字段时,更新 created_at 字段日期。这是我的控制器代码

 async destroy({ params, request, response }) {
    try {
      const Applicationdata = await Application.find(params.id)
      if (Applicationdata) {
        Applicationdata.status = !Applicationdata.status
        await Applicationdata.save()
        return response.ok(Config.get('HttpResponse.OK'), {
              Applicationdata
        })
      } else {
        return response.fail(
          Config.get('HttpResponse.NOT_FOUND'),
          Antl.formatMessage('messages.recordNotFound')
        )
      }
    } catch (error) {
      console.log(error)
      return response.fail(
        Config.get('HttpResponse.INTERNAL_SERVER_ERROR'),
        Antl.formatMessage('messages.serverError')
      )
    }
  }

4

0 回答 0