mirror of
https://github.com/vale981/grapher
synced 2025-03-07 02:21:43 -05:00
32 lines
604 B
JavaScript
Executable file
32 lines
604 B
JavaScript
Executable file
import Comments from './collection.js';
|
|
import Authors from '../authors/collection.js';
|
|
import Posts from '../posts/collection.js';
|
|
|
|
Comments.addLinks({
|
|
author: {
|
|
type: 'one',
|
|
collection: Authors,
|
|
field: 'authorId',
|
|
index: true
|
|
},
|
|
|
|
post: {
|
|
type: 'one',
|
|
collection: Posts,
|
|
field: 'postId',
|
|
index: true
|
|
}
|
|
});
|
|
|
|
Comments.addReducers({
|
|
authorLinkReducer: {
|
|
body: {
|
|
author: {
|
|
name: 1,
|
|
},
|
|
},
|
|
reduce(object) {
|
|
return object.author;
|
|
}
|
|
}
|
|
});
|