Needed no actual changes...
This commit is contained in:
parent
7f83004e07
commit
f1d7081f46
8 changed files with 78 additions and 9 deletions
65
.gitignore
vendored
65
.gitignore
vendored
|
@ -26,3 +26,68 @@ doc/api/
|
|||
# Don't commit pubspec lock file
|
||||
# (Library packages only! Remove pattern if developing an application package)
|
||||
pubspec.lock
|
||||
### Dart template
|
||||
# See https://www.dartlang.org/tools/private-files.html
|
||||
|
||||
# Files and directories created by pub
|
||||
|
||||
# SDK 1.20 and later (no longer creates packages directories)
|
||||
|
||||
# Older SDK versions
|
||||
# (Include if the minimum SDK version specified in pubsepc.yaml is earlier than 1.20)
|
||||
|
||||
|
||||
# Files created by dart2js
|
||||
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
||||
# rules if you intend to use dart2js directly
|
||||
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
||||
# differentiate from explicit Javascript files)
|
||||
|
||||
# Directory created by dartdoc
|
||||
|
||||
# Don't commit pubspec lock file
|
||||
# (Library packages only! Remove pattern if developing an application package)
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff:
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/dictionaries
|
||||
|
||||
# Sensitive or high-churn files:
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.xml
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
|
||||
# Gradle:
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Mongo Explorer plugin:
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
|
|
@ -9,8 +9,8 @@ import 'no_service.dart';
|
|||
/// on the target object.
|
||||
///
|
||||
/// Defaults:
|
||||
/// * [foreignKey]: `userId`
|
||||
/// * [localKey]: `id`
|
||||
/// * [localKey]: `userId`
|
||||
/// * [foreignKey]: `id`
|
||||
HookedServiceEventListener belongsTo(Pattern servicePath,
|
||||
{String as,
|
||||
String foreignKey,
|
||||
|
|
|
@ -52,6 +52,7 @@ HookedServiceEventListener hasOne(Pattern servicePath,
|
|||
_normalize(obj) async {
|
||||
if (obj != null) {
|
||||
var id = await _getLocalKey(obj);
|
||||
|
||||
var indexed = await ref.index({
|
||||
'query': {foreignKey ?? 'userId': id}
|
||||
});
|
||||
|
|
|
@ -8,5 +8,5 @@ environment:
|
|||
dependencies:
|
||||
angel_framework: ^1.0.0-dev
|
||||
dev_dependencies:
|
||||
angel_seeder: ^0.0.0
|
||||
angel_seeder: ^1.0.0
|
||||
test: ^0.12.0
|
||||
|
|
|
@ -9,8 +9,8 @@ main() {
|
|||
|
||||
setUp(() async {
|
||||
app = new Angel()
|
||||
..use('/authors', new CustomMapService())
|
||||
..use('/books', new CustomMapService());
|
||||
..use('/authors', new MapService())
|
||||
..use('/books', new MapService());
|
||||
|
||||
await app.configure(seed(
|
||||
'authors',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:angel_framework/angel_framework.dart';
|
||||
import 'package:json_god/json_god.dart' as god;
|
||||
|
||||
@deprecated
|
||||
class CustomMapService extends Service {
|
||||
final List<Map> _items = [];
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ main() {
|
|||
|
||||
setUp(() async {
|
||||
app = new Angel()
|
||||
..use('/authors', new CustomMapService())
|
||||
..use('/books', new CustomMapService());
|
||||
..use('/authors', new MapService())
|
||||
..use('/books', new MapService());
|
||||
|
||||
await app.configure(seed(
|
||||
'authors',
|
||||
|
|
|
@ -9,8 +9,8 @@ main() {
|
|||
|
||||
setUp(() async {
|
||||
app = new Angel()
|
||||
..use('/authors', new CustomMapService())
|
||||
..use('/books', new CustomMapService());
|
||||
..use('/authors', new MapService())
|
||||
..use('/books', new MapService());
|
||||
|
||||
await app.configure(seed(
|
||||
'authors',
|
||||
|
@ -41,6 +41,8 @@ main() {
|
|||
expect(author.keys, contains('book'));
|
||||
|
||||
Map book = author['book'];
|
||||
print('Author: $author');
|
||||
print('Book: $book');
|
||||
expect(book['authorId'], equals(author['id']));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue