mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
40 lines
647 B
JavaScript
40 lines
647 B
JavaScript
![]() |
/*
|
||
|
|
||
|
The main Pics collection definition file.
|
||
|
|
||
|
*/
|
||
|
|
||
|
import { createCollection, getDefaultResolvers, getDefaultMutations } from 'meteor/vulcan:core';
|
||
|
import schema from './schema.js';
|
||
|
import './fragments.js';
|
||
|
|
||
|
const Pics = createCollection({
|
||
|
|
||
|
collectionName: 'Pics',
|
||
|
|
||
|
typeName: 'Pic',
|
||
|
|
||
|
schema,
|
||
|
|
||
|
resolvers: getDefaultResolvers('Pics'),
|
||
|
|
||
|
mutations: getDefaultMutations('Pics'),
|
||
|
|
||
|
});
|
||
|
|
||
|
/*
|
||
|
|
||
|
Set a default results view whenever the Pics collection is queried:
|
||
|
|
||
|
- Pics are sorted by their createdAt timestamp in descending order
|
||
|
|
||
|
*/
|
||
|
|
||
|
Pics.addDefaultView(terms => {
|
||
|
return {
|
||
|
options: {sort: {createdAt: -1}}
|
||
|
};
|
||
|
});
|
||
|
|
||
|
export default Pics;
|