Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. // api/year-end-reporting/ales
  2. interface Ale {
  3. aleId: string,
  4. aleName: string,
  5. clientType: string,
  6. totals: [{
  7. formType: string,
  8. approvedCount: number,
  9. notApprovedWithoutErrorCount: number,
  10. notApprovedAttentionCount: number,
  11. extensionDate: string
  12. }],
  13. associatedMembers?: Array<Ale>
  14. }
  15.  
  16. // Transformer
  17. var request = {
  18. endpoint: 'api/year-end-report/ales',
  19. descriptor: {
  20. type: 'products',
  21. id: {$alias: 'clientType'},
  22. attributes: {
  23. name: {$alias: 'clientType'}
  24. },
  25. relationships: {
  26. companies: [{
  27. data: {
  28. type: 'companies',
  29. id: {$alias: 'aleId'},
  30. attributes: {
  31. name: {$alias: 'aleName'},
  32. totals: __
  33. },
  34. relationships: {
  35. ales: {
  36. data: [{
  37. $each: 'associatedMembers',
  38. type: 'ales',
  39. id: {$alias: 'aleId'},
  40. attributes: {
  41. name: {$alias: 'aleName'},
  42. totals: __
  43. }
  44. }]
  45. }
  46. }
  47. }
  48. }]
  49. }
  50. }
  51. }
  52.  
  53. // Usage
  54. store.findWhere({name, taxYear}).related('companies')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement