org.js 616 B

123456789101112131415161718192021222324252627282930
  1. import { ReactiveCache } from '/imports/reactiveCache';
  2. Meteor.publish('org', function(query, limit) {
  3. check(query, Match.OneOf(Object, null));
  4. check(limit, Number);
  5. let ret = [];
  6. const user = ReactiveCache.getCurrentUser();
  7. if (user && user.isAdmin) {
  8. ret = ReactiveCache.getOrgs(query,
  9. {
  10. limit,
  11. sort: { createdAt: -1 },
  12. fields: {
  13. orgDisplayName: 1,
  14. orgDesc: 1,
  15. orgShortName: 1,
  16. orgWebsite: 1,
  17. orgTeams: 1,
  18. createdAt: 1,
  19. orgIsActive: 1,
  20. }
  21. },
  22. true,
  23. );
  24. }
  25. return ret;
  26. });