mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-05 03:40:19 +00:00
Removed Firefly’s ability to generate test data.
This commit is contained in:
@@ -1,897 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* TestData.php
|
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
||||||
*
|
|
||||||
* This software may be modified and distributed under the terms of the
|
|
||||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
||||||
*
|
|
||||||
* See the LICENSE file for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types = 1);
|
|
||||||
namespace FireflyIII\Support\Migration;
|
|
||||||
|
|
||||||
use Carbon\Carbon;
|
|
||||||
use Crypt;
|
|
||||||
use DB;
|
|
||||||
use Navigation;
|
|
||||||
use Storage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class TestData
|
|
||||||
*
|
|
||||||
* @package FireflyIII\Support\Migration
|
|
||||||
*/
|
|
||||||
class TestData
|
|
||||||
{
|
|
||||||
/** @var array */
|
|
||||||
private $data = [];
|
|
||||||
/** @var Carbon */
|
|
||||||
private $end;
|
|
||||||
/** @var Carbon */
|
|
||||||
private $start;
|
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
private $time;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TestData constructor.
|
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
private function __construct(array $data)
|
|
||||||
{
|
|
||||||
$this->data = $data;
|
|
||||||
$start = new Carbon;
|
|
||||||
$start->startOfYear();
|
|
||||||
$start->subYears(2);
|
|
||||||
$end = new Carbon;
|
|
||||||
|
|
||||||
$this->start = $start;
|
|
||||||
$this->end = $end;
|
|
||||||
$this->time = $end->format('Y-m-d H:i:s');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $data
|
|
||||||
*/
|
|
||||||
public static function run(array $data)
|
|
||||||
{
|
|
||||||
$seeder = new TestData($data);
|
|
||||||
$seeder->go();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createAccounts()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['accounts'] as $account) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $account['user_id'],
|
|
||||||
'account_type_id' => $account['account_type_id'],
|
|
||||||
'name' => $account['name'],
|
|
||||||
'active' => 1,
|
|
||||||
'encrypted' => 0,
|
|
||||||
'virtual_balance' => 0,
|
|
||||||
'iban' => isset($account['iban']) ? Crypt::encrypt($account['iban']) : null,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('accounts')->insert($insert);
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['account-meta'] as $meta) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $meta['account_id'],
|
|
||||||
'name' => $meta['name'],
|
|
||||||
'data' => $meta['data'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('account_meta')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createAttachments()
|
|
||||||
{
|
|
||||||
$disk = Storage::disk('upload');
|
|
||||||
foreach ($this->data['attachments'] as $attachment) {
|
|
||||||
$data = Crypt::encrypt($attachment['content']);
|
|
||||||
$attachmentId = DB::table('attachments')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'attachable_id' => $attachment['attachable_id'],
|
|
||||||
'attachable_type' => $attachment['attachable_type'],
|
|
||||||
'user_id' => $attachment['user_id'],
|
|
||||||
'md5' => md5($attachment['content']),
|
|
||||||
'filename' => Crypt::encrypt($attachment['filename']),
|
|
||||||
'title' => Crypt::encrypt($attachment['title']),
|
|
||||||
'description' => Crypt::encrypt($attachment['description']),
|
|
||||||
'notes' => Crypt::encrypt($attachment['notes']),
|
|
||||||
'mime' => Crypt::encrypt($attachment['mime']),
|
|
||||||
'size' => strlen($attachment['content']),
|
|
||||||
'uploaded' => 1,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$disk->put('at-' . $attachmentId . '.data', $data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createBills()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['bills'] as $bill) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $bill['user_id'],
|
|
||||||
'name' => Crypt::encrypt($bill['name']),
|
|
||||||
'match' => Crypt::encrypt($bill['match']),
|
|
||||||
'amount_min' => $bill['amount_min'],
|
|
||||||
'amount_max' => $bill['amount_max'],
|
|
||||||
'date' => $bill['date'],
|
|
||||||
'active' => $bill['active'],
|
|
||||||
'automatch' => $bill['automatch'],
|
|
||||||
'repeat_freq' => $bill['repeat_freq'],
|
|
||||||
'skip' => $bill['skip'],
|
|
||||||
'name_encrypted' => 1,
|
|
||||||
'match_encrypted' => 1,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('bills')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createBudgets()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['budgets'] as $budget) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $budget['user_id'],
|
|
||||||
'name' => Crypt::encrypt($budget['name']),
|
|
||||||
'encrypted' => 1,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('budgets')->insert($insert);
|
|
||||||
|
|
||||||
foreach ($this->data['budget-limits'] as $limit) {
|
|
||||||
$amount = rand($limit['amount_min'], $limit['amount_max']);
|
|
||||||
$limitId = DB::table('budget_limits')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'budget_id' => $limit['budget_id'],
|
|
||||||
'startdate' => $limit['startdate'],
|
|
||||||
'amount' => $amount,
|
|
||||||
'repeats' => 0,
|
|
||||||
'repeat_freq' => $limit['repeat_freq'],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
DB::table('limit_repetitions')->insert(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'budget_limit_id' => $limitId,
|
|
||||||
'startdate' => $limit['startdate'],
|
|
||||||
'enddate' => Navigation::endOfPeriod(new Carbon($limit['startdate']), $limit['repeat_freq'])->format('Y-m-d'),
|
|
||||||
'amount' => $amount,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$current = clone $this->start;
|
|
||||||
while ($current <= $this->end) {
|
|
||||||
foreach ($this->data['monthly-limits'] as $limit) {
|
|
||||||
$amount = rand($limit['amount_min'], $limit['amount_max']);
|
|
||||||
$limitId = DB::table('budget_limits')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'budget_id' => $limit['budget_id'],
|
|
||||||
'startdate' => $current->format('Y-m-d'),
|
|
||||||
'amount' => $amount,
|
|
||||||
'repeats' => 0,
|
|
||||||
'repeat_freq' => 'monthly',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
DB::table('limit_repetitions')->insert(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'budget_limit_id' => $limitId,
|
|
||||||
'startdate' => $current->format('Y-m-d'),
|
|
||||||
'enddate' => Navigation::endOfPeriod($current, 'monthly')->format('Y-m-d'),
|
|
||||||
'amount' => $amount,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$current->addMonth();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createCategories()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['categories'] as $category) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $category['user_id'],
|
|
||||||
'name' => Crypt::encrypt($category['name']),
|
|
||||||
'encrypted' => 1,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('categories')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createCurrencies()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['currencies'] as $job) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'deleted_at' => null,
|
|
||||||
'code' => $job['code'],
|
|
||||||
'name' => $job['name'],
|
|
||||||
'symbol' => $job['symbol'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('transaction_currencies')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createExportJobs()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
$disk = Storage::disk('export');
|
|
||||||
foreach ($this->data['export-jobs'] as $job) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $job['user_id'],
|
|
||||||
'key' => $job['key'],
|
|
||||||
'status' => $job['status'],
|
|
||||||
];
|
|
||||||
$disk->put($job['key'] . '.zip', 'Nonsense data for "ziP" file.');
|
|
||||||
}
|
|
||||||
DB::table('export_jobs')->insert($insert);
|
|
||||||
|
|
||||||
// store fake export file:
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createImportJobs()
|
|
||||||
{
|
|
||||||
|
|
||||||
$disk = Storage::disk('upload');
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['import-jobs'] as $job) {
|
|
||||||
$insert[]
|
|
||||||
= [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $job['user_id'],
|
|
||||||
'file_type' => $job['file_type'],
|
|
||||||
'key' => $job['key'],
|
|
||||||
'status' => $job['status'],
|
|
||||||
'extended_status' => json_encode($job['extended_status']),
|
|
||||||
'configuration' => json_encode($job['configuration']),
|
|
||||||
];
|
|
||||||
|
|
||||||
$disk->put($job['key'] . '.upload', Crypt::encrypt(''));
|
|
||||||
}
|
|
||||||
DB::table('import_jobs')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createJournals()
|
|
||||||
{
|
|
||||||
$current = clone $this->start;
|
|
||||||
$transactions = [];
|
|
||||||
while ($current <= $this->end) {
|
|
||||||
$date = $current->format('Y-m-');
|
|
||||||
$month = $current->format('F');
|
|
||||||
|
|
||||||
// run all monthly withdrawals:
|
|
||||||
foreach ($this->data['monthly-withdrawals'] as $withdrawal) {
|
|
||||||
$description = str_replace(':month', $month, $withdrawal['description']);
|
|
||||||
$journalId = DB::table('transaction_journals')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $withdrawal['user_id'],
|
|
||||||
'transaction_type_id' => 1,
|
|
||||||
'bill_id' => $withdrawal['bill_id'] ?? null,
|
|
||||||
'transaction_currency_id' => 1,
|
|
||||||
'description' => Crypt::encrypt($description),
|
|
||||||
'completed' => 1,
|
|
||||||
'date' => $date . $withdrawal['day-of-month'],
|
|
||||||
'interest_date' => $withdrawal['interest_date'] ?? null,
|
|
||||||
'book_date' => $withdrawal['book_date'] ?? null,
|
|
||||||
'process_date' => $withdrawal['process_date'] ?? null,
|
|
||||||
'encrypted' => 1,
|
|
||||||
'order' => 0,
|
|
||||||
'tag_count' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$amount = (rand($withdrawal['min_amount'] * 100, $withdrawal['max_amount'] * 100)) / 100;
|
|
||||||
$transactions[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'account_id' => $withdrawal['source_id'],
|
|
||||||
'amount' => $amount * -1,
|
|
||||||
];
|
|
||||||
$transactions[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'account_id' => $withdrawal['destination_id'],
|
|
||||||
'amount' => $amount,
|
|
||||||
];
|
|
||||||
|
|
||||||
// link to budget if set.
|
|
||||||
if (isset($withdrawal['budget_id'])) {
|
|
||||||
DB::table('budget_transaction_journal')->insert(
|
|
||||||
[
|
|
||||||
'budget_id' => $withdrawal['budget_id'],
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// link to category if set.
|
|
||||||
if (isset($withdrawal['category_id'])) {
|
|
||||||
DB::table('category_transaction_journal')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $withdrawal['category_id'],
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// run all monthly deposits:
|
|
||||||
foreach ($this->data['monthly-deposits'] as $deposit) {
|
|
||||||
$description = str_replace(':month', $month, $deposit['description']);
|
|
||||||
$journalId = DB::table('transaction_journals')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $deposit['user_id'],
|
|
||||||
'transaction_type_id' => 2,
|
|
||||||
'bill_id' => $deposit['bill_id'] ?? null,
|
|
||||||
'transaction_currency_id' => 1,
|
|
||||||
'description' => Crypt::encrypt($description),
|
|
||||||
'completed' => 1,
|
|
||||||
'date' => $date . $deposit['day-of-month'],
|
|
||||||
'interest_date' => $deposit['interest_date'] ?? null,
|
|
||||||
'book_date' => $deposit['book_date'] ?? null,
|
|
||||||
'process_date' => $deposit['process_date'] ?? null,
|
|
||||||
'encrypted' => 1,
|
|
||||||
'order' => 0,
|
|
||||||
'tag_count' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$amount = (rand($deposit['min_amount'] * 100, $deposit['max_amount'] * 100)) / 100;
|
|
||||||
$transactions[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'account_id' => $deposit['source_id'],
|
|
||||||
'amount' => $amount * -1,
|
|
||||||
];
|
|
||||||
$transactions[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'account_id' => $deposit['destination_id'],
|
|
||||||
'amount' => $amount,
|
|
||||||
];
|
|
||||||
|
|
||||||
// link to category if set.
|
|
||||||
if (isset($deposit['category_id'])) {
|
|
||||||
DB::table('category_transaction_journal')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $deposit['category_id'],
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// run all monthly transfers:
|
|
||||||
foreach ($this->data['monthly-transfers'] as $transfer) {
|
|
||||||
$description = str_replace(':month', $month, $transfer['description']);
|
|
||||||
$journalId = DB::table('transaction_journals')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $transfer['user_id'],
|
|
||||||
'transaction_type_id' => 3,
|
|
||||||
'bill_id' => $transfer['bill_id'] ?? null,
|
|
||||||
'transaction_currency_id' => 1,
|
|
||||||
'description' => Crypt::encrypt($description),
|
|
||||||
'completed' => 1,
|
|
||||||
'date' => $date . $transfer['day-of-month'],
|
|
||||||
'interest_date' => $transfer['interest_date'] ?? null,
|
|
||||||
'book_date' => $transfer['book_date'] ?? null,
|
|
||||||
'process_date' => $transfer['process_date'] ?? null,
|
|
||||||
'encrypted' => 1,
|
|
||||||
'order' => 0,
|
|
||||||
'tag_count' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$amount = (rand($transfer['min_amount'] * 100, $transfer['max_amount'] * 100)) / 100;
|
|
||||||
$transactions[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'account_id' => $transfer['source_id'],
|
|
||||||
'amount' => $amount * -1,
|
|
||||||
];
|
|
||||||
$transactions[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'account_id' => $transfer['destination_id'],
|
|
||||||
'amount' => $amount,
|
|
||||||
];
|
|
||||||
// link to category if set.
|
|
||||||
if (isset($transfer['category_id'])) {
|
|
||||||
DB::table('category_transaction_journal')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $transfer['category_id'],
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DB::table('transactions')->insert($transactions);
|
|
||||||
$transactions = [];
|
|
||||||
$current->addMonth();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createMultiDeposits()
|
|
||||||
{
|
|
||||||
foreach ($this->data['multi-deposits'] as $deposit) {
|
|
||||||
$journalId = DB::table('transaction_journals')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $deposit['user_id'],
|
|
||||||
'transaction_type_id' => 2,
|
|
||||||
'transaction_currency_id' => 1,
|
|
||||||
'description' => Crypt::encrypt($deposit['description']),
|
|
||||||
'completed' => 1,
|
|
||||||
'date' => $deposit['date'],
|
|
||||||
'interest_date' => $deposit['interest_date'] ?? null,
|
|
||||||
'book_date' => $deposit['book_date'] ?? null,
|
|
||||||
'process_date' => $deposit['process_date'] ?? null,
|
|
||||||
'encrypted' => 1,
|
|
||||||
'order' => 0,
|
|
||||||
'tag_count' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$identifier = 0;
|
|
||||||
foreach ($deposit['source_ids'] as $index => $source) {
|
|
||||||
$description = $deposit['description'] . ' (#' . ($index + 1) . ')';
|
|
||||||
$amount = $deposit['amounts'][$index];
|
|
||||||
$first = DB::table('transactions')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $deposit['destination_id'],
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'description' => $description,
|
|
||||||
'amount' => $amount,
|
|
||||||
'identifier' => $identifier,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$second = DB::table('transactions')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $source,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'description' => $description,
|
|
||||||
'amount' => $amount * -1,
|
|
||||||
'identifier' => $identifier,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$identifier++;
|
|
||||||
// link first and second to budget and category, if present.
|
|
||||||
|
|
||||||
if (isset($deposit['category_ids'][$index])) {
|
|
||||||
DB::table('category_transaction')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $deposit['category_ids'][$index],
|
|
||||||
'transaction_id' => $first,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DB::table('category_transaction')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $deposit['category_ids'][$index],
|
|
||||||
'transaction_id' => $second,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createMultiTransfers()
|
|
||||||
{
|
|
||||||
foreach ($this->data['multi-transfers'] as $transfer) {
|
|
||||||
$journalId = DB::table('transaction_journals')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $transfer['user_id'],
|
|
||||||
'transaction_type_id' => 3,
|
|
||||||
'transaction_currency_id' => 1,
|
|
||||||
'description' => Crypt::encrypt($transfer['description']),
|
|
||||||
'completed' => 1,
|
|
||||||
'date' => $transfer['date'],
|
|
||||||
'interest_date' => $transfer['interest_date'] ?? null,
|
|
||||||
'book_date' => $transfer['book_date'] ?? null,
|
|
||||||
'process_date' => $transfer['process_date'] ?? null,
|
|
||||||
'encrypted' => 1,
|
|
||||||
'order' => 0,
|
|
||||||
'tag_count' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$identifier = 0;
|
|
||||||
foreach ($transfer['destination_ids'] as $index => $destination) {
|
|
||||||
$description = $transfer['description'] . ' (#' . ($index + 1) . ')';
|
|
||||||
$amount = $transfer['amounts'][$index];
|
|
||||||
$source = $transfer['source_ids'][$index];
|
|
||||||
$first = DB::table('transactions')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $source,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'description' => $description,
|
|
||||||
'amount' => $amount * -1,
|
|
||||||
'identifier' => $identifier,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$second = DB::table('transactions')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $destination,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'description' => $description,
|
|
||||||
'amount' => $amount,
|
|
||||||
'identifier' => $identifier,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$identifier++;
|
|
||||||
if (isset($transfer['category_ids'][$index])) {
|
|
||||||
DB::table('category_transaction')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $transfer['category_ids'][$index],
|
|
||||||
'transaction_id' => $first,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DB::table('category_transaction')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $transfer['category_ids'][$index],
|
|
||||||
'transaction_id' => $second,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createMultiWithdrawals()
|
|
||||||
{
|
|
||||||
foreach ($this->data['multi-withdrawals'] as $withdrawal) {
|
|
||||||
$journalId = DB::table('transaction_journals')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $withdrawal['user_id'],
|
|
||||||
'transaction_type_id' => 1,
|
|
||||||
'transaction_currency_id' => 1,
|
|
||||||
'description' => Crypt::encrypt($withdrawal['description']),
|
|
||||||
'completed' => 1,
|
|
||||||
'date' => $withdrawal['date'],
|
|
||||||
'interest_date' => $withdrawal['interest_date'] ?? null,
|
|
||||||
'book_date' => $withdrawal['book_date'] ?? null,
|
|
||||||
'process_date' => $withdrawal['process_date'] ?? null,
|
|
||||||
'encrypted' => 1,
|
|
||||||
'order' => 0,
|
|
||||||
'tag_count' => 0,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$identifier = 0;
|
|
||||||
foreach ($withdrawal['destination_ids'] as $index => $destination) {
|
|
||||||
$description = $withdrawal['description'] . ' (#' . ($index + 1) . ')';
|
|
||||||
$amount = $withdrawal['amounts'][$index];
|
|
||||||
$first = DB::table('transactions')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $withdrawal['source_id'],
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'description' => $description,
|
|
||||||
'amount' => $amount * -1,
|
|
||||||
'identifier' => $identifier,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$second = DB::table('transactions')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $destination,
|
|
||||||
'transaction_journal_id' => $journalId,
|
|
||||||
'description' => $description,
|
|
||||||
'amount' => $amount,
|
|
||||||
'identifier' => $identifier,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$identifier++;
|
|
||||||
// link first and second to budget and category, if present.
|
|
||||||
if (isset($withdrawal['budget_ids'][$index])) {
|
|
||||||
DB::table('budget_transaction')->insert(
|
|
||||||
[
|
|
||||||
'budget_id' => $withdrawal['budget_ids'][$index],
|
|
||||||
'transaction_id' => $first,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DB::table('budget_transaction')->insert(
|
|
||||||
[
|
|
||||||
'budget_id' => $withdrawal['budget_ids'][$index],
|
|
||||||
'transaction_id' => $second,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($withdrawal['category_ids'][$index])) {
|
|
||||||
DB::table('category_transaction')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $withdrawal['category_ids'][$index],
|
|
||||||
'transaction_id' => $first,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
DB::table('category_transaction')->insert(
|
|
||||||
[
|
|
||||||
'category_id' => $withdrawal['category_ids'][$index],
|
|
||||||
'transaction_id' => $second,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createPiggyBanks()
|
|
||||||
{
|
|
||||||
foreach ($this->data['piggy-banks'] as $piggyBank) {
|
|
||||||
$piggyId = DB::table('piggy_banks')->insertGetId(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'account_id' => $piggyBank['account_id'],
|
|
||||||
'name' => Crypt::encrypt($piggyBank['name']),
|
|
||||||
'targetamount' => $piggyBank['targetamount'],
|
|
||||||
'startdate' => $piggyBank['startdate'],
|
|
||||||
'order' => $piggyBank['order'],
|
|
||||||
'encrypted' => 1,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
if (isset($piggyBank['currentamount'])) {
|
|
||||||
DB::table('piggy_bank_repetitions')->insert(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'piggy_bank_id' => $piggyId,
|
|
||||||
'startdate' => $piggyBank['startdate'],
|
|
||||||
'currentamount' => $piggyBank['currentamount'],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->data['piggy-events'] as $event) {
|
|
||||||
DB::table('piggy_bank_events')->insert(
|
|
||||||
[
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'piggy_bank_id' => $event['piggy_bank_id'],
|
|
||||||
'date' => $event['date'],
|
|
||||||
'amount' => $event['amount'],
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createRules()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['rule-groups'] as $group) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $group['user_id'],
|
|
||||||
'order' => $group['order'],
|
|
||||||
'title' => $group['title'],
|
|
||||||
'description' => $group['description'],
|
|
||||||
'active' => 1,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('rule_groups')->insert($insert);
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['rules'] as $rule) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $rule['user_id'],
|
|
||||||
'rule_group_id' => $rule['rule_group_id'],
|
|
||||||
'order' => $rule['order'],
|
|
||||||
'active' => $rule['active'],
|
|
||||||
'stop_processing' => $rule['stop_processing'],
|
|
||||||
'title' => $rule['title'],
|
|
||||||
'description' => $rule['description'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('rules')->insert($insert);
|
|
||||||
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['rule-triggers'] as $trigger) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'rule_id' => $trigger['rule_id'],
|
|
||||||
'order' => $trigger['order'],
|
|
||||||
'active' => $trigger['active'],
|
|
||||||
'stop_processing' => $trigger['stop_processing'],
|
|
||||||
'trigger_type' => $trigger['trigger_type'],
|
|
||||||
'trigger_value' => $trigger['trigger_value'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('rule_triggers')->insert($insert);
|
|
||||||
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['rule-actions'] as $action) {
|
|
||||||
$insert[] = [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'rule_id' => $action['rule_id'],
|
|
||||||
'order' => $action['order'],
|
|
||||||
'active' => $action['active'],
|
|
||||||
'stop_processing' => $action['stop_processing'],
|
|
||||||
'action_type' => $action['action_type'],
|
|
||||||
'action_value' => $action['action_value'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('rule_actions')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createTags()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['tags'] as $tag) {
|
|
||||||
$insert[]
|
|
||||||
= [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'user_id' => $tag['user_id'],
|
|
||||||
'tag' => Crypt::encrypt($tag['tag']),
|
|
||||||
'tagMode' => $tag['tagMode'],
|
|
||||||
'date' => $tag['date'] ?? null,
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
||||||
DB::table('tags')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function createUsers()
|
|
||||||
{
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['users'] as $user) {
|
|
||||||
$insert[]
|
|
||||||
= [
|
|
||||||
'created_at' => $this->time,
|
|
||||||
'updated_at' => $this->time,
|
|
||||||
'email' => $user['email'],
|
|
||||||
'remember_token' => '',
|
|
||||||
'password' => bcrypt($user['password']),
|
|
||||||
];
|
|
||||||
|
|
||||||
}
|
|
||||||
DB::table('users')->insert($insert);
|
|
||||||
$insert = [];
|
|
||||||
foreach ($this->data['roles'] as $role) {
|
|
||||||
$insert[]
|
|
||||||
= [
|
|
||||||
'user_id' => $role['user_id'],
|
|
||||||
'role_id' => $role['role'],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
DB::table('role_user')->insert($insert);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private function go()
|
|
||||||
{
|
|
||||||
$this->createUsers();
|
|
||||||
$this->createAccounts();
|
|
||||||
$this->createBills();
|
|
||||||
$this->createBudgets();
|
|
||||||
$this->createCategories();
|
|
||||||
$this->createPiggyBanks();
|
|
||||||
$this->createRules();
|
|
||||||
$this->createTags();
|
|
||||||
$this->createJournals();
|
|
||||||
$this->createAttachments();
|
|
||||||
$this->createMultiWithdrawals();
|
|
||||||
$this->createMultiDeposits();
|
|
||||||
$this->createMultiTransfers();
|
|
||||||
$this->createImportJobs();
|
|
||||||
$this->createCurrencies();
|
|
||||||
$this->createExportJobs();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -28,7 +28,6 @@ class DatabaseSeeder extends Seeder
|
|||||||
$this->call(TransactionCurrencySeeder::class);
|
$this->call(TransactionCurrencySeeder::class);
|
||||||
$this->call(TransactionTypeSeeder::class);
|
$this->call(TransactionTypeSeeder::class);
|
||||||
$this->call(PermissionSeeder::class);
|
$this->call(PermissionSeeder::class);
|
||||||
$this->call(TestDataSeeder::class);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* TestDataSeeder.php
|
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
||||||
*
|
|
||||||
* This software may be modified and distributed under the terms of the
|
|
||||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
||||||
*
|
|
||||||
* See the LICENSE file for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types = 1);
|
|
||||||
|
|
||||||
use FireflyIII\Support\Migration\TestData;
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class TestDataSeeder
|
|
||||||
*/
|
|
||||||
class TestDataSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* TestDataSeeder constructor.
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
$disk = Storage::disk('seeds');
|
|
||||||
$env = App::environment();
|
|
||||||
Log::debug('Environment is ' . $env);
|
|
||||||
$fileName = 'seed.' . $env . '.json';
|
|
||||||
if ($disk->exists($fileName)) {
|
|
||||||
Log::debug('Now seeding ' . $fileName);
|
|
||||||
$file = json_decode($disk->get($fileName), true);
|
|
||||||
|
|
||||||
if (is_array($file)) {
|
|
||||||
// run the file:
|
|
||||||
TestData::run($file);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Log::error(sprintf('No valid data found (%s) for environment %s', $fileName, $env));
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
Log::error(sprintf('No seed file (%s) for environment %s', $fileName, $env));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,137 +0,0 @@
|
|||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"email": "thegrumpydictator@gmail.com",
|
|
||||||
"password": "james"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "thegrumpydictator+empty@gmail.com",
|
|
||||||
"password": "james"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"email": "thegrumpydictator+deleteme@gmail.com",
|
|
||||||
"password": "james"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"role": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 3,
|
|
||||||
"name": "Checking Account",
|
|
||||||
"iban": "NL11XOLA6707795988"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"account-meta": [
|
|
||||||
],
|
|
||||||
"bills": [
|
|
||||||
{
|
|
||||||
"name": "Some weird weekly bill",
|
|
||||||
"match": "weird,weekly,bill",
|
|
||||||
"amount_min": 30,
|
|
||||||
"amount_max": 35,
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-06-12",
|
|
||||||
"active": 1,
|
|
||||||
"automatch": 1,
|
|
||||||
"repeat_freq": "weekly",
|
|
||||||
"skip": 0
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Rent",
|
|
||||||
"match": "rent,land,lord",
|
|
||||||
"amount_min": 795,
|
|
||||||
"amount_max": 805,
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2015-01-02",
|
|
||||||
"active": 1,
|
|
||||||
"automatch": 1,
|
|
||||||
"repeat_freq": "monthly",
|
|
||||||
"skip": 0
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Netflix subscription per quarter",
|
|
||||||
"match": "netflix,subscription",
|
|
||||||
"amount_min": 36,
|
|
||||||
"amount_max": 36,
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-09-06",
|
|
||||||
"active": 1,
|
|
||||||
"automatch": 1,
|
|
||||||
"repeat_freq": "quarterly",
|
|
||||||
"skip": 0
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Travel insurance",
|
|
||||||
"match": "abn,travel,insurance",
|
|
||||||
"amount_min": 55,
|
|
||||||
"amount_max": 62,
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2015-03-04",
|
|
||||||
"active": 1,
|
|
||||||
"automatch": 1,
|
|
||||||
"repeat_freq": "yearly",
|
|
||||||
"skip": 0
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Health insurance",
|
|
||||||
"match": "insurer,insurance,health",
|
|
||||||
"amount_min": 120,
|
|
||||||
"amount_max": 140,
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2015-01-07",
|
|
||||||
"active": 1,
|
|
||||||
"automatch": 1,
|
|
||||||
"repeat_freq": "monthly",
|
|
||||||
"skip": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"budgets": [
|
|
||||||
],
|
|
||||||
"budget-limits": [
|
|
||||||
],
|
|
||||||
"monthly-limits": [
|
|
||||||
],
|
|
||||||
"categories": [
|
|
||||||
],
|
|
||||||
"piggy-banks": [
|
|
||||||
],
|
|
||||||
"piggy-events": [
|
|
||||||
],
|
|
||||||
"rule-groups": [
|
|
||||||
],
|
|
||||||
"rules": [
|
|
||||||
],
|
|
||||||
"rule-triggers": [
|
|
||||||
],
|
|
||||||
"rule-actions": [
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
],
|
|
||||||
"monthly-deposits": [
|
|
||||||
],
|
|
||||||
"monthly-transfers": [
|
|
||||||
],
|
|
||||||
"monthly-withdrawals": [
|
|
||||||
],
|
|
||||||
"attachments": [
|
|
||||||
],
|
|
||||||
"multi-withdrawals": [
|
|
||||||
],
|
|
||||||
"multi-deposits": [
|
|
||||||
],
|
|
||||||
"multi-transfers": [
|
|
||||||
],
|
|
||||||
"import-jobs": [],
|
|
||||||
"currencies": []
|
|
||||||
}
|
|
||||||
@@ -1,279 +0,0 @@
|
|||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"email": "thegrumpydictator@gmail.com",
|
|
||||||
"password": "james"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"role": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 3,
|
|
||||||
"name": "ExistingAssetAccount",
|
|
||||||
"iban": "NL62EXFK3945306779"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 4,
|
|
||||||
"name": "ExistingOpposingAccount",
|
|
||||||
"iban": "NL79BGWN6303364632"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"account-meta": [
|
|
||||||
{
|
|
||||||
"account_id": 1,
|
|
||||||
"name": "accountNumber",
|
|
||||||
"data": "\"3945306779\""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account_id": 2,
|
|
||||||
"name": "accountNumber",
|
|
||||||
"data": "\"6303364632\""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"bills": [
|
|
||||||
{
|
|
||||||
"name": "ExistingBill",
|
|
||||||
"match": "ExistingBill",
|
|
||||||
"amount_min": 100,
|
|
||||||
"amount_max": 200,
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2015-01-01",
|
|
||||||
"active": 1,
|
|
||||||
"automatch": 1,
|
|
||||||
"repeat_freq": "monthly",
|
|
||||||
"skip": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"budgets": [
|
|
||||||
{
|
|
||||||
"name": "ExistingBudget",
|
|
||||||
"user_id": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"budget-limits": [],
|
|
||||||
"monthly-limits": [],
|
|
||||||
"categories": [
|
|
||||||
{
|
|
||||||
"name": "ExistingCategory",
|
|
||||||
"user_id": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "UnExpected Taxes",
|
|
||||||
"user_id": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"piggy-banks": [],
|
|
||||||
"piggy-events": [],
|
|
||||||
"rule-groups": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"order": 1,
|
|
||||||
"title": "Default rules",
|
|
||||||
"description": "All your rules not in a particular group."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"order": 2,
|
|
||||||
"title": "Unexpected rules",
|
|
||||||
"description": "Group for unexpected rules"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"rules": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"rule_group_id": 1,
|
|
||||||
"order": 1,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"title": "Your first default rule",
|
|
||||||
"description": "This rule is an example. You can safely delete it."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"rule_group_id": 2,
|
|
||||||
"order": 1,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"title": "Onverwachte belastingen",
|
|
||||||
"description": "Triggers on the storage of onverwachte belastingen."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"rule-triggers": [
|
|
||||||
{
|
|
||||||
"rule_id": 1,
|
|
||||||
"order": 1,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"trigger_type": "user_action",
|
|
||||||
"trigger_value": "store-journal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule_id": 1,
|
|
||||||
"order": 2,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"trigger_type": "description_is",
|
|
||||||
"trigger_value": "The Man Who Sold the World"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule_id": 1,
|
|
||||||
"order": 3,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"trigger_type": "from_account_is",
|
|
||||||
"trigger_value": "David Bowie"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule_id": 2,
|
|
||||||
"order": 1,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"trigger_type": "user_action",
|
|
||||||
"trigger_value": "store-journal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule_id": 2,
|
|
||||||
"order": 2,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"trigger_type": "description_contains",
|
|
||||||
"trigger_value": "(on)verwachte"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"rule-actions": [
|
|
||||||
{
|
|
||||||
"rule_id": 1,
|
|
||||||
"order": 1,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"action_type": "prepend_description",
|
|
||||||
"action_value": "Bought the world from "
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule_id": 1,
|
|
||||||
"order": 2,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"action_type": "set_category",
|
|
||||||
"action_value": "Large expenses"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule_id": 2,
|
|
||||||
"order": 1,
|
|
||||||
"active": 1,
|
|
||||||
"stop_processing": 0,
|
|
||||||
"action_type": "set_category",
|
|
||||||
"action_value": "UnExpected Taxes"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"tag": "ExistingTag",
|
|
||||||
"tagMode": "nothing"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"tag": "AnotherExistingTag",
|
|
||||||
"tagMode": "nothing"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"monthly-deposits": [],
|
|
||||||
"monthly-transfers": [],
|
|
||||||
"monthly-withdrawals": [],
|
|
||||||
"attachments": [],
|
|
||||||
"multi-withdrawals": [],
|
|
||||||
"multi-deposits": [],
|
|
||||||
"multi-transfers": [],
|
|
||||||
"import-jobs": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"key": "testImport",
|
|
||||||
"file_type": "csv",
|
|
||||||
"status": "settings_complete",
|
|
||||||
"extended_status": {
|
|
||||||
"steps_done": 0,
|
|
||||||
"total_steps": 0,
|
|
||||||
"errors": [],
|
|
||||||
"import_count": 0,
|
|
||||||
"importTag": 0
|
|
||||||
},
|
|
||||||
"configuration": {
|
|
||||||
"has-headers": false,
|
|
||||||
"date-format": "Ymd",
|
|
||||||
"delimiter": ",",
|
|
||||||
"import-account": 1,
|
|
||||||
"specifics": {
|
|
||||||
"RabobankDescription": 1
|
|
||||||
},
|
|
||||||
"column-count": 19,
|
|
||||||
"column-roles": [
|
|
||||||
"account-iban",
|
|
||||||
"currency-code",
|
|
||||||
"date-interest",
|
|
||||||
"rabo-debet-credit",
|
|
||||||
"amount",
|
|
||||||
"opposing-iban",
|
|
||||||
"opposing-name",
|
|
||||||
"date-book",
|
|
||||||
"description",
|
|
||||||
"_ignore",
|
|
||||||
"description",
|
|
||||||
"description",
|
|
||||||
"description",
|
|
||||||
"description",
|
|
||||||
"description",
|
|
||||||
"description",
|
|
||||||
"sepa-ct-id",
|
|
||||||
"sepa-ct-op",
|
|
||||||
"sepa-db"
|
|
||||||
],
|
|
||||||
"column-do-mapping": [
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"column-roles-complete": false,
|
|
||||||
"column-mapping-config": {
|
|
||||||
"0": [],
|
|
||||||
"1": {
|
|
||||||
"EUR": 1
|
|
||||||
},
|
|
||||||
"5": [],
|
|
||||||
"6": []
|
|
||||||
},
|
|
||||||
"column-mapping-complete": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"currencies": [
|
|
||||||
{
|
|
||||||
"name": "ExistingCurrency",
|
|
||||||
"symbol": "#",
|
|
||||||
"code": "EXI"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,303 +0,0 @@
|
|||||||
{
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"email": "thegrumpydictator@gmail.com",
|
|
||||||
"password": "james"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"roles": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"role": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"accounts": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 3,
|
|
||||||
"name": "Checking Account",
|
|
||||||
"iban": "NL11XOLA6707795988"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 3,
|
|
||||||
"name": "Alternate",
|
|
||||||
"iban": "NL40UKBK3619908726"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 4,
|
|
||||||
"name": "SixtyFive"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 4,
|
|
||||||
"name": "EightyFour"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 4,
|
|
||||||
"name": "Fiftyone"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 5,
|
|
||||||
"name": "Work SixtyFive"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 5,
|
|
||||||
"name": "Work EightyFour"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"account_type_id": 5,
|
|
||||||
"name": "Work Fiftyone"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"account-meta": [
|
|
||||||
{
|
|
||||||
"account_id": 1,
|
|
||||||
"name": "accountRole",
|
|
||||||
"data": "\"defaultAsset\""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account_id": 2,
|
|
||||||
"name": "accountRole",
|
|
||||||
"data": "\"defaultAsset\""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"bills": [],
|
|
||||||
"budgets": [
|
|
||||||
{
|
|
||||||
"name": "Groceries",
|
|
||||||
"user_id": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Bills",
|
|
||||||
"user_id": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Car",
|
|
||||||
"user_id": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"budget-limits": [],
|
|
||||||
"monthly-limits": [
|
|
||||||
{
|
|
||||||
"budget_id": 1,
|
|
||||||
"amount_min": 200,
|
|
||||||
"amount_max": 200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"budget_id": 2,
|
|
||||||
"amount_min": 1000,
|
|
||||||
"amount_max": 1000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"budget_id": 3,
|
|
||||||
"amount_min": 200,
|
|
||||||
"amount_max": 200
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"categories": [
|
|
||||||
{
|
|
||||||
"name": "Daily groceries",
|
|
||||||
"user_id": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Car",
|
|
||||||
"user_id": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Reimbursements",
|
|
||||||
"user_id": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"piggy-banks": [
|
|
||||||
{
|
|
||||||
"account_id": 2,
|
|
||||||
"name": "New camera",
|
|
||||||
"targetamount": 1000,
|
|
||||||
"startdate": "2015-04-01",
|
|
||||||
"reminder_skip": 0,
|
|
||||||
"remind_me": 0,
|
|
||||||
"order": 1,
|
|
||||||
"currentamount": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account_id": 2,
|
|
||||||
"name": "New phone",
|
|
||||||
"targetamount": 600,
|
|
||||||
"startdate": "2015-04-01",
|
|
||||||
"reminder_skip": 0,
|
|
||||||
"remind_me": 0,
|
|
||||||
"order": 2,
|
|
||||||
"currentamount": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"account_id": 2,
|
|
||||||
"name": "New couch",
|
|
||||||
"targetamount": 500,
|
|
||||||
"startdate": "2015-04-01",
|
|
||||||
"reminder_skip": 0,
|
|
||||||
"remind_me": 0,
|
|
||||||
"order": 3,
|
|
||||||
"currentamount": 0
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"piggy-events": [],
|
|
||||||
"rule-groups": [],
|
|
||||||
"rules": [],
|
|
||||||
"rule-triggers": [],
|
|
||||||
"rule-actions": [],
|
|
||||||
"tags": [],
|
|
||||||
"monthly-deposits": [],
|
|
||||||
"monthly-transfers": [],
|
|
||||||
"monthly-withdrawals": [],
|
|
||||||
"attachments": [],
|
|
||||||
"multi-withdrawals": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-03-12",
|
|
||||||
"description": "Even multi-withdrawal (50, 50)",
|
|
||||||
"destination_ids": [
|
|
||||||
3,
|
|
||||||
4
|
|
||||||
],
|
|
||||||
"source_id": 1,
|
|
||||||
"amounts": [
|
|
||||||
50,
|
|
||||||
50
|
|
||||||
],
|
|
||||||
"category_ids": [
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
],
|
|
||||||
"budget_ids": [
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-05-12",
|
|
||||||
"description": "Uneven multi-withdrawal (15,34,51)",
|
|
||||||
"destination_ids": [
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
5
|
|
||||||
],
|
|
||||||
"source_id": 1,
|
|
||||||
"amounts": [
|
|
||||||
15,
|
|
||||||
34,
|
|
||||||
51
|
|
||||||
],
|
|
||||||
"category_ids": [
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
],
|
|
||||||
"budget_ids": [
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"multi-deposits": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-03-02",
|
|
||||||
"description": "Even multi-deposit (50, 50)",
|
|
||||||
"source_ids": [
|
|
||||||
6,
|
|
||||||
7
|
|
||||||
],
|
|
||||||
"destination_id": 1,
|
|
||||||
"amounts": [
|
|
||||||
50,
|
|
||||||
50
|
|
||||||
],
|
|
||||||
"category_ids": [
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-05-02",
|
|
||||||
"description": "Uneven multi-deposit (15,34,51)",
|
|
||||||
"source_ids": [
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
8
|
|
||||||
],
|
|
||||||
"destination_id": 1,
|
|
||||||
"amounts": [
|
|
||||||
15,
|
|
||||||
34,
|
|
||||||
51
|
|
||||||
],
|
|
||||||
"category_ids": [
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"multi-transfers": [
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-01-18",
|
|
||||||
"description": "Even multi-transfer (50, 50)",
|
|
||||||
"source_ids": [
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"destination_ids": [
|
|
||||||
2,
|
|
||||||
2
|
|
||||||
],
|
|
||||||
"amounts": [
|
|
||||||
50,
|
|
||||||
50
|
|
||||||
],
|
|
||||||
"category_ids": [
|
|
||||||
1,
|
|
||||||
2
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"user_id": 1,
|
|
||||||
"date": "2016-05-08",
|
|
||||||
"description": "Uneven multi-transfer (15,34,51)",
|
|
||||||
"source_ids": [
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1
|
|
||||||
],
|
|
||||||
"destination_ids": [
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
2
|
|
||||||
],
|
|
||||||
"amounts": [
|
|
||||||
15,
|
|
||||||
34,
|
|
||||||
51
|
|
||||||
],
|
|
||||||
"category_ids": [
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"import-jobs": [],
|
|
||||||
"currencies": []
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user