Commit 3ca8b1b8 authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

Mock mode: add transactions with attachments;

parent 9a54bedd
......@@ -100,6 +100,14 @@ export async function merge(req, res) {
export async function file(req, res) {
try {
if (req.preloaded.operation.binary &&
req.preloaded.operation.binary.fileName === '__dev_example_file') {
res.set('Content-Type', 'text/plain');
res.status(200).send('This is an example file for developer mode.');
return true;
}
let operationId = req.preloaded.operation.id;
let binaryPath = `/data/${operationId}/binaries/file`;
......
......@@ -247,7 +247,8 @@ should be empty.`);
amount: sourceOp.amount,
raw: sourceOp.raw,
date: sourceOp.date,
title: sourceOp.title
title: sourceOp.title,
binary: sourceOp.binary
};
operation.title = operation.title || operation.raw || '';
......
......@@ -149,13 +149,22 @@ let generateOne = account => {
let [title, raw] = randomArray(randomLabels);
let amount = (-rand(0, 60) + rand(0, 100) / 100).toString();
let binary = null;
if (rand(0, 100) > 90) {
log.info('Generating a binary attached to the operation.');
binary = {
fileName: '__dev_example_file'
};
}
return {
account,
amount,
title,
raw,
date,
type
type,
binary
};
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment