mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-08-18 19:47:15 +00:00
Compare commits
906 Commits
5.7.4
...
v6.0.0-bet
Author | SHA1 | Date | |
---|---|---|---|
|
86d6a2f581 | ||
|
df4f28e819 | ||
|
9ee66625de | ||
|
fb595bb335 | ||
|
a8e4fbb7b6 | ||
|
0060c46cdb | ||
|
b909841eae | ||
|
f001675066 | ||
|
c979cfcd89 | ||
|
2a30b10b97 | ||
|
fb903d5e3a | ||
|
268f690d75 | ||
|
2e074009c4 | ||
|
d5e60b206d | ||
|
1964afe876 | ||
|
328a476fb5 | ||
|
12ca0811e6 | ||
|
7a20f7ce34 | ||
|
cce856c0e2 | ||
|
5ef2a33334 | ||
|
6e29a7421f | ||
|
89e6bd7471 | ||
|
df0a6db83f | ||
|
c949ff19b7 | ||
|
e4b4234fbb | ||
|
86aaa3068a | ||
|
08f9da8a15 | ||
|
6bd0aa14b3 | ||
|
38bff09c1d | ||
|
93caa433d7 | ||
|
bcb1fce7ed | ||
|
c777c95ced | ||
|
5e89bde05b | ||
|
79e98cf8a2 | ||
|
bf8ab7f5d7 | ||
|
54a471ba4c | ||
|
26accbc81e | ||
|
242c6c1b0c | ||
|
db659efe27 | ||
|
06be3f0d46 | ||
|
da318fb592 | ||
|
d58c230f00 | ||
|
fd7ba9dd57 | ||
|
47a98451a0 | ||
|
91e961a876 | ||
|
9aaf79a3ab | ||
|
b1e3cf3a20 | ||
|
be0d785a56 | ||
|
efb89023ac | ||
|
9adccb345a | ||
|
83f5b8ab12 | ||
|
de38e7cf9f | ||
|
3a0b3f46a5 | ||
|
806d108d1c | ||
|
794d130ff9 | ||
|
848e7d4c9f | ||
|
6e96c75be7 | ||
|
e20dc78620 | ||
|
35912fe9fb | ||
|
74777a648c | ||
|
0eb0f7f35f | ||
|
1226ef542f | ||
|
7d169518a5 | ||
|
abfd837f68 | ||
|
8ab1e97fb0 | ||
|
9fbb290d0f | ||
|
28deb32f5e | ||
|
2c1023ad40 | ||
|
766418a894 | ||
|
970193473d | ||
|
a782abd6db | ||
|
b98050e238 | ||
|
1c02b04a0d | ||
|
c5f94372a0 | ||
|
928613e908 | ||
|
fd3da949da | ||
|
15210f75e7 | ||
|
dec5e3440d | ||
|
413a4f3d9c | ||
|
1cbb644d65 | ||
|
e008c1f742 | ||
|
9bffa86706 | ||
|
a5a95055c5 | ||
|
5a5c92b5b5 | ||
|
41941b37f9 | ||
|
881fe3e6e7 | ||
|
a7570d9ab5 | ||
|
605afdb271 | ||
|
b6e54fe3cf | ||
|
fbe5a5dd39 | ||
|
e284da368d | ||
|
a5328a9ff4 | ||
|
a925e1aa02 | ||
|
81c37b3349 | ||
|
c84c64a1c2 | ||
|
ced9ea4777 | ||
|
36c0e8df2d | ||
|
61a0a7795e | ||
|
e2b4448985 | ||
|
f5d1a597cf | ||
|
80607bc6ae | ||
|
8c5c6c2bde | ||
|
f476a909df | ||
|
9bf86be305 | ||
|
3d96f5df58 | ||
|
fc0adfd375 | ||
|
1d62d5d44a | ||
|
6c2486faa7 | ||
|
f9daf7751a | ||
|
c269913510 | ||
|
cc436605d0 | ||
|
c697d2aa13 | ||
|
90219bec35 | ||
|
afca023767 | ||
|
1502c5de94 | ||
|
cd408e581b | ||
|
122c8acae0 | ||
|
13cffaa1e3 | ||
|
feab244edd | ||
|
259ad852c9 | ||
|
6802f53c96 | ||
|
d922390802 | ||
|
2a9f51a40f | ||
|
614d54c9bd | ||
|
3ea8792c6e | ||
|
3d802b9c9e | ||
|
480d787242 | ||
|
820c6feadd | ||
|
8c1eeedf17 | ||
|
9b5931f1d6 | ||
|
d5cade320b | ||
|
ef46ab6de2 | ||
|
d0d3921ff6 | ||
|
2cb2e2e635 | ||
|
1a0047205d | ||
|
468655cd94 | ||
|
09cb4b10b9 | ||
|
6eaf83d6d2 | ||
|
7c8a2e3591 | ||
|
ba5c3ef0a1 | ||
|
c0f744b03a | ||
|
8cd13ba13b | ||
|
10db3d63ac | ||
|
a753fde2f1 | ||
|
d4f1b9a1bc | ||
|
3cfaa5aa03 | ||
|
bc47017e31 | ||
|
125d9e7e9d | ||
|
4cea7a3287 | ||
|
e7a1ad23f4 | ||
|
afd3fd9f88 | ||
|
f2251d7bfa | ||
|
700ccaa853 | ||
|
0fcdcf0f01 | ||
|
fa347a5ee4 | ||
|
d412c2407a | ||
|
dea86242fd | ||
|
973c175213 | ||
|
e135d01655 | ||
|
9b37d5ab8d | ||
|
84c3868c9b | ||
|
3c0b23aaed | ||
|
7e6ce7c3e8 | ||
|
7111aec101 | ||
|
1f9e0b48c9 | ||
|
63a7aad44c | ||
|
9191ae5054 | ||
|
618e70748c | ||
|
68e4f26656 | ||
|
5124a5eba9 | ||
|
708cd014c5 | ||
|
9654f631c5 | ||
|
65027d7832 | ||
|
db0500dcf0 | ||
|
89d4a34acf | ||
|
23bbebb80e | ||
|
4ccdd8f322 | ||
|
3033b0fa7f | ||
|
abc7bfb54c | ||
|
1fede6b802 | ||
|
6e3381844e | ||
|
3f2560c8e5 | ||
|
abdbb86d05 | ||
|
9008d19494 | ||
|
929513c220 | ||
|
566a303650 | ||
|
e783b8dba4 | ||
|
bb6cbe884e | ||
|
3be4c07848 | ||
|
732a87f051 | ||
|
124d3aaf96 | ||
|
65df355440 | ||
|
29e07c6604 | ||
|
c0af63e59e | ||
|
772f0f5ba4 | ||
|
6db3e3d75e | ||
|
9290c2247e | ||
|
5967762cd8 | ||
|
5845ba0daf | ||
|
961d067aec | ||
|
81ce2c1b3e | ||
|
d6bf304390 | ||
|
fe9620a438 | ||
|
d90321aa1e | ||
|
c26667ebc7 | ||
|
862140a9fc | ||
|
8447670ed5 | ||
|
7a2c52531a | ||
|
cb4e5a80b2 | ||
|
c976149bf1 | ||
|
4917f40abf | ||
|
4c27bbf069 | ||
|
a90214273b | ||
|
5167f53fd5 | ||
|
40083230fd | ||
|
ca57942b38 | ||
|
ef58d5b1b2 | ||
|
cc218e203f | ||
|
9fdaf1cee8 | ||
|
770d092e93 | ||
|
6d4e45b89f | ||
|
1fee2092d6 | ||
|
7bd824e8cb | ||
|
fa588db1a9 | ||
|
c3e0ce0c08 | ||
|
6a629a7da3 | ||
|
07e4e93632 | ||
|
6784fe4436 | ||
|
af8c127106 | ||
|
ebd32e0e08 | ||
|
b56acf36c5 | ||
|
4daaa44ba8 | ||
|
93ae82691b | ||
|
c3e739cd6f | ||
|
851da6a0a1 | ||
|
a99f68fd17 | ||
|
1266eff7f6 | ||
|
e5d5e774dc | ||
|
0429f50e5c | ||
|
e9e0225731 | ||
|
e4db5f5a21 | ||
|
3c1f44f554 | ||
|
67434bb8a5 | ||
|
b0b65c3f04 | ||
|
fe724fa1b8 | ||
|
c3ce9e896e | ||
|
c60120ac20 | ||
|
8bbe519350 | ||
|
c426ff352c | ||
|
15605dd163 | ||
|
4d0ff86bfa | ||
|
7722ca2bf0 | ||
|
5878b2c427 | ||
|
f2499e0a77 | ||
|
81f781a823 | ||
|
b5734beb32 | ||
|
24696bf800 | ||
|
27a576ae8a | ||
|
2b9996b844 | ||
|
742c84269b | ||
|
333c348117 | ||
|
ed4d2ee6ad | ||
|
445804a7f1 | ||
|
ee0116f112 | ||
|
03e176bd16 | ||
|
a84050a084 | ||
|
bef7887a8d | ||
|
5b8e01fbfb | ||
|
56b9b66352 | ||
|
6cfdc58cb1 | ||
|
dbf3e76ecc | ||
|
0022009dd5 | ||
|
6249488f0f | ||
|
29bd3a2804 | ||
|
ba35c5da0b | ||
|
9b242f1a75 | ||
|
1acc2ab18b | ||
|
e031fffe65 | ||
|
2a61633ab9 | ||
|
5e3f9f9bce | ||
|
8c320fd199 | ||
|
85a2a87806 | ||
|
3666ef8c59 | ||
|
e4db21f0c0 | ||
|
d137b2938d | ||
|
d3a619cb15 | ||
|
d40fd485ca | ||
|
32e89155a0 | ||
|
cae0b1798a | ||
|
5e654786be | ||
|
75ce777090 | ||
|
f350948fb2 | ||
|
1f4ca9c8fe | ||
|
dd0c36d464 | ||
|
e468d5b892 | ||
|
e58cf0d3c9 | ||
|
e389fd7d7c | ||
|
83b5ca69dd | ||
|
5e17cb5823 | ||
|
bb11e61034 | ||
|
eff631276e | ||
|
89ab62fff2 | ||
|
bdf7d3978f | ||
|
3fbaed2fdc | ||
|
a4f3be5397 | ||
|
265d973811 | ||
|
e22ed9a69b | ||
|
80762616f3 | ||
|
fcecd5c85e | ||
|
2780cf4b20 | ||
|
7e63700ca2 | ||
|
2d9a3f5fc6 | ||
|
f5bbd445d2 | ||
|
12008fb0e9 | ||
|
5f6c84ab4c | ||
|
8b9936044b | ||
|
db478711ed | ||
|
63184ac298 | ||
|
5f6772260d | ||
|
22a237d316 | ||
|
c47980a737 | ||
|
e43372b2ce | ||
|
395b6ecb76 | ||
|
328a1e256e | ||
|
4a31f9ce7e | ||
|
345f4903a9 | ||
|
3fe5e5ea8c | ||
|
b0da22ddf2 | ||
|
388ee14dfc | ||
|
2c53c72024 | ||
|
de260adca4 | ||
|
33f764088e | ||
|
23a8835758 | ||
|
034647a5ca | ||
|
d8813120a7 | ||
|
989fd1adba | ||
|
a5f4793e81 | ||
|
9529721368 | ||
|
86243131cd | ||
|
344cbe4fb7 | ||
|
44af5473a8 | ||
|
f33f9c797b | ||
|
352eedb136 | ||
|
c8d6ef3782 | ||
|
922a5fa9c7 | ||
|
c125984d55 | ||
|
a60c3165f1 | ||
|
363c849c50 | ||
|
36c9782c8f | ||
|
49847a91e3 | ||
|
516653d007 | ||
|
2743359a4e | ||
|
8055e9e927 | ||
|
702f2c3146 | ||
|
ad36082fca | ||
|
81e650986d | ||
|
f3c89e8055 | ||
|
3a8c0074b7 | ||
|
dcfcbfd9b5 | ||
|
04c71a2e9e | ||
|
2383d16e7a | ||
|
5bb7705702 | ||
|
2e3267ab9e | ||
|
d969cd72c0 | ||
|
e4894c756a | ||
|
f52044e794 | ||
|
43960a5b60 | ||
|
81b0b048db | ||
|
3278d9850e | ||
|
b13bcec61a | ||
|
21d18acabc | ||
|
4060d14de0 | ||
|
c67a71e238 | ||
|
ed330e30d0 | ||
|
7673d11673 | ||
|
e1114f720d | ||
|
b49e7d6b21 | ||
|
c9ba5f08c4 | ||
|
5aa8793e33 | ||
|
dd98549bce | ||
|
d6d53cc598 | ||
|
6516495e2b | ||
|
7fcdf85dee | ||
|
704c6055b3 | ||
|
f650dd9463 | ||
|
1b261359e6 | ||
|
8050c8cb84 | ||
|
7666960a86 | ||
|
0a7210729f | ||
|
90c9fdaf55 | ||
|
60d8bb2aab | ||
|
d55833cb86 | ||
|
39fbf3ce20 | ||
|
acd9685578 | ||
|
15994c8c56 | ||
|
b942f351f8 | ||
|
f16b679049 | ||
|
8d8f81c27d | ||
|
74610a5d55 | ||
|
409b4fe4d9 | ||
|
817a9f57c4 | ||
|
e05c174e6d | ||
|
05d461fb88 | ||
|
7bb2f96ae2 | ||
|
8f15bd716d | ||
|
a702662e88 | ||
|
0c6e00666b | ||
|
5ba079e71c | ||
|
ebcf9b3be1 | ||
|
e7e3370baa | ||
|
21d4b396cc | ||
|
249b0c3377 | ||
|
b36f6741ff | ||
|
0059ed7bde | ||
|
d7bbc8334e | ||
|
bd245d5c92 | ||
|
4e618a4d0b | ||
|
b57785a234 | ||
|
2b7101e362 | ||
|
e74b629dc2 | ||
|
a4f329cfc3 | ||
|
e993abc8fb | ||
|
6961365a40 | ||
|
16303515f5 | ||
|
bb5bca9cf0 | ||
|
e8a61821e9 | ||
|
5d4cf5f55e | ||
|
5e9de60c1a | ||
|
417700ef13 | ||
|
b14062b197 | ||
|
33f370359c | ||
|
c032ffd4f9 | ||
|
1a7d60ccc8 | ||
|
f52675068b | ||
|
f53923f16c | ||
|
2eebcb21f1 | ||
|
64ff5eed27 | ||
|
1667b88dcd | ||
|
b27fe59ab4 | ||
|
bdcd9825ec | ||
|
8edfb1460c | ||
|
914dc8596b | ||
|
6b64a39182 | ||
|
d28326cc89 | ||
|
e3181e90df | ||
|
486f25cd96 | ||
|
612a395eb2 | ||
|
a3b4d5ff62 | ||
|
b613b56d1e | ||
|
6b7fc03f02 | ||
|
5999ee406c | ||
|
e348127770 | ||
|
b60a3be34b | ||
|
e3bdc62ac4 | ||
|
83b8fdba05 | ||
|
b21461c824 | ||
|
0b64507fd7 | ||
|
45dcd5df09 | ||
|
3bdea43744 | ||
|
b3895a04a0 | ||
|
d4738b21ab | ||
|
2f66315416 | ||
|
f4af19e121 | ||
|
abdb717b37 | ||
|
e229bd8121 | ||
|
d31fa743d0 | ||
|
4ad666d964 | ||
|
f7b66a048a | ||
|
a91f6fbfaf | ||
|
f3566c609a | ||
|
904320b9b8 | ||
|
35c1ce6504 | ||
|
a96c830e3e | ||
|
ddefdd5ec5 | ||
|
9e41cd9c8c | ||
|
b3740e643a | ||
|
55ac76f663 | ||
|
49560ca6a6 | ||
|
fd37054493 | ||
|
bf589e5c57 | ||
|
e97018cf2e | ||
|
5038ed7708 | ||
|
02081b09a2 | ||
|
a74d345ac2 | ||
|
e472c3520d | ||
|
39654249e4 | ||
|
69929bee31 | ||
|
b276b24a79 | ||
|
1b99dbab0a | ||
|
1ea0fa318c | ||
|
4066fc643f | ||
|
b7975c6a88 | ||
|
1e88b1eb88 | ||
|
88490de38f | ||
|
77759d5580 | ||
|
22971ded84 | ||
|
841edcfffb | ||
|
05fe503456 | ||
|
030b6cb281 | ||
|
896c15a7a1 | ||
|
b176308dbd | ||
|
da71d6172c | ||
|
f1457fcda6 | ||
|
a39553256e | ||
|
553a9be3d5 | ||
|
187e1914e3 | ||
|
fc83565d02 | ||
|
7e94f246e3 | ||
|
44637dfaab | ||
|
bab4c05e5f | ||
|
5b43a2e99f | ||
|
ee2b87d5fe | ||
|
c9f7e96450 | ||
|
ea361365f0 | ||
|
5dfb35064a | ||
|
5522e4f514 | ||
|
c1367d12a6 | ||
|
db2485f97a | ||
|
321c8fca67 | ||
|
73b98612a5 | ||
|
671e93c50f | ||
|
553c3ec17e | ||
|
94b933c7a4 | ||
|
38bdd6c36c | ||
|
536e054961 | ||
|
6dfe93bc19 | ||
|
d8a15e41e6 | ||
|
ca8a65af60 | ||
|
06cd75ba74 | ||
|
10d2a91d99 | ||
|
f2f3d69aa8 | ||
|
0338010eaa | ||
|
185842a891 | ||
|
ff91fe432c | ||
|
681b0b9046 | ||
|
5f11272d49 | ||
|
c4e46bf89b | ||
|
ee9b651f0f | ||
|
9bfa52f3ce | ||
|
5c471059f3 | ||
|
5714bd0749 | ||
|
749ce2ca9b | ||
|
93c83fbe7a | ||
|
4474a71e65 | ||
|
697ad5b2b5 | ||
|
1558e87923 | ||
|
3b18a29adc | ||
|
c6bc308ce7 | ||
|
36caf5d8ec | ||
|
c49f3fcccf | ||
|
d144392bd6 | ||
|
9b7285ea84 | ||
|
0671f20ab1 | ||
|
4bdc5fa3fc | ||
|
ddff192a1f | ||
|
ff55b36f32 | ||
|
8e4c772dcd | ||
|
fd7683c212 | ||
|
6eaed9829b | ||
|
3c33ea959e | ||
|
80a732b32b | ||
|
a9f2741282 | ||
|
600fa388c1 | ||
|
45d7042405 | ||
|
2945f5fcde | ||
|
be1dff49fa | ||
|
665b78ebf5 | ||
|
416fe0c147 | ||
|
4ca346fc4d | ||
|
6f9482fc1b | ||
|
af6e70c41c | ||
|
7116c65bd7 | ||
|
9e98c52c64 | ||
|
c5e0c492a7 | ||
|
f43c74df66 | ||
|
40dbae17b1 | ||
|
3ca88adade | ||
|
c8be9ceaf5 | ||
|
52df1aad14 | ||
|
6bc73f4f55 | ||
|
4ade02efc8 | ||
|
d2c52b47f1 | ||
|
c25b63d87b | ||
|
c120a908f3 | ||
|
07541fa08f | ||
|
0098a9c3c0 | ||
|
9f95d7a76f | ||
|
67126e46b9 | ||
|
c4c178b39d | ||
|
eef14ced59 | ||
|
d9245f06f7 | ||
|
625ad14d7d | ||
|
23e5cf1b34 | ||
|
ad9efde2d0 | ||
|
10f2cf2481 | ||
|
f0416f5322 | ||
|
11ba24482f | ||
|
e5bc074e68 | ||
|
93ea86f921 | ||
|
cf8957a460 | ||
|
9c2f771bae | ||
|
d9e8f8106a | ||
|
6589f88883 | ||
|
38ebdd8249 | ||
|
6296ead897 | ||
|
ecf5cc62f9 | ||
|
b205cc87fc | ||
|
4c60473f02 | ||
|
7104433a68 | ||
|
f47464944b | ||
|
edb9480c90 | ||
|
615e789134 | ||
|
3e96bb526c | ||
|
1d21a8788c | ||
|
e420ead9e8 | ||
|
06b7f18d55 | ||
|
8659c7efbd | ||
|
80fe52f5d7 | ||
|
77358301e8 | ||
|
93ed1de23f | ||
|
a81ca5114b | ||
|
9a69b941d8 | ||
|
194ecc7ac7 | ||
|
44da3be910 | ||
|
22de6e61ff | ||
|
37f91cabf5 | ||
|
7f9d87a117 | ||
|
52e83c2ec2 | ||
|
70c08d6b50 | ||
|
0b49e9b8a8 | ||
|
6add8765c4 | ||
|
73d97d90ae | ||
|
4d12e6b58b | ||
|
43650583fe | ||
|
3cc0e0f20f | ||
|
27d6e70469 | ||
|
ab4ee2fdb0 | ||
|
23a09825cb | ||
|
ce1e99be9a | ||
|
63440c4cb7 | ||
|
e5b30fa156 | ||
|
8c067019f7 | ||
|
bb3ceaeb0e | ||
|
7cf6066afd | ||
|
b6e8144fe9 | ||
|
7cabc5db57 | ||
|
059df6f8ac | ||
|
6ae43aee5c | ||
|
0ef99077d8 | ||
|
3ea48eb6ee | ||
|
322b6d19d8 | ||
|
8045d3c170 | ||
|
76885d2c50 | ||
|
a1f7a518e3 | ||
|
55205d6107 | ||
|
c7ce5632ea | ||
|
91cec7485a | ||
|
37fbc657a7 | ||
|
908dc15a3b | ||
|
d4bd7c0549 | ||
|
4c0d6a5259 | ||
|
48c8c5b353 | ||
|
d502c8d286 | ||
|
79c4fad922 | ||
|
ae0a675668 | ||
|
b1532ab982 | ||
|
08e65887ca | ||
|
4c0934bae8 | ||
|
1670fe5e4d | ||
|
bba362fb58 | ||
|
4aa361617f | ||
|
be01b177fa | ||
|
4d1b21f70d | ||
|
aa3fba91d4 | ||
|
cc6a7b181a | ||
|
c460ccfad5 | ||
|
69d875d981 | ||
|
75ea1c4f4b | ||
|
cfbda09e36 | ||
|
7746f2ca19 | ||
|
a8fb463520 | ||
|
3ef732b895 | ||
|
1101af87cb | ||
|
c9e0043cc1 | ||
|
edb8bb3ce3 | ||
|
ac0f75c808 | ||
|
b39e16c51c | ||
|
23d3abbf63 | ||
|
34e5433082 | ||
|
9fbc4c2ba1 | ||
|
38ed7c1543 | ||
|
39a928d7f4 | ||
|
121561da3e | ||
|
5893b30da8 | ||
|
858480929c | ||
|
242fb3b498 | ||
|
47469c7082 | ||
|
18f2633810 | ||
|
c50a4ae993 | ||
|
2db32ce44f | ||
|
38b505d036 | ||
|
b03a36b87f | ||
|
fa72912349 | ||
|
7e98fac3b7 | ||
|
f14c8a2ec2 | ||
|
443b76388e | ||
|
7c63f097c8 | ||
|
037cd75658 | ||
|
4e394d6017 | ||
|
76dadd1cab | ||
|
d8506c4361 | ||
|
d49809c939 | ||
|
ea808b441b | ||
|
a464ad015f | ||
|
e8ec13ca5f | ||
|
7f694ede98 | ||
|
203ae2812f | ||
|
20dfeae653 | ||
|
397c0abebe | ||
|
72ef7ac5e4 | ||
|
9f8e33a1ec | ||
|
0b378b51f8 | ||
|
20ab457222 | ||
|
b138812e1a | ||
|
dcfd4d6672 | ||
|
11b109d425 | ||
|
ba1f0d9a24 | ||
|
3cdae5a851 | ||
|
7c162fe87f | ||
|
eb8f595541 | ||
|
6b6107fb00 | ||
|
b4feb27118 | ||
|
2e8ea7493a | ||
|
d26a5a6e9c | ||
|
29dce924cf | ||
|
2bd068211b | ||
|
1406abe7ae | ||
|
c97792d1d1 | ||
|
ef23948b41 | ||
|
4e47641c76 | ||
|
0e8d2c5f0a | ||
|
9493046212 | ||
|
5c3b4d1663 | ||
|
5e8671d24b | ||
|
9118a153d5 | ||
|
b97988a597 | ||
|
56ff25285c | ||
|
2f20bac734 | ||
|
4b23ca1186 | ||
|
cb7e766321 | ||
|
a63f1c30d9 | ||
|
196c504b3d | ||
|
68755137e4 | ||
|
19bef9b725 | ||
|
34e006d87b | ||
|
d215510124 | ||
|
9d75ac221c | ||
|
e610c3d6ab | ||
|
96d70a84ab | ||
|
3f6abdb457 | ||
|
00d19241d9 | ||
|
7c44cae83c | ||
|
9652c86782 | ||
|
cea8c4c217 | ||
|
03637a080c | ||
|
e27cffcf31 | ||
|
f52144d8d9 | ||
|
b12d72bef6 | ||
|
4e6dc3bcef | ||
|
c1cd322f8f | ||
|
0995d78506 | ||
|
34c9823096 | ||
|
040ba2cf8b | ||
|
08896c5813 | ||
|
ebe67b14c1 | ||
|
75ed1fbbfc | ||
|
e39c0c8414 | ||
|
769fb7c218 | ||
|
359a5656e8 | ||
|
8e3b5f9cbc | ||
|
a9747d668a | ||
|
9c815c916f | ||
|
faa995fd01 | ||
|
be224367bb | ||
|
609ff7d2aa | ||
|
10544e5fbd | ||
|
812e767ba4 | ||
|
134f0cfcd1 | ||
|
e46adb6539 | ||
|
97c1233e89 | ||
|
3e0d8e024c | ||
|
1f7fbf57af | ||
|
ade653c393 | ||
|
016395fe8a | ||
|
e0c9d3627e | ||
|
07fe4400ed | ||
|
70ddbd743c | ||
|
5a02006a42 | ||
|
cc7db2b614 | ||
|
1b2106d43b | ||
|
86d15435a5 | ||
|
beed44f065 | ||
|
de3376c966 | ||
|
313676e3be | ||
|
86d4549874 | ||
|
c3bd46d7c0 | ||
|
46e97f95f9 | ||
|
f13dd18b6f | ||
|
c916fbbee9 | ||
|
d007db166a | ||
|
d3314e0130 | ||
|
75b033c563 | ||
|
f451efd90c | ||
|
81f2c59ae4 | ||
|
ef67355e3b | ||
|
4201bc16a1 | ||
|
14d58c9834 | ||
|
8ac9fe7e69 | ||
|
9c08b9f1d3 | ||
|
6b2619c5cc | ||
|
2ace09eb49 | ||
|
47167c06ae | ||
|
2d62fcac06 | ||
|
eeda74d79c | ||
|
4cf23a954f | ||
|
0bc1e6dbaa | ||
|
7da0c94e45 | ||
|
69b1985ac0 | ||
|
61eb8f325e | ||
|
0ab92114a5 | ||
|
66310b494b | ||
|
805d3ec975 | ||
|
f83ab0a7dc | ||
|
ced55b5065 | ||
|
986863f1d2 | ||
|
d1529a0cfc | ||
|
f3ceba5325 | ||
|
711b4c62b5 | ||
|
f441f68da6 | ||
|
2cf8bb2537 | ||
|
bf434e5d42 | ||
|
b1ea36ae5b | ||
|
5f3524c5aa | ||
|
2f75437ac1 | ||
|
6c945bfd60 | ||
|
82f993f0ff | ||
|
08f3f2aeb9 | ||
|
099fc49c4b | ||
|
6f2c46cb36 | ||
|
135424f8b8 | ||
|
9534fa59d6 | ||
|
51ae15a650 | ||
|
29776fa98c | ||
|
7ddffb9251 | ||
|
069770b39e | ||
|
626119d774 | ||
|
993d18d508 | ||
|
7b84c7c2dc | ||
|
76429c923e | ||
|
ca1b048758 | ||
|
fb11971b84 | ||
|
465542b0f5 | ||
|
5185a3ed5a | ||
|
4d1615197d | ||
|
83c6887ed0 | ||
|
9d1e20192d | ||
|
ad17837593 | ||
|
40ec63ddb9 | ||
|
bc3c019d03 | ||
|
35f8ecf9bf | ||
|
4c649a7099 | ||
|
1abf214141 | ||
|
8cb748745b | ||
|
f3df783ed3 | ||
|
50d6234089 | ||
|
baa1da3e8e | ||
|
35a8016744 | ||
|
89af363ba1 | ||
|
9020ed158c | ||
|
2e3071d40f | ||
|
df5aff279e | ||
|
249b2c63d8 | ||
|
6d8f5b88fe | ||
|
2579750ba3 | ||
|
5e7ee8c5bf | ||
|
610bc9f4bc | ||
|
3d1233314a | ||
|
a258b35236 | ||
|
51e23dae21 | ||
|
cba3590dec | ||
|
20852acc78 | ||
|
0babe84a33 | ||
|
8c64c1d5e4 | ||
|
cfcf860438 | ||
|
71d53fbda4 | ||
|
4a3c2d5d97 | ||
|
089514908d | ||
|
9cfced1732 | ||
|
a2627b5158 | ||
|
342e9a263a | ||
|
1d90748e4d | ||
|
40efaa1017 | ||
|
641683d431 | ||
|
b10c1044bd | ||
|
5c069caea1 | ||
|
e78f2213ed |
@@ -60,7 +60,7 @@ APP_LOG_LEVEL=info
|
|||||||
# Use "pgsql" for PostgreSQL
|
# Use "pgsql" for PostgreSQL
|
||||||
# Use "mysql" for MySQL and MariaDB.
|
# Use "mysql" for MySQL and MariaDB.
|
||||||
# Use "sqlite" for SQLite.
|
# Use "sqlite" for SQLite.
|
||||||
DB_CONNECTION=sqlite_test
|
DB_CONNECTION=sqlite
|
||||||
|
|
||||||
# MySQL supports SSL. You can configure it here.
|
# MySQL supports SSL. You can configure it here.
|
||||||
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
|
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
|
||||||
@@ -127,7 +127,6 @@ MAIL_ENCRYPTION=null
|
|||||||
MAILGUN_DOMAIN=
|
MAILGUN_DOMAIN=
|
||||||
MAILGUN_SECRET=
|
MAILGUN_SECRET=
|
||||||
|
|
||||||
|
|
||||||
# If you are on EU region in mailgun, use api.eu.mailgun.net, otherwise use api.mailgun.net
|
# If you are on EU region in mailgun, use api.eu.mailgun.net, otherwise use api.mailgun.net
|
||||||
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
|
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
|
||||||
MAILGUN_ENDPOINT=api.mailgun.net
|
MAILGUN_ENDPOINT=api.mailgun.net
|
||||||
@@ -136,7 +135,6 @@ MAILGUN_ENDPOINT=api.mailgun.net
|
|||||||
MANDRILL_SECRET=
|
MANDRILL_SECRET=
|
||||||
SPARKPOST_SECRET=
|
SPARKPOST_SECRET=
|
||||||
|
|
||||||
|
|
||||||
# Firefly III can send you the following messages
|
# Firefly III can send you the following messages
|
||||||
SEND_REGISTRATION_MAIL=true
|
SEND_REGISTRATION_MAIL=true
|
||||||
SEND_ERROR_MESSAGE=true
|
SEND_ERROR_MESSAGE=true
|
||||||
@@ -223,7 +221,6 @@ ADLDAP_ADMIN_PASSWORD=
|
|||||||
ADLDAP_ACCOUNT_PREFIX=
|
ADLDAP_ACCOUNT_PREFIX=
|
||||||
ADLDAP_ACCOUNT_SUFFIX=
|
ADLDAP_ACCOUNT_SUFFIX=
|
||||||
|
|
||||||
|
|
||||||
# LDAP authentication settings.
|
# LDAP authentication settings.
|
||||||
ADLDAP_PASSWORD_SYNC=false
|
ADLDAP_PASSWORD_SYNC=false
|
||||||
ADLDAP_LOGIN_FALLBACK=false
|
ADLDAP_LOGIN_FALLBACK=false
|
||||||
|
1
.ci/php-cs-fixer/.gitignore
vendored
Normal file
1
.ci/php-cs-fixer/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
vendor
|
44
.ci/php-cs-fixer/.php-cs-fixer.php
Normal file
44
.ci/php-cs-fixer/.php-cs-fixer.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* .php-cs-fixer.php
|
||||||
|
* Copyright (c) 2022 james@firefly-iii.org
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$current = __DIR__;
|
||||||
|
|
||||||
|
$paths = [
|
||||||
|
$current . '/../../app',
|
||||||
|
$current . '/../../config',
|
||||||
|
$current . '/../../database',
|
||||||
|
$current . '/../../routes',
|
||||||
|
$current . '/../../tests',
|
||||||
|
$current . '/../../resources/lang',
|
||||||
|
];
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->in($paths);
|
||||||
|
|
||||||
|
|
||||||
|
$config = new PhpCsFixer\Config();
|
||||||
|
return $config->setRules([
|
||||||
|
'@PSR12' => true,
|
||||||
|
'strict_param' => true,
|
||||||
|
'array_syntax' => ['syntax' => 'short'],
|
||||||
|
])
|
||||||
|
->setFinder($finder)
|
||||||
|
;
|
5
.ci/php-cs-fixer/composer.json
Normal file
5
.ci/php-cs-fixer/composer.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.12"
|
||||||
|
}
|
||||||
|
}
|
2053
.ci/php-cs-fixer/composer.lock
generated
Normal file
2053
.ci/php-cs-fixer/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
37
.ci/phpcs.sh
Executable file
37
.ci/phpcs.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# phpstan.sh
|
||||||
|
# Copyright (c) 2021 james@firefly-iii.org
|
||||||
|
#
|
||||||
|
# This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Install composer packages
|
||||||
|
#composer install --no-scripts --no-ansi
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
|
||||||
|
# enable test .env file.
|
||||||
|
# cp .ci/.env.ci .env
|
||||||
|
|
||||||
|
# clean up php code
|
||||||
|
cd $SCRIPT_DIR/php-cs-fixer
|
||||||
|
composer update
|
||||||
|
PHP_CS_FIXER_IGNORE_ENV=true ./vendor/bin/php-cs-fixer fix --config $SCRIPT_DIR/php-cs-fixer/.php-cs-fixer.php --allow-risky=yes
|
||||||
|
cd $SCRIPT_DIR/..
|
||||||
|
|
||||||
|
exit 0
|
@@ -8,26 +8,63 @@ parameters:
|
|||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#is not allowed to extend#'
|
- '#is not allowed to extend#'
|
||||||
- '#is neither abstract nor final#'
|
- '#is neither abstract nor final#'
|
||||||
- '#Control structures using switch should not be used\.#'
|
|
||||||
- '#has a nullable return type declaration#'
|
- '#has a nullable return type declaration#'
|
||||||
- '#with a nullable type declaration#'
|
- '#with a nullable type declaration#'
|
||||||
- '#with null as default value#'
|
- '#with null as default value#'
|
||||||
- '#Constructor in [a-zA-Z0-9\\_]+ has parameter \$[a-zA-Z0-9\\_]+ with default value#'
|
- '#is not covariant with PHPDoc type array#'
|
||||||
-
|
-
|
||||||
message: '#Function compact\(\) should not be used.#'
|
message: '#but containers should not be injected#'
|
||||||
paths:
|
paths:
|
||||||
- ../app/Http/Controllers
|
- ../app/Support/Authentication/RemoteUserGuard.php
|
||||||
- ../app/Support/Http/Controllers/RenderPartialViews.php
|
-
|
||||||
- ../app/Support/Form/FormSupport.php
|
message: '#Control structures using switch should not be used.#'
|
||||||
- ../app/Support/Form/CurrencyForm.php
|
paths:
|
||||||
- ../app/Support/Form/AccountForm.php
|
- ../app/Api/V1/Controllers/Data/DestroyController.php
|
||||||
|
- ../app/Console/Commands/Correction/FixAccountTypes.php
|
||||||
|
- ../app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php
|
||||||
|
- ../app/Exceptions/GracefulNotFoundHandler.php
|
||||||
|
- ../app/Generator/Webhook/StandardMessageGenerator.php
|
||||||
|
- ../app/Support/Amount.php
|
||||||
|
- ../app/Support/Navigation.php
|
||||||
|
- ../app/Support/ParseDateString.php
|
||||||
|
- ../app/Support/Search/AccountSearch.php
|
||||||
|
- ../app/Support/Search/OperatorQuerySearch.php
|
||||||
|
- ../app/Support/Twig/General.php
|
||||||
|
- ../app/Transformers/RecurrenceTransformer.php
|
||||||
|
- ../app/Validation/AccountValidator.php
|
||||||
|
- ../app/Validation/RecurrenceValidation.php
|
||||||
|
- ../app/Validation/TransactionValidation.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: '#Function compact\(\) should not be used#'
|
||||||
|
paths:
|
||||||
|
- ../app/Generator/Report/Account/MonthReportGenerator.php
|
||||||
|
- ../app/Generator/Report/Audit/MonthReportGenerator.php
|
||||||
|
- ../app/Generator/Report/Budget/MonthReportGenerator.php
|
||||||
|
- ../app/Generator/Report/Category/MonthReportGenerator.php
|
||||||
|
- ../app/Generator/Report/Standard/MonthReportGenerator.php
|
||||||
|
- ../app/Generator/Report/Standard/MultiYearReportGenerator.php
|
||||||
|
- ../app/Generator/Report/Standard/YearReportGenerator.php
|
||||||
|
- ../app/Generator/Report/Tag/MonthReportGenerator.php
|
||||||
|
- ../app/Http/Controllers/Account/*.php
|
||||||
|
- ../app/Http/Controllers/Admin/*.php
|
||||||
|
- ../app/Http/Controllers/*.php
|
||||||
- ../app/Support/ExpandedForm.php
|
- ../app/Support/ExpandedForm.php
|
||||||
- ../app/Generator/Report
|
- ../app/Support/Form/AccountForm.php
|
||||||
|
- ../app/Support/Form/CurrencyForm.php
|
||||||
|
- ../app/Support/Form/FormSupport.php
|
||||||
|
-
|
||||||
|
message: '#Either catch a more specific exception#'
|
||||||
|
paths:
|
||||||
|
- ../app/Support/Form/FormSupport.php
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
- ../app
|
- ../app
|
||||||
- ../database
|
- ../database
|
||||||
- ../routes
|
- ../routes
|
||||||
|
- ../config
|
||||||
- ../bootstrap/app.php
|
- ../bootstrap/app.php
|
||||||
|
|
||||||
# The level 8 is the highest level. original was 5
|
# The level 8 is the highest level. original was 5
|
||||||
level: 3
|
level: 4
|
||||||
|
|
||||||
|
@@ -23,11 +23,11 @@
|
|||||||
# Install composer packages
|
# Install composer packages
|
||||||
#composer install --no-scripts --no-ansi
|
#composer install --no-scripts --no-ansi
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
|
||||||
# enable test .env file.
|
# enable test .env file.
|
||||||
cp .ci/.env.ci .env
|
# cp .ci/.env.ci .env
|
||||||
|
|
||||||
# Do static code analysis.
|
# Do static code analysis.
|
||||||
# ./vendor/bin/phpstan analyse -c .ci/phpstan.neon --no-progress
|
# ./vendor/bin/phpstan analyse -c .ci/phpstan.neon --no-progress
|
||||||
./vendor/bin/phpstan analyse -c .ci/phpstan.neon
|
./vendor/bin/phpstan analyse -c .ci/phpstan.neon --xdebug --error-format=table > phpstan-report.txt
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
@@ -19,15 +19,43 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
# enable test .env file.
|
# enable test .env file.
|
||||||
cp .ci/.env.ci ../.env
|
cp $SCRIPT_DIR/../.env $SCRIPT_DIR/../.env.backup
|
||||||
|
cp $SCRIPT_DIR/.env.ci $SCRIPT_DIR/../.env
|
||||||
|
|
||||||
|
COVERAGE=false
|
||||||
|
RESET=false
|
||||||
|
FILE=storage/database/database.sqlite
|
||||||
|
|
||||||
|
while getopts "cr" o; do
|
||||||
|
case "${o}" in
|
||||||
|
c) COVERAGE=true;;
|
||||||
|
r) RESET=true;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# reset if necessary.
|
||||||
|
if [ $RESET = "true" ] ; then
|
||||||
|
rm -f $FILE
|
||||||
|
fi
|
||||||
|
|
||||||
# download test database
|
# download test database
|
||||||
# TODO no longer exists
|
if [ -f "$FILE" ]; then
|
||||||
wget --quiet https://raw.githubusercontent.com/firefly-iii/test-data/main/test_db.sqlite -o storage/database/test_db.sqlite
|
echo 'DB exists, will use it'
|
||||||
|
else
|
||||||
|
echo 'Download new DB'
|
||||||
|
wget --quiet https://github.com/firefly-iii/test-fixtures/raw/main/test-database.sqlite -O $FILE
|
||||||
|
fi
|
||||||
|
|
||||||
# run phpunit
|
# run phpunit
|
||||||
./vendor/bin/phpunit --configuration phpunit.coverage.xml
|
if [ $COVERAGE = "true" ] ; then
|
||||||
|
echo 'Run with coverage'
|
||||||
|
XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration phpunit.xml --coverage-html $SCRIPT_DIR/coverage
|
||||||
|
else
|
||||||
|
echo 'Run without coverage'
|
||||||
|
./vendor/bin/phpunit --configuration phpunit.xml
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
# restore .env file
|
||||||
|
mv $SCRIPT_DIR/../.env.backup $SCRIPT_DIR/../.env
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
bg_BG
|
bg_BG
|
||||||
|
ca_ES
|
||||||
cs_CZ
|
cs_CZ
|
||||||
|
da_DK
|
||||||
de_DE
|
de_DE
|
||||||
el_GR
|
el_GR
|
||||||
en_GB
|
en_GB
|
||||||
@@ -8,7 +10,9 @@ es_ES
|
|||||||
fi_FI
|
fi_FI
|
||||||
fr_FR
|
fr_FR
|
||||||
hu_HU
|
hu_HU
|
||||||
|
id_ID
|
||||||
it_IT
|
it_IT
|
||||||
|
ja_JP
|
||||||
nb_NO
|
nb_NO
|
||||||
nl_NL
|
nl_NL
|
||||||
pl_PL
|
pl_PL
|
||||||
@@ -17,7 +21,10 @@ pt_PT
|
|||||||
ro_RO
|
ro_RO
|
||||||
ru_RU
|
ru_RU
|
||||||
sk_SK
|
sk_SK
|
||||||
|
sl_SI
|
||||||
sv_SE
|
sv_SE
|
||||||
|
tr_TR
|
||||||
|
uk_UA
|
||||||
vi_VN
|
vi_VN
|
||||||
zh-hans_CN
|
zh-hans_CN
|
||||||
zh-hant_CN
|
zh-hant_CN
|
||||||
|
28
.env.example
28
.env.example
@@ -7,11 +7,15 @@ APP_DEBUG=false
|
|||||||
|
|
||||||
# This should be your email address.
|
# This should be your email address.
|
||||||
# If you use Docker or similar, you can set this variable from a file by using SITE_OWNER_FILE
|
# If you use Docker or similar, you can set this variable from a file by using SITE_OWNER_FILE
|
||||||
|
# The variable is used in some errors shown to users who aren't admin.
|
||||||
SITE_OWNER=mail@example.com
|
SITE_OWNER=mail@example.com
|
||||||
|
|
||||||
# The encryption key for your sessions. Keep this very secure.
|
# The encryption key for your sessions. Keep this very secure.
|
||||||
# Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it.
|
# Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it.
|
||||||
# If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE
|
# If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE
|
||||||
|
#
|
||||||
|
# Avoid the "#" character in your APP_KEY, it may break things.
|
||||||
|
#
|
||||||
APP_KEY=SomeRandomStringOf32CharsExactly
|
APP_KEY=SomeRandomStringOf32CharsExactly
|
||||||
|
|
||||||
# Firefly III will launch using this language (for new users and unauthenticated visitors)
|
# Firefly III will launch using this language (for new users and unauthenticated visitors)
|
||||||
@@ -111,7 +115,10 @@ REDIS_PATH=
|
|||||||
# use only when using 'tcp' or 'http' for REDIS_SCHEME. Leave empty otherwise.
|
# use only when using 'tcp' or 'http' for REDIS_SCHEME. Leave empty otherwise.
|
||||||
REDIS_HOST=127.0.0.1
|
REDIS_HOST=127.0.0.1
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
REDIS_PASSWORD=null
|
|
||||||
|
# Use only with Redis 6+ with proper ACL set. Leave empty otherwise.
|
||||||
|
REDIS_USERNAME=
|
||||||
|
REDIS_PASSWORD=
|
||||||
|
|
||||||
# always use quotes and make sure redis db "0" and "1" exists. Otherwise change accordingly.
|
# always use quotes and make sure redis db "0" and "1" exists. Otherwise change accordingly.
|
||||||
REDIS_DB="0"
|
REDIS_DB="0"
|
||||||
@@ -151,9 +158,7 @@ MANDRILL_SECRET=
|
|||||||
SPARKPOST_SECRET=
|
SPARKPOST_SECRET=
|
||||||
|
|
||||||
# Firefly III can send you the following messages.
|
# Firefly III can send you the following messages.
|
||||||
SEND_REGISTRATION_MAIL=true
|
|
||||||
SEND_ERROR_MESSAGE=true
|
SEND_ERROR_MESSAGE=true
|
||||||
SEND_LOGIN_NEW_IP_WARNING=true
|
|
||||||
|
|
||||||
# These messages contain (sensitive) transaction information:
|
# These messages contain (sensitive) transaction information:
|
||||||
SEND_REPORT_JOURNALS=true
|
SEND_REPORT_JOURNALS=true
|
||||||
@@ -163,6 +168,12 @@ SEND_REPORT_JOURNALS=true
|
|||||||
# and disabled by default.
|
# and disabled by default.
|
||||||
ENABLE_EXTERNAL_MAP=false
|
ENABLE_EXTERNAL_MAP=false
|
||||||
|
|
||||||
|
# Set this value to true if you want Firefly III to download currency exchange rates
|
||||||
|
# from the internet. These rates are hosted by the creator of Firefly III inside
|
||||||
|
# an Azure Storage Container.
|
||||||
|
# Not all currencies may be available. Rates may be wrong.
|
||||||
|
ENABLE_EXTERNAL_RATES=false
|
||||||
|
|
||||||
# The map will default to this location:
|
# The map will default to this location:
|
||||||
MAP_DEFAULT_LAT=51.983333
|
MAP_DEFAULT_LAT=51.983333
|
||||||
MAP_DEFAULT_LONG=5.916667
|
MAP_DEFAULT_LONG=5.916667
|
||||||
@@ -189,6 +200,15 @@ AUTHENTICATION_GUARD=web
|
|||||||
AUTHENTICATION_GUARD_HEADER=REMOTE_USER
|
AUTHENTICATION_GUARD_HEADER=REMOTE_USER
|
||||||
AUTHENTICATION_GUARD_EMAIL=
|
AUTHENTICATION_GUARD_EMAIL=
|
||||||
|
|
||||||
|
#
|
||||||
|
# Firefly III generates a basic keypair for your OAuth tokens.
|
||||||
|
# If you want, you can overrule the key with your own (secure) value.
|
||||||
|
# It's also possible to set PASSPORT_PUBLIC_KEY_FILE or PASSPORT_PRIVATE_KEY_FILE
|
||||||
|
# if you're using Docker secrets or similar solutions for secret management
|
||||||
|
#
|
||||||
|
PASSPORT_PRIVATE_KEY=
|
||||||
|
PASSPORT_PUBLIC_KEY=
|
||||||
|
|
||||||
#
|
#
|
||||||
# Extra authentication settings
|
# Extra authentication settings
|
||||||
#
|
#
|
||||||
@@ -230,7 +250,7 @@ ALLOW_WEBHOOKS=false
|
|||||||
STATIC_CRON_TOKEN=
|
STATIC_CRON_TOKEN=
|
||||||
|
|
||||||
# You can fine tune the start-up of a Docker container by editing these environment variables.
|
# You can fine tune the start-up of a Docker container by editing these environment variables.
|
||||||
# Use this at your own risk. Disabling certain checks and features may result in lost of inconsistent data.
|
# Use this at your own risk. Disabling certain checks and features may result in lots of inconsistent data.
|
||||||
# However if you know what you're doing you can significantly speed up container start times.
|
# However if you know what you're doing you can significantly speed up container start times.
|
||||||
# Set each value to true to enable, or false to disable.
|
# Set each value to true to enable, or false to disable.
|
||||||
|
|
||||||
|
57
.github/mergify.yml
vendored
57
.github/mergify.yml
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
pull_request_rules:
|
pull_request_rules:
|
||||||
- name: Close all on main
|
- name: Close all on main
|
||||||
conditions:
|
conditions:
|
||||||
@@ -5,4 +6,58 @@ pull_request_rules:
|
|||||||
- -author~=^dependabot(|-preview)\[bot\]$
|
- -author~=^dependabot(|-preview)\[bot\]$
|
||||||
actions:
|
actions:
|
||||||
close:
|
close:
|
||||||
message: Please do not open PR's on the `main` branch, but on the `develop` branch only. Thank you!
|
message: Please do not open PR's on the `main` branch, but on the `develop`
|
||||||
|
branch only. Thank you!
|
||||||
|
- name: No translations
|
||||||
|
conditions:
|
||||||
|
- -author~=^dependabot(|-preview)\[bot\]$
|
||||||
|
- base=develop
|
||||||
|
- or:
|
||||||
|
- files~=^resources/lang/bg_BG
|
||||||
|
- files~=^resources/lang/ca_ES
|
||||||
|
- files~=^resources/lang/cs_CZ
|
||||||
|
- files~=^resources/lang/da_DK
|
||||||
|
- files~=^resources/lang/de_DE
|
||||||
|
- files~=^resources/lang/el_GR
|
||||||
|
- files~=^resources/lang/en_GB
|
||||||
|
- files~=^resources/lang/es_ES
|
||||||
|
- files~=^resources/lang/et_EE
|
||||||
|
- files~=^resources/lang/fa_IR
|
||||||
|
- files~=^resources/lang/fi_FI
|
||||||
|
- files~=^resources/lang/fr_FR
|
||||||
|
- files~=^resources/lang/he_IL
|
||||||
|
- files~=^resources/lang/hu_HU
|
||||||
|
- files~=^resources/lang/id_ID
|
||||||
|
- files~=^resources/lang/is_IS
|
||||||
|
- files~=^resources/lang/it_IT
|
||||||
|
- files~=^resources/lang/ja_JP
|
||||||
|
- files~=^resources/lang/ko_KR
|
||||||
|
- files~=^resources/lang/lt_LT
|
||||||
|
- files~=^resources/lang/nb_NO
|
||||||
|
- files~=^resources/lang/nl_NL
|
||||||
|
- files~=^resources/lang/pl_PL
|
||||||
|
- files~=^resources/lang/pt_BR
|
||||||
|
- files~=^resources/lang/pt_PT
|
||||||
|
- files~=^resources/lang/ro_RO
|
||||||
|
- files~=^resources/lang/ru_RU
|
||||||
|
- files~=^resources/lang/si_LK
|
||||||
|
- files~=^resources/lang/sk_SK
|
||||||
|
- files~=^resources/lang/sl_SI
|
||||||
|
- files~=^resources/lang/sr_CS
|
||||||
|
- files~=^resources/lang/sv_SE
|
||||||
|
- files~=^resources/lang/th_TH
|
||||||
|
- files~=^resources/lang/tlh_AA
|
||||||
|
- files~=^resources/lang/tr_TR
|
||||||
|
- files~=^resources/lang/uk_UA
|
||||||
|
- files~=^resources/lang/vi_VN
|
||||||
|
- files~=^resources/lang/zh_CN
|
||||||
|
- files~=^resources/lang/zh_TW
|
||||||
|
actions:
|
||||||
|
comment:
|
||||||
|
message: >
|
||||||
|
Please do not submit translated strings in your PR. If you need new
|
||||||
|
sentences to be translated, add them to the `en_US` language strings.
|
||||||
|
New or changed translations for other languages can be submitted at
|
||||||
|
https://crowdin.com/project/firefly-iii
|
||||||
|
|
||||||
|
Thank you!
|
||||||
|
94
.github/security.md
vendored
94
.github/security.md
vendored
@@ -1,53 +1,101 @@
|
|||||||
# Security Policy
|
# Security Policy
|
||||||
|
|
||||||
Firefly III is an application to manage your personal finances. As such, the developer has adopted this security disclosure and response policy to ensure that critical issues are responsibly handled.
|
Firefly III is an application to manage your personal finances. As such, the developer has adopted this security
|
||||||
|
disclosure and response policy to ensure that critical issues are responsibly handled.
|
||||||
|
|
||||||
## Supported Versions
|
## Supported Versions
|
||||||
Only the latest Firefly III release is maintained. Applicable fixes, including security fixes, will not backported to older release branches. Please refer to [releases.md](https://github.com/firefly-iii/firefly-iii/blob/main/releases.md) for details.
|
|
||||||
|
Only the latest Firefly III release is maintained. Applicable fixes, including security fixes, will not backported to
|
||||||
|
older release branches. Please refer to [releases.md](https://github.com/firefly-iii/firefly-iii/blob/main/releases.md)
|
||||||
|
for details.
|
||||||
|
|
||||||
## Reporting a Vulnerability - Private Disclosure Process
|
## Reporting a Vulnerability - Private Disclosure Process
|
||||||
Security is of the highest importance and all security vulnerabilities or suspected security vulnerabilities should be reported to Firefly III privately, to minimize attacks against current users of Firefly III before they are fixed. Vulnerabilities will be investigated and patched on the next patch (or minor) release as soon as possible. This information could be kept entirely internal to the project.
|
|
||||||
|
|
||||||
If you know of a publicly disclosed security vulnerability for Firefly III, please **IMMEDIATELY** contact james@firefly-iii.org to inform the Firefly III developer. You can use my [GPG key](https://keybase.io/jc5) for extra security.
|
Security is of the highest importance and all security vulnerabilities or suspected security vulnerabilities should be
|
||||||
|
reported to Firefly III privately, to minimize attacks against current users of Firefly III before they are fixed.
|
||||||
|
Vulnerabilities will be investigated and patched on the next patch (or minor) release as soon as possible. This
|
||||||
|
information could be kept entirely internal to the project.
|
||||||
|
|
||||||
|
If you know of a publicly disclosed security vulnerability for Firefly III, please **IMMEDIATELY** contact
|
||||||
|
james@firefly-iii.org to inform the Firefly III developer. You can use my [GPG key](https://keybase.io/jc5) for extra
|
||||||
|
security.
|
||||||
|
|
||||||
**IMPORTANT: Do not file public issues on GitHub for security vulnerabilities**
|
**IMPORTANT: Do not file public issues on GitHub for security vulnerabilities**
|
||||||
|
|
||||||
To report a vulnerability or a security-related issue, please email the private address james@firefly-iii.org with the details of the vulnerability. The email will be received by the developer of Firefly III. Emails will be addressed within 3 business days, including a detailed plan to investigate the issue and any potential workarounds to perform in the meantime. Do not report non-security-impacting bugs through this channel. Use [GitHub issues](https://github.com/firefly-iii/firefly-iii/issues/new/choose) instead.
|
To report a vulnerability or a security-related issue, please email the private address james@firefly-iii.org with the
|
||||||
|
details of the vulnerability. The email will be received by the developer of Firefly III. Emails will be addressed
|
||||||
|
within 3 business days, including a detailed plan to investigate the issue and any potential workarounds to perform in
|
||||||
|
the meantime. Do not report non-security-impacting bugs through this channel.
|
||||||
|
Use [GitHub issues](https://github.com/firefly-iii/firefly-iii/issues/new/choose) instead.
|
||||||
|
|
||||||
### Proposed Email Content
|
### Proposed Email Content
|
||||||
|
|
||||||
Provide a descriptive subject line and in the body of the email include the following information:
|
Provide a descriptive subject line and in the body of the email include the following information:
|
||||||
|
|
||||||
* Basic identity information, such as your name and your affiliation or company.
|
* Basic identity information, such as your name and your affiliation or company.
|
||||||
* Detailed steps to reproduce the vulnerability (POC scripts, screenshots, and compressed packet captures are all helpful to us).
|
* Detailed steps to reproduce the vulnerability (POC scripts, screenshots, and compressed packet captures are all
|
||||||
* Description of the effects of the vulnerability on Firefly III and the related hardware and software configurations, so that the developer can reproduce it.
|
helpful to us).
|
||||||
|
* Description of the effects of the vulnerability on Firefly III and the related hardware and software configurations,
|
||||||
|
so that the developer can reproduce it.
|
||||||
* How the vulnerability affects Firefly III usage and an estimation of the attack surface, if there is one.
|
* How the vulnerability affects Firefly III usage and an estimation of the attack surface, if there is one.
|
||||||
* List other projects or dependencies that were used in conjunction with Firefly III to produce the vulnerability.
|
* List other projects or dependencies that were used in conjunction with Firefly III to produce the vulnerability.
|
||||||
|
|
||||||
## When to report a vulnerability
|
## When to report a vulnerability
|
||||||
|
|
||||||
* When you think Firefly III has a potential security vulnerability.
|
* When you think Firefly III has a potential security vulnerability.
|
||||||
* When you suspect a potential vulnerability but you are unsure that it impacts Firefly III.
|
* When you suspect a potential vulnerability but you are unsure that it impacts Firefly III.
|
||||||
* When you know of or suspect a potential vulnerability on another project that is used by Firefly III. For example Firefly III has a dependency on Docker, MySQL, etc.
|
* When you know of or suspect a potential vulnerability on another project that is used by Firefly III. For example
|
||||||
|
Firefly III has a dependency on Docker, MySQL, etc.
|
||||||
|
|
||||||
## Patch, Release, and Disclosure
|
## Patch, Release, and Disclosure
|
||||||
|
|
||||||
The Firefly III developer will respond to vulnerability reports as follows:
|
The Firefly III developer will respond to vulnerability reports as follows:
|
||||||
|
|
||||||
1. The developer will investigate the vulnerability and determine its effects and criticality.
|
1. The developer will investigate the vulnerability and determine its effects and criticality.
|
||||||
2. If the issue is not deemed to be a vulnerability, the developer will follow up with a detailed reason for rejection.
|
2. If the issue is not deemed to be a vulnerability, the developer will follow up with a detailed reason for rejection.
|
||||||
3. The developer will initiate a conversation with the reporter within 3 business days.
|
3. The developer will initiate a conversation with the reporter within 3 business days.
|
||||||
4. If a vulnerability is acknowledged and the timeline for a fix is determined, the developer will work on a plan to communicate with the appropriate community, including identifying mitigating steps that affected users can take to protect themselves until the fix is rolled out.
|
4. If a vulnerability is acknowledged and the timeline for a fix is determined, the developer will work on a plan to
|
||||||
5. The developer will also create a [CVSS](https://www.first.org/cvss/specification-document) using the [CVSS Calculator](https://www.first.org/cvss/calculator/3.0). The developer makes the final call on the calculated CVSS; it is better to move quickly than making the CVSS perfect. Issues may also be reported to [Mitre](https://cve.mitre.org/) using this [scoring calculator](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator). The CVE will initially be set to private.
|
communicate with the appropriate community, including identifying mitigating steps that affected users can take to
|
||||||
6. The developer will work on fixing the vulnerability and perform internal testing before preparing to roll out the fix.
|
protect themselves until the fix is rolled out.
|
||||||
7. A public disclosure date is negotiated by the Firefly III developer and the bug submitter. We prefer to fully disclose the bug as soon as possible once a user mitigation or patch is available. It is reasonable to delay disclosure when the bug or the fix is not yet fully understood, the solution is not well-tested, or for distributor coordination. The timeframe for disclosure is from immediate (especially if it’s already publicly known) to a few weeks. For a critical vulnerability with a straightforward mitigation, we expect report date to public disclosure date to be on the order of 14 business days. The Firefly III developer holds the final say when setting a public disclosure date.
|
5. The developer will also create a [CVSS](https://www.first.org/cvss/specification-document) using
|
||||||
9. Once the fix is confirmed, the developer will patch the vulnerability in the next patch or minor release. Upon release of the patched version of Firefly III, we will follow the **Public Disclosure Process**.
|
the [CVSS Calculator](https://www.first.org/cvss/calculator/3.0). The developer makes the final call on the
|
||||||
|
calculated CVSS; it is better to move quickly than making the CVSS perfect. Issues may also be reported
|
||||||
|
to [Mitre](https://cve.mitre.org/) using
|
||||||
|
this [scoring calculator](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator). The CVE will initially be set to
|
||||||
|
private.
|
||||||
|
6. The developer will work on fixing the vulnerability and perform internal testing before preparing to roll out the
|
||||||
|
fix.
|
||||||
|
7. A public disclosure date is negotiated by the Firefly III developer and the bug submitter. We prefer to fully
|
||||||
|
disclose the bug as soon as possible once a user mitigation or patch is available. It is reasonable to delay
|
||||||
|
disclosure when the bug or the fix is not yet fully understood, the solution is not well-tested, or for distributor
|
||||||
|
coordination. The timeframe for disclosure is from immediate (especially if it’s already publicly known) to a few
|
||||||
|
weeks. For a critical vulnerability with a straightforward mitigation, we expect report date to public disclosure
|
||||||
|
date to be on the order of 14 business days. The Firefly III developer holds the final say when setting a public
|
||||||
|
disclosure date.
|
||||||
|
8. Once the fix is confirmed, the developer will patch the vulnerability in the next patch or minor release. Upon
|
||||||
|
release of the patched version of Firefly III, we will follow the **Public Disclosure Process**.
|
||||||
|
|
||||||
### Public Disclosure Process
|
### Public Disclosure Process
|
||||||
The developer publishes a public [advisory](https://github.com/firefly-iii/firefly-iii/security/advisories) to the Firefly III community via GitHub. In most cases, additional communication via Twitter, reddit and other channels will assist in educating Firefly III users and rolling out the patched release to affected users.
|
|
||||||
|
|
||||||
The develop will also publish any mitigating steps users can take until the fix can be applied to their Firefly III instances.
|
The developer publishes a public [advisory](https://github.com/firefly-iii/firefly-iii/security/advisories) to the
|
||||||
|
Firefly III community via GitHub. In most cases, additional communication via Mastodon, Gitter and other channels will
|
||||||
|
assist in educating Firefly III users and rolling out the patched release to affected users.
|
||||||
|
|
||||||
|
The developer will also publish any mitigating steps users can take until the fix can be applied to their Firefly III
|
||||||
|
instances.
|
||||||
|
|
||||||
## Confidentiality, integrity and availability
|
## Confidentiality, integrity and availability
|
||||||
We consider vulnerabilities leading to the compromise of data confidentiality, elevation of privilege, or integrity to be our highest priority concerns. Availability, in particular in areas relating to DoS and resource exhaustion, is also a serious security concern. The Firefly III developer takes all vulnerabilities, potential vulnerabilities, and suspected vulnerabilities seriously and will investigate them in an urgent and expeditious manner.
|
|
||||||
|
|
||||||
Note that we do not currently consider the default settings for Firefly III to be secure-by-default. It is necessary for operators to explicitly configure settings, role based access control, and other resource related features in Firefly III to provide a hardened Firefly III environment. We will not act on any security disclosure that relates to a lack of safe defaults. Over time, we will work towards improved safe-by-default configuration, taking into account backwards compatibility.
|
We consider vulnerabilities leading to the compromise of data confidentiality, elevation of privilege, or integrity to
|
||||||
|
be our highest priority concerns. Availability, in particular in areas relating to DoS and resource exhaustion, is also
|
||||||
|
a serious security concern. The Firefly III developer takes all vulnerabilities, potential vulnerabilities, and
|
||||||
|
suspected vulnerabilities seriously and will investigate them in an urgent and expeditious manner.
|
||||||
|
|
||||||
|
Note that we do not currently consider the default settings for Firefly III to be secure-by-default. It is necessary for
|
||||||
|
operators to explicitly configure settings, role based access control, and other resource related features in Firefly
|
||||||
|
III to provide a hardened Firefly III environment. We will not act on any security disclosure that relates to a lack of
|
||||||
|
safe defaults. Over time, we will work towards improved safe-by-default configuration, taking into account backwards
|
||||||
|
compatibility.
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
|
1
.github/stale.yml
vendored
1
.github/stale.yml
vendored
@@ -14,6 +14,7 @@ exemptLabels:
|
|||||||
- feature
|
- feature
|
||||||
- bug
|
- bug
|
||||||
- announcement
|
- announcement
|
||||||
|
- "layout-v3"
|
||||||
|
|
||||||
# Set to true to ignore issues in a project (defaults to false)
|
# Set to true to ignore issues in a project (defaults to false)
|
||||||
exemptProjects: false
|
exemptProjects: false
|
||||||
|
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@@ -1,11 +1,6 @@
|
|||||||
name: Sonarcloud CI
|
name: Sonarcloud CI
|
||||||
on:
|
on:
|
||||||
push:
|
workflow_dispatch:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- develop
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
jobs:
|
jobs:
|
||||||
sonarcloud:
|
sonarcloud:
|
||||||
name: SonarCloud
|
name: SonarCloud
|
||||||
@@ -18,4 +13,4 @@ jobs:
|
|||||||
uses: SonarSource/sonarcloud-github-action@master
|
uses: SonarSource/sonarcloud-github-action@master
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
99
.github/workflows/cleanup.yml
vendored
Normal file
99
.github/workflows/cleanup.yml
vendored
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
# This workflow prunes old workflow runs for an entire repository.
|
||||||
|
|
||||||
|
name: Prune old builds
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
prune:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
|
steps:
|
||||||
|
- name: Prune cancelled/skipped runs
|
||||||
|
uses: actions/github-script@v4
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const cancelled = await github.actions.listWorkflowRunsForRepo({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
per_page: 100,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
status: 'cancelled',
|
||||||
|
});
|
||||||
|
|
||||||
|
const skipped = await github.actions.listWorkflowRunsForRepo({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
per_page: 100,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
status: 'skipped',
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const response of [cancelled, skipped]) {
|
||||||
|
for (const run of response.data.workflow_runs) {
|
||||||
|
console.log(`Run id ${run.id} of '${run.name}' is a cancelled/skipped run. Deleting...`);
|
||||||
|
await github.actions.deleteWorkflowRun({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
run_id: run.id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: Prune runs older than 3 days
|
||||||
|
uses: actions/github-script@v4
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const days_to_expiration = 3;
|
||||||
|
const ms_in_day = 86400000;
|
||||||
|
const now = Date.now();
|
||||||
|
const pages = 5;
|
||||||
|
|
||||||
|
// we don't want to prune old runs from test.yml
|
||||||
|
// because we track the duration of runs over time
|
||||||
|
|
||||||
|
const workflows = [
|
||||||
|
'build.yml',
|
||||||
|
'cleanup.yml',
|
||||||
|
'depsreview.yaml',
|
||||||
|
'laravel.yml',
|
||||||
|
'lock.yml',
|
||||||
|
'stale.yml'
|
||||||
|
]
|
||||||
|
|
||||||
|
let runs_to_delete = [];
|
||||||
|
|
||||||
|
for (const workflow of workflows) {
|
||||||
|
for (let page = 0; page < pages; page += 1) {
|
||||||
|
let response = await github.actions.listWorkflowRuns({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
page: page,
|
||||||
|
per_page: 100,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
workflow_id: workflow
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.data.workflow_runs.length > 0) {
|
||||||
|
for (const run of response.data.workflow_runs) {
|
||||||
|
if (now - Date.parse(run.created_at) > ms_in_day * days_to_expiration) {
|
||||||
|
runs_to_delete.push([run.id, run.name]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const run of runs_to_delete) {
|
||||||
|
console.log(`Run id ${run[0]} of '${run[1]}' is older than ${days_to_expiration} days. Deleting...`);
|
||||||
|
try {
|
||||||
|
await github.actions.deleteWorkflowRun({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
run_id: run[0]
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
// ignore errors
|
||||||
|
}
|
||||||
|
}
|
22
.github/workflows/closed-issues.yml
vendored
Normal file
22
.github/workflows/closed-issues.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
name: "Reply to closed issue"
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types:
|
||||||
|
- closed
|
||||||
|
jobs:
|
||||||
|
auto_comment:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
uses: aws-actions/closed-issue-message@v1
|
||||||
|
with:
|
||||||
|
message: |
|
||||||
|
Hi there! This is an automatic reply. `Share and enjoy`
|
||||||
|
|
||||||
|
This issue is now closed. Please be aware that closed issues are not actively monitored. If you reply, you may get no response.
|
||||||
|
|
||||||
|
- If the original bug is not actually fixed, please feel free to open a new ticket. Please refer to this issue for clarity.
|
||||||
|
- Follow-up questions can also be posted in a new [discussion](https://github.com/firefly-iii/firefly-iii/discussions/)
|
||||||
|
|
||||||
|
Thank you for your consideration.
|
||||||
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
14
.github/workflows/depsreview.yaml
vendored
Normal file
14
.github/workflows/depsreview.yaml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: 'Dependency Review'
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dependency-review:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 'Checkout Repository'
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: 'Dependency Review'
|
||||||
|
uses: actions/dependency-review-action@v1
|
29
.github/workflows/qodana.yml
vendored
Normal file
29
.github/workflows/qodana.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: Qodana
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
types: [ opened, synchronize, reopened ]
|
||||||
|
jobs:
|
||||||
|
qodana:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: 'Qodana Scan'
|
||||||
|
steps:
|
||||||
|
- name: Setup PHP with no coverage driver
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.2'
|
||||||
|
coverage: none
|
||||||
|
extensions: bcmath, intl
|
||||||
|
env:
|
||||||
|
update: true
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||||
|
- name: 'Qodana Scan'
|
||||||
|
uses: JetBrains/qodana-action@main
|
||||||
|
env:
|
||||||
|
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
5
.github/workflows/stale.yml
vendored
5
.github/workflows/stale.yml
vendored
@@ -2,6 +2,7 @@ name: "Close stale issues"
|
|||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "30 1 * * *"
|
- cron: "30 1 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -13,7 +14,7 @@ jobs:
|
|||||||
pull-requests: write # for actions/stale to close stale PRs
|
pull-requests: write # for actions/stale to close stale PRs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v3
|
- uses: actions/stale@v6
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
stale-issue-message: >
|
stale-issue-message: >
|
||||||
@@ -26,4 +27,4 @@ jobs:
|
|||||||
for your contributions.
|
for your contributions.
|
||||||
days-before-stale: 14
|
days-before-stale: 14
|
||||||
days-before-close: 7
|
days-before-close: 7
|
||||||
exempt-issue-labels: 'enhancement,feature,bug,announcement'
|
exempt-issue-labels: 'enhancement,feature,bug,announcement,layout-v3'
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,3 +6,5 @@
|
|||||||
npm-debug.log
|
npm-debug.log
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
.env
|
.env
|
||||||
|
/.ci/php-cs-fixer/vendor
|
||||||
|
/.ci/coverage
|
||||||
|
@@ -67,7 +67,7 @@ class AccountController extends Controller
|
|||||||
* Documentation for this endpoint:
|
* Documentation for this endpoint:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getAccountsAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getAccountsAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws JsonException
|
* @throws JsonException
|
||||||
@@ -82,7 +82,7 @@ class AccountController extends Controller
|
|||||||
$date = $data['date'] ?? today(config('app.timezone'));
|
$date = $data['date'] ?? today(config('app.timezone'));
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
$result = $this->repository->searchAccount((string) $query, $types, $data['limit']);
|
$result = $this->repository->searchAccount((string)$query, $types, $data['limit']);
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
@@ -96,7 +96,7 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$return[] = [
|
$return[] = [
|
||||||
'id' => (string) $account->id,
|
'id' => (string)$account->id,
|
||||||
'name' => $account->name,
|
'name' => $account->name,
|
||||||
'name_with_balance' => $nameWithBalance,
|
'name_with_balance' => $nameWithBalance,
|
||||||
'type' => $account->accountType->type,
|
'type' => $account->accountType->type,
|
||||||
@@ -111,12 +111,13 @@ class AccountController extends Controller
|
|||||||
// custom order.
|
// custom order.
|
||||||
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
|
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
|
||||||
usort(
|
usort(
|
||||||
$return, function ($a, $b) use ($order) {
|
$return,
|
||||||
$pos_a = array_search($a['type'], $order);
|
function ($a, $b) use ($order) {
|
||||||
$pos_b = array_search($b['type'], $order);
|
$pos_a = array_search($a['type'], $order, true);
|
||||||
|
$pos_b = array_search($b['type'], $order, true);
|
||||||
|
|
||||||
return $pos_a - $pos_b;
|
return $pos_a - $pos_b;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return response()->json($return);
|
return response()->json($return);
|
||||||
|
@@ -58,8 +58,9 @@ class BillController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Documentation for this endpoint is at:
|
* Documentation for this endpoint is at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getBillsAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getBillsAC
|
||||||
|
* TODO expand API to add active field.
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -70,13 +71,13 @@ class BillController extends Controller
|
|||||||
$filtered = $result->map(
|
$filtered = $result->map(
|
||||||
static function (Bill $item) {
|
static function (Bill $item) {
|
||||||
return [
|
return [
|
||||||
'id' => (string) $item->id,
|
'id' => (string)$item->id,
|
||||||
'name' => $item->name,
|
'name' => $item->name,
|
||||||
|
'active' => $item->active
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return response()->json($filtered->toArray());
|
return response()->json($filtered->toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ class BudgetController extends Controller
|
|||||||
* Documentation for this endpoint is at:
|
* Documentation for this endpoint is at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getBudgetsAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getBudgetsAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -70,7 +70,7 @@ class BudgetController extends Controller
|
|||||||
$filtered = $result->map(
|
$filtered = $result->map(
|
||||||
static function (Budget $item) {
|
static function (Budget $item) {
|
||||||
return [
|
return [
|
||||||
'id' => (string) $item->id,
|
'id' => (string)$item->id,
|
||||||
'name' => $item->name,
|
'name' => $item->name,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ class CategoryController extends Controller
|
|||||||
* Documentation for this endpoint is at:
|
* Documentation for this endpoint is at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getCategoriesAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getCategoriesAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -70,7 +70,7 @@ class CategoryController extends Controller
|
|||||||
$filtered = $result->map(
|
$filtered = $result->map(
|
||||||
static function (Category $item) {
|
static function (Category $item) {
|
||||||
return [
|
return [
|
||||||
'id' => (string) $item->id,
|
'id' => (string)$item->id,
|
||||||
'name' => $item->name,
|
'name' => $item->name,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ class CurrencyController extends Controller
|
|||||||
* Documentation for this endpoint is at:
|
* Documentation for this endpoint is at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getCurrenciesAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getCurrenciesAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -72,7 +72,7 @@ class CurrencyController extends Controller
|
|||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
foreach ($collection as $currency) {
|
foreach ($collection as $currency) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $currency->id,
|
'id' => (string)$currency->id,
|
||||||
'name' => $currency->name,
|
'name' => $currency->name,
|
||||||
'code' => $currency->code,
|
'code' => $currency->code,
|
||||||
'symbol' => $currency->symbol,
|
'symbol' => $currency->symbol,
|
||||||
@@ -87,7 +87,7 @@ class CurrencyController extends Controller
|
|||||||
* Documentation for this endpoint is at:
|
* Documentation for this endpoint is at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getCurrenciesCodeAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getCurrenciesCodeAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@@ -101,7 +101,7 @@ class CurrencyController extends Controller
|
|||||||
/** @var TransactionCurrency $currency */
|
/** @var TransactionCurrency $currency */
|
||||||
foreach ($collection as $currency) {
|
foreach ($collection as $currency) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $currency->id,
|
'id' => (string)$currency->id,
|
||||||
'name' => sprintf('%s (%s)', $currency->name, $currency->code),
|
'name' => sprintf('%s (%s)', $currency->name, $currency->code),
|
||||||
'code' => $currency->code,
|
'code' => $currency->code,
|
||||||
'symbol' => $currency->symbol,
|
'symbol' => $currency->symbol,
|
||||||
|
@@ -59,7 +59,7 @@ class ObjectGroupController extends Controller
|
|||||||
* Documentation for this endpoint is at:
|
* Documentation for this endpoint is at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getObjectGroupsAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getObjectGroupsAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -72,7 +72,7 @@ class ObjectGroupController extends Controller
|
|||||||
/** @var ObjectGroup $objectGroup */
|
/** @var ObjectGroup $objectGroup */
|
||||||
foreach ($result as $objectGroup) {
|
foreach ($result as $objectGroup) {
|
||||||
$return[] = [
|
$return[] = [
|
||||||
'id' => (string) $objectGroup->id,
|
'id' => (string)$objectGroup->id,
|
||||||
'name' => $objectGroup->title,
|
'name' => $objectGroup->title,
|
||||||
'title' => $objectGroup->title,
|
'title' => $objectGroup->title,
|
||||||
];
|
];
|
||||||
@@ -80,5 +80,4 @@ class ObjectGroupController extends Controller
|
|||||||
|
|
||||||
return response()->json($return);
|
return response()->json($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ class PiggyBankController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getPiggiesAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getPiggiesAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -78,7 +78,7 @@ class PiggyBankController extends Controller
|
|||||||
foreach ($piggies as $piggy) {
|
foreach ($piggies as $piggy) {
|
||||||
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
|
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
|
||||||
$response[] = [
|
$response[] = [
|
||||||
'id' => (string) $piggy->id,
|
'id' => (string)$piggy->id,
|
||||||
'name' => $piggy->name,
|
'name' => $piggy->name,
|
||||||
'currency_id' => $currency->id,
|
'currency_id' => $currency->id,
|
||||||
'currency_name' => $currency->name,
|
'currency_name' => $currency->name,
|
||||||
@@ -95,7 +95,7 @@ class PiggyBankController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getPiggiesBalanceAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getPiggiesBalanceAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -110,10 +110,12 @@ class PiggyBankController extends Controller
|
|||||||
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
|
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
|
||||||
$currentAmount = $this->piggyRepository->getRepetition($piggy)->currentamount ?? '0';
|
$currentAmount = $this->piggyRepository->getRepetition($piggy)->currentamount ?? '0';
|
||||||
$response[] = [
|
$response[] = [
|
||||||
'id' => (string) $piggy->id,
|
'id' => (string)$piggy->id,
|
||||||
'name' => $piggy->name,
|
'name' => $piggy->name,
|
||||||
'name_with_balance' => sprintf(
|
'name_with_balance' => sprintf(
|
||||||
'%s (%s / %s)', $piggy->name, app('amount')->formatAnything($currency, $currentAmount, false),
|
'%s (%s / %s)',
|
||||||
|
$piggy->name,
|
||||||
|
app('amount')->formatAnything($currency, $currentAmount, false),
|
||||||
app('amount')->formatAnything($currency, $piggy->targetamount, false),
|
app('amount')->formatAnything($currency, $piggy->targetamount, false),
|
||||||
),
|
),
|
||||||
'currency_id' => $currency->id,
|
'currency_id' => $currency->id,
|
||||||
@@ -126,5 +128,4 @@ class PiggyBankController extends Controller
|
|||||||
|
|
||||||
return response()->json($response);
|
return response()->json($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ class RecurrenceController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getRecurringAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getRecurringAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -69,7 +69,7 @@ class RecurrenceController extends Controller
|
|||||||
/** @var Recurrence $recurrence */
|
/** @var Recurrence $recurrence */
|
||||||
foreach ($recurrences as $recurrence) {
|
foreach ($recurrences as $recurrence) {
|
||||||
$response[] = [
|
$response[] = [
|
||||||
'id' => (string) $recurrence->id,
|
'id' => (string)$recurrence->id,
|
||||||
'name' => $recurrence->title,
|
'name' => $recurrence->title,
|
||||||
'description' => $recurrence->description,
|
'description' => $recurrence->description,
|
||||||
];
|
];
|
||||||
@@ -77,5 +77,4 @@ class RecurrenceController extends Controller
|
|||||||
|
|
||||||
return response()->json($response);
|
return response()->json($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ class RuleController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getRulesAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getRulesAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -69,7 +69,7 @@ class RuleController extends Controller
|
|||||||
/** @var Rule $rule */
|
/** @var Rule $rule */
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
$response[] = [
|
$response[] = [
|
||||||
'id' => (string) $rule->id,
|
'id' => (string)$rule->id,
|
||||||
'name' => $rule->title,
|
'name' => $rule->title,
|
||||||
'description' => $rule->description,
|
'description' => $rule->description,
|
||||||
];
|
];
|
||||||
@@ -77,5 +77,4 @@ class RuleController extends Controller
|
|||||||
|
|
||||||
return response()->json($response);
|
return response()->json($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ class RuleGroupController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getRuleGroupsAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getRuleGroupsAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -69,7 +69,7 @@ class RuleGroupController extends Controller
|
|||||||
/** @var RuleGroup $group */
|
/** @var RuleGroup $group */
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$response[] = [
|
$response[] = [
|
||||||
'id' => (string) $group->id,
|
'id' => (string)$group->id,
|
||||||
'name' => $group->title,
|
'name' => $group->title,
|
||||||
'description' => $group->description,
|
'description' => $group->description,
|
||||||
];
|
];
|
||||||
|
@@ -59,7 +59,7 @@ class TagController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTagAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getTagAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -72,7 +72,7 @@ class TagController extends Controller
|
|||||||
/** @var Tag $tag */
|
/** @var Tag $tag */
|
||||||
foreach ($result as $tag) {
|
foreach ($result as $tag) {
|
||||||
$array[] = [
|
$array[] = [
|
||||||
'id' => (string) $tag->id,
|
'id' => (string)$tag->id,
|
||||||
'name' => $tag->tag,
|
'name' => $tag->tag,
|
||||||
'tag' => $tag->tag,
|
'tag' => $tag->tag,
|
||||||
];
|
];
|
||||||
|
@@ -64,7 +64,7 @@ class TransactionController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionsAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionsAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -80,8 +80,8 @@ class TransactionController extends Controller
|
|||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
foreach ($filtered as $journal) {
|
foreach ($filtered as $journal) {
|
||||||
$array[] = [
|
$array[] = [
|
||||||
'id' => (string) $journal->id,
|
'id' => (string)$journal->id,
|
||||||
'transaction_group_id' => (string) $journal->transaction_group_id,
|
'transaction_group_id' => (string)$journal->transaction_group_id,
|
||||||
'name' => $journal->description,
|
'name' => $journal->description,
|
||||||
'description' => $journal->description,
|
'description' => $journal->description,
|
||||||
];
|
];
|
||||||
@@ -94,17 +94,17 @@ class TransactionController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionsIDAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionsIDAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function transactionsWithID(AutocompleteRequest $request): JsonResponse
|
public function transactionsWithID(AutocompleteRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$data = $request->getData();
|
$data = $request->getData();
|
||||||
$result = new Collection;
|
$result = new Collection();
|
||||||
if (is_numeric($data['query'])) {
|
if (is_numeric($data['query'])) {
|
||||||
// search for group, not journal.
|
// search for group, not journal.
|
||||||
$firstResult = $this->groupRepository->find((int) $data['query']);
|
$firstResult = $this->groupRepository->find((int)$data['query']);
|
||||||
if (null !== $firstResult) {
|
if (null !== $firstResult) {
|
||||||
// group may contain multiple journals, each a result:
|
// group may contain multiple journals, each a result:
|
||||||
foreach ($firstResult->transactionJournals as $journal) {
|
foreach ($firstResult->transactionJournals as $journal) {
|
||||||
@@ -122,8 +122,8 @@ class TransactionController extends Controller
|
|||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
foreach ($result as $journal) {
|
foreach ($result as $journal) {
|
||||||
$array[] = [
|
$array[] = [
|
||||||
'id' => (string) $journal->id,
|
'id' => (string)$journal->id,
|
||||||
'transaction_group_id' => (string) $journal->transaction_group_id,
|
'transaction_group_id' => (string)$journal->transaction_group_id,
|
||||||
'name' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
|
'name' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
|
||||||
'description' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
|
'description' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
|
||||||
];
|
];
|
||||||
|
@@ -55,7 +55,7 @@ class TransactionTypeController extends Controller
|
|||||||
* This endpoint is documented at
|
* This endpoint is documented at
|
||||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionTypesAC
|
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionTypesAC
|
||||||
*
|
*
|
||||||
* @param AutocompleteRequest $request
|
* @param AutocompleteRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -70,7 +70,7 @@ class TransactionTypeController extends Controller
|
|||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
// different key for consistency.
|
// different key for consistency.
|
||||||
$array[] = [
|
$array[] = [
|
||||||
'id' => (string) $type->id,
|
'id' => (string)$type->id,
|
||||||
'name' => $type->type,
|
'name' => $type->type,
|
||||||
'type' => $type->type,
|
'type' => $type->type,
|
||||||
];
|
];
|
||||||
|
@@ -76,7 +76,7 @@ class AccountController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/charts/getChartAccountOverview
|
* https://api-docs.firefly-iii.org/#/charts/getChartAccountOverview
|
||||||
*
|
*
|
||||||
* @param DateRequest $request
|
* @param DateRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -98,7 +98,7 @@ class AccountController extends Controller
|
|||||||
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
|
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
|
||||||
$default = app('amount')->getDefaultCurrency();
|
$default = app('amount')->getDefaultCurrency();
|
||||||
|
|
||||||
if (empty($frontPage->data)) {
|
if (!(is_array($frontPage->data) && count($frontPage->data) > 0)) {
|
||||||
$frontPage->data = $defaultSet;
|
$frontPage->data = $defaultSet;
|
||||||
$frontPage->save();
|
$frontPage->save();
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,7 @@ class AccountController extends Controller
|
|||||||
}
|
}
|
||||||
$currentSet = [
|
$currentSet = [
|
||||||
'label' => $account->name,
|
'label' => $account->name,
|
||||||
'currency_id' => (string) $currency->id,
|
'currency_id' => (string)$currency->id,
|
||||||
'currency_code' => $currency->code,
|
'currency_code' => $currency->code,
|
||||||
'currency_symbol' => $currency->symbol,
|
'currency_symbol' => $currency->symbol,
|
||||||
'currency_decimal_places' => $currency->decimal_places,
|
'currency_decimal_places' => $currency->decimal_places,
|
||||||
@@ -127,11 +127,12 @@ class AccountController extends Controller
|
|||||||
];
|
];
|
||||||
$currentStart = clone $start;
|
$currentStart = clone $start;
|
||||||
$range = app('steam')->balanceInRange($account, $start, clone $end);
|
$range = app('steam')->balanceInRange($account, $start, clone $end);
|
||||||
$previous = round((float) array_values($range)[0], 12);
|
// 2022-10-11 this method no longer converts to float.
|
||||||
|
$previous = array_values($range)[0];
|
||||||
while ($currentStart <= $end) {
|
while ($currentStart <= $end) {
|
||||||
$format = $currentStart->format('Y-m-d');
|
$format = $currentStart->format('Y-m-d');
|
||||||
$label = $currentStart->toAtomString();
|
$label = $currentStart->toAtomString();
|
||||||
$balance = array_key_exists($format, $range) ? round((float) $range[$format], 12) : $previous;
|
$balance = array_key_exists($format, $range) ? $range[$format] : $previous;
|
||||||
$previous = $balance;
|
$previous = $balance;
|
||||||
$currentStart->addDay();
|
$currentStart->addDay();
|
||||||
$currentSet['entries'][$label] = $balance;
|
$currentSet['entries'][$label] = $balance;
|
||||||
|
@@ -31,11 +31,12 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use League\Fractal\Manager;
|
use League\Fractal\Manager;
|
||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
use Log;
|
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,9 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
*/
|
*/
|
||||||
abstract class Controller extends BaseController
|
abstract class Controller extends BaseController
|
||||||
{
|
{
|
||||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
use AuthorizesRequests;
|
||||||
|
use DispatchesJobs;
|
||||||
|
use ValidatesRequests;
|
||||||
|
|
||||||
protected const CONTENT_TYPE = 'application/vnd.api+json';
|
protected const CONTENT_TYPE = 'application/vnd.api+json';
|
||||||
protected array $allowedSort;
|
protected array $allowedSort;
|
||||||
@@ -69,7 +72,6 @@ abstract class Controller extends BaseController
|
|||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,24 +83,34 @@ abstract class Controller extends BaseController
|
|||||||
*/
|
*/
|
||||||
private function getParameters(): ParameterBag
|
private function getParameters(): ParameterBag
|
||||||
{
|
{
|
||||||
$bag = new ParameterBag;
|
$bag = new ParameterBag();
|
||||||
$page = (int)request()->get('page');
|
$page = (int)request()->get('page');
|
||||||
if (0 === $page) {
|
|
||||||
|
if ($page < 1) {
|
||||||
$page = 1;
|
$page = 1;
|
||||||
}
|
}
|
||||||
|
if ($page > (2 ^ 16)) {
|
||||||
|
$page = (2 ^ 16);
|
||||||
|
}
|
||||||
$bag->set('page', $page);
|
$bag->set('page', $page);
|
||||||
|
|
||||||
// some date fields:
|
// some date fields:
|
||||||
$dates = ['start', 'end', 'date'];
|
$dates = ['start', 'end', 'date'];
|
||||||
foreach ($dates as $field) {
|
foreach ($dates as $field) {
|
||||||
$date = request()->query->get($field);
|
try {
|
||||||
$obj = null;
|
$date = request()->query->get($field);
|
||||||
|
} catch (BadRequestException $e) {
|
||||||
|
Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $field));
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
$value = null;
|
||||||
|
}
|
||||||
|
$obj = null;
|
||||||
if (null !== $date) {
|
if (null !== $date) {
|
||||||
try {
|
try {
|
||||||
$obj = Carbon::parse($date);
|
$obj = Carbon::parse($date);
|
||||||
} catch (InvalidDateException | InvalidFormatException $e) {
|
} catch (InvalidDateException|InvalidFormatException $e) {
|
||||||
// don't care
|
// don't care
|
||||||
Log::warning(sprintf('Ignored invalid date "%s" in API controller parameter check: %s', $date, $e->getMessage()));
|
app('log')->warning(sprintf('Ignored invalid date "%s" in API controller parameter check: %s', substr($date, 0, 20), $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$bag->set($field, $obj);
|
$bag->set($field, $obj);
|
||||||
@@ -107,7 +119,13 @@ abstract class Controller extends BaseController
|
|||||||
// integer fields:
|
// integer fields:
|
||||||
$integers = ['limit'];
|
$integers = ['limit'];
|
||||||
foreach ($integers as $integer) {
|
foreach ($integers as $integer) {
|
||||||
$value = request()->query->get($integer);
|
try {
|
||||||
|
$value = request()->query->get($integer);
|
||||||
|
} catch (BadRequestException $e) {
|
||||||
|
Log::error(sprintf('Request field "%s" contains a non-scalar value. Value set to NULL.', $integer));
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
$value = null;
|
||||||
|
}
|
||||||
if (null !== $value) {
|
if (null !== $value) {
|
||||||
$bag->set($integer, (int)$value);
|
$bag->set($integer, (int)$value);
|
||||||
}
|
}
|
||||||
@@ -118,14 +136,20 @@ abstract class Controller extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ParameterBag $bag
|
* @param ParameterBag $bag
|
||||||
*
|
*
|
||||||
* @return ParameterBag
|
* @return ParameterBag
|
||||||
*/
|
*/
|
||||||
private function getSortParameters(ParameterBag $bag): ParameterBag
|
private function getSortParameters(ParameterBag $bag): ParameterBag
|
||||||
{
|
{
|
||||||
$sortParameters = [];
|
$sortParameters = [];
|
||||||
$param = (string)request()->query->get('sort');
|
try {
|
||||||
|
$param = (string)request()->query->get('sort');
|
||||||
|
} catch (BadRequestException $e) {
|
||||||
|
Log::error('Request field "sort" contains a non-scalar value. Value set to NULL.');
|
||||||
|
Log::error($e->getMessage());
|
||||||
|
$param = '';
|
||||||
|
}
|
||||||
if ('' === $param) {
|
if ('' === $param) {
|
||||||
return $bag;
|
return $bag;
|
||||||
}
|
}
|
||||||
@@ -167,7 +191,7 @@ abstract class Controller extends BaseController
|
|||||||
$params[$key] = $value;
|
$params[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return . http_build_query($params);
|
return $return.http_build_query($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -176,8 +200,8 @@ abstract class Controller extends BaseController
|
|||||||
final protected function getManager(): Manager
|
final protected function getManager(): Manager
|
||||||
{
|
{
|
||||||
// create some objects:
|
// create some objects:
|
||||||
$manager = new Manager;
|
$manager = new Manager();
|
||||||
$baseUrl = request()->getSchemeAndHttpHost() . '/api/v1';
|
$baseUrl = request()->getSchemeAndHttpHost().'/api/v1';
|
||||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||||
|
|
||||||
return $manager;
|
return $manager;
|
||||||
|
@@ -24,7 +24,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Data\Bulk;
|
namespace FireflyIII\Api\V1\Controllers\Data\Bulk;
|
||||||
|
|
||||||
|
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Data\Bulk\MoveTransactionsRequest;
|
use FireflyIII\Api\V1\Requests\Data\Bulk\MoveTransactionsRequest;
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
@@ -59,7 +58,7 @@ class AccountController extends Controller
|
|||||||
/**
|
/**
|
||||||
* This endpoint is deprecated and not documented.
|
* This endpoint is deprecated and not documented.
|
||||||
*
|
*
|
||||||
* @param MoveTransactionsRequest $request
|
* @param MoveTransactionsRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @deprecated
|
* @deprecated
|
||||||
@@ -75,7 +74,5 @@ class AccountController extends Controller
|
|||||||
$service->moveTransactions($original, $destination);
|
$service->moveTransactions($original, $destination);
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ class TransactionController extends Controller
|
|||||||
/**
|
/**
|
||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
*
|
*
|
||||||
* @param TransactionRequest $request
|
* @param TransactionRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -76,8 +76,8 @@ class TransactionController extends Controller
|
|||||||
// to respond to what is in the $query.
|
// to respond to what is in the $query.
|
||||||
// this is OK because only one thing can be in the query at the moment.
|
// this is OK because only one thing can be in the query at the moment.
|
||||||
if ($this->updatesTransactionAccount($params)) {
|
if ($this->updatesTransactionAccount($params)) {
|
||||||
$original = $this->repository->find((int) $params['where']['account_id']);
|
$original = $this->repository->find((int)$params['where']['account_id']);
|
||||||
$destination = $this->repository->find((int) $params['update']['account_id']);
|
$destination = $this->repository->find((int)$params['update']['account_id']);
|
||||||
|
|
||||||
/** @var AccountDestroyService $service */
|
/** @var AccountDestroyService $service */
|
||||||
$service = app(AccountDestroyService::class);
|
$service = app(AccountDestroyService::class);
|
||||||
@@ -88,7 +88,7 @@ class TransactionController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $params
|
* @param array $params
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -96,5 +96,4 @@ class TransactionController extends Controller
|
|||||||
{
|
{
|
||||||
return array_key_exists('account_id', $params['where']) && array_key_exists('account_id', $params['update']);
|
return array_key_exists('account_id', $params['where']) && array_key_exists('account_id', $params['update']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -45,28 +45,31 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
|||||||
use FireflyIII\Services\Internal\Destroy\AccountDestroyService;
|
use FireflyIII\Services\Internal\Destroy\AccountDestroyService;
|
||||||
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
|
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DestroyController
|
* Class DestroyController
|
||||||
*/
|
*/
|
||||||
class DestroyController extends Controller
|
class DestroyController extends Controller
|
||||||
{
|
{
|
||||||
|
private bool $unused;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/destroyData
|
* https://api-docs.firefly-iii.org/#/data/destroyData
|
||||||
*
|
*
|
||||||
* @param DestroyRequest $request
|
* @param DestroyRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function destroy(DestroyRequest $request): JsonResponse
|
public function destroy(DestroyRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$objects = $request->getObjects();
|
$objects = $request->getObjects();
|
||||||
|
$this->unused = $request->boolean('unused', false);
|
||||||
switch ($objects) {
|
switch ($objects) {
|
||||||
default:
|
default:
|
||||||
throw new FireflyException(sprintf('This endpoint can\'t handle object "%s"', $objects));
|
throw new FireflyException(sprintf('200033: This endpoint can\'t handle object "%s"', $objects));
|
||||||
case 'budgets':
|
case 'budgets':
|
||||||
$this->destroyBudgets();
|
$this->destroyBudgets();
|
||||||
break;
|
break;
|
||||||
@@ -94,24 +97,32 @@ class DestroyController extends Controller
|
|||||||
case 'accounts':
|
case 'accounts':
|
||||||
$this->destroyAccounts(
|
$this->destroyAccounts(
|
||||||
[
|
[
|
||||||
AccountType::ASSET, AccountType::DEFAULT,
|
AccountType::ASSET,
|
||||||
AccountType::BENEFICIARY, AccountType::EXPENSE,
|
AccountType::DEFAULT,
|
||||||
AccountType::REVENUE, AccountType::INITIAL_BALANCE,
|
AccountType::BENEFICIARY,
|
||||||
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD,
|
AccountType::EXPENSE,
|
||||||
|
AccountType::REVENUE,
|
||||||
|
AccountType::INITIAL_BALANCE,
|
||||||
|
AccountType::DEBT,
|
||||||
|
AccountType::LOAN,
|
||||||
|
AccountType::MORTGAGE,
|
||||||
|
AccountType::CREDITCARD,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'asset_accounts':
|
case 'asset_accounts':
|
||||||
$this->destroyAccounts(
|
$this->destroyAccounts(
|
||||||
[
|
[
|
||||||
AccountType::ASSET, AccountType::DEFAULT,
|
AccountType::ASSET,
|
||||||
|
AccountType::DEFAULT,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'expense_accounts':
|
case 'expense_accounts':
|
||||||
$this->destroyAccounts(
|
$this->destroyAccounts(
|
||||||
[
|
[
|
||||||
AccountType::BENEFICIARY, AccountType::EXPENSE,
|
AccountType::BENEFICIARY,
|
||||||
|
AccountType::EXPENSE,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -125,7 +136,10 @@ class DestroyController extends Controller
|
|||||||
case 'liabilities':
|
case 'liabilities':
|
||||||
$this->destroyAccounts(
|
$this->destroyAccounts(
|
||||||
[
|
[
|
||||||
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD,
|
AccountType::DEBT,
|
||||||
|
AccountType::LOAN,
|
||||||
|
AccountType::MORTGAGE,
|
||||||
|
AccountType::CREDITCARD,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -162,6 +176,7 @@ class DestroyController extends Controller
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
@@ -252,7 +267,7 @@ class DestroyController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $types
|
* @param array $types
|
||||||
*/
|
*/
|
||||||
private function destroyAccounts(array $types): void
|
private function destroyAccounts(array $types): void
|
||||||
{
|
{
|
||||||
@@ -260,14 +275,24 @@ class DestroyController extends Controller
|
|||||||
$repository = app(AccountRepositoryInterface::class);
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
$collection = $repository->getAccountsByType($types);
|
$collection = $repository->getAccountsByType($types);
|
||||||
$service = app(AccountDestroyService::class);
|
$service = app(AccountDestroyService::class);
|
||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
foreach ($collection as $account) {
|
foreach ($collection as $account) {
|
||||||
$service->destroy($account, null);
|
$count = $account->transactions()->count();
|
||||||
|
if (true === $this->unused && 0 === $count) {
|
||||||
|
Log::info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name));
|
||||||
|
$service->destroy($account, null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (false === $this->unused) {
|
||||||
|
Log::info(sprintf('Deleting account #%d "%s"', $account->id, $account->name));
|
||||||
|
$service->destroy($account, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $types
|
* @param array $types
|
||||||
*/
|
*/
|
||||||
private function destroyTransactions(array $types): void
|
private function destroyTransactions(array $types): void
|
||||||
{
|
{
|
||||||
@@ -280,5 +305,4 @@ class DestroyController extends Controller
|
|||||||
$service->destroy($journal);
|
$service->destroy($journal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportAccounts
|
* https://api-docs.firefly-iii.org/#/data/exportAccounts
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -67,11 +67,10 @@ class ExportController extends Controller
|
|||||||
$this->exporter->setExportAccounts(true);
|
$this->exporter->setExportAccounts(true);
|
||||||
|
|
||||||
return $this->returnExport('accounts');
|
return $this->returnExport('accounts');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -87,13 +86,13 @@ class ExportController extends Controller
|
|||||||
$response
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
->header('Content-Disposition', 'attachment; filename=' . $fileName)
|
->header('Content-Disposition', 'attachment; filename='.$fileName)
|
||||||
->header('Content-Transfer-Encoding', 'binary')
|
->header('Content-Transfer-Encoding', 'binary')
|
||||||
->header('Connection', 'Keep-Alive')
|
->header('Connection', 'Keep-Alive')
|
||||||
->header('Expires', '0')
|
->header('Expires', '0')
|
||||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||||
->header('Pragma', 'public')
|
->header('Pragma', 'public')
|
||||||
->header('Content-Length', (string) strlen($data[$key]));
|
->header('Content-Length', (string)strlen($data[$key]));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -102,7 +101,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportBills
|
* https://api-docs.firefly-iii.org/#/data/exportBills
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -118,7 +117,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportBudgets
|
* https://api-docs.firefly-iii.org/#/data/exportBudgets
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -134,7 +133,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportCategories
|
* https://api-docs.firefly-iii.org/#/data/exportCategories
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -150,7 +149,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportPiggies
|
* https://api-docs.firefly-iii.org/#/data/exportPiggies
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -166,7 +165,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportRecurring
|
* https://api-docs.firefly-iii.org/#/data/exportRecurring
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -182,7 +181,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportRules
|
* https://api-docs.firefly-iii.org/#/data/exportRules
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -198,7 +197,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportTags
|
* https://api-docs.firefly-iii.org/#/data/exportTags
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -214,7 +213,7 @@ class ExportController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/data/exportTransactions
|
* https://api-docs.firefly-iii.org/#/data/exportTransactions
|
||||||
*
|
*
|
||||||
* @param ExportRequest $request
|
* @param ExportRequest $request
|
||||||
*
|
*
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -229,5 +228,4 @@ class ExportController extends Controller
|
|||||||
|
|
||||||
return $this->returnExport('transactions');
|
return $this->returnExport('transactions');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
93
app/Api/V1/Controllers/Data/PurgeController.php
Normal file
93
app/Api/V1/Controllers/Data/PurgeController.php
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* PurgeController.php
|
||||||
|
* Copyright (c) 2022 james@firefly-iii.org
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Api\V1\Controllers\Data;
|
||||||
|
|
||||||
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\Budget;
|
||||||
|
use FireflyIII\Models\Category;
|
||||||
|
use FireflyIII\Models\PiggyBank;
|
||||||
|
use FireflyIII\Models\Recurrence;
|
||||||
|
use FireflyIII\Models\Rule;
|
||||||
|
use FireflyIII\Models\RuleGroup;
|
||||||
|
use FireflyIII\Models\Tag;
|
||||||
|
use FireflyIII\Models\TransactionGroup;
|
||||||
|
use FireflyIII\Models\TransactionJournal;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class PurgeController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return JsonResponse
|
||||||
|
*/
|
||||||
|
public function purge(): JsonResponse
|
||||||
|
{
|
||||||
|
$user = auth()->user();
|
||||||
|
|
||||||
|
// some manual code, too lazy to call all repositories.
|
||||||
|
//,transactions,withdrawals,deposits,transfers';
|
||||||
|
|
||||||
|
// budgets:
|
||||||
|
Budget::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// bills
|
||||||
|
Bill::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// piggies
|
||||||
|
$set = PiggyBank::leftJoin('accounts', 'accounts.id', 'piggy_banks.account_id')
|
||||||
|
->where('accounts.user_id', $user->id)->onlyTrashed()->get(['piggy_banks.*']);
|
||||||
|
/** @var PiggyBank $piggy */
|
||||||
|
foreach ($set as $piggy) {
|
||||||
|
$piggy->forceDelete();
|
||||||
|
}
|
||||||
|
|
||||||
|
// rule group
|
||||||
|
RuleGroup::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// rules
|
||||||
|
Rule::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// recurring transactions
|
||||||
|
Recurrence::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// categories
|
||||||
|
Category::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// tags
|
||||||
|
Tag::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
|
||||||
|
// accounts
|
||||||
|
Account::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// transaction groups
|
||||||
|
TransactionGroup::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
// transaction journals
|
||||||
|
TransactionJournal::whereUserId($user->id)->onlyTrashed()->forceDelete();
|
||||||
|
|
||||||
|
return response()->json([], 204);
|
||||||
|
}
|
||||||
|
}
|
@@ -76,7 +76,7 @@ class AccountController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseAsset
|
* https://api-docs.firefly-iii.org/#/insight/insightExpenseAsset
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -91,11 +91,11 @@ class AccountController extends Controller
|
|||||||
/** @var array $expense */
|
/** @var array $expense */
|
||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $expense['id'],
|
'id' => (string)$expense['id'],
|
||||||
'name' => $expense['name'],
|
'name' => $expense['name'],
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // intentional float
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ class AccountController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseExpense
|
* https://api-docs.firefly-iii.org/#/insight/insightExpenseExpense
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -123,16 +123,15 @@ class AccountController extends Controller
|
|||||||
/** @var array $expense */
|
/** @var array $expense */
|
||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $expense['id'],
|
'id' => (string)$expense['id'],
|
||||||
'name' => $expense['name'],
|
'name' => $expense['name'],
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // intentional float
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($result);
|
return response()->json($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ class BillController extends Controller
|
|||||||
*
|
*
|
||||||
* Expenses per bill, possibly filtered by bill and account.
|
* Expenses per bill, possibly filtered by bill and account.
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -85,33 +85,33 @@ class BillController extends Controller
|
|||||||
|
|
||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$billId = (int) $journal['bill_id'];
|
$billId = (int)$journal['bill_id'];
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
$key = sprintf('%d-%d', $billId, $currencyId);
|
$key = sprintf('%d-%d', $billId, $currencyId);
|
||||||
$foreignKey = sprintf('%d-%d', $billId, $foreignCurrencyId);
|
$foreignKey = sprintf('%d-%d', $billId, $foreignCurrencyId);
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$key] = $response[$key] ?? [
|
$response[$key] = $response[$key] ?? [
|
||||||
'id' => (string) $billId,
|
'id' => (string)$billId,
|
||||||
'name' => $journal['bill_name'],
|
'name' => $journal['bill_name'],
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']);
|
$response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']);
|
||||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
$response[$key]['difference_float'] = (float)$response[$key]['difference']; // intentional float
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignKey] = $response[$foreignKey] ?? [
|
$response[$foreignKey] = $response[$foreignKey] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']);
|
$response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']);
|
||||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
|
$response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; // intentional float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ class BillController extends Controller
|
|||||||
*
|
*
|
||||||
* Expenses for no bill filtered by account.
|
* Expenses for no bill filtered by account.
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -143,32 +143,31 @@ class BillController extends Controller
|
|||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
|
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$currencyId] = $response[$currencyId] ?? [
|
$response[$currencyId] = $response[$currencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
||||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
||||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
|
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; // intentional float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(array_values($response));
|
return response()->json(array_values($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -68,7 +68,7 @@ class BudgetController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseBudget
|
* https://api-docs.firefly-iii.org/#/insight/insightExpenseBudget
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -88,11 +88,11 @@ class BudgetController extends Controller
|
|||||||
/** @var array $expense */
|
/** @var array $expense */
|
||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $budget->id,
|
'id' => (string)$budget->id,
|
||||||
'name' => $budget->name,
|
'name' => $budget->name,
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // intentional float
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ class BudgetController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseNoBudget
|
* https://api-docs.firefly-iii.org/#/insight/insightExpenseNoBudget
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -120,14 +120,12 @@ class BudgetController extends Controller
|
|||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // intentional float
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($result);
|
return response()->json($result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,7 @@ class CategoryController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferCategory
|
* https://api-docs.firefly-iii.org/#/insight/insightTransferCategory
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -89,11 +89,11 @@ class CategoryController extends Controller
|
|||||||
/** @var array $expense */
|
/** @var array $expense */
|
||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $category->id,
|
'id' => (string)$category->id,
|
||||||
'name' => $category->name,
|
'name' => $category->name,
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // intentional float
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ class CategoryController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoCategory
|
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoCategory
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -121,13 +121,12 @@ class CategoryController extends Controller
|
|||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // intentional float
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($result);
|
return response()->json($result);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,12 +34,11 @@ use Illuminate\Http\JsonResponse;
|
|||||||
*/
|
*/
|
||||||
class PeriodController extends Controller
|
class PeriodController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseTotal
|
* https://api-docs.firefly-iii.org/#/insight/insightExpenseTotal
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -55,32 +54,31 @@ class PeriodController extends Controller
|
|||||||
$collector->setTypes([TransactionType::WITHDRAWAL])->setRange($start, $end)->setSourceAccounts($accounts);
|
$collector->setTypes([TransactionType::WITHDRAWAL])->setRange($start, $end)->setSourceAccounts($accounts);
|
||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$currencyId] = $response[$currencyId] ?? [
|
$response[$currencyId] = $response[$currencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
||||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
||||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
|
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; // intentional float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(array_values($response));
|
return response()->json(array_values($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ class TagController extends Controller
|
|||||||
*
|
*
|
||||||
* Expenses for no tag filtered by account.
|
* Expenses for no tag filtered by account.
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -79,28 +79,28 @@ class TagController extends Controller
|
|||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
|
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$currencyId] = $response[$currencyId] ?? [
|
$response[$currencyId] = $response[$currencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
||||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // float but on purpose.
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
||||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
|
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; // float but on purpose.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ class TagController extends Controller
|
|||||||
*
|
*
|
||||||
* Expenses per tag, possibly filtered by tag and account.
|
* Expenses per tag, possibly filtered by tag and account.
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -137,8 +137,8 @@ class TagController extends Controller
|
|||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
/** @var array $journal */
|
/** @var array $journal */
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
/** @var array $tag */
|
/** @var array $tag */
|
||||||
foreach ($journal['tags'] as $tag) {
|
foreach ($journal['tags'] as $tag) {
|
||||||
@@ -149,32 +149,31 @@ class TagController extends Controller
|
|||||||
// on currency ID
|
// on currency ID
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$key] = $response[$key] ?? [
|
$response[$key] = $response[$key] ?? [
|
||||||
'id' => (string) $tagId,
|
'id' => (string)$tagId,
|
||||||
'name' => $tag['name'],
|
'name' => $tag['name'],
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']);
|
$response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']);
|
||||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
$response[$key]['difference_float'] = (float)$response[$key]['difference']; // float but on purpose.
|
||||||
}
|
}
|
||||||
|
|
||||||
// on foreign ID
|
// on foreign ID
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']);
|
$response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']);
|
||||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
|
$response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; // float but on purpose.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(array_values($response));
|
return response()->json(array_values($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,7 @@ class AccountController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeAsset
|
* https://api-docs.firefly-iii.org/#/insight/insightIncomeAsset
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -90,11 +90,11 @@ class AccountController extends Controller
|
|||||||
/** @var array $entry */
|
/** @var array $entry */
|
||||||
foreach ($income as $entry) {
|
foreach ($income as $entry) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $entry['id'],
|
'id' => (string)$entry['id'],
|
||||||
'name' => $entry['name'],
|
'name' => $entry['name'],
|
||||||
'difference' => $entry['sum'],
|
'difference' => $entry['sum'],
|
||||||
'difference_float' => (float) $entry['sum'],
|
'difference_float' => (float)$entry['sum'], // float but on purpose.
|
||||||
'currency_id' => (string) $entry['currency_id'],
|
'currency_id' => (string)$entry['currency_id'],
|
||||||
'currency_code' => $entry['currency_code'],
|
'currency_code' => $entry['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ class AccountController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeRevenue
|
* https://api-docs.firefly-iii.org/#/insight/insightIncomeRevenue
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -122,16 +122,15 @@ class AccountController extends Controller
|
|||||||
/** @var array $entry */
|
/** @var array $entry */
|
||||||
foreach ($income as $entry) {
|
foreach ($income as $entry) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $entry['id'],
|
'id' => (string)$entry['id'],
|
||||||
'name' => $entry['name'],
|
'name' => $entry['name'],
|
||||||
'difference' => $entry['sum'],
|
'difference' => $entry['sum'],
|
||||||
'difference_float' => (float) $entry['sum'],
|
'difference_float' => (float)$entry['sum'], // float but on purpose.
|
||||||
'currency_id' => (string) $entry['currency_id'],
|
'currency_id' => (string)$entry['currency_id'],
|
||||||
'currency_code' => $entry['currency_code'],
|
'currency_code' => $entry['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($result);
|
return response()->json($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,7 @@ class CategoryController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeCategory
|
* https://api-docs.firefly-iii.org/#/insight/insightIncomeCategory
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -89,11 +89,11 @@ class CategoryController extends Controller
|
|||||||
/** @var array $expense */
|
/** @var array $expense */
|
||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $category->id,
|
'id' => (string)$category->id,
|
||||||
'name' => $category->name,
|
'name' => $category->name,
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // float but on purpose.
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ class CategoryController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeNoCategory
|
* https://api-docs.firefly-iii.org/#/insight/insightIncomeNoCategory
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -121,13 +121,12 @@ class CategoryController extends Controller
|
|||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'], // float but on purpose.
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($result);
|
return response()->json($result);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,12 +34,11 @@ use Illuminate\Http\JsonResponse;
|
|||||||
*/
|
*/
|
||||||
class PeriodController extends Controller
|
class PeriodController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeTotal
|
* https://api-docs.firefly-iii.org/#/insight/insightIncomeTotal
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -55,34 +54,34 @@ class PeriodController extends Controller
|
|||||||
$collector->setTypes([TransactionType::DEPOSIT])->setRange($start, $end)->setDestinationAccounts($accounts);
|
$collector->setTypes([TransactionType::DEPOSIT])->setRange($start, $end)->setDestinationAccounts($accounts);
|
||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$currencyId] = $response[$currencyId] ?? [
|
$response[$currencyId] = $response[$currencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
||||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // float but on purpose.
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignCurrencyId]['difference'] = bcadd(
|
$response[$foreignCurrencyId]['difference'] = bcadd(
|
||||||
$response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount'])
|
$response[$foreignCurrencyId]['difference'],
|
||||||
|
app('steam')->positive($journal['foreign_amount'])
|
||||||
);
|
);
|
||||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
|
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; // float but on purpose.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(array_values($response));
|
return response()->json(array_values($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ class TagController extends Controller
|
|||||||
*
|
*
|
||||||
* Expenses for no tag filtered by account.
|
* Expenses for no tag filtered by account.
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -80,30 +80,31 @@ class TagController extends Controller
|
|||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
|
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$currencyId] = $response[$currencyId] ?? [
|
$response[$currencyId] = $response[$currencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
||||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignCurrencyId]['difference'] = bcadd(
|
$response[$foreignCurrencyId]['difference'] = bcadd(
|
||||||
$response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount'])
|
$response[$foreignCurrencyId]['difference'],
|
||||||
|
app('steam')->positive($journal['foreign_amount'])
|
||||||
);
|
);
|
||||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
|
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +117,7 @@ class TagController extends Controller
|
|||||||
*
|
*
|
||||||
* Expenses per tag, possibly filtered by tag and account.
|
* Expenses per tag, possibly filtered by tag and account.
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -140,8 +141,8 @@ class TagController extends Controller
|
|||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
/** @var array $journal */
|
/** @var array $journal */
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
/** @var array $tag */
|
/** @var array $tag */
|
||||||
foreach ($journal['tags'] as $tag) {
|
foreach ($journal['tags'] as $tag) {
|
||||||
@@ -152,34 +153,34 @@ class TagController extends Controller
|
|||||||
// on currency ID
|
// on currency ID
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$key] = $response[$key] ?? [
|
$response[$key] = $response[$key] ?? [
|
||||||
'id' => (string) $tagId,
|
'id' => (string)$tagId,
|
||||||
'name' => $tag['name'],
|
'name' => $tag['name'],
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount']));
|
$response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount']));
|
||||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
$response[$key]['difference_float'] = (float)$response[$key]['difference'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// on foreign ID
|
// on foreign ID
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignKey]['difference'] = bcadd(
|
$response[$foreignKey]['difference'] = bcadd(
|
||||||
$response[$foreignKey]['difference'], app('steam')->positive($journal['foreign_amount'])
|
$response[$foreignKey]['difference'],
|
||||||
|
app('steam')->positive($journal['foreign_amount'])
|
||||||
);
|
);
|
||||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
|
$response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(array_values($response));
|
return response()->json(array_values($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ class AccountController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightTransfers
|
* https://api-docs.firefly-iii.org/#/insight/insightTransfers
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -68,7 +68,7 @@ class CategoryController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferCategory
|
* https://api-docs.firefly-iii.org/#/insight/insightTransferCategory
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -88,11 +88,11 @@ class CategoryController extends Controller
|
|||||||
/** @var array $expense */
|
/** @var array $expense */
|
||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'id' => (string) $category->id,
|
'id' => (string)$category->id,
|
||||||
'name' => $category->name,
|
'name' => $category->name,
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'],
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ class CategoryController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoCategory
|
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoCategory
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -120,13 +120,12 @@ class CategoryController extends Controller
|
|||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$result[] = [
|
$result[] = [
|
||||||
'difference' => $expense['sum'],
|
'difference' => $expense['sum'],
|
||||||
'difference_float' => (float) $expense['sum'],
|
'difference_float' => (float)$expense['sum'],
|
||||||
'currency_id' => (string) $expense['currency_id'],
|
'currency_id' => (string)$expense['currency_id'],
|
||||||
'currency_code' => $expense['currency_code'],
|
'currency_code' => $expense['currency_code'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($result);
|
return response()->json($result);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,12 +34,11 @@ use Illuminate\Http\JsonResponse;
|
|||||||
*/
|
*/
|
||||||
class PeriodController extends Controller
|
class PeriodController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferTotal
|
* https://api-docs.firefly-iii.org/#/insight/insightTransferTotal
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -55,34 +54,34 @@ class PeriodController extends Controller
|
|||||||
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
|
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
|
||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$currencyId] = $response[$currencyId] ?? [
|
$response[$currencyId] = $response[$currencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
||||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignCurrencyId]['difference'] = bcadd(
|
$response[$foreignCurrencyId]['difference'] = bcadd(
|
||||||
$response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount'])
|
$response[$foreignCurrencyId]['difference'],
|
||||||
|
app('steam')->positive($journal['foreign_amount'])
|
||||||
);
|
);
|
||||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
|
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(array_values($response));
|
return response()->json(array_values($response));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ class TagController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoTag
|
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoTag
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -77,30 +77,31 @@ class TagController extends Controller
|
|||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
|
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$currencyId] = $response[$currencyId] ?? [
|
$response[$currencyId] = $response[$currencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
|
||||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
|
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference'];
|
||||||
}
|
}
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignCurrencyId]['difference'] = bcadd(
|
$response[$foreignCurrencyId]['difference'] = bcadd(
|
||||||
$response[$foreignCurrencyId]['difference'], app('steam')->positive($journal['foreign_amount'])
|
$response[$foreignCurrencyId]['difference'],
|
||||||
|
app('steam')->positive($journal['foreign_amount'])
|
||||||
);
|
);
|
||||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
|
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ class TagController extends Controller
|
|||||||
*
|
*
|
||||||
* Transfers per tag, possibly filtered by tag and account.
|
* Transfers per tag, possibly filtered by tag and account.
|
||||||
*
|
*
|
||||||
* @param GenericRequest $request
|
* @param GenericRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -137,8 +138,8 @@ class TagController extends Controller
|
|||||||
$genericSet = $collector->getExtractedJournals();
|
$genericSet = $collector->getExtractedJournals();
|
||||||
/** @var array $journal */
|
/** @var array $journal */
|
||||||
foreach ($genericSet as $journal) {
|
foreach ($genericSet as $journal) {
|
||||||
$currencyId = (int) $journal['currency_id'];
|
$currencyId = (int)$journal['currency_id'];
|
||||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||||
|
|
||||||
/** @var array $tag */
|
/** @var array $tag */
|
||||||
foreach ($journal['tags'] as $tag) {
|
foreach ($journal['tags'] as $tag) {
|
||||||
@@ -149,29 +150,30 @@ class TagController extends Controller
|
|||||||
// on currency ID
|
// on currency ID
|
||||||
if (0 !== $currencyId) {
|
if (0 !== $currencyId) {
|
||||||
$response[$key] = $response[$key] ?? [
|
$response[$key] = $response[$key] ?? [
|
||||||
'id' => (string) $tagId,
|
'id' => (string)$tagId,
|
||||||
'name' => $tag['name'],
|
'name' => $tag['name'],
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $currencyId,
|
'currency_id' => (string)$currencyId,
|
||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
];
|
];
|
||||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount']));
|
$response[$key]['difference'] = bcadd($response[$key]['difference'], app('steam')->positive($journal['amount']));
|
||||||
$response[$key]['difference_float'] = (float) $response[$key]['difference'];
|
$response[$key]['difference_float'] = (float)$response[$key]['difference'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// on foreign ID
|
// on foreign ID
|
||||||
if (0 !== $foreignCurrencyId) {
|
if (0 !== $foreignCurrencyId) {
|
||||||
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
||||||
'difference' => '0',
|
'difference' => '0',
|
||||||
'difference_float' => 0,
|
'difference_float' => 0,
|
||||||
'currency_id' => (string) $foreignCurrencyId,
|
'currency_id' => (string)$foreignCurrencyId,
|
||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
];
|
];
|
||||||
$response[$foreignKey]['difference'] = bcadd(
|
$response[$foreignKey]['difference'] = bcadd(
|
||||||
$response[$foreignKey]['difference'], app('steam')->positive($journal['foreign_amount'])
|
$response[$foreignKey]['difference'],
|
||||||
|
app('steam')->positive($journal['foreign_amount'])
|
||||||
);
|
);
|
||||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference'];
|
$response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; // intentional float
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -69,6 +69,7 @@ class DestroyController extends Controller
|
|||||||
public function destroy(Account $account): JsonResponse
|
public function destroy(Account $account): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($account, null);
|
$this->repository->destroy($account, null);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -73,7 +73,7 @@ class ListController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/accounts/listAttachmentByAccount
|
* https://api-docs.firefly-iii.org/#/accounts/listAttachmentByAccount
|
||||||
*
|
*
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -82,7 +82,7 @@ class ListController extends Controller
|
|||||||
public function attachments(Account $account): JsonResponse
|
public function attachments(Account $account): JsonResponse
|
||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$collection = $this->repository->getAttachments($account);
|
$collection = $this->repository->getAttachments($account);
|
||||||
|
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@@ -90,7 +90,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.accounts.attachments', [$account->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.accounts.attachments', [$account->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var AttachmentTransformer $transformer */
|
/** @var AttachmentTransformer $transformer */
|
||||||
$transformer = app(AttachmentTransformer::class);
|
$transformer = app(AttachmentTransformer::class);
|
||||||
@@ -106,7 +106,7 @@ class ListController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/accounts/listPiggyBankByAccount
|
* https://api-docs.firefly-iii.org/#/accounts/listPiggyBankByAccount
|
||||||
*
|
*
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -118,7 +118,7 @@ class ListController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of budgets. Count it and split it.
|
// get list of budgets. Count it and split it.
|
||||||
$collection = $this->repository->getPiggyBanks($account);
|
$collection = $this->repository->getPiggyBanks($account);
|
||||||
@@ -127,7 +127,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.accounts.piggy_banks', [$account->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.accounts.piggy_banks', [$account->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var PiggyBankTransformer $transformer */
|
/** @var PiggyBankTransformer $transformer */
|
||||||
$transformer = app(PiggyBankTransformer::class);
|
$transformer = app(PiggyBankTransformer::class);
|
||||||
@@ -137,7 +137,6 @@ class ListController extends Controller
|
|||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,15 +147,15 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function transactions(Request $request, Account $account): JsonResponse
|
public function transactions(Request $request, Account $account): JsonResponse
|
||||||
{
|
{
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$type = $request->get('type') ?? 'default';
|
$type = $request->get('type') ?? 'default';
|
||||||
$this->parameters->set('type', $type);
|
$this->parameters->set('type', $type);
|
||||||
|
|
||||||
@@ -181,7 +180,7 @@ class ListController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$paginator->setPath(route('api.v1.accounts.transactions', [$account->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.accounts.transactions', [$account->id]).$this->buildParams());
|
||||||
$groups = $paginator->getCollection();
|
$groups = $paginator->getCollection();
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
|
@@ -71,7 +71,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -85,7 +85,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$types = $this->mapAccountTypes($this->parameters->get('type'));
|
$types = $this->mapAccountTypes($this->parameters->get('type'));
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of accounts. Count it and split it.
|
// get list of accounts. Count it and split it.
|
||||||
$this->repository->resetAccountOrder();
|
$this->repository->resetAccountOrder();
|
||||||
@@ -99,7 +99,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($accounts, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($accounts, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.accounts.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.accounts.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var AccountTransformer $transformer */
|
/** @var AccountTransformer $transformer */
|
||||||
$transformer = app(AccountTransformer::class);
|
$transformer = app(AccountTransformer::class);
|
||||||
@@ -117,7 +117,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Show single instance.
|
* Show single instance.
|
||||||
*
|
*
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -135,5 +135,4 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* Store a new instance.
|
* Store a new instance.
|
||||||
*
|
*
|
||||||
* @param StoreRequest $request
|
* @param StoreRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -82,5 +82,4 @@ class StoreController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -66,8 +66,8 @@ class UpdateController extends Controller
|
|||||||
*
|
*
|
||||||
* Update account.
|
* Update account.
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param Account $account
|
* @param Account $account
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -75,7 +75,7 @@ class UpdateController extends Controller
|
|||||||
{
|
{
|
||||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||||
$data = $request->getUpdateData();
|
$data = $request->getUpdateData();
|
||||||
$data['type'] = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
$data['type'] = config('firefly.shortNamesByFullName.'.$account->accountType->type);
|
||||||
$account = $this->repository->update($account, $data);
|
$account = $this->repository->update($account, $data);
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$account->refresh();
|
$account->refresh();
|
||||||
|
@@ -66,13 +66,14 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function destroy(Attachment $attachment): JsonResponse
|
public function destroy(Attachment $attachment): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($attachment);
|
$this->repository->destroy($attachment);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -71,7 +71,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Download an attachment.
|
* Download an attachment.
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return LaravelResponse
|
* @return LaravelResponse
|
||||||
@@ -97,13 +97,13 @@ class ShowController extends Controller
|
|||||||
$response
|
$response
|
||||||
->header('Content-Description', 'File Transfer')
|
->header('Content-Description', 'File Transfer')
|
||||||
->header('Content-Type', 'application/octet-stream')
|
->header('Content-Type', 'application/octet-stream')
|
||||||
->header('Content-Disposition', 'attachment; filename=' . $quoted)
|
->header('Content-Disposition', 'attachment; filename='.$quoted)
|
||||||
->header('Content-Transfer-Encoding', 'binary')
|
->header('Content-Transfer-Encoding', 'binary')
|
||||||
->header('Connection', 'Keep-Alive')
|
->header('Connection', 'Keep-Alive')
|
||||||
->header('Expires', '0')
|
->header('Expires', '0')
|
||||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||||
->header('Pragma', 'public')
|
->header('Pragma', 'public')
|
||||||
->header('Content-Length', (string) strlen($content));
|
->header('Content-Length', (string)strlen($content));
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ class ShowController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of attachments. Count it and split it.
|
// get list of attachments. Count it and split it.
|
||||||
$collection = $this->repository->get();
|
$collection = $this->repository->get();
|
||||||
@@ -134,7 +134,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.attachments.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.attachments.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var AttachmentTransformer $transformer */
|
/** @var AttachmentTransformer $transformer */
|
||||||
$transformer = app(AttachmentTransformer::class);
|
$transformer = app(AttachmentTransformer::class);
|
||||||
@@ -152,7 +152,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -71,7 +71,7 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*
|
*
|
||||||
* @param StoreRequest $request
|
* @param StoreRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -97,8 +97,8 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -67,8 +67,8 @@ class UpdateController extends Controller
|
|||||||
*
|
*
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param Attachment $attachment
|
* @param Attachment $attachment
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* DestroyController.php
|
|
||||||
* Copyright (c) 2021 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\AvailableBudget;
|
|
||||||
|
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
|
||||||
use FireflyIII\Models\AvailableBudget;
|
|
||||||
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
|
|
||||||
use FireflyIII\User;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DestroyController
|
|
||||||
*/
|
|
||||||
class DestroyController extends Controller
|
|
||||||
{
|
|
||||||
private AvailableBudgetRepositoryInterface $abRepository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AvailableBudgetController constructor.
|
|
||||||
*
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
$this->middleware(
|
|
||||||
function ($request, $next) {
|
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
|
||||||
$this->abRepository->setUser($user);
|
|
||||||
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This endpoint is documented at:
|
|
||||||
* https://api-docs.firefly-iii.org/#/available_budgets/listAvailableBudget
|
|
||||||
*
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param AvailableBudget $availableBudget
|
|
||||||
*
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
|
||||||
public function destroy(AvailableBudget $availableBudget): JsonResponse
|
|
||||||
{
|
|
||||||
$this->abRepository->destroyAvailableBudget($availableBudget);
|
|
||||||
|
|
||||||
return response()->json([], 204);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -77,7 +77,7 @@ class ShowController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
$start = $this->parameters->get('start');
|
$start = $this->parameters->get('start');
|
||||||
$end = $this->parameters->get('end');
|
$end = $this->parameters->get('end');
|
||||||
@@ -89,7 +89,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($availableBudgets, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($availableBudgets, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.available_budgets.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.available_budgets.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var AvailableBudgetTransformer $transformer */
|
/** @var AvailableBudgetTransformer $transformer */
|
||||||
$transformer = app(AvailableBudgetTransformer::class);
|
$transformer = app(AvailableBudgetTransformer::class);
|
||||||
@@ -107,7 +107,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param AvailableBudget $availableBudget
|
* @param AvailableBudget $availableBudget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -124,5 +124,4 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,105 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* StoreController.php
|
|
||||||
* Copyright (c) 2021 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\AvailableBudget;
|
|
||||||
|
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
|
||||||
use FireflyIII\Api\V1\Requests\Models\AvailableBudget\Request;
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
|
||||||
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
|
|
||||||
use FireflyIII\Transformers\AvailableBudgetTransformer;
|
|
||||||
use FireflyIII\User;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use JsonException;
|
|
||||||
use League\Fractal\Resource\Item;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class StoreController
|
|
||||||
*/
|
|
||||||
class StoreController extends Controller
|
|
||||||
{
|
|
||||||
private AvailableBudgetRepositoryInterface $abRepository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AvailableBudgetController constructor.
|
|
||||||
*
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
$this->middleware(
|
|
||||||
function ($request, $next) {
|
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
|
||||||
$this->abRepository->setUser($user);
|
|
||||||
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This endpoint is documented at:
|
|
||||||
* https://api-docs.firefly-iii.org/#/available_budgets/storeAvailableBudget
|
|
||||||
*
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
* @throws FireflyException
|
|
||||||
* @throws JsonException
|
|
||||||
*/
|
|
||||||
public function store(Request $request): JsonResponse
|
|
||||||
{
|
|
||||||
$data = $request->getAll();
|
|
||||||
$data['start']->startOfDay();
|
|
||||||
$data['end']->endOfDay();
|
|
||||||
|
|
||||||
// currency is not mandatory:
|
|
||||||
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
|
|
||||||
$factory = app(TransactionCurrencyFactory::class);
|
|
||||||
$currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null);
|
|
||||||
$data['currency_id'] = $currency->id;
|
|
||||||
unset($data['currency_code']);
|
|
||||||
}
|
|
||||||
if (!array_key_exists('currency_id', $data)) {
|
|
||||||
$currency = app('amount')->getDefaultCurrencyByUser(auth()->user());
|
|
||||||
$data['currency_id'] = $currency->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$availableBudget = $this->abRepository->store($data);
|
|
||||||
$manager = $this->getManager();
|
|
||||||
|
|
||||||
/** @var AvailableBudgetTransformer $transformer */
|
|
||||||
$transformer = app(AvailableBudgetTransformer::class);
|
|
||||||
$transformer->setParameters($this->parameters);
|
|
||||||
|
|
||||||
$resource = new Item($availableBudget, $transformer, 'available_budgets');
|
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,100 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* UpdateController.php
|
|
||||||
* Copyright (c) 2021 james@firefly-iii.org
|
|
||||||
*
|
|
||||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\AvailableBudget;
|
|
||||||
|
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
|
||||||
use FireflyIII\Api\V1\Requests\Models\AvailableBudget\Request;
|
|
||||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
|
||||||
use FireflyIII\Models\AvailableBudget;
|
|
||||||
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
|
|
||||||
use FireflyIII\Transformers\AvailableBudgetTransformer;
|
|
||||||
use FireflyIII\User;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use League\Fractal\Resource\Item;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class UpdateController
|
|
||||||
*/
|
|
||||||
class UpdateController extends Controller
|
|
||||||
{
|
|
||||||
private AvailableBudgetRepositoryInterface $abRepository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AvailableBudgetController constructor.
|
|
||||||
*
|
|
||||||
* @codeCoverageIgnore
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
$this->middleware(
|
|
||||||
function ($request, $next) {
|
|
||||||
/** @var User $user */
|
|
||||||
$user = auth()->user();
|
|
||||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
|
||||||
$this->abRepository->setUser($user);
|
|
||||||
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This endpoint is documented at:
|
|
||||||
* https://api-docs.firefly-iii.org/#/available_budgets/updateAvailableBudget
|
|
||||||
*
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param AvailableBudget $availableBudget
|
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
|
||||||
public function update(Request $request, AvailableBudget $availableBudget): JsonResponse
|
|
||||||
{
|
|
||||||
$data = $request->getAll();
|
|
||||||
|
|
||||||
// find and validate currency ID
|
|
||||||
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
|
|
||||||
$factory = app(TransactionCurrencyFactory::class);
|
|
||||||
$currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null) ?? app('amount')->getDefaultCurrency();
|
|
||||||
$currency->enabled = true;
|
|
||||||
$currency->save();
|
|
||||||
unset($data['currency_code']);
|
|
||||||
$data['currency_id'] = $currency->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->abRepository->updateAvailableBudget($availableBudget, $data);
|
|
||||||
$manager = $this->getManager();
|
|
||||||
|
|
||||||
/** @var AvailableBudgetTransformer $transformer */
|
|
||||||
$transformer = app(AvailableBudgetTransformer::class);
|
|
||||||
$transformer->setParameters($this->parameters);
|
|
||||||
|
|
||||||
$resource = new Item($availableBudget, $transformer, 'available_budgets');
|
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -59,7 +59,7 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -67,8 +67,8 @@ class DestroyController extends Controller
|
|||||||
public function destroy(Bill $bill): JsonResponse
|
public function destroy(Bill $bill): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($bill);
|
$this->repository->destroy($bill);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -81,7 +81,7 @@ class ListController extends Controller
|
|||||||
public function attachments(Bill $bill): JsonResponse
|
public function attachments(Bill $bill): JsonResponse
|
||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$collection = $this->repository->getAttachments($bill);
|
$collection = $this->repository->getAttachments($bill);
|
||||||
|
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@@ -89,7 +89,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.bills.attachments', [$bill->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.bills.attachments', [$bill->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var AttachmentTransformer $transformer */
|
/** @var AttachmentTransformer $transformer */
|
||||||
$transformer = app(AttachmentTransformer::class);
|
$transformer = app(AttachmentTransformer::class);
|
||||||
@@ -107,7 +107,7 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* List all of them.
|
* List all of them.
|
||||||
*
|
*
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -118,7 +118,7 @@ class ListController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of budgets. Count it and split it.
|
// get list of budgets. Count it and split it.
|
||||||
$collection = $this->repository->getRulesForBill($bill);
|
$collection = $this->repository->getRulesForBill($bill);
|
||||||
@@ -127,7 +127,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($rules, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($rules, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.bills.rules', [$bill->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.bills.rules', [$bill->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var RuleTransformer $transformer */
|
/** @var RuleTransformer $transformer */
|
||||||
$transformer = app(RuleTransformer::class);
|
$transformer = app(RuleTransformer::class);
|
||||||
@@ -136,7 +136,6 @@ class ListController extends Controller
|
|||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -145,9 +144,9 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* Show all transactions.
|
* Show all transactions.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -155,7 +154,7 @@ class ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function transactions(Request $request, Bill $bill): JsonResponse
|
public function transactions(Request $request, Bill $bill): JsonResponse
|
||||||
{
|
{
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$type = $request->get('type') ?? 'default';
|
$type = $request->get('type') ?? 'default';
|
||||||
$this->parameters->set('type', $type);
|
$this->parameters->set('type', $type);
|
||||||
|
|
||||||
@@ -188,7 +187,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// get paginator.
|
// get paginator.
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$paginator->setPath(route('api.v1.bills.transactions', [$bill->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.bills.transactions', [$bill->id]).$this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
@@ -200,5 +199,4 @@ class ListController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ class ShowController extends Controller
|
|||||||
$this->repository->correctOrder();
|
$this->repository->correctOrder();
|
||||||
$bills = $this->repository->getBills();
|
$bills = $this->repository->getBills();
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$count = $bills->count();
|
$count = $bills->count();
|
||||||
$bills = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
$bills = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||||
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
|
||||||
@@ -95,7 +95,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Show the specified bill.
|
* Show the specified bill.
|
||||||
*
|
*
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
@@ -65,7 +65,7 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* Store a bill.
|
* Store a bill.
|
||||||
*
|
*
|
||||||
* @param StoreRequest $request
|
* @param StoreRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
|
@@ -62,8 +62,8 @@ class UpdateController extends Controller
|
|||||||
*
|
*
|
||||||
* Update a bill.
|
* Update a bill.
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -80,7 +80,5 @@ class UpdateController extends Controller
|
|||||||
$resource = new Item($bill, $transformer, 'bills');
|
$resource = new Item($bill, $transformer, 'bills');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -67,6 +67,7 @@ class DestroyController extends Controller
|
|||||||
public function destroy(Budget $budget): JsonResponse
|
public function destroy(Budget $budget): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($budget);
|
$this->repository->destroy($budget);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ class ListController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/budgets/listAttachmentByBudget
|
* https://api-docs.firefly-iii.org/#/budgets/listAttachmentByBudget
|
||||||
*
|
*
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -83,7 +83,7 @@ class ListController extends Controller
|
|||||||
public function attachments(Budget $budget): JsonResponse
|
public function attachments(Budget $budget): JsonResponse
|
||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$collection = $this->repository->getAttachments($budget);
|
$collection = $this->repository->getAttachments($budget);
|
||||||
|
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@@ -91,7 +91,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.budgets.attachments', [$budget->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.attachments', [$budget->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var AttachmentTransformer $transformer */
|
/** @var AttachmentTransformer $transformer */
|
||||||
$transformer = app(AttachmentTransformer::class);
|
$transformer = app(AttachmentTransformer::class);
|
||||||
@@ -109,7 +109,7 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -118,13 +118,13 @@ class ListController extends Controller
|
|||||||
public function budgetLimits(Budget $budget): JsonResponse
|
public function budgetLimits(Budget $budget): JsonResponse
|
||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$this->parameters->set('budget_id', $budget->id);
|
$this->parameters->set('budget_id', $budget->id);
|
||||||
$collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
|
$collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||||
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.budgets.budget_limits', [$budget->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.budget_limits', [$budget->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var BudgetLimitTransformer $transformer */
|
/** @var BudgetLimitTransformer $transformer */
|
||||||
$transformer = app(BudgetLimitTransformer::class);
|
$transformer = app(BudgetLimitTransformer::class);
|
||||||
@@ -141,9 +141,9 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* Show all transactions.
|
* Show all transactions.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -151,7 +151,7 @@ class ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function transactions(Request $request, Budget $budget): JsonResponse
|
public function transactions(Request $request, Budget $budget): JsonResponse
|
||||||
{
|
{
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// user can overrule page size with limit parameter.
|
// user can overrule page size with limit parameter.
|
||||||
$limit = $this->parameters->get('limit');
|
$limit = $this->parameters->get('limit');
|
||||||
@@ -189,7 +189,7 @@ class ListController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$paginator->setPath(route('api.v1.budgets.transactions', [$budget->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.transactions', [$budget->id]).$this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
@@ -207,7 +207,7 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* Show all transactions.
|
* Show all transactions.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -215,7 +215,7 @@ class ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function withoutBudget(Request $request): JsonResponse
|
public function withoutBudget(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// user can overrule page size with limit parameter.
|
// user can overrule page size with limit parameter.
|
||||||
$limit = $this->parameters->get('limit');
|
$limit = $this->parameters->get('limit');
|
||||||
@@ -253,7 +253,7 @@ class ListController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$paginator->setPath(route('api.v1.budgets.without-budget') . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.without-budget').$this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
@@ -264,5 +264,4 @@ class ListController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ class ShowController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of budgets. Count it and split it.
|
// get list of budgets. Count it and split it.
|
||||||
$collection = $this->repository->getBudgets();
|
$collection = $this->repository->getBudgets();
|
||||||
@@ -87,7 +87,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($budgets, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($budgets, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.budgets.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var BudgetTransformer $transformer */
|
/** @var BudgetTransformer $transformer */
|
||||||
$transformer = app(BudgetTransformer::class);
|
$transformer = app(BudgetTransformer::class);
|
||||||
@@ -102,7 +102,7 @@ class ShowController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Show a budget.
|
* Show a budget.
|
||||||
*
|
*
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -119,5 +119,4 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* Store a budget.
|
* Store a budget.
|
||||||
*
|
*
|
||||||
* @param StoreRequest $request
|
* @param StoreRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
|
@@ -62,8 +62,8 @@ class UpdateController extends Controller
|
|||||||
*
|
*
|
||||||
* Update a budget.
|
* Update a budget.
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -80,6 +80,5 @@ class UpdateController extends Controller
|
|||||||
$resource = new Item($budget, $transformer, 'budgets');
|
$resource = new Item($budget, $transformer, 'budgets');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -64,8 +64,8 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param BudgetLimit $budgetLimit
|
* @param BudgetLimit $budgetLimit
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -77,6 +77,7 @@ class DestroyController extends Controller
|
|||||||
throw new FireflyException('20028: The budget limit does not belong to the budget.');
|
throw new FireflyException('20028: The budget limit does not belong to the budget.');
|
||||||
}
|
}
|
||||||
$this->blRepository->destroyBudgetLimit($budgetLimit);
|
$this->blRepository->destroyBudgetLimit($budgetLimit);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -71,9 +71,9 @@ class ListController extends Controller
|
|||||||
* https://api-docs.firefly-iii.org/#/budgets/listTransactionByBudgetLimit
|
* https://api-docs.firefly-iii.org/#/budgets/listTransactionByBudgetLimit
|
||||||
* Show all transactions.
|
* Show all transactions.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param BudgetLimit $budgetLimit
|
* @param BudgetLimit $budgetLimit
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -81,7 +81,7 @@ class ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
||||||
{
|
{
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$type = $request->get('type') ?? 'default';
|
$type = $request->get('type') ?? 'default';
|
||||||
$this->parameters->set('type', $type);
|
$this->parameters->set('type', $type);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ class ListController extends Controller
|
|||||||
$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date);
|
$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date);
|
||||||
$collector->setTypes($types);
|
$collector->setTypes($types);
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$paginator->setPath(route('api.v1.budgets.limits.transactions', [$budget->id, $budgetLimit->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.limits.transactions', [$budget->id, $budgetLimit->id]).$this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
|
@@ -75,8 +75,8 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Display a listing of the budget limits for this budget.
|
* Display a listing of the budget limits for this budget.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -86,12 +86,12 @@ class ShowController extends Controller
|
|||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$manager->parseIncludes('budget');
|
$manager->parseIncludes('budget');
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
|
$collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||||
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.budgets.limits.index', [$budget->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.budgets.limits.index', [$budget->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var BudgetLimitTransformer $transformer */
|
/** @var BudgetLimitTransformer $transformer */
|
||||||
$transformer = app(BudgetLimitTransformer::class);
|
$transformer = app(BudgetLimitTransformer::class);
|
||||||
@@ -109,7 +109,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Display a listing of the budget limits for this budget.
|
* Display a listing of the budget limits for this budget.
|
||||||
*
|
*
|
||||||
* @param DateRequest $request
|
* @param DateRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -119,12 +119,12 @@ class ShowController extends Controller
|
|||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$manager->parseIncludes('budget');
|
$manager->parseIncludes('budget');
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$collection = $this->blRepository->getAllBudgetLimits($this->parameters->get('start'), $this->parameters->get('end'));
|
$collection = $this->blRepository->getAllBudgetLimits($this->parameters->get('start'), $this->parameters->get('end'));
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||||
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.budget-limits.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.budget-limits.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var BudgetLimitTransformer $transformer */
|
/** @var BudgetLimitTransformer $transformer */
|
||||||
$transformer = app(BudgetLimitTransformer::class);
|
$transformer = app(BudgetLimitTransformer::class);
|
||||||
@@ -140,16 +140,16 @@ class ShowController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/budgets/getBudgetLimit
|
* https://api-docs.firefly-iii.org/#/budgets/getBudgetLimit
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param BudgetLimit $budgetLimit
|
* @param BudgetLimit $budgetLimit
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function show(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
public function show(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
||||||
{
|
{
|
||||||
if ((int) $budget->id !== (int) $budgetLimit->budget_id) {
|
if ((int)$budget->id !== (int)$budgetLimit->budget_id) {
|
||||||
throw new FireflyException('20028: The budget limit does not belong to the budget.');
|
throw new FireflyException('20028: The budget limit does not belong to the budget.');
|
||||||
}
|
}
|
||||||
// continue!
|
// continue!
|
||||||
@@ -163,5 +163,4 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -65,8 +65,8 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*
|
*
|
||||||
* @param StoreRequest $request
|
* @param StoreRequest $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -67,17 +67,16 @@ class UpdateController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param Budget $budget
|
* @param Budget $budget
|
||||||
* @param BudgetLimit $budgetLimit
|
* @param BudgetLimit $budgetLimit
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function update(UpdateRequest $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
public function update(UpdateRequest $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
||||||
{
|
{
|
||||||
|
if ((int)$budget->id !== (int)$budgetLimit->budget_id) {
|
||||||
if ((int) $budget->id !== (int) $budgetLimit->budget_id) {
|
|
||||||
throw new FireflyException('20028: The budget limit does not belong to the budget.');
|
throw new FireflyException('20028: The budget limit does not belong to the budget.');
|
||||||
}
|
}
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
@@ -92,6 +91,5 @@ class UpdateController extends Controller
|
|||||||
$resource = new Item($budgetLimit, $transformer, 'budget_limits');
|
$resource = new Item($budgetLimit, $transformer, 'budget_limits');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -67,6 +67,7 @@ class DestroyController extends Controller
|
|||||||
public function destroy(Category $category): JsonResponse
|
public function destroy(Category $category): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($category);
|
$this->repository->destroy($category);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,7 @@ class ListController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/categories/listAttachmentByCategory
|
* https://api-docs.firefly-iii.org/#/categories/listAttachmentByCategory
|
||||||
*
|
*
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -78,7 +78,7 @@ class ListController extends Controller
|
|||||||
public function attachments(Category $category): JsonResponse
|
public function attachments(Category $category): JsonResponse
|
||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$collection = $this->repository->getAttachments($category);
|
$collection = $this->repository->getAttachments($category);
|
||||||
|
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@@ -86,7 +86,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.categories.attachments', [$category->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.categories.attachments', [$category->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var AttachmentTransformer $transformer */
|
/** @var AttachmentTransformer $transformer */
|
||||||
$transformer = app(AttachmentTransformer::class);
|
$transformer = app(AttachmentTransformer::class);
|
||||||
@@ -104,9 +104,9 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* Show all transactions.
|
* Show all transactions.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -114,7 +114,7 @@ class ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function transactions(Request $request, Category $category): JsonResponse
|
public function transactions(Request $request, Category $category): JsonResponse
|
||||||
{
|
{
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$type = $request->get('type') ?? 'default';
|
$type = $request->get('type') ?? 'default';
|
||||||
$this->parameters->set('type', $type);
|
$this->parameters->set('type', $type);
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ class ListController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$paginator->setPath(route('api.v1.categories.transactions', [$category->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.categories.transactions', [$category->id]).$this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
@@ -157,5 +157,4 @@ class ListController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ class ShowController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of budgets. Count it and split it.
|
// get list of budgets. Count it and split it.
|
||||||
$collection = $this->repository->getCategories();
|
$collection = $this->repository->getCategories();
|
||||||
@@ -83,7 +83,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($categories, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($categories, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.categories.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.categories.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var CategoryTransformer $transformer */
|
/** @var CategoryTransformer $transformer */
|
||||||
$transformer = app(CategoryTransformer::class);
|
$transformer = app(CategoryTransformer::class);
|
||||||
@@ -100,7 +100,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Show the category.
|
* Show the category.
|
||||||
*
|
*
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
@@ -62,7 +62,7 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* Store new category.
|
* Store new category.
|
||||||
*
|
*
|
||||||
* @param StoreRequest $request
|
* @param StoreRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -80,5 +80,4 @@ class StoreController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -62,8 +62,8 @@ class UpdateController extends Controller
|
|||||||
*
|
*
|
||||||
* Update the category.
|
* Update the category.
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param Category $category
|
* @param Category $category
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -80,6 +80,5 @@ class UpdateController extends Controller
|
|||||||
$resource = new Item($category, $transformer, 'categories');
|
$resource = new Item($category, $transformer, 'categories');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param ObjectGroup $objectGroup
|
* @param ObjectGroup $objectGroup
|
||||||
*
|
*
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
@@ -70,6 +70,7 @@ class DestroyController extends Controller
|
|||||||
public function destroy(ObjectGroup $objectGroup): JsonResponse
|
public function destroy(ObjectGroup $objectGroup): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($objectGroup);
|
$this->repository->destroy($objectGroup);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -68,7 +68,7 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* List all bills in this object group
|
* List all bills in this object group
|
||||||
*
|
*
|
||||||
* @param ObjectGroup $objectGroup
|
* @param ObjectGroup $objectGroup
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -78,7 +78,7 @@ class ListController extends Controller
|
|||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
// get list of piggy banks. Count it and split it.
|
// get list of piggy banks. Count it and split it.
|
||||||
$collection = $this->repository->getBills($objectGroup);
|
$collection = $this->repository->getBills($objectGroup);
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@@ -86,7 +86,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.currencies.bills', [$objectGroup->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.currencies.bills', [$objectGroup->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var BillTransformer $transformer */
|
/** @var BillTransformer $transformer */
|
||||||
$transformer = app(BillTransformer::class);
|
$transformer = app(BillTransformer::class);
|
||||||
@@ -104,7 +104,7 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* List all piggies under the object group.
|
* List all piggies under the object group.
|
||||||
*
|
*
|
||||||
* @param ObjectGroup $objectGroup
|
* @param ObjectGroup $objectGroup
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -116,7 +116,7 @@ class ListController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of piggy banks. Count it and split it.
|
// get list of piggy banks. Count it and split it.
|
||||||
$collection = $this->repository->getPiggyBanks($objectGroup);
|
$collection = $this->repository->getPiggyBanks($objectGroup);
|
||||||
@@ -125,7 +125,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.object-groups.piggy_banks', [$objectGroup->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.object-groups.piggy_banks', [$objectGroup->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var PiggyBankTransformer $transformer */
|
/** @var PiggyBankTransformer $transformer */
|
||||||
$transformer = app(PiggyBankTransformer::class);
|
$transformer = app(PiggyBankTransformer::class);
|
||||||
@@ -135,6 +135,5 @@ class ListController extends Controller
|
|||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -69,7 +69,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -80,7 +80,7 @@ class ShowController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
$this->repository->resetOrder();
|
$this->repository->resetOrder();
|
||||||
$collection = $this->repository->get();
|
$collection = $this->repository->get();
|
||||||
@@ -89,7 +89,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($objectGroups, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($objectGroups, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.object-groups.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.object-groups.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var ObjectGroupTransformer $transformer */
|
/** @var ObjectGroupTransformer $transformer */
|
||||||
$transformer = app(ObjectGroupTransformer::class);
|
$transformer = app(ObjectGroupTransformer::class);
|
||||||
@@ -107,7 +107,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* Show single instance.
|
* Show single instance.
|
||||||
*
|
*
|
||||||
* @param ObjectGroup $objectGroup
|
* @param ObjectGroup $objectGroup
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -63,8 +63,8 @@ class UpdateController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/object_groups/updateObjectGroup
|
* https://api-docs.firefly-iii.org/#/object_groups/updateObjectGroup
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param ObjectGroup $objectGroup
|
* @param ObjectGroup $objectGroup
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
|
@@ -59,7 +59,7 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Delete the resource.
|
* Delete the resource.
|
||||||
*
|
*
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -67,6 +67,7 @@ class DestroyController extends Controller
|
|||||||
public function destroy(PiggyBank $piggyBank): JsonResponse
|
public function destroy(PiggyBank $piggyBank): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($piggyBank);
|
$this->repository->destroy($piggyBank);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ class ListController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/#/piggy_banks/listAttachmentByPiggyBank
|
* https://api-docs.firefly-iii.org/#/piggy_banks/listAttachmentByPiggyBank
|
||||||
*
|
*
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -72,7 +72,7 @@ class ListController extends Controller
|
|||||||
public function attachments(PiggyBank $piggyBank): JsonResponse
|
public function attachments(PiggyBank $piggyBank): JsonResponse
|
||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$collection = $this->repository->getAttachments($piggyBank);
|
$collection = $this->repository->getAttachments($piggyBank);
|
||||||
|
|
||||||
$count = $collection->count();
|
$count = $collection->count();
|
||||||
@@ -80,7 +80,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($attachments, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.piggy_banks.attachments', [$piggyBank->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.piggy_banks.attachments', [$piggyBank->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var AttachmentTransformer $transformer */
|
/** @var AttachmentTransformer $transformer */
|
||||||
$transformer = app(AttachmentTransformer::class);
|
$transformer = app(AttachmentTransformer::class);
|
||||||
@@ -98,7 +98,7 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* List single resource.
|
* List single resource.
|
||||||
*
|
*
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -107,7 +107,7 @@ class ListController extends Controller
|
|||||||
public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse
|
public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse
|
||||||
{
|
{
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
$collection = $this->repository->getEvents($piggyBank);
|
$collection = $this->repository->getEvents($piggyBank);
|
||||||
@@ -116,7 +116,7 @@ class ListController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($events, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($events, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.piggy_banks.events', [$piggyBank->id]) . $this->buildParams());
|
$paginator->setPath(route('api.v1.piggy_banks.events', [$piggyBank->id]).$this->buildParams());
|
||||||
|
|
||||||
/** @var PiggyBankEventTransformer $transformer */
|
/** @var PiggyBankEventTransformer $transformer */
|
||||||
$transformer = app(PiggyBankEventTransformer::class);
|
$transformer = app(PiggyBankEventTransformer::class);
|
||||||
@@ -126,6 +126,5 @@ class ListController extends Controller
|
|||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -73,7 +73,7 @@ class ShowController extends Controller
|
|||||||
{
|
{
|
||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of budgets. Count it and split it.
|
// get list of budgets. Count it and split it.
|
||||||
$collection = $this->repository->getPiggyBanks();
|
$collection = $this->repository->getPiggyBanks();
|
||||||
@@ -82,7 +82,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.piggy_banks.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.piggy_banks.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var PiggyBankTransformer $transformer */
|
/** @var PiggyBankTransformer $transformer */
|
||||||
$transformer = app(PiggyBankTransformer::class);
|
$transformer = app(PiggyBankTransformer::class);
|
||||||
@@ -92,7 +92,6 @@ class ShowController extends Controller
|
|||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,7 +100,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* List single resource.
|
* List single resource.
|
||||||
*
|
*
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -117,6 +116,5 @@ class ShowController extends Controller
|
|||||||
$resource = new Item($piggyBank, $transformer, 'piggy_banks');
|
$resource = new Item($piggyBank, $transformer, 'piggy_banks');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@ class StoreController extends Controller
|
|||||||
*
|
*
|
||||||
* Store new object.
|
* Store new object.
|
||||||
*
|
*
|
||||||
* @param StoreRequest $request
|
* @param StoreRequest $request
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
|
@@ -62,8 +62,8 @@ class UpdateController extends Controller
|
|||||||
*
|
*
|
||||||
* Update piggy bank.
|
* Update piggy bank.
|
||||||
*
|
*
|
||||||
* @param UpdateRequest $request
|
* @param UpdateRequest $request
|
||||||
* @param PiggyBank $piggyBank
|
* @param PiggyBank $piggyBank
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
@@ -84,6 +84,5 @@ class UpdateController extends Controller
|
|||||||
$resource = new Item($piggyBank, $transformer, 'piggy_banks');
|
$resource = new Item($piggyBank, $transformer, 'piggy_banks');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -59,7 +59,7 @@ class DestroyController extends Controller
|
|||||||
*
|
*
|
||||||
* Delete the resource.
|
* Delete the resource.
|
||||||
*
|
*
|
||||||
* @param Recurrence $recurrence
|
* @param Recurrence $recurrence
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@@ -67,6 +67,7 @@ class DestroyController extends Controller
|
|||||||
public function destroy(Recurrence $recurrence): JsonResponse
|
public function destroy(Recurrence $recurrence): JsonResponse
|
||||||
{
|
{
|
||||||
$this->repository->destroy($recurrence);
|
$this->repository->destroy($recurrence);
|
||||||
|
app('preferences')->mark();
|
||||||
|
|
||||||
return response()->json([], 204);
|
return response()->json([], 204);
|
||||||
}
|
}
|
||||||
|
@@ -69,8 +69,8 @@ class ListController extends Controller
|
|||||||
*
|
*
|
||||||
* Show transactions for this recurrence.
|
* Show transactions for this recurrence.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param Recurrence $recurrence
|
* @param Recurrence $recurrence
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
@@ -78,7 +78,7 @@ class ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function transactions(Request $request, Recurrence $recurrence): JsonResponse
|
public function transactions(Request $request, Recurrence $recurrence): JsonResponse
|
||||||
{
|
{
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
$type = $request->get('type') ?? 'default';
|
$type = $request->get('type') ?? 'default';
|
||||||
$this->parameters->set('type', $type);
|
$this->parameters->set('type', $type);
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ class ListController extends Controller
|
|||||||
$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
|
$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
|
||||||
}
|
}
|
||||||
$paginator = $collector->getPaginatedGroups();
|
$paginator = $collector->getPaginatedGroups();
|
||||||
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.transactions.index').$this->buildParams());
|
||||||
$transactions = $paginator->getCollection();
|
$transactions = $paginator->getCollection();
|
||||||
|
|
||||||
/** @var TransactionGroupTransformer $transformer */
|
/** @var TransactionGroupTransformer $transformer */
|
||||||
|
@@ -74,7 +74,7 @@ class ShowController extends Controller
|
|||||||
$manager = $this->getManager();
|
$manager = $this->getManager();
|
||||||
|
|
||||||
// types to get, page size:
|
// types to get, page size:
|
||||||
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
|
||||||
|
|
||||||
// get list of budgets. Count it and split it.
|
// get list of budgets. Count it and split it.
|
||||||
$collection = $this->repository->get();
|
$collection = $this->repository->get();
|
||||||
@@ -83,7 +83,7 @@ class ShowController extends Controller
|
|||||||
|
|
||||||
// make paginator:
|
// make paginator:
|
||||||
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
|
||||||
$paginator->setPath(route('api.v1.recurrences.index') . $this->buildParams());
|
$paginator->setPath(route('api.v1.recurrences.index').$this->buildParams());
|
||||||
|
|
||||||
/** @var RecurrenceTransformer $transformer */
|
/** @var RecurrenceTransformer $transformer */
|
||||||
$transformer = app(RecurrenceTransformer::class);
|
$transformer = app(RecurrenceTransformer::class);
|
||||||
@@ -93,7 +93,6 @@ class ShowController extends Controller
|
|||||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,7 +101,7 @@ class ShowController extends Controller
|
|||||||
*
|
*
|
||||||
* List single resource.
|
* List single resource.
|
||||||
*
|
*
|
||||||
* @param Recurrence $recurrence
|
* @param Recurrence $recurrence
|
||||||
*
|
*
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user