summaryrefslogtreecommitdiff
path: root/common/src/leap/soledad/common/ddocs/transactions/lists/generation.js
blob: dbdfff0de817829afe9efbe56d18b036987f77fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function(head, req) {
    var row;
    var rows=[];
    // fetch all rows
    while(row = getRow()) {
        rows.push(row);
    }
    if (rows.length > 0)
        send(JSON.stringify({
            "generation": rows.length,
            "doc_id": rows[rows.length-1]['id'],
            "transaction_id": rows[rows.length-1]['value']
        }));
    else
        send(JSON.stringify({
            "generation": 0,
            "doc_id": "",
            "transaction_id": "",
        }));
}