src/lib/rules.js
// Add a rule to the database
Add a rule to the database
Add a rule to the database
add(data) {
    const rule = data
      .set(
        'blocked',
        Map({
          per_minute: new Speed(60, 15),
          per_hour: new Speed(3600, 24),
        })
      )
      .set(
        'passed',
        Map({
          per_minute: new Speed(60, 15),
          per_hour: new Speed(3600, 24),
        })
      )
      .update('id', id => id || uuid())
      .set('created', now());
    validateRule(rule);
    this.rules = this.rules.set(rule.get('id'), rule);
    return rule;
  }
add ( data ) { const rule = data . set ( 'blocked' , Map ( { per_minute : new Speed ( 60 , 15 ) , per_hour : new Speed ( 3600 , 24 ) , } ) ) . set ( 'passed' , Map ( { per_minute : new Speed ( 60 , 15 ) , per_hour : new Speed ( 3600 , 24 ) , } ) ) . update ( 'id' , id => id || uuid ( ) ) . set ( 'created' , now ( ) ) ; validateRule ( rule ) ; this . rules = this . rules . set ( rule . get ( 'id' ) , rule ) ; return rule ; }
Add a rule to the database
Add a rule to the database