This commit is contained in:
Tobe O 2018-06-03 21:35:44 -04:00
parent 550a334c66
commit 1207881c71
6 changed files with 24 additions and 19 deletions

3
.gitignore vendored
View file

@ -26,4 +26,5 @@ doc/api/
# (Library packages only! Remove pattern if developing an application package)
pubspec.lock
rethinkdb_data/
rethinkdb_data/
.idea

3
CHANGELOG.md Normal file
View file

@ -0,0 +1,3 @@
# 1.1.0
* Moved to `package:rethinkdb_driver`
* Fixed references to old hooked event names.

View file

@ -1,8 +1,8 @@
import 'dart:async';
import 'dart:io';
//import 'dart:io';
import 'package:angel_framework/angel_framework.dart';
import 'package:json_god/json_god.dart' as god;
import 'package:rethinkdb_driver2/rethinkdb_driver2.dart';
import 'package:rethinkdb_driver/rethinkdb_driver.dart';
// Extends a RethinkDB query.
typedef RqlQuery QueryCallback(RqlQuery query);
@ -130,21 +130,21 @@ class RethinkService extends Service {
hookedService.fireEvent(
hookedService.afterCreated,
new HookedServiceEvent(
true, null, null, this, HookedServiceEvent.CREATED,
true, null, null, this, HookedServiceEvent.created,
result: newVal));
} else if (type == 'change') {
// Update
hookedService.fireEvent(
hookedService.afterCreated,
new HookedServiceEvent(
true, null, null, this, HookedServiceEvent.UPDATED,
true, null, null, this, HookedServiceEvent.updated,
result: newVal, id: oldVal['id'], data: newVal));
} else if (type == 'remove') {
// Remove
hookedService.fireEvent(
hookedService.afterCreated,
new HookedServiceEvent(
true, null, null, this, HookedServiceEventREMOVED,
true, null, null, this, HookedServiceEvent.removed,
result: oldVal, id: oldVal['id']));
}
});
@ -187,7 +187,7 @@ class RethinkService extends Service {
try {
await read(d['id'], params);
} on AngelHttpException catch (e) {
if (e.statusCode == HttpStatus.NOT_FOUND)
if (e.statusCode == 404)
return await create(data, params);
else
rethrow;
@ -207,7 +207,7 @@ class RethinkService extends Service {
try {
await read(d['id'], params);
} on AngelHttpException catch (e) {
if (e.statusCode == HttpStatus.NOT_FOUND)
if (e.statusCode == 404)
return await create(data, params);
else
rethrow;

View file

@ -1,13 +1,16 @@
name: angel_rethink
version: 1.0.7
version: 1.1.0
description: RethinkDB-enabled services for the Angel framework.
author: Tobe O <thosakwe@gmail.com>
environment:
sdk: ">=1.19.0"
sdk: ">=1.19.0 <3.0.0"
homepage: https://github.com/angel-dart/rethink
dependencies:
angel_framework: ^1.0.0-dev
rethinkdb_driver2: ^2.3.1
angel_framework: ^1.1.0
json_god: ^2.0.0-beta
rethinkdb_driver: ^2.3.1
dev_dependencies:
angel_test: ^1.0.0-dev
angel_client: ^1.1.0
angel_test: ^1.1.0
logging: ^0.11.3
test: ^0.12.0

View file

@ -1,5 +1,5 @@
import 'dart:io';
import 'package:rethinkdb_driver2/rethinkdb_driver2.dart';
import 'package:rethinkdb_driver/rethinkdb_driver.dart';
main() async {
var r = new Rethinkdb();

View file

@ -2,7 +2,8 @@ import 'package:angel_client/angel_client.dart' as c;
import 'package:angel_framework/angel_framework.dart';
import 'package:angel_rethink/angel_rethink.dart';
import 'package:angel_test/angel_test.dart';
import 'package:rethinkdb_driver2/rethinkdb_driver2.dart';
import 'package:logging/logging.dart';
import 'package:rethinkdb_driver/rethinkdb_driver.dart';
import 'package:test/test.dart';
import 'common.dart';
@ -23,10 +24,7 @@ main() {
print('Whoops: $e');
};
app.fatalErrorStream.listen((e) {
print('Whoops: ${e.error}');
print(e.stack);
});
app.logger = new Logger.detached('angel')..onRecord.listen(print);
client = await connectTo(app);
todoService = client.service('todos');