docs: function rateLastSeen(params, config, conn) {
  
    // validate
    if ( params.rating === null || params.rating === undefined ) {
      return 'You must enter a valid rating'
    }
  
    var reviewer = params.reviewer || 1
  
    // defaults
    config = config || require('../config/config.js')
  
  
    // main
    return new Promise((resolve, reject) => {
  
      if (!conn) {
        var conn = wc_db.getConnection(config.db)
      }
      var datePublished
      var row
  
      getLastSeen(params, config.con).then(function(res) {
        row = res.ret[0][0]
        debug(row)
        datePublished = row.datePublished
        if (datePublished) {
          var sql = 'UPDATE Media set rating = :rating where id = :id'
        } else {
          var sql = 'UPDATE Fragment set rating = :rating where id = :id and start = :start'
        }
        debug('rateLastSeen', sql, params)
  
        return conn.query(sql, { replacements: { "rating" : params.rating, "id" : row.id, "start" : row.start } })
  
      }). then(function(ret) {
        if (datePublished) {
          var rating = {}
          rating.uri = row.uri
          rating.reviewer = reviewer
          rating.rating = params.rating
          debug('rateLastSeen', rating)
          return updateRating(rating, config, conn)
        } else {
          return 'done'
        }
      }).then(function(ret) {
        return resolve({"ret" : ret, "conn" : conn})
      }).catch(function(err) {
        return reject({"err" : err, "conn" : conn})
      })
  
    })
  
  }