This commit is contained in:
thosakwe 2017-02-22 20:08:02 -05:00
parent f4186e4c96
commit ae5b31184e
3 changed files with 17 additions and 11 deletions

View file

@ -1,6 +1,6 @@
# rethink
[![version 1.0.1](https://img.shields.io/badge/pub-1.0.1-brightgreen.svg)](https://pub.dartlang.org/packages/angel_rethink)
[![version 1.0.2](https://img.shields.io/badge/pub-1.0.2-brightgreen.svg)](https://pub.dartlang.org/packages/angel_rethink)
[![build status](https://travis-ci.org/angel-dart/rethink.svg?branch=master)](https://travis-ci.org/angel-dart/rethink)
RethinkDB-enabled services for the Angel framework.

View file

@ -127,19 +127,25 @@ class RethinkService extends Service {
if (type == 'add') {
// Create
hookedService.fire(HookedServiceEvent.CREATED, newVal);
hookedService.fireEvent(
hookedService.afterCreated,
new HookedServiceEvent(
true, null, null, this, HookedServiceEvent.CREATED,
result: newVal));
} else if (type == 'change') {
// Update
hookedService.fire(HookedServiceEvent.UPDATED, newVal, (e) {
e
..id = oldVal['id']
..data = newVal;
});
hookedService.fireEvent(
hookedService.afterCreated,
new HookedServiceEvent(
true, null, null, this, HookedServiceEvent.UPDATED,
result: newVal, id: oldVal['od'], data: newVal));
} else if (type == 'remove') {
// Remove
hookedService.fire(HookedServiceEvent.CREATED, oldVal, (e) {
e.id = oldVal['id'];
});
hookedService.fireEvent(
hookedService.afterCreated,
new HookedServiceEvent(
true, null, null, this, HookedServiceEventREMOVED,
result: oldVal, id: oldVal['id']));
}
});
}

View file

@ -1,5 +1,5 @@
name: angel_rethink
version: 1.0.1
version: 1.0.2
description: RethinkDB-enabled services for the Angel framework.
author: Tobe O <thosakwe@gmail.com>
environment: