aboutsummaryrefslogtreecommitdiffstats
path: root/routes/transactions.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'routes/transactions.coffee')
-rw-r--r--routes/transactions.coffee38
1 files changed, 0 insertions, 38 deletions
diff --git a/routes/transactions.coffee b/routes/transactions.coffee
deleted file mode 100644
index 0bdaeed6..00000000
--- a/routes/transactions.coffee
+++ /dev/null
@@ -1,38 +0,0 @@
-db = require('../redis')
-
-module.exports =
- json: (req, res) ->
- user = req.params.user
- r = 'transactions': []
-
- db.lrange("#{user}:transactions", 0, -1, (err, transactions) ->
- process = (err, t) ->
- r.transactions.push t
-
- if i >= transactions.length
- res.write(JSON.stringify(r))
- res.end()
- else
- db.hgetall("#{user}:transactions:#{transactions[i++]}", process)
-
- i = 0
- db.hgetall("#{user}:transactions:#{transactions[i++]}", process)
- )
-
- create: (req, res) ->
- user = req.params.user
- db.incr('transactions', (err, id) ->
- db.hmset("#{user}:transactions:#{id}", req.body, ->
- db.rpush("#{user}:transactions", id, ->
- res.write(JSON.stringify(req.body))
- res.end()
- )
- )
- )
-
- index: (req, res) ->
- res.render('transactions/index',
- user: req.params.user,
- layout: 'layout'
- )
-