mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-08-17 11:16:39 +00:00
Compare commits
662 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bd556f1934 | ||
|
ae367aa736 | ||
|
3ccff2969b | ||
|
530abb1da6 | ||
|
9fe70fb8d8 | ||
|
b0215a23fb | ||
|
48735b1a5b | ||
|
3c0b802667 | ||
|
9bfad07f8c | ||
|
5c91da80e1 | ||
|
e465c93ffc | ||
|
8e56fa4ef8 | ||
|
f56de6e719 | ||
|
86ba1d151a | ||
|
8d24db14e9 | ||
|
cead122d96 | ||
|
b7dd335fb7 | ||
|
20a7092fe3 | ||
|
1d3da33e1d | ||
|
e36675e232 | ||
|
aa8588758a | ||
|
47a58738d4 | ||
|
e0a31d29a4 | ||
|
45369868ad | ||
|
639c51d651 | ||
|
3d424972cc | ||
|
96fd4da6d8 | ||
|
a97a0d461d | ||
|
8d3170785e | ||
|
ae373a15c5 | ||
|
1f342ed592 | ||
|
3e04f14665 | ||
|
dbf83df363 | ||
|
15bfc0d6fa | ||
|
f3fc1d8382 | ||
|
07cb7dd06e | ||
|
38624442d1 | ||
|
258dfb3d11 | ||
|
51ddfcdaaa | ||
|
2a0acdbb27 | ||
|
99bd28f21e | ||
|
643ae91bb5 | ||
|
591e3ab3ec | ||
|
edd7aed691 | ||
|
2e89586559 | ||
|
173f593a7e | ||
|
d4839c8818 | ||
|
a122dba0ad | ||
|
ae813a536e | ||
|
b9d174238b | ||
|
fbf5adbe79 | ||
|
c676a65f93 | ||
|
5ab8fbddcb | ||
|
b942fa4b09 | ||
|
8ee358551c | ||
|
a5f3b4533b | ||
|
e258efe1bf | ||
|
f9a213e06f | ||
|
05bd732e7c | ||
|
70050678c5 | ||
|
6a649f2f42 | ||
|
6912e05677 | ||
|
c78fa8eaea | ||
|
5a06e3523b | ||
|
b34cb0428b | ||
|
ce3c866168 | ||
|
4ada2f3e3c | ||
|
ad739c1d84 | ||
|
60af2c4232 | ||
|
cc69f50106 | ||
|
0f57094b17 | ||
|
dad738ae42 | ||
|
3df05eb63c | ||
|
57b83dd239 | ||
|
1539dcffd5 | ||
|
b4a09efb8b | ||
|
e82b372f75 | ||
|
83a89181bc | ||
|
b1e08b1084 | ||
|
0eb582ab3b | ||
|
07b58b4200 | ||
|
8807f04599 | ||
|
4657d34ae4 | ||
|
79951453cd | ||
|
5291f485ac | ||
|
ed75d84376 | ||
|
a7011376cb | ||
|
6c4bd84b66 | ||
|
c4418857e6 | ||
|
5d316ea26a | ||
|
4a0887c978 | ||
|
dbfceafb02 | ||
|
4db73285b7 | ||
|
876ea8bb07 | ||
|
e0e90845e7 | ||
|
f1223a5a3f | ||
|
1a3720bfaa | ||
|
1ddcc51c48 | ||
|
9f43ea3118 | ||
|
0fe4ac9ef5 | ||
|
d6d395eccd | ||
|
a26f5e2e6d | ||
|
849e006eda | ||
|
f70a4511c6 | ||
|
21ba311ecf | ||
|
fb0a100a7f | ||
|
2295110cf1 | ||
|
3c82c9af8b | ||
|
df78aa2f0d | ||
|
1ac18909b4 | ||
|
07d793e9f7 | ||
|
2a7b540a95 | ||
|
5cdecf7d04 | ||
|
1a0e6ffffb | ||
|
c0cfc60da6 | ||
|
9f831a8b3d | ||
|
ec3ee2f995 | ||
|
25ca02f541 | ||
|
776c59faea | ||
|
a4b1587a78 | ||
|
1d79eea69e | ||
|
b369b6e7b8 | ||
|
3832297d69 | ||
|
a7e64a130e | ||
|
73715dc0b9 | ||
|
8f66c93ad0 | ||
|
bcaf6402b5 | ||
|
16b0ee0c79 | ||
|
1033655615 | ||
|
6d327b98d4 | ||
|
585cfddfd7 | ||
|
a18cd23154 | ||
|
e421b29b01 | ||
|
e6dc881f56 | ||
|
01308e2076 | ||
|
26ab65c5aa | ||
|
68f398f97c | ||
|
eb04b11c30 | ||
|
29ff1648e2 | ||
|
13a1e45fc5 | ||
|
2ac3e130ec | ||
|
0436614643 | ||
|
427e11dac9 | ||
|
c3a4656e22 | ||
|
aab8eb467c | ||
|
84987dbe02 | ||
|
b7c2576970 | ||
|
57f32ec987 | ||
|
af73069409 | ||
|
1b06211152 | ||
|
8ee428eb17 | ||
|
07f3386ec7 | ||
|
94ae0bd7c3 | ||
|
8bd13b19a6 | ||
|
1118954db6 | ||
|
a798a9d50d | ||
|
9e11b504e1 | ||
|
2e65055c9a | ||
|
733607a8a9 | ||
|
30d40d1d57 | ||
|
a3eec9d5ec | ||
|
d9599b3448 | ||
|
3ca0fc15b1 | ||
|
e3a71b64f8 | ||
|
d403f4f9d3 | ||
|
e0577bddc5 | ||
|
38b88dce44 | ||
|
e1f99139f3 | ||
|
2e5d5f5a36 | ||
|
6b05c0fbd3 | ||
|
0667ccfc98 | ||
|
0d9c4ec25d | ||
|
e4fa385ac5 | ||
|
f8f2a10014 | ||
|
6502559341 | ||
|
3f50cd74da | ||
|
b32500c3e3 | ||
|
1f338f0062 | ||
|
76925585c3 | ||
|
55de722229 | ||
|
5b35e6ec4b | ||
|
80431bae4f | ||
|
68222e20f7 | ||
|
85c2e9cf1e | ||
|
c64227d90b | ||
|
83f9149606 | ||
|
2ad2d53f88 | ||
|
1fd455dbab | ||
|
9b86b20eff | ||
|
13712f7c5e | ||
|
789935cf1c | ||
|
03a4633a98 | ||
|
a252522e27 | ||
|
927d607b1a | ||
|
ef6af34af9 | ||
|
61f04fe4c1 | ||
|
ac1e026981 | ||
|
7225474621 | ||
|
86d6a2f581 | ||
|
f82a884783 | ||
|
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 | ||
|
93ae82691b | ||
|
e5d5e774dc | ||
|
e4db5f5a21 | ||
|
67434bb8a5 | ||
|
4d0ff86bfa | ||
|
7722ca2bf0 | ||
|
5878b2c427 | ||
|
81f781a823 | ||
|
24696bf800 | ||
|
27a576ae8a | ||
|
2b9996b844 | ||
|
742c84269b | ||
|
333c348117 | ||
|
445804a7f1 | ||
|
ee0116f112 | ||
|
03e176bd16 | ||
|
a84050a084 | ||
|
bef7887a8d | ||
|
5b8e01fbfb | ||
|
56b9b66352 | ||
|
6cfdc58cb1 | ||
|
dbf3e76ecc | ||
|
0022009dd5 | ||
|
e031fffe65 | ||
|
2a61633ab9 | ||
|
5e3f9f9bce | ||
|
8c320fd199 | ||
|
85a2a87806 | ||
|
d137b2938d | ||
|
d3a619cb15 | ||
|
cae0b1798a | ||
|
dd0c36d464 | ||
|
e58cf0d3c9 | ||
|
e389fd7d7c | ||
|
83b5ca69dd | ||
|
5e17cb5823 | ||
|
bb11e61034 | ||
|
eff631276e | ||
|
3fbaed2fdc | ||
|
80762616f3 | ||
|
8b9936044b | ||
|
db478711ed | ||
|
33f764088e | ||
|
23a8835758 | ||
|
034647a5ca | ||
|
9529721368 | ||
|
60d8bb2aab | ||
|
acd9685578 | ||
|
f16b679049 | ||
|
8d8f81c27d | ||
|
74610a5d55 | ||
|
409b4fe4d9 | ||
|
817a9f57c4 | ||
|
a702662e88 | ||
|
ebcf9b3be1 | ||
|
e7e3370baa | ||
|
21d4b396cc | ||
|
249b0c3377 | ||
|
0059ed7bde | ||
|
bd245d5c92 | ||
|
4e618a4d0b | ||
|
b57785a234 | ||
|
33f370359c | ||
|
c032ffd4f9 | ||
|
1a7d60ccc8 | ||
|
f52675068b | ||
|
f53923f16c | ||
|
2eebcb21f1 | ||
|
64ff5eed27 | ||
|
1667b88dcd | ||
|
b27fe59ab4 | ||
|
bdcd9825ec | ||
|
8edfb1460c | ||
|
914dc8596b | ||
|
6b64a39182 | ||
|
d28326cc89 | ||
|
e3181e90df | ||
|
486f25cd96 | ||
|
612a395eb2 | ||
|
b613b56d1e | ||
|
5999ee406c | ||
|
e348127770 | ||
|
e3bdc62ac4 | ||
|
b21461c824 | ||
|
f4af19e121 | ||
|
e229bd8121 | ||
|
d31fa743d0 | ||
|
4ad666d964 | ||
|
a96c830e3e | ||
|
9e41cd9c8c | ||
|
b3740e643a | ||
|
55ac76f663 | ||
|
49560ca6a6 | ||
|
e472c3520d | ||
|
39654249e4 | ||
|
77759d5580 | ||
|
22971ded84 | ||
|
841edcfffb | ||
|
05fe503456 | ||
|
da71d6172c | ||
|
f1457fcda6 | ||
|
a39553256e | ||
|
7e94f246e3 | ||
|
44637dfaab | ||
|
ee2b87d5fe | ||
|
db2485f97a | ||
|
38bdd6c36c | ||
|
536e054961 | ||
|
6dfe93bc19 | ||
|
d8a15e41e6 | ||
|
ca8a65af60 | ||
|
06cd75ba74 | ||
|
10d2a91d99 | ||
|
f2f3d69aa8 | ||
|
185842a891 | ||
|
681b0b9046 | ||
|
5f11272d49 | ||
|
ee9b651f0f | ||
|
9bfa52f3ce | ||
|
5714bd0749 | ||
|
749ce2ca9b | ||
|
697ad5b2b5 | ||
|
3b18a29adc | ||
|
36caf5d8ec | ||
|
9b7285ea84 | ||
|
6eaed9829b | ||
|
3c33ea959e | ||
|
80a732b32b | ||
|
a9f2741282 | ||
|
600fa388c1 | ||
|
45d7042405 | ||
|
2945f5fcde | ||
|
be1dff49fa | ||
|
665b78ebf5 | ||
|
416fe0c147 | ||
|
4ca346fc4d | ||
|
d2c52b47f1 | ||
|
c25b63d87b | ||
|
c120a908f3 | ||
|
07541fa08f | ||
|
0098a9c3c0 | ||
|
9f95d7a76f | ||
|
67126e46b9 | ||
|
c4c178b39d | ||
|
d9245f06f7 | ||
|
625ad14d7d | ||
|
23e5cf1b34 | ||
|
ad9efde2d0 | ||
|
10f2cf2481 | ||
|
f0416f5322 | ||
|
7104433a68 | ||
|
6add8765c4 | ||
|
4d12e6b58b | ||
|
7cf6066afd | ||
|
7cabc5db57 | ||
|
0ef99077d8 | ||
|
322b6d19d8 | ||
|
8045d3c170 | ||
|
ae0a675668 | ||
|
4d1b21f70d | ||
|
39a928d7f4 | ||
|
443b76388e | ||
|
4e394d6017 | ||
|
ea808b441b | ||
|
a464ad015f | ||
|
72ef7ac5e4 | ||
|
20ab457222 | ||
|
eb8f595541 | ||
|
6b6107fb00 | ||
|
1406abe7ae | ||
|
4e47641c76 | ||
|
0e8d2c5f0a | ||
|
9493046212 | ||
|
5c3b4d1663 | ||
|
5e8671d24b | ||
|
9118a153d5 | ||
|
56ff25285c | ||
|
196c504b3d | ||
|
68755137e4 | ||
|
19bef9b725 | ||
|
34e006d87b | ||
|
d215510124 | ||
|
9652c86782 | ||
|
cea8c4c217 | ||
|
03637a080c | ||
|
e27cffcf31 | ||
|
f52144d8d9 | ||
|
b12d72bef6 | ||
|
e0c9d3627e | ||
|
70ddbd743c | ||
|
5a02006a42 | ||
|
1b2106d43b | ||
|
86d15435a5 | ||
|
beed44f065 | ||
|
de3376c966 | ||
|
313676e3be | ||
|
86d4549874 | ||
|
c3bd46d7c0 | ||
|
46e97f95f9 | ||
|
f13dd18b6f | ||
|
c916fbbee9 | ||
|
d007db166a | ||
|
9c08b9f1d3 | ||
|
6b2619c5cc | ||
|
2ace09eb49 | ||
|
47167c06ae | ||
|
2d62fcac06 | ||
|
eeda74d79c | ||
|
4cf23a954f | ||
|
0bc1e6dbaa | ||
|
7da0c94e45 | ||
|
69b1985ac0 | ||
|
61eb8f325e | ||
|
35a8016744 | ||
|
9020ed158c | ||
|
2e3071d40f | ||
|
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 "mysql" for MySQL and MariaDB.
|
||||
# Use "sqlite" for SQLite.
|
||||
DB_CONNECTION=sqlite_test
|
||||
DB_CONNECTION=sqlite
|
||||
|
||||
# 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
|
||||
@@ -127,7 +127,6 @@ MAIL_ENCRYPTION=null
|
||||
MAILGUN_DOMAIN=
|
||||
MAILGUN_SECRET=
|
||||
|
||||
|
||||
# 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
|
||||
MAILGUN_ENDPOINT=api.mailgun.net
|
||||
@@ -136,7 +135,6 @@ MAILGUN_ENDPOINT=api.mailgun.net
|
||||
MANDRILL_SECRET=
|
||||
SPARKPOST_SECRET=
|
||||
|
||||
|
||||
# Firefly III can send you the following messages
|
||||
SEND_REGISTRATION_MAIL=true
|
||||
SEND_ERROR_MESSAGE=true
|
||||
@@ -223,7 +221,6 @@ ADLDAP_ADMIN_PASSWORD=
|
||||
ADLDAP_ACCOUNT_PREFIX=
|
||||
ADLDAP_ACCOUNT_SUFFIX=
|
||||
|
||||
|
||||
# LDAP authentication settings.
|
||||
ADLDAP_PASSWORD_SYNC=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,
|
||||
'declare_strict_types' => 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"
|
||||
}
|
||||
}
|
2059
.ci/php-cs-fixer/composer.lock
generated
Normal file
2059
.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:
|
||||
- '#is not allowed to extend#'
|
||||
- '#is neither abstract nor final#'
|
||||
- '#Control structures using switch should not be used\.#'
|
||||
- '#has a nullable return type declaration#'
|
||||
- '#with a nullable type declaration#'
|
||||
- '#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:
|
||||
- ../app/Http/Controllers
|
||||
- ../app/Support/Http/Controllers/RenderPartialViews.php
|
||||
- ../app/Support/Form/FormSupport.php
|
||||
- ../app/Support/Form/CurrencyForm.php
|
||||
- ../app/Support/Form/AccountForm.php
|
||||
- ../app/Support/Authentication/RemoteUserGuard.php
|
||||
-
|
||||
message: '#Control structures using switch should not be used.#'
|
||||
paths:
|
||||
- ../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/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:
|
||||
- ../app
|
||||
- ../database
|
||||
- ../routes
|
||||
- ../config
|
||||
- ../bootstrap/app.php
|
||||
|
||||
# The level 8 is the highest level. original was 5
|
||||
level: 3
|
||||
level: 4
|
||||
|
||||
|
@@ -23,11 +23,13 @@
|
||||
# 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
|
||||
# cp .ci/.env.ci .env
|
||||
|
||||
# Do static code analysis.
|
||||
# ./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
|
||||
echo 'The PHPstan report can be found in phpstan-report.txt'
|
||||
|
@@ -19,15 +19,43 @@
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
# 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
|
||||
# TODO no longer exists
|
||||
wget --quiet https://raw.githubusercontent.com/firefly-iii/test-data/main/test_db.sqlite -o storage/database/test_db.sqlite
|
||||
if [ -f "$FILE" ]; then
|
||||
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
|
||||
./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,4 +1,5 @@
|
||||
bg_BG
|
||||
ca_ES
|
||||
cs_CZ
|
||||
da_DK
|
||||
de_DE
|
||||
|
@@ -7,6 +7,7 @@ APP_DEBUG=false
|
||||
|
||||
# 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
|
||||
# The variable is used in some errors shown to users who aren't admin.
|
||||
SITE_OWNER=mail@example.com
|
||||
|
||||
# The encryption key for your sessions. Keep this very secure.
|
||||
@@ -157,9 +158,7 @@ MANDRILL_SECRET=
|
||||
SPARKPOST_SECRET=
|
||||
|
||||
# Firefly III can send you the following messages.
|
||||
SEND_REGISTRATION_MAIL=true
|
||||
SEND_ERROR_MESSAGE=true
|
||||
SEND_LOGIN_NEW_IP_WARNING=true
|
||||
|
||||
# These messages contain (sensitive) transaction information:
|
||||
SEND_REPORT_JOURNALS=true
|
||||
@@ -169,6 +168,12 @@ SEND_REPORT_JOURNALS=true
|
||||
# and disabled by default.
|
||||
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:
|
||||
MAP_DEFAULT_LAT=51.983333
|
||||
MAP_DEFAULT_LONG=5.916667
|
||||
|
14
.github/ISSUE_TEMPLATE/bug.yml
vendored
14
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -16,7 +16,7 @@ body:
|
||||
options:
|
||||
- label: ... [the documentation](https://docs.firefly-iii.org/) does not mention anything about my problem
|
||||
- label: ... there are no open or closed issues that are related to my problem
|
||||
- label: ... it's [definitely me, not you](https://github.com/firefly-iii/firefly-iii/blob/main/.github/its_you_not_me.md)
|
||||
- label: ... it's [definitely a Firefly III issue, not me](https://github.com/firefly-iii/firefly-iii/blob/main/.github/its_you_not_me.md)
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
@@ -27,18 +27,18 @@ body:
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: Please describe precisely what you'd expect to happen.
|
||||
label: Debug information
|
||||
description: Please provide the table from the /debug page. Do not add backticks or quotes.
|
||||
placeholder: The output from the /debug page
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Debug information
|
||||
description: Please provide the table from the /debug page
|
||||
placeholder: The output from the /debug page
|
||||
label: Expected behaviour
|
||||
description: Please describe precisely what you'd expect to happen. Be specific.
|
||||
validations:
|
||||
required: true
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
|
10
.github/ISSUE_TEMPLATE/fr.yml
vendored
10
.github/ISSUE_TEMPLATE/fr.yml
vendored
@@ -8,9 +8,9 @@ body:
|
||||
options:
|
||||
- label: I've read the [support guidelines](https://github.com/firefly-iii/firefly-iii/blob/main/.github/support.md)
|
||||
required: true
|
||||
- label: My request is not listed as [a very good idea, but unfortunately...](https://docs.firefly-iii.org/firefly-iii/about-firefly-iii/what-its-not/)
|
||||
- label: My request is not listed as [a very good idea, but unfortunately...](https://docs.firefly-iii.org/firefly-iii/more-information/what-its-not/)
|
||||
required: true
|
||||
- label: I've used [the search](https://github.com/firefly-iii/firefly-iii/issues?q=is%3Aissue) and this has not been discussed before.
|
||||
- label: I've used [the search](https://github.com/firefly-iii/firefly-iii/issues?q=is%3Aissue) and this has not been requested before.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
@@ -18,9 +18,9 @@ body:
|
||||
label: Description
|
||||
description: Please describe your feature request
|
||||
placeholder: |
|
||||
- I would like Firefly III to do ABC.
|
||||
- What if you would add feature XYZ?
|
||||
- Firefly III doesn't do DEF.
|
||||
- I would like Firefly III to do (thing).
|
||||
- What if you would add feature (feature here)?
|
||||
- Firefly III doesn't do (thing).
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
57
.github/mergify.yml
vendored
57
.github/mergify.yml
vendored
@@ -1,3 +1,4 @@
|
||||
---
|
||||
pull_request_rules:
|
||||
- name: Close all on main
|
||||
conditions:
|
||||
@@ -5,4 +6,58 @@ pull_request_rules:
|
||||
- -author~=^dependabot(|-preview)\[bot\]$
|
||||
actions:
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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**
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
* Detailed steps to reproduce the vulnerability (POC scripts, screenshots, and compressed packet captures are all 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.
|
||||
* Detailed steps to reproduce the vulnerability (POC scripts, screenshots, and compressed packet captures are all
|
||||
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.
|
||||
* List other projects or dependencies that were used in conjunction with Firefly III to produce the vulnerability.
|
||||
|
||||
## When to report a 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 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
|
||||
|
||||
The Firefly III developer will respond to vulnerability reports as follows:
|
||||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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**.
|
||||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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
|
||||
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 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
|
||||
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
|
||||
|
||||
|
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@@ -1,18 +1,12 @@
|
||||
name: Sonarcloud CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
- 5.8-dev
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: SonarCloud
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: SonarCloud Scan
|
||||
|
14
.github/workflows/cleanup.yml
vendored
14
.github/workflows/cleanup.yml
vendored
@@ -12,18 +12,18 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Prune cancelled/skipped runs
|
||||
uses: actions/github-script@v4
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
||||
script: |
|
||||
const cancelled = await github.actions.listWorkflowRunsForRepo({
|
||||
const cancelled = await github.rest.actions.listWorkflowRunsForRepo({
|
||||
owner: context.repo.owner,
|
||||
per_page: 100,
|
||||
repo: context.repo.repo,
|
||||
status: 'cancelled',
|
||||
});
|
||||
|
||||
const skipped = await github.actions.listWorkflowRunsForRepo({
|
||||
const skipped = await github.rest.actions.listWorkflowRunsForRepo({
|
||||
owner: context.repo.owner,
|
||||
per_page: 100,
|
||||
repo: context.repo.repo,
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
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({
|
||||
await github.rest.actions.deleteWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: run.id
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
}
|
||||
|
||||
- name: Prune runs older than 3 days
|
||||
uses: actions/github-script@v4
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
|
||||
script: |
|
||||
@@ -67,7 +67,7 @@ jobs:
|
||||
|
||||
for (const workflow of workflows) {
|
||||
for (let page = 0; page < pages; page += 1) {
|
||||
let response = await github.actions.listWorkflowRuns({
|
||||
let response = await github.rest.actions.listWorkflowRuns({
|
||||
owner: context.repo.owner,
|
||||
page: page,
|
||||
per_page: 100,
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
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({
|
||||
await github.rest.actions.deleteWorkflowRun({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: run[0]
|
||||
|
18
.github/workflows/closed-issues.yml
vendored
18
.github/workflows/closed-issues.yml
vendored
@@ -1,21 +1,21 @@
|
||||
name: "Reply to closed issue"
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- closed
|
||||
jobs:
|
||||
auto_comment:
|
||||
jobs:
|
||||
auto_comment:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
steps:
|
||||
-
|
||||
uses: aws-actions/closed-issue-message@v1
|
||||
with:
|
||||
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.
|
||||
- If the original bug is not actually fixed, please feel free to open a new issue. 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.
|
||||
|
2
.github/workflows/depsreview.yaml
vendored
2
.github/workflows/depsreview.yaml
vendored
@@ -11,4 +11,4 @@ jobs:
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@v3
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@v1
|
||||
uses: actions/dependency-review-action@v3
|
||||
|
8
.github/workflows/laravel.yml
vendored
8
.github/workflows/laravel.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Copy .env
|
||||
run: test -f .env || cp .ci/.env.ci .env
|
||||
- name: Prepare dependencies
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
- prepare
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Copy .env
|
||||
run: test -f .env || cp .ci/.env.ci .env
|
||||
- name: Download database
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
- prepare
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Copy .env
|
||||
run: test -f .env || cp .ci/.env.ci .env
|
||||
- name: Download database
|
||||
@@ -120,7 +120,7 @@ jobs:
|
||||
- prepare
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Copy .env
|
||||
run: test -f .env || cp .ci/.env.ci .env
|
||||
- name: Download database
|
||||
|
11
.github/workflows/lock.yml
vendored
11
.github/workflows/lock.yml
vendored
@@ -15,7 +15,16 @@ jobs:
|
||||
pull-requests: write # for dessant/lock-threads to lock PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2
|
||||
- uses: dessant/lock-threads@v4
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: '90'
|
||||
issue-comment: >
|
||||
Hi there! This is an automatic reply. `Share and enjoy`
|
||||
|
||||
This issue is now `locked` :lock:.
|
||||
|
||||
- If you feel there is more to be said about this specific issue, please feel free to open a new issue. Please refer to this issue for clarity.
|
||||
- Follow-up questions and comments can also be posted in a new [discussion](https://github.com/firefly-iii/firefly-iii/discussions/)
|
||||
|
||||
Thank you for your consideration.
|
||||
|
37
.github/workflows/qodana.yml
vendored
Normal file
37
.github/workflows/qodana.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
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: Install dependencies
|
||||
run: |
|
||||
composer install --no-scripts
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
php artisan clear-compiled
|
||||
php artisan ide-helper:generate;
|
||||
|
||||
- name: 'Qodana Scan'
|
||||
uses: JetBrains/qodana-action@main
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
16
.github/workflows/stale.yml
vendored
16
.github/workflows/stale.yml
vendored
@@ -18,13 +18,17 @@ jobs:
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
Hi there! This is an automatic reply. `Share and enjoy`
|
||||
|
||||
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
|
||||
|
||||
Thank you for your contributions.
|
||||
stale-pr-message: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
Hi there! This is an automatic reply. `Share and enjoy`
|
||||
|
||||
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
|
||||
|
||||
Thank you for your contributions.
|
||||
days-before-stale: 14
|
||||
days-before-close: 7
|
||||
exempt-issue-labels: 'enhancement,feature,bug,announcement,layout-v3'
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ npm-debug.log
|
||||
yarn-error.log
|
||||
.env
|
||||
/.ci/php-cs-fixer/vendor
|
||||
/.ci/coverage
|
||||
|
@@ -65,9 +65,9 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* Documentation for this endpoint:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getAccountsAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getAccountsAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws JsonException
|
||||
@@ -82,7 +82,7 @@ class AccountController extends Controller
|
||||
$date = $data['date'] ?? today(config('app.timezone'));
|
||||
|
||||
$return = [];
|
||||
$result = $this->repository->searchAccount((string) $query, $types, $data['limit']);
|
||||
$result = $this->repository->searchAccount((string)$query, $types, $data['limit']);
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
|
||||
/** @var Account $account */
|
||||
@@ -96,7 +96,7 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
$return[] = [
|
||||
'id' => (string) $account->id,
|
||||
'id' => (string)$account->id,
|
||||
'name' => $account->name,
|
||||
'name_with_balance' => $nameWithBalance,
|
||||
'type' => $account->accountType->type,
|
||||
@@ -111,12 +111,13 @@ class AccountController extends Controller
|
||||
// custom order.
|
||||
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
|
||||
usort(
|
||||
$return, function ($a, $b) use ($order) {
|
||||
$pos_a = array_search($a['type'], $order);
|
||||
$pos_b = array_search($b['type'], $order);
|
||||
$return,
|
||||
function ($a, $b) use ($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);
|
||||
|
@@ -57,9 +57,10 @@ class BillController extends Controller
|
||||
|
||||
/**
|
||||
* Documentation for this endpoint is at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getBillsAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getBillsAC
|
||||
* TODO expand API to add active field.
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -70,13 +71,13 @@ class BillController extends Controller
|
||||
$filtered = $result->map(
|
||||
static function (Bill $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'name' => $item->name,
|
||||
'id' => (string)$item->id,
|
||||
'name' => $item->name,
|
||||
'active' => $item->active,
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
return response()->json($filtered->toArray());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -57,9 +57,9 @@ class BudgetController extends Controller
|
||||
|
||||
/**
|
||||
* Documentation for this endpoint is at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getBudgetsAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getBudgetsAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ class BudgetController extends Controller
|
||||
$filtered = $result->map(
|
||||
static function (Budget $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'id' => (string)$item->id,
|
||||
'name' => $item->name,
|
||||
];
|
||||
}
|
||||
|
@@ -57,9 +57,9 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* Documentation for this endpoint is at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getCategoriesAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getCategoriesAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ class CategoryController extends Controller
|
||||
$filtered = $result->map(
|
||||
static function (Category $item) {
|
||||
return [
|
||||
'id' => (string) $item->id,
|
||||
'id' => (string)$item->id,
|
||||
'name' => $item->name,
|
||||
];
|
||||
}
|
||||
|
@@ -57,9 +57,9 @@ class CurrencyController extends Controller
|
||||
|
||||
/**
|
||||
* Documentation for this endpoint is at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getCurrenciesAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getCurrenciesAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ class CurrencyController extends Controller
|
||||
/** @var TransactionCurrency $currency */
|
||||
foreach ($collection as $currency) {
|
||||
$result[] = [
|
||||
'id' => (string) $currency->id,
|
||||
'id' => (string)$currency->id,
|
||||
'name' => $currency->name,
|
||||
'code' => $currency->code,
|
||||
'symbol' => $currency->symbol,
|
||||
@@ -85,9 +85,9 @@ class CurrencyController extends Controller
|
||||
|
||||
/**
|
||||
* Documentation for this endpoint is at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getCurrenciesCodeAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getCurrenciesCodeAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @deprecated
|
||||
@@ -101,7 +101,7 @@ class CurrencyController extends Controller
|
||||
/** @var TransactionCurrency $currency */
|
||||
foreach ($collection as $currency) {
|
||||
$result[] = [
|
||||
'id' => (string) $currency->id,
|
||||
'id' => (string)$currency->id,
|
||||
'name' => sprintf('%s (%s)', $currency->name, $currency->code),
|
||||
'code' => $currency->code,
|
||||
'symbol' => $currency->symbol,
|
||||
|
@@ -57,9 +57,9 @@ class ObjectGroupController extends Controller
|
||||
|
||||
/**
|
||||
* Documentation for this endpoint is at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getObjectGroupsAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getObjectGroupsAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ class ObjectGroupController extends Controller
|
||||
/** @var ObjectGroup $objectGroup */
|
||||
foreach ($result as $objectGroup) {
|
||||
$return[] = [
|
||||
'id' => (string) $objectGroup->id,
|
||||
'id' => (string)$objectGroup->id,
|
||||
'name' => $objectGroup->title,
|
||||
'title' => $objectGroup->title,
|
||||
];
|
||||
@@ -80,5 +80,4 @@ class ObjectGroupController extends Controller
|
||||
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -61,9 +61,9 @@ class PiggyBankController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getPiggiesAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getPiggiesAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -76,15 +76,18 @@ class PiggyBankController extends Controller
|
||||
|
||||
/** @var PiggyBank $piggy */
|
||||
foreach ($piggies as $piggy) {
|
||||
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
|
||||
$response[] = [
|
||||
'id' => (string) $piggy->id,
|
||||
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
|
||||
$objectGroup = $piggy->objectGroups()->first();
|
||||
$response[] = [
|
||||
'id' => (string)$piggy->id,
|
||||
'name' => $piggy->name,
|
||||
'currency_id' => $currency->id,
|
||||
'currency_id' => (string)$currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'object_group_id' => null === $objectGroup ? null : (string)$objectGroup->id,
|
||||
'object_group_title' => $objectGroup?->title,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -93,9 +96,9 @@ class PiggyBankController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getPiggiesBalanceAC
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getPiggiesBalanceAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -109,22 +112,26 @@ class PiggyBankController extends Controller
|
||||
foreach ($piggies as $piggy) {
|
||||
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
|
||||
$currentAmount = $this->piggyRepository->getRepetition($piggy)->currentamount ?? '0';
|
||||
$objectGroup = $piggy->objectGroups()->first();
|
||||
$response[] = [
|
||||
'id' => (string) $piggy->id,
|
||||
'id' => (string)$piggy->id,
|
||||
'name' => $piggy->name,
|
||||
'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),
|
||||
),
|
||||
'currency_id' => $currency->id,
|
||||
'currency_id' => (string)$currency->id,
|
||||
'currency_name' => $currency->name,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'object_group_id' => null === $objectGroup ? null : (string)$objectGroup->id,
|
||||
'object_group_title' => $objectGroup?->title,
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -45,6 +45,7 @@ class RecurrenceController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(RecurringRepositoryInterface::class);
|
||||
|
||||
$this->repository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
@@ -54,9 +55,9 @@ class RecurrenceController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getRecurringAC
|
||||
* * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getRecurringAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -69,7 +70,7 @@ class RecurrenceController extends Controller
|
||||
/** @var Recurrence $recurrence */
|
||||
foreach ($recurrences as $recurrence) {
|
||||
$response[] = [
|
||||
'id' => (string) $recurrence->id,
|
||||
'id' => (string)$recurrence->id,
|
||||
'name' => $recurrence->title,
|
||||
'description' => $recurrence->description,
|
||||
];
|
||||
@@ -77,5 +78,4 @@ class RecurrenceController extends Controller
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -54,9 +54,9 @@ class RuleController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getRulesAC
|
||||
* * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getRulesAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -69,7 +69,7 @@ class RuleController extends Controller
|
||||
/** @var Rule $rule */
|
||||
foreach ($rules as $rule) {
|
||||
$response[] = [
|
||||
'id' => (string) $rule->id,
|
||||
'id' => (string)$rule->id,
|
||||
'name' => $rule->title,
|
||||
'description' => $rule->description,
|
||||
];
|
||||
@@ -77,5 +77,4 @@ class RuleController extends Controller
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -54,9 +54,9 @@ class RuleGroupController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getRuleGroupsAC
|
||||
* * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getRuleGroupsAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -69,7 +69,7 @@ class RuleGroupController extends Controller
|
||||
/** @var RuleGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
$response[] = [
|
||||
'id' => (string) $group->id,
|
||||
'id' => (string)$group->id,
|
||||
'name' => $group->title,
|
||||
'description' => $group->description,
|
||||
];
|
||||
|
@@ -57,9 +57,9 @@ class TagController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTagAC
|
||||
* * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getTagAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ class TagController extends Controller
|
||||
/** @var Tag $tag */
|
||||
foreach ($result as $tag) {
|
||||
$array[] = [
|
||||
'id' => (string) $tag->id,
|
||||
'id' => (string)$tag->id,
|
||||
'name' => $tag->tag,
|
||||
'tag' => $tag->tag,
|
||||
];
|
||||
|
@@ -62,9 +62,9 @@ class TransactionController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionsAC
|
||||
* * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getTransactionsAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -80,8 +80,8 @@ class TransactionController extends Controller
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($filtered as $journal) {
|
||||
$array[] = [
|
||||
'id' => (string) $journal->id,
|
||||
'transaction_group_id' => (string) $journal->transaction_group_id,
|
||||
'id' => (string)$journal->id,
|
||||
'transaction_group_id' => (string)$journal->transaction_group_id,
|
||||
'name' => $journal->description,
|
||||
'description' => $journal->description,
|
||||
];
|
||||
@@ -92,19 +92,19 @@ class TransactionController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionsIDAC
|
||||
* * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getTransactionsIDAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function transactionsWithID(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->getData();
|
||||
$result = new Collection;
|
||||
$result = new Collection();
|
||||
if (is_numeric($data['query'])) {
|
||||
// search for group, not journal.
|
||||
$firstResult = $this->groupRepository->find((int) $data['query']);
|
||||
$firstResult = $this->groupRepository->find((int)$data['query']);
|
||||
if (null !== $firstResult) {
|
||||
// group may contain multiple journals, each a result:
|
||||
foreach ($firstResult->transactionJournals as $journal) {
|
||||
@@ -122,8 +122,8 @@ class TransactionController extends Controller
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($result as $journal) {
|
||||
$array[] = [
|
||||
'id' => (string) $journal->id,
|
||||
'transaction_group_id' => (string) $journal->transaction_group_id,
|
||||
'id' => (string)$journal->id,
|
||||
'transaction_group_id' => (string)$journal->transaction_group_id,
|
||||
'name' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
|
||||
'description' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
|
||||
];
|
||||
|
@@ -53,12 +53,11 @@ class TransactionTypeController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at
|
||||
* https://api-docs.firefly-iii.org/#/autocomplete/getTransactionTypesAC
|
||||
* * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/autocomplete/getTransactionTypesAC
|
||||
*
|
||||
* @param AutocompleteRequest $request
|
||||
* @param AutocompleteRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function transactionTypes(AutocompleteRequest $request): JsonResponse
|
||||
{
|
||||
@@ -70,7 +69,7 @@ class TransactionTypeController extends Controller
|
||||
foreach ($types as $type) {
|
||||
// different key for consistency.
|
||||
$array[] = [
|
||||
'id' => (string) $type->id,
|
||||
'id' => (string)$type->id,
|
||||
'name' => $type->type,
|
||||
'type' => $type->type,
|
||||
];
|
||||
|
@@ -52,7 +52,7 @@ class AccountController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -74,9 +74,9 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/charts/getChartAccountOverview
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/charts/getChartAccountOverview
|
||||
*
|
||||
* @param DateRequest $request
|
||||
* @param DateRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
@@ -98,7 +98,7 @@ class AccountController extends Controller
|
||||
$frontPage = app('preferences')->get('frontPageAccounts', $defaultSet);
|
||||
$default = app('amount')->getDefaultCurrency();
|
||||
|
||||
if (empty($frontPage->data)) {
|
||||
if (!(is_array($frontPage->data) && count($frontPage->data) > 0)) {
|
||||
$frontPage->data = $defaultSet;
|
||||
$frontPage->save();
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class AccountController extends Controller
|
||||
}
|
||||
$currentSet = [
|
||||
'label' => $account->name,
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_id' => (string)$currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
@@ -127,7 +127,8 @@ class AccountController extends Controller
|
||||
];
|
||||
$currentStart = clone $start;
|
||||
$range = app('steam')->balanceInRange($account, $start, clone $end);
|
||||
$previous = $range[0] ?? '0';
|
||||
// 2022-10-11 this method no longer converts to float.
|
||||
$previous = array_values($range)[0];
|
||||
while ($currentStart <= $end) {
|
||||
$format = $currentStart->format('Y-m-d');
|
||||
$label = $currentStart->toAtomString();
|
||||
|
@@ -31,21 +31,24 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use League\Fractal\Manager;
|
||||
use League\Fractal\Serializer\JsonApiSerializer;
|
||||
use Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
|
||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||
|
||||
/**
|
||||
* Class Controller.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
abstract class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
use AuthorizesRequests;
|
||||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
|
||||
protected const CONTENT_TYPE = 'application/vnd.api+json';
|
||||
protected array $allowedSort;
|
||||
@@ -69,7 +72,6 @@ abstract class Controller extends BaseController
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,24 +83,35 @@ abstract class Controller extends BaseController
|
||||
*/
|
||||
private function getParameters(): ParameterBag
|
||||
{
|
||||
$bag = new ParameterBag;
|
||||
$bag = new ParameterBag();
|
||||
$page = (int)request()->get('page');
|
||||
if (0 === $page) {
|
||||
|
||||
if ($page < 1) {
|
||||
$page = 1;
|
||||
}
|
||||
if ($page > (2 ^ 16)) {
|
||||
$page = (2 ^ 16);
|
||||
}
|
||||
$bag->set('page', $page);
|
||||
|
||||
// some date fields:
|
||||
$dates = ['start', 'end', 'date'];
|
||||
foreach ($dates as $field) {
|
||||
$date = request()->query->get($field);
|
||||
$obj = null;
|
||||
$date = null;
|
||||
try {
|
||||
$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) {
|
||||
try {
|
||||
$obj = Carbon::parse($date);
|
||||
} catch (InvalidDateException | InvalidFormatException $e) {
|
||||
} catch (InvalidDateException|InvalidFormatException $e) {
|
||||
// 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);
|
||||
@@ -107,7 +120,13 @@ abstract class Controller extends BaseController
|
||||
// integer fields:
|
||||
$integers = ['limit'];
|
||||
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) {
|
||||
$bag->set($integer, (int)$value);
|
||||
}
|
||||
@@ -118,14 +137,20 @@ abstract class Controller extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ParameterBag $bag
|
||||
* @param ParameterBag $bag
|
||||
*
|
||||
* @return ParameterBag
|
||||
*/
|
||||
private function getSortParameters(ParameterBag $bag): ParameterBag
|
||||
{
|
||||
$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) {
|
||||
return $bag;
|
||||
}
|
||||
@@ -167,7 +192,7 @@ abstract class Controller extends BaseController
|
||||
$params[$key] = $value;
|
||||
}
|
||||
|
||||
return $return . http_build_query($params);
|
||||
return $return.http_build_query($params);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,8 +201,8 @@ abstract class Controller extends BaseController
|
||||
final protected function getManager(): Manager
|
||||
{
|
||||
// create some objects:
|
||||
$manager = new Manager;
|
||||
$baseUrl = request()->getSchemeAndHttpHost() . '/api/v1';
|
||||
$manager = new Manager();
|
||||
$baseUrl = request()->getSchemeAndHttpHost().'/api/v1';
|
||||
$manager->setSerializer(new JsonApiSerializer($baseUrl));
|
||||
|
||||
return $manager;
|
||||
|
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* AccountController.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\Data\Bulk;
|
||||
|
||||
|
||||
use FireflyIII\Api\V1\Controllers\Controller;
|
||||
use FireflyIII\Api\V1\Requests\Data\Bulk\MoveTransactionsRequest;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Services\Internal\Destroy\AccountDestroyService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* Class AccountController
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
class AccountController extends Controller
|
||||
{
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->repository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint is deprecated and not documented.
|
||||
*
|
||||
* @param MoveTransactionsRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @deprecated
|
||||
*/
|
||||
public function moveTransactions(MoveTransactionsRequest $request): JsonResponse
|
||||
{
|
||||
$accountIds = $request->getAll();
|
||||
$original = $this->repository->find($accountIds['original_account']);
|
||||
$destination = $this->repository->find($accountIds['destination_account']);
|
||||
|
||||
/** @var AccountDestroyService $service */
|
||||
$service = app(AccountDestroyService::class);
|
||||
$service->moveTransactions($original, $destination);
|
||||
|
||||
return response()->json([], 204);
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -62,8 +62,9 @@ class TransactionController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/bulkUpdateTransactions
|
||||
*
|
||||
* @param TransactionRequest $request
|
||||
* @param TransactionRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -76,8 +77,8 @@ class TransactionController extends Controller
|
||||
// to respond to what is in the $query.
|
||||
// this is OK because only one thing can be in the query at the moment.
|
||||
if ($this->updatesTransactionAccount($params)) {
|
||||
$original = $this->repository->find((int) $params['where']['account_id']);
|
||||
$destination = $this->repository->find((int) $params['update']['account_id']);
|
||||
$original = $this->repository->find((int)$params['where']['account_id']);
|
||||
$destination = $this->repository->find((int)$params['update']['account_id']);
|
||||
|
||||
/** @var AccountDestroyService $service */
|
||||
$service = app(AccountDestroyService::class);
|
||||
@@ -88,7 +89,7 @@ class TransactionController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
* @param array $params
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -96,5 +97,4 @@ class TransactionController extends Controller
|
||||
{
|
||||
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\JournalDestroyService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class DestroyController
|
||||
*/
|
||||
class DestroyController extends Controller
|
||||
{
|
||||
private bool $unused;
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/destroyData
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/destroyData
|
||||
*
|
||||
* @param DestroyRequest $request
|
||||
* @param DestroyRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function destroy(DestroyRequest $request): JsonResponse
|
||||
{
|
||||
$objects = $request->getObjects();
|
||||
|
||||
$objects = $request->getObjects();
|
||||
$this->unused = $request->boolean('unused', false);
|
||||
switch ($objects) {
|
||||
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':
|
||||
$this->destroyBudgets();
|
||||
break;
|
||||
@@ -91,27 +94,55 @@ class DestroyController extends Controller
|
||||
case 'object_groups':
|
||||
$this->destroyObjectGroups();
|
||||
break;
|
||||
case 'not_assets_liabilities':
|
||||
$this->destroyAccounts(
|
||||
[
|
||||
AccountType::BENEFICIARY,
|
||||
AccountType::CASH,
|
||||
AccountType::CREDITCARD,
|
||||
AccountType::DEFAULT,
|
||||
AccountType::EXPENSE,
|
||||
AccountType::IMPORT,
|
||||
AccountType::INITIAL_BALANCE,
|
||||
AccountType::LIABILITY_CREDIT,
|
||||
AccountType::RECONCILIATION,
|
||||
AccountType::REVENUE,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'accounts':
|
||||
$this->destroyAccounts(
|
||||
[
|
||||
AccountType::ASSET, AccountType::DEFAULT,
|
||||
AccountType::BENEFICIARY, AccountType::EXPENSE,
|
||||
AccountType::REVENUE, AccountType::INITIAL_BALANCE,
|
||||
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD,
|
||||
AccountType::ASSET,
|
||||
AccountType::BENEFICIARY,
|
||||
AccountType::CASH,
|
||||
AccountType::CREDITCARD,
|
||||
AccountType::DEBT,
|
||||
AccountType::DEFAULT,
|
||||
AccountType::EXPENSE,
|
||||
AccountType::IMPORT,
|
||||
AccountType::INITIAL_BALANCE,
|
||||
AccountType::LIABILITY_CREDIT,
|
||||
AccountType::LOAN,
|
||||
AccountType::MORTGAGE,
|
||||
AccountType::RECONCILIATION,
|
||||
AccountType::REVENUE,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'asset_accounts':
|
||||
$this->destroyAccounts(
|
||||
[
|
||||
AccountType::ASSET, AccountType::DEFAULT,
|
||||
AccountType::ASSET,
|
||||
AccountType::DEFAULT,
|
||||
]
|
||||
);
|
||||
break;
|
||||
case 'expense_accounts':
|
||||
$this->destroyAccounts(
|
||||
[
|
||||
AccountType::BENEFICIARY, AccountType::EXPENSE,
|
||||
AccountType::BENEFICIARY,
|
||||
AccountType::EXPENSE,
|
||||
]
|
||||
);
|
||||
break;
|
||||
@@ -125,7 +156,10 @@ class DestroyController extends Controller
|
||||
case 'liabilities':
|
||||
$this->destroyAccounts(
|
||||
[
|
||||
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD,
|
||||
AccountType::DEBT,
|
||||
AccountType::LOAN,
|
||||
AccountType::MORTGAGE,
|
||||
AccountType::CREDITCARD,
|
||||
]
|
||||
);
|
||||
break;
|
||||
@@ -253,7 +287,7 @@ class DestroyController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
* @param array $types
|
||||
*/
|
||||
private function destroyAccounts(array $types): void
|
||||
{
|
||||
@@ -261,14 +295,24 @@ class DestroyController extends Controller
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$collection = $repository->getAccountsByType($types);
|
||||
$service = app(AccountDestroyService::class);
|
||||
|
||||
/** @var Account $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
|
||||
{
|
||||
@@ -281,5 +325,4 @@ class DestroyController extends Controller
|
||||
$service->destroy($journal);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -55,9 +55,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportAccounts
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportAccounts
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -67,11 +67,10 @@ class ExportController extends Controller
|
||||
$this->exporter->setExportAccounts(true);
|
||||
|
||||
return $this->returnExport('accounts');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param string $key
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -87,22 +86,22 @@ class ExportController extends Controller
|
||||
$response
|
||||
->header('Content-Description', 'File Transfer')
|
||||
->header('Content-Type', 'application/octet-stream')
|
||||
->header('Content-Disposition', 'attachment; filename=' . $fileName)
|
||||
->header('Content-Disposition', 'attachment; filename='.$fileName)
|
||||
->header('Content-Transfer-Encoding', 'binary')
|
||||
->header('Connection', 'Keep-Alive')
|
||||
->header('Expires', '0')
|
||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||
->header('Pragma', 'public')
|
||||
->header('Content-Length', (string) strlen($data[$key]));
|
||||
->header('Content-Length', (string)strlen($data[$key]));
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportBills
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportBills
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -116,9 +115,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportBudgets
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportBudgets
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -132,9 +131,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportCategories
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportCategories
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -148,9 +147,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportPiggies
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportPiggies
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -164,9 +163,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportRecurring
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportRecurring
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -180,9 +179,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportRules
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportRules
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -196,9 +195,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportTags
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportTags
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -212,9 +211,9 @@ class ExportController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/data/exportTransactions
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/exportTransactions
|
||||
*
|
||||
* @param ExportRequest $request
|
||||
* @param ExportRequest $request
|
||||
*
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
@@ -229,5 +228,4 @@ class ExportController extends Controller
|
||||
|
||||
return $this->returnExport('transactions');
|
||||
}
|
||||
|
||||
}
|
||||
|
95
app/Api/V1/Controllers/Data/PurgeController.php
Normal file
95
app/Api/V1/Controllers/Data/PurgeController.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?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
|
||||
{
|
||||
/**
|
||||
* TODO cleanup and use repositories.
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/data/purgeData
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function purge(): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
// some manual code, too lazy to call all repositories.
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
@@ -50,7 +50,7 @@ class AccountController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -74,9 +74,9 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseAsset
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseAsset
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -91,11 +91,11 @@ class AccountController extends Controller
|
||||
/** @var array $expense */
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'id' => (string) $expense['id'],
|
||||
'id' => (string)$expense['id'],
|
||||
'name' => $expense['name'],
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'], // intentional float
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // intentional float
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
@@ -105,9 +105,9 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseExpense
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseExpense
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -123,16 +123,15 @@ class AccountController extends Controller
|
||||
/** @var array $expense */
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'id' => (string) $expense['id'],
|
||||
'id' => (string)$expense['id'],
|
||||
'name' => $expense['name'],
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'], // intentional float
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // intentional float
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -57,11 +57,11 @@ class BillController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseBill
|
||||
*
|
||||
* Expenses per bill, possibly filtered by bill and account.
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -85,33 +85,33 @@ class BillController extends Controller
|
||||
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
foreach ($genericSet as $journal) {
|
||||
$billId = (int) $journal['bill_id'];
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$billId = (int)$journal['bill_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
$key = sprintf('%d-%d', $billId, $currencyId);
|
||||
$foreignKey = sprintf('%d-%d', $billId, $foreignCurrencyId);
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
'id' => (string) $billId,
|
||||
'name' => $journal['bill_name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'id' => (string)$billId,
|
||||
'name' => $journal['bill_name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']);
|
||||
$response[$key]['difference_float'] = (float) $response[$key]['difference']; // intentional float
|
||||
$response[$key]['difference_float'] = (float)$response[$key]['difference']; // intentional float
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignKey] = $response[$foreignKey] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']);
|
||||
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; // intentional float
|
||||
$response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; // intentional float
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,11 +120,11 @@ class BillController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseNoBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseNoBill
|
||||
*
|
||||
* Expenses for no bill filtered by account.
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -143,32 +143,31 @@ class BillController extends Controller
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // intentional float
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; // intentional float
|
||||
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; // intentional float
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(array_values($response));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ class BudgetController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -66,9 +66,9 @@ class BudgetController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseBudget
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -88,11 +88,11 @@ class BudgetController extends Controller
|
||||
/** @var array $expense */
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'id' => (string) $budget->id,
|
||||
'id' => (string)$budget->id,
|
||||
'name' => $budget->name,
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'], // intentional float
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // intentional float
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
@@ -103,9 +103,9 @@ class BudgetController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseNoBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseNoBudget
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -120,14 +120,12 @@ class BudgetController extends Controller
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'], // intentional float
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // intentional float
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ class CategoryController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,9 +67,9 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransferCategory
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -89,11 +89,11 @@ class CategoryController extends Controller
|
||||
/** @var array $expense */
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'id' => (string) $category->id,
|
||||
'id' => (string)$category->id,
|
||||
'name' => $category->name,
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'], // intentional float
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // intentional float
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
@@ -104,9 +104,9 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransferNoCategory
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -121,13 +121,12 @@ class CategoryController extends Controller
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'], // intentional float
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // intentional float
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -34,12 +34,11 @@ use Illuminate\Http\JsonResponse;
|
||||
*/
|
||||
class PeriodController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseTotal
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseTotal
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -55,32 +54,31 @@ class PeriodController extends Controller
|
||||
$collector->setTypes([TransactionType::WITHDRAWAL])->setRange($start, $end)->setSourceAccounts($accounts);
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
|
||||
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // intentional float
|
||||
$response[$currencyId]['difference_float'] = (float)$response[$currencyId]['difference']; // intentional float
|
||||
}
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
|
||||
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; // intentional float
|
||||
$response[$foreignCurrencyId]['difference_float'] = (float)$response[$foreignCurrencyId]['difference']; // intentional float
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(array_values($response));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -56,11 +56,11 @@ class TagController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseNoTag
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseNoTag
|
||||
*
|
||||
* Expenses for no tag filtered by account.
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -79,28 +79,28 @@ class TagController extends Controller
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,11 +109,11 @@ class TagController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightExpenseTag
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightExpenseTag
|
||||
*
|
||||
* Expenses per tag, possibly filtered by tag and account.
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -137,8 +137,8 @@ class TagController extends Controller
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
/** @var array $journal */
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
/** @var array $tag */
|
||||
foreach ($journal['tags'] as $tag) {
|
||||
@@ -149,32 +149,31 @@ class TagController extends Controller
|
||||
// on currency ID
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
'id' => (string) $tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'id' => (string)$tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ use Illuminate\Http\JsonResponse;
|
||||
* Class AccountController
|
||||
*
|
||||
* Shows income information grouped or limited by date.
|
||||
* Ie. all income grouped by account + currency.
|
||||
* I.e. all income grouped by account + currency.
|
||||
*/
|
||||
class AccountController extends Controller
|
||||
{
|
||||
@@ -50,7 +50,7 @@ class AccountController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -74,9 +74,9 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeAsset
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightIncomeAsset
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -90,11 +90,11 @@ class AccountController extends Controller
|
||||
/** @var array $entry */
|
||||
foreach ($income as $entry) {
|
||||
$result[] = [
|
||||
'id' => (string) $entry['id'],
|
||||
'id' => (string)$entry['id'],
|
||||
'name' => $entry['name'],
|
||||
'difference' => $entry['sum'],
|
||||
'difference_float' => (float) $entry['sum'],
|
||||
'currency_id' => (string) $entry['currency_id'],
|
||||
'difference_float' => (float)$entry['sum'], // float but on purpose.
|
||||
'currency_id' => (string)$entry['currency_id'],
|
||||
'currency_code' => $entry['currency_code'],
|
||||
];
|
||||
}
|
||||
@@ -104,9 +104,9 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeRevenue
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightIncomeRevenue
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -122,16 +122,15 @@ class AccountController extends Controller
|
||||
/** @var array $entry */
|
||||
foreach ($income as $entry) {
|
||||
$result[] = [
|
||||
'id' => (string) $entry['id'],
|
||||
'id' => (string)$entry['id'],
|
||||
'name' => $entry['name'],
|
||||
'difference' => $entry['sum'],
|
||||
'difference_float' => (float) $entry['sum'],
|
||||
'currency_id' => (string) $entry['currency_id'],
|
||||
'difference_float' => (float)$entry['sum'], // float but on purpose.
|
||||
'currency_id' => (string)$entry['currency_id'],
|
||||
'currency_code' => $entry['currency_code'],
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ class CategoryController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,9 +67,9 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightIncomeCategory
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -89,11 +89,11 @@ class CategoryController extends Controller
|
||||
/** @var array $expense */
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'id' => (string) $category->id,
|
||||
'id' => (string)$category->id,
|
||||
'name' => $category->name,
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'],
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // float but on purpose.
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
@@ -104,9 +104,9 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeNoCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightIncomeNoCategory
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -121,13 +121,12 @@ class CategoryController extends Controller
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'],
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'], // float but on purpose.
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -34,12 +34,11 @@ use Illuminate\Http\JsonResponse;
|
||||
*/
|
||||
class PeriodController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeTotal
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightIncomeTotal
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -55,34 +54,34 @@ class PeriodController extends Controller
|
||||
$collector->setTypes([TransactionType::DEPOSIT])->setRange($start, $end)->setDestinationAccounts($accounts);
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -57,11 +57,11 @@ class TagController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeTag
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightIncomeTag
|
||||
*
|
||||
* Expenses for no tag filtered by account.
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -80,30 +80,31 @@ class TagController extends Controller
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +113,11 @@ class TagController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightIncomeNoTag
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightIncomeNoTag
|
||||
*
|
||||
* Expenses per tag, possibly filtered by tag and account.
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -140,8 +141,8 @@ class TagController extends Controller
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
/** @var array $journal */
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
/** @var array $tag */
|
||||
foreach ($journal['tags'] as $tag) {
|
||||
@@ -152,34 +153,34 @@ class TagController extends Controller
|
||||
// on currency ID
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
'id' => (string) $tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'id' => (string)$tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class AccountController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -59,9 +59,9 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransfers
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransfers
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -44,7 +44,7 @@ class CategoryController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -66,9 +66,9 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransferCategory
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -88,11 +88,11 @@ class CategoryController extends Controller
|
||||
/** @var array $expense */
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'id' => (string) $category->id,
|
||||
'id' => (string)$category->id,
|
||||
'name' => $category->name,
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'],
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'],
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
@@ -103,9 +103,9 @@ class CategoryController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransferNoCategory
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -120,13 +120,12 @@ class CategoryController extends Controller
|
||||
foreach ($expenses as $expense) {
|
||||
$result[] = [
|
||||
'difference' => $expense['sum'],
|
||||
'difference_float' => (float) $expense['sum'],
|
||||
'currency_id' => (string) $expense['currency_id'],
|
||||
'difference_float' => (float)$expense['sum'],
|
||||
'currency_id' => (string)$expense['currency_id'],
|
||||
'currency_code' => $expense['currency_code'],
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -34,12 +34,11 @@ use Illuminate\Http\JsonResponse;
|
||||
*/
|
||||
class PeriodController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferTotal
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransferTotal
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -55,34 +54,34 @@ class PeriodController extends Controller
|
||||
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -56,9 +56,9 @@ class TagController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferNoTag
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransferNoTag
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -77,30 +77,31 @@ class TagController extends Controller
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
if (0 !== $currencyId) {
|
||||
$response[$currencyId] = $response[$currencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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) {
|
||||
$response[$foreignCurrencyId] = $response[$foreignCurrencyId] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,11 +110,11 @@ class TagController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/insight/insightTransferTag
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/insight/insightTransferTag
|
||||
*
|
||||
* Transfers per tag, possibly filtered by tag and account.
|
||||
*
|
||||
* @param GenericRequest $request
|
||||
* @param GenericRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -137,8 +138,8 @@ class TagController extends Controller
|
||||
$genericSet = $collector->getExtractedJournals();
|
||||
/** @var array $journal */
|
||||
foreach ($genericSet as $journal) {
|
||||
$currencyId = (int) $journal['currency_id'];
|
||||
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
|
||||
$currencyId = (int)$journal['currency_id'];
|
||||
$foreignCurrencyId = (int)$journal['foreign_currency_id'];
|
||||
|
||||
/** @var array $tag */
|
||||
foreach ($journal['tags'] as $tag) {
|
||||
@@ -149,29 +150,30 @@ class TagController extends Controller
|
||||
// on currency ID
|
||||
if (0 !== $currencyId) {
|
||||
$response[$key] = $response[$key] ?? [
|
||||
'id' => (string) $tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
'id' => (string)$tagId,
|
||||
'name' => $tag['name'],
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$currencyId,
|
||||
'currency_code' => $journal['currency_code'],
|
||||
];
|
||||
$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
|
||||
if (0 !== $foreignCurrencyId) {
|
||||
$response[$foreignKey] = $journal[$foreignKey] ?? [
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string) $foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
'difference' => '0',
|
||||
'difference_float' => 0,
|
||||
'currency_id' => (string)$foreignCurrencyId,
|
||||
'currency_code' => $journal['foreign_currency_code'],
|
||||
];
|
||||
$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']; // intentional float
|
||||
$response[$foreignKey]['difference_float'] = (float)$response[$foreignKey]['difference']; // intentional float
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -57,13 +57,12 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/deleteAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/deleteAccount
|
||||
*
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Account $account
|
||||
* @param Account $account
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(Account $account): JsonResponse
|
||||
|
@@ -54,7 +54,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -71,18 +71,17 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/listAttachmentByAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/listAttachmentByAccount
|
||||
*
|
||||
* @param Account $account
|
||||
* @param Account $account
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function attachments(Account $account): JsonResponse
|
||||
{
|
||||
$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);
|
||||
|
||||
$count = $collection->count();
|
||||
@@ -90,7 +89,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -104,13 +103,12 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/listPiggyBankByAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/listPiggyBankByAccount
|
||||
*
|
||||
* @param Account $account
|
||||
* @param Account $account
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function piggyBanks(Account $account): JsonResponse
|
||||
{
|
||||
@@ -118,7 +116,7 @@ class ListController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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.
|
||||
$collection = $this->repository->getPiggyBanks($account);
|
||||
@@ -127,7 +125,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(PiggyBankTransformer::class);
|
||||
@@ -137,26 +135,24 @@ class ListController extends Controller
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/listTransactionByAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/listTransactionByAccount
|
||||
*
|
||||
* Show all transaction groups related to the account.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
* @param Request $request
|
||||
* @param Account $account
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
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';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@@ -181,7 +177,7 @@ class ListController extends Controller
|
||||
}
|
||||
|
||||
$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();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
|
@@ -50,7 +50,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,15 +67,14 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/listAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/listAccount
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
@@ -85,7 +84,7 @@ class ShowController extends Controller
|
||||
|
||||
// types to get, page size:
|
||||
$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.
|
||||
$this->repository->resetAccountOrder();
|
||||
@@ -99,7 +98,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AccountTransformer::class);
|
||||
@@ -113,11 +112,11 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/getAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/getAccount
|
||||
*
|
||||
* Show single instance.
|
||||
*
|
||||
* @param Account $account
|
||||
* @param Account $account
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -135,5 +134,4 @@ class ShowController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -59,11 +59,11 @@ class StoreController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/storeAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/storeAccount
|
||||
*
|
||||
* Store a new instance.
|
||||
*
|
||||
* @param StoreRequest $request
|
||||
* @param StoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -82,5 +82,4 @@ class StoreController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* AccountController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -62,12 +62,12 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/accounts/updateAccount
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/accounts/updateAccount
|
||||
*
|
||||
* Update account.
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param Account $account
|
||||
* @param UpdateRequest $request
|
||||
* @param Account $account
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -75,7 +75,7 @@ class UpdateController extends Controller
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
$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);
|
||||
$manager = $this->getManager();
|
||||
$account->refresh();
|
||||
|
@@ -40,7 +40,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* DestroyController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -60,13 +60,12 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/attachments/deleteAttachment
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/attachments/deleteAttachment
|
||||
*
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Attachment $attachment
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -47,7 +47,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* ShowController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,13 +67,12 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/attachments/downloadAttachment
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/attachments/downloadAttachment
|
||||
*
|
||||
* Download an attachment.
|
||||
*
|
||||
* @param Attachment $attachment
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return LaravelResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
@@ -97,13 +96,13 @@ class ShowController extends Controller
|
||||
$response
|
||||
->header('Content-Description', 'File Transfer')
|
||||
->header('Content-Type', 'application/octet-stream')
|
||||
->header('Content-Disposition', 'attachment; filename=' . $quoted)
|
||||
->header('Content-Disposition', 'attachment; filename='.$quoted)
|
||||
->header('Content-Transfer-Encoding', 'binary')
|
||||
->header('Connection', 'Keep-Alive')
|
||||
->header('Expires', '0')
|
||||
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||
->header('Pragma', 'public')
|
||||
->header('Content-Length', (string) strlen($content));
|
||||
->header('Content-Length', (string)strlen($content));
|
||||
|
||||
return $response;
|
||||
}
|
||||
@@ -112,20 +111,19 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/attachments/listAttachment
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/attachments/listAttachment
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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.
|
||||
$collection = $this->repository->get();
|
||||
@@ -134,7 +132,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -148,11 +146,11 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/attachments/getAttachment
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/attachments/getAttachment
|
||||
*
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param Attachment $attachment
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -47,7 +47,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* StoreController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,11 +67,11 @@ class StoreController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/attachments/uploadAttachment
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/attachments/uploadAttachment
|
||||
*
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param StoreRequest $request
|
||||
* @param StoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
@@ -95,10 +95,9 @@ class StoreController extends Controller
|
||||
/**
|
||||
* Upload an attachment.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Attachment $attachment
|
||||
* @param Request $request
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -43,7 +43,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* UpdateController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -63,12 +63,12 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/attachments/updateAttachment
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/attachments/updateAttachment
|
||||
*
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param Attachment $attachment
|
||||
* @param UpdateRequest $request
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -1,78 +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);
|
||||
app('preferences')->mark();
|
||||
|
||||
return response()->json([], 204);
|
||||
}
|
||||
}
|
@@ -45,7 +45,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* AvailableBudgetController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -64,20 +64,19 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/available_budgets/getAvailableBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/available_budgets/getAvailableBudget
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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');
|
||||
$end = $this->parameters->get('end');
|
||||
@@ -89,7 +88,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AvailableBudgetTransformer::class);
|
||||
@@ -103,14 +102,13 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/available_budgets/getAvailableBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/available_budgets/getAvailableBudget
|
||||
*
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param AvailableBudget $availableBudget
|
||||
* @param AvailableBudget $availableBudget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function show(AvailableBudget $availableBudget): JsonResponse
|
||||
{
|
||||
@@ -124,5 +122,4 @@ class ShowController extends Controller
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
@@ -38,7 +38,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -55,14 +55,13 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/deleteBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/deleteBill
|
||||
*
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function destroy(Bill $bill): JsonResponse
|
||||
{
|
||||
@@ -71,5 +70,4 @@ class DestroyController extends Controller
|
||||
|
||||
return response()->json([], 204);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -68,20 +68,19 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/listAttachmentByBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/listAttachmentByBill
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function attachments(Bill $bill): JsonResponse
|
||||
{
|
||||
$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);
|
||||
|
||||
$count = $collection->count();
|
||||
@@ -89,7 +88,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -103,22 +102,21 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/listRuleByBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/listRuleByBill
|
||||
*
|
||||
* List all of them.
|
||||
*
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function rules(Bill $bill): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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.
|
||||
$collection = $this->repository->getRulesForBill($bill);
|
||||
@@ -127,7 +125,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(RuleTransformer::class);
|
||||
@@ -136,26 +134,24 @@ class ListController extends Controller
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/listTransactionByBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/listTransactionByBill
|
||||
*
|
||||
* Show all transactions.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
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';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@@ -188,7 +184,7 @@ class ListController extends Controller
|
||||
|
||||
// get paginator.
|
||||
$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();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
@@ -200,5 +196,4 @@ class ListController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,20 +61,19 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/listBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/listBill
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$this->repository->correctOrder();
|
||||
$bills = $this->repository->getBills();
|
||||
$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();
|
||||
$bills = $bills->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
$paginator = new LengthAwarePaginator($bills, $count, $pageSize, $this->parameters->get('page'));
|
||||
@@ -91,14 +90,13 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/getBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/getBill
|
||||
*
|
||||
* Show the specified bill.
|
||||
*
|
||||
* @param Bill $bill
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function show(Bill $bill): JsonResponse
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,11 +61,11 @@ class StoreController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/storeBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/storeBill
|
||||
*
|
||||
* Store a bill.
|
||||
*
|
||||
* @param StoreRequest $request
|
||||
* @param StoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
@@ -41,7 +41,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* BillController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,12 +58,12 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/bills/updateBill
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/bills/updateBill
|
||||
*
|
||||
* Update a bill.
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param Bill $bill
|
||||
* @param UpdateRequest $request
|
||||
* @param Bill $bill
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -80,7 +80,5 @@ class UpdateController extends Controller
|
||||
$resource = new Item($bill, $transformer, 'bills');
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* DestroyController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -55,14 +55,13 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/deleteBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/deleteBudget
|
||||
*
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function destroy(Budget $budget): JsonResponse
|
||||
{
|
||||
|
@@ -53,7 +53,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* ListController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -72,18 +72,17 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listAttachmentByBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listAttachmentByBudget
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function attachments(Budget $budget): JsonResponse
|
||||
{
|
||||
$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);
|
||||
|
||||
$count = $collection->count();
|
||||
@@ -91,7 +90,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -105,26 +104,25 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listBudgetLimitByBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listBudgetLimitByBudget
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function budgetLimits(Budget $budget): JsonResponse
|
||||
{
|
||||
$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);
|
||||
$collection = $this->blRepository->getBudgetLimits($budget, $this->parameters->get('start'), $this->parameters->get('end'));
|
||||
$count = $collection->count();
|
||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
$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 */
|
||||
$transformer = app(BudgetLimitTransformer::class);
|
||||
@@ -137,21 +135,20 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listTransactionByBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listTransactionByBudget
|
||||
*
|
||||
* Show all transactions.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
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.
|
||||
$limit = $this->parameters->get('limit');
|
||||
@@ -189,7 +186,7 @@ class ListController extends Controller
|
||||
}
|
||||
|
||||
$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();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
@@ -203,19 +200,18 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listTransactionWithoutBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listTransactionWithoutBudget
|
||||
*
|
||||
* Show all transactions.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
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.
|
||||
$limit = $this->parameters->get('limit');
|
||||
@@ -253,7 +249,7 @@ class ListController extends Controller
|
||||
}
|
||||
|
||||
$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();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
@@ -264,5 +260,4 @@ class ListController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* ListController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -65,20 +65,19 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listBudget
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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.
|
||||
$collection = $this->repository->getBudgets();
|
||||
@@ -87,7 +86,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(BudgetTransformer::class);
|
||||
@@ -102,10 +101,9 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Show a budget.
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function show(Budget $budget): JsonResponse
|
||||
{
|
||||
@@ -119,5 +117,4 @@ class ShowController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* StoreController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,11 +58,11 @@ class StoreController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/storeBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/storeBudget
|
||||
*
|
||||
* Store a budget.
|
||||
*
|
||||
* @param StoreRequest $request
|
||||
* @param StoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
@@ -41,7 +41,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* UpdateController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,12 +58,12 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/updateBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/updateBudget
|
||||
*
|
||||
* Update a budget.
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param Budget $budget
|
||||
* @param UpdateRequest $request
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -80,6 +80,5 @@ class UpdateController extends Controller
|
||||
$resource = new Item($budget, $transformer, 'budgets');
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* BudgetLimitController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -60,16 +60,15 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/deleteBudgetLimit
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/deleteBudgetLimit
|
||||
*
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function destroy(Budget $budget, BudgetLimit $budgetLimit): JsonResponse
|
||||
{
|
||||
|
@@ -49,7 +49,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* BudgetLimitController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -68,20 +68,19 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listTransactionByBudgetLimit
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listTransactionByBudgetLimit
|
||||
* Show all transactions.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
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';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@@ -110,7 +109,7 @@ class ListController extends Controller
|
||||
$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date);
|
||||
$collector->setTypes($types);
|
||||
$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();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
|
@@ -50,7 +50,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* BudgetLimitController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -71,27 +71,26 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listBudgetLimitByBudget
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listBudgetLimitByBudget
|
||||
*
|
||||
* Display a listing of the budget limits for this budget.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(Request $request, Budget $budget): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$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'));
|
||||
$count = $collection->count();
|
||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
$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 */
|
||||
$transformer = app(BudgetLimitTransformer::class);
|
||||
@@ -105,26 +104,25 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/listBudgetLimit
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listBudgetLimit
|
||||
*
|
||||
* Display a listing of the budget limits for this budget.
|
||||
*
|
||||
* @param DateRequest $request
|
||||
* @param DateRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function indexAll(DateRequest $request): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
$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'));
|
||||
$count = $collection->count();
|
||||
$budgetLimits = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
|
||||
$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 */
|
||||
$transformer = app(BudgetLimitTransformer::class);
|
||||
@@ -138,18 +136,18 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/getBudgetLimit
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/getBudgetLimit
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
* @param Request $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
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.');
|
||||
}
|
||||
// continue!
|
||||
@@ -163,5 +161,4 @@ class ShowController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* BudgetLimitController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,12 +61,12 @@ class StoreController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/storeBudgetLimit
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/storeBudgetLimit
|
||||
*
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param StoreRequest $request
|
||||
* @param Budget $budget
|
||||
* @param StoreRequest $request
|
||||
* @param Budget $budget
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -43,11 +43,11 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/budgets/updateBudgetLimit
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/updateBudgetLimit
|
||||
*
|
||||
* BudgetLimitController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -66,18 +66,19 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/updateBudgetLimit
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
* @param UpdateRequest $request
|
||||
* @param Budget $budget
|
||||
* @param BudgetLimit $budgetLimit
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
*/
|
||||
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.');
|
||||
}
|
||||
$data = $request->getAll();
|
||||
@@ -92,6 +93,5 @@ class UpdateController extends Controller
|
||||
$resource = new Item($budgetLimit, $transformer, 'budget_limits');
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -55,14 +55,13 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/categories/deleteCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/deleteCategory
|
||||
*
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Category $category
|
||||
* @param Category $category
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function destroy(Category $category): JsonResponse
|
||||
{
|
||||
|
@@ -50,7 +50,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -67,18 +67,17 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/categories/listAttachmentByCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/listAttachmentByCategory
|
||||
*
|
||||
* @param Category $category
|
||||
* @param Category $category
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function attachments(Category $category): JsonResponse
|
||||
{
|
||||
$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);
|
||||
|
||||
$count = $collection->count();
|
||||
@@ -86,7 +85,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -100,21 +99,20 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/categories/listTransactionByCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/listTransactionByCategory
|
||||
*
|
||||
* Show all transactions.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @param Category $category
|
||||
* @param Category $category
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
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';
|
||||
$this->parameters->set('type', $type);
|
||||
|
||||
@@ -145,7 +143,7 @@ class ListController extends Controller
|
||||
}
|
||||
|
||||
$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();
|
||||
|
||||
/** @var TransactionGroupTransformer $transformer */
|
||||
@@ -157,5 +155,4 @@ class ListController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,20 +61,19 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/categories/listCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/listCategory
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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.
|
||||
$collection = $this->repository->getCategories();
|
||||
@@ -83,7 +82,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(CategoryTransformer::class);
|
||||
@@ -96,14 +95,13 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/categories/getCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/getCategory
|
||||
*
|
||||
* Show the category.
|
||||
*
|
||||
* @param Category $category
|
||||
* @param Category $category
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function show(Category $category): JsonResponse
|
||||
{
|
||||
|
@@ -41,7 +41,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,11 +58,11 @@ class StoreController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/categories/storeCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/storeCategory
|
||||
*
|
||||
* Store new category.
|
||||
*
|
||||
* @param StoreRequest $request
|
||||
* @param StoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
@@ -80,5 +80,4 @@ class StoreController extends Controller
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* CategoryController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,12 +58,12 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/categories/updateCategory
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/updateCategory
|
||||
*
|
||||
* Update the category.
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param Category $category
|
||||
* @param UpdateRequest $request
|
||||
* @param Category $category
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -80,6 +80,5 @@ class UpdateController extends Controller
|
||||
$resource = new Item($category, $transformer, 'categories');
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* ObjectGroupController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,13 +58,12 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/object_groups/deleteObjectGroup
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/object_groups/deleteObjectGroup
|
||||
*
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(ObjectGroup $objectGroup): JsonResponse
|
||||
|
@@ -45,7 +45,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* ObjectGroupController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -64,21 +64,20 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/object_groups/listBillByObjectGroup
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/object_groups/listBillByObjectGroup
|
||||
*
|
||||
* List all bills in this object group
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function bills(ObjectGroup $objectGroup): JsonResponse
|
||||
{
|
||||
$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.
|
||||
$collection = $this->repository->getBills($objectGroup);
|
||||
$count = $collection->count();
|
||||
@@ -86,7 +85,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(BillTransformer::class);
|
||||
@@ -100,15 +99,14 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/object_groups/listPiggyBankByObjectGroup
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/object_groups/listPiggyBankByObjectGroup
|
||||
*
|
||||
* List all piggies under the object group.
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function piggyBanks(ObjectGroup $objectGroup): JsonResponse
|
||||
{
|
||||
@@ -116,7 +114,7 @@ class ListController extends Controller
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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.
|
||||
$collection = $this->repository->getPiggyBanks($objectGroup);
|
||||
@@ -125,7 +123,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(PiggyBankTransformer::class);
|
||||
@@ -135,6 +133,5 @@ class ListController extends Controller
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* ObjectGroupController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -65,22 +65,21 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/object_groups/listObjectGroups
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/object_groups/listObjectGroups
|
||||
*
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
|
||||
// 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();
|
||||
$collection = $this->repository->get();
|
||||
@@ -89,7 +88,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(ObjectGroupTransformer::class);
|
||||
@@ -103,11 +102,11 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/object_groups/getObjectGroup
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/object_groups/getObjectGroup
|
||||
*
|
||||
* Show single instance.
|
||||
*
|
||||
* @param ObjectGroup $objectGroup
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -42,7 +42,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* ObjectGroupController constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,10 +61,10 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/object_groups/updateObjectGroup
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/object_groups/updateObjectGroup
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param ObjectGroup $objectGroup
|
||||
* @param UpdateRequest $request
|
||||
* @param ObjectGroup $objectGroup
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
@@ -38,7 +38,7 @@ class DestroyController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -55,14 +55,13 @@ class DestroyController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/piggy_banks/deletePiggyBank
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/deletePiggyBank
|
||||
*
|
||||
* Delete the resource.
|
||||
*
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function destroy(PiggyBank $piggyBank): JsonResponse
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ class ListController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,18 +61,17 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/piggy_banks/listAttachmentByPiggyBank
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/listAttachmentByPiggyBank
|
||||
*
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function attachments(PiggyBank $piggyBank): JsonResponse
|
||||
{
|
||||
$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);
|
||||
|
||||
$count = $collection->count();
|
||||
@@ -80,7 +79,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(AttachmentTransformer::class);
|
||||
@@ -94,20 +93,19 @@ class ListController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/piggy_banks/listEventByPiggyBank
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/listEventByPiggyBank
|
||||
*
|
||||
* List single resource.
|
||||
*
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse
|
||||
{
|
||||
// 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();
|
||||
|
||||
$collection = $this->repository->getEvents($piggyBank);
|
||||
@@ -116,7 +114,7 @@ class ListController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(PiggyBankEventTransformer::class);
|
||||
@@ -126,6 +124,5 @@ class ListController extends Controller
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ class ShowController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -61,19 +61,18 @@ class ShowController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/piggy_banks/listPiggyBank
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/listPiggyBank
|
||||
*
|
||||
* List all of them.
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$manager = $this->getManager();
|
||||
// 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.
|
||||
$collection = $this->repository->getPiggyBanks();
|
||||
@@ -82,7 +81,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$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 */
|
||||
$transformer = app(PiggyBankTransformer::class);
|
||||
@@ -92,19 +91,17 @@ class ShowController extends Controller
|
||||
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/piggy_banks/getPiggyBank
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/getPiggyBank
|
||||
*
|
||||
* List single resource.
|
||||
*
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function show(PiggyBank $piggyBank): JsonResponse
|
||||
{
|
||||
@@ -117,6 +114,5 @@ class ShowController extends Controller
|
||||
$resource = new Item($piggyBank, $transformer, 'piggy_banks');
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ class StoreController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,11 +58,11 @@ class StoreController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/piggy_banks/storePiggyBank
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/storePiggyBank
|
||||
*
|
||||
* Store new object.
|
||||
*
|
||||
* @param StoreRequest $request
|
||||
* @param StoreRequest $request
|
||||
*
|
||||
* @return JsonResponse
|
||||
* @throws FireflyException
|
||||
|
@@ -41,7 +41,7 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
@@ -58,12 +58,12 @@ class UpdateController extends Controller
|
||||
|
||||
/**
|
||||
* This endpoint is documented at:
|
||||
* https://api-docs.firefly-iii.org/#/piggy_banks/updatePiggyBank
|
||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/updatePiggyBank
|
||||
*
|
||||
* Update piggy bank.
|
||||
*
|
||||
* @param UpdateRequest $request
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param UpdateRequest $request
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
@@ -84,6 +84,5 @@ class UpdateController extends Controller
|
||||
$resource = new Item($piggyBank, $transformer, 'piggy_banks');
|
||||
|
||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
|
||||
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user