summaryrefslogtreecommitdiff
path: root/index.js
blob: c6ca9b6d68dc7362b5967ae5e4dcf8a774a626d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
var okcms = require('okcms')
var assign = require('object-assign')
var path = require('path')

var port = process.env.PORT || 1337

var app = okcms.createApp({

  meta: {
    project: 'Stone Island'
  },

  debug: false,

  schemas: {
    story: {
      id: {type: 'string', hidden: true},
      title: {type: 'string'},
      image: {type: 'image'},
      body: {type: 'text'},
    },
    archive: {
      id: {type: 'string', hidden: true},
      title: {type: 'string'},
      images: {type: 'triple-captioned-image-list'},
    },
    hub: {
      id: {type: 'string', hidden: true},
      date: {type: 'date'},
      title: {type: 'string'},
      subtitle: {type: 'string'},
      body: {type: 'text'},
      link: {type: 'string'},
      store: {type: 'enum', options: ["true", "false"]},
      image: {type: 'captioned-image-list'},
    },
    page: {
      id: {type: 'string', hidden: true},
      title: {type: 'string'},
      image: {type: 'image'},
      body: {type: 'text'},
      tag: {type: 'string'},
    },
    store: {
      id: {type: 'string', hidden: true},
      title: {type: 'string'},
      collection: {type: 'string'},
      CollectionId: {type: 'string'},
      DepartmentId: {type: 'string'},
      Departments: {type: 'link-list', textLabel: "Department Name", linkLabel: "Department ID" },
      StoreStatus: {type: 'enum', options: ["open","closed"] },
      DepartmentStoreStatus: {type: 'enum', options: ["open","closed"] },
      GroupBy: {type: 'enum', options: ['none','size'] },
      FilterBy: {type: 'enum', options: ['none','category','size'] },
      ShowProductNameOnCollectionPage: {type: 'flag'},
      OpensOn: {type: 'string'},
      StoreClosedMessageOne: {type: 'string'},
      StoreClosedMessageTwo: {type: 'string'},
      NotAvailableInCanada: {type: 'flag'},
      FitsLarge: {type: 'enum', options: ["use_alt_text","true","false"] },
      FitsLargeText: {type: 'text' },
      SizingFooter: {type: 'enum', options: ["use_alt_text","true","false"] },
      SizingFooterText: {type: 'text'},
      FittingCodes: {type: 'text'},
      BackgroundIsGray: {type: 'enum', options: ["true","false"] },
      ClosedStoreImages: {type: 'captioned-image-list'},
      // modal
      showModal: {type: 'enum', options: ['never','once','always'] },
      modalBackgroundColor: {type: 'enum', options: ["white","black",] },
      modalTaglineColor: {type: 'enum', options: ["black","red","blue","white"] },
      modalTaglinePosition: {type: 'enum', options: ["hidden","top","bottom"] },
      modalTaglineLink: {type: 'string'},
      modalTitle: {type: 'string'},
      modalTagline: {type: 'string'},
      modalContent: {type: 'text'},
      modalButton: {type: 'string'},
    },
  },

  resources: [
    { type: 'story' },
    { type: 'archive' },
    { type: 'hub' },
    { type: 'page' },
    { type: 'store' },
  ],

  views: {
    '/': {},
  },

  services: {
    s3: {
      key: process.env.S3_KEY,
      secret: process.env.S3_SECRET,
      bucket: process.env.S3_BUCKET,
      dirname: process.env.S3_DIRNAME,
      maxbytes: 1024*1024*2,
    },
    
    geo: {
      lib: require("./lib/okgeo"),
    },

    push: {
      lib: require("./lib/okpush"),
      // mongodbUrl: "mongodb://localhost/okpush_stone" + '_dev',
      // production: false,
      mongodbUrl: "mongodb://localhost/okpush_stone",
      production: true,
      apn_development: {
        cert: path.join(__dirname, "./lib/okpush/certs/aps_development_cert.pem"),
        key: path.join(__dirname, "./lib/okpush/certs/aps_development_key.pem"),
        connection: {
          gateway: "gateway.sandbox.push.apple.com",
        }
      },
      apn_production: {
        cert: path.join(__dirname, "./lib/okpush/certs/aps_production_cert.pem"),
        key: path.join(__dirname, "./lib/okpush/certs/aps_production_key.pem"),
        connection: {
          gateway: "gateway.push.apple.com",
        }
      },
      bundleId: "us.okfoc.stoneisland",
      notifications: {
        // expiry (in seconds)
        // badge (int)
        // alert (message)
        // payload (raw json)
        hub: {
          alert: "The hub has been updated.",
        },
        store: {
          alert: "The store is now open.",
        },
      }
    },
  }

})
app.listen(port)
module.exports = app

console.log('Server listening at port ' + port + '...');