mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-19 12:59:36 +02:00
Compare commits
1199 commits
Author | SHA1 | Date | |
---|---|---|---|
|
4e96e529f4 | ||
|
cadea118d3 | ||
|
7a17e0e1d8 | ||
|
6516bc56ef | ||
|
a6b39f64d6 | ||
|
36f9022872 | ||
|
3b0ccdb6d3 | ||
|
9964398e25 | ||
|
df24316837 | ||
|
63e8e96d52 | ||
|
08cd3912c7 | ||
|
eef8c92e82 | ||
|
3306b799df | ||
|
8b108c5797 | ||
|
93a489a778 | ||
|
44ea7dff0c | ||
|
7ec4e5d0f5 | ||
|
380fe1364f | ||
|
69631848cf | ||
|
7f285f2b1d | ||
|
4f7d408460 | ||
|
aed76a5689 | ||
|
a556c49147 | ||
|
ea4b6bd715 | ||
|
2fb1548f9f | ||
|
be8ac67161 | ||
|
0636f0ec8c | ||
|
09ffb6cdff | ||
|
930c98a607 | ||
|
cee9345bf1 | ||
|
ced1f94473 | ||
|
da65235277 | ||
|
ab5082317e | ||
|
c2074c1581 | ||
|
977843cbc6 | ||
|
b0e8000cf8 | ||
|
b5931c6c23 | ||
|
151c76dbd1 | ||
|
d4c76f8718 | ||
|
badeac867d | ||
|
a99553ba0d | ||
|
14eb4ca802 | ||
|
7eb96bcc2a | ||
|
24cf3f844d | ||
|
c60ced09c4 | ||
|
05db98f968 | ||
|
3f9a6767bd | ||
|
f6b9802ba7 | ||
|
71ff217323 | ||
|
ef5dca79e5 | ||
|
d9070e68bb | ||
|
f72fb50eb0 | ||
|
b59dcade3b | ||
|
164627b35b | ||
|
3f89fad67f | ||
|
871e265001 | ||
|
2cab28e921 | ||
|
8a46bd7ed3 | ||
|
f36de76501 | ||
|
55f501d939 | ||
|
0037d037cf | ||
|
19baf6ab35 | ||
|
20cdc2405f | ||
|
297eb2916a | ||
|
27a27545ca | ||
|
06a5bb06b3 | ||
|
c0f2d060db | ||
|
2d7b6c85c9 | ||
|
5d0132a2a8 | ||
|
39c664ab1a | ||
|
d91a4fbe98 | ||
|
90624664f4 | ||
|
5f9d0cd207 | ||
|
36a2e59d52 | ||
|
af5be0bc8f | ||
|
16840a6040 | ||
|
ebee6f52e8 | ||
|
9d817a5ce9 | ||
|
6fdfb86297 | ||
|
c0c91c8472 | ||
|
d6ab4e9f64 | ||
|
4f342425ab | ||
|
6c338b8c0f | ||
|
2f7103f5f3 | ||
|
d0c1ecd394 | ||
|
cf108ecd3a | ||
|
50a80a8116 | ||
|
442a7724a0 | ||
|
b336a24401 | ||
|
45e195a84e | ||
|
937db00226 | ||
|
0838a41156 | ||
|
06787bccf6 | ||
|
f95afdc35c | ||
|
c159e176b3 | ||
|
b50447b1a2 | ||
|
92f9bf6908 | ||
|
48df9ee56d | ||
|
64bfda6bf0 | ||
|
8f1c60a440 | ||
|
806efd71bf | ||
|
e89f2a947e | ||
|
724aec1f3a | ||
|
514ee85767 | ||
|
53d370297e | ||
|
ae16c12251 | ||
|
4e8024051c | ||
|
9d69935f22 | ||
|
787ac4a8b3 | ||
|
81006af027 | ||
|
3acfc9f228 | ||
|
8be723b9ad | ||
|
a7128756bd | ||
|
d41d46f15d | ||
|
0adfdfa62f | ||
|
fa52af8ad1 | ||
|
6be4acb196 | ||
|
9df0338c3d | ||
|
069bcfb58a | ||
|
1551fba9ab | ||
|
56b8b55b84 | ||
|
57aa2c9916 | ||
|
37866660d3 | ||
|
d34a9001c0 | ||
|
bcd1f02131 | ||
|
f2246921d4 | ||
|
575669aedf | ||
|
9eaaadc0f2 | ||
|
3f6aa67b3f | ||
|
5e6d5305cc | ||
|
4fb25f63fd | ||
|
40f54529a4 | ||
|
7707ac7769 | ||
|
b25bf4af27 | ||
|
f355ba48e2 | ||
|
e56335d30f | ||
|
c123231bab | ||
|
9e304f81fe | ||
|
1997f164b8 | ||
|
c0b9013576 | ||
|
ce9faa28f8 | ||
|
68ba3c4b4d | ||
|
042d034594 | ||
|
ec2b285d50 | ||
|
03c76adc6d | ||
|
4404064263 | ||
|
7fddca6fb0 | ||
|
809cf98169 | ||
|
d3d74f9f35 | ||
|
e856a57498 | ||
|
0d5792a99a | ||
|
2ccb8f5e0b | ||
|
0d800e8986 | ||
|
3d9f4545a1 | ||
|
0a7db8985d | ||
|
c828f86570 | ||
|
a1062e72cf | ||
|
84cd136401 | ||
|
ac32f9ac5b | ||
|
d52e302e9b | ||
|
14e71626f6 | ||
|
f96b6f5f65 | ||
|
5dfe39468a | ||
|
a991f54d0a | ||
|
274dafc47d | ||
|
5f19670ed9 | ||
|
bd9f3fc494 | ||
|
d87d0e807f | ||
|
8b41a0f5a4 | ||
|
9435ccfa5a | ||
|
890332f4b6 | ||
|
049c229799 | ||
|
f15d7bfd1e | ||
|
7c3c139e61 | ||
|
1ff116ed00 | ||
|
b0e8c025fc | ||
|
feeb682e14 | ||
|
6de737bbf8 | ||
|
6ca674ff7e | ||
|
908d31a4a3 | ||
|
4af80eb584 | ||
|
d9d754a87c | ||
|
abc2d86dcf | ||
|
330fabb3e0 | ||
|
8538aa0b7c | ||
|
c9fa1d55f7 | ||
|
ab189c8aff | ||
|
1323d91e32 | ||
|
b30d6df964 | ||
|
89c4f1058a | ||
|
13bc748d0d | ||
|
c6177c5a05 | ||
|
e9c333642f | ||
|
07c0c36ab8 | ||
|
b712d10d7e | ||
|
a5e44d29e6 | ||
|
a91018d792 | ||
|
9f86688fe9 | ||
|
4ce7ed7045 | ||
|
b74fe90512 | ||
|
73c664e549 | ||
|
5e1f17fe2e | ||
|
f3f75368df | ||
|
ab12a2e7d8 | ||
|
cbb8c6283b | ||
|
0af0218a34 | ||
|
04f9227ae6 | ||
|
3caebd37dd | ||
|
311e2847cb | ||
|
2c50ca0b1a | ||
|
bbad7b890c | ||
|
5c109bbbaf | ||
|
c93d4865ce | ||
|
8d0490fd81 | ||
|
77be046f19 | ||
|
827b150965 | ||
|
7442bd70cd | ||
|
645cc9728b | ||
|
d99ca18e1c | ||
|
39104b3fef | ||
|
5bdadd0f88 | ||
|
f1f1cda799 | ||
|
f31db982ce | ||
|
f6097a2d60 | ||
|
5f7bf52758 | ||
|
911ce67d9f | ||
|
932036bc8b | ||
|
cd494fefee | ||
|
5136122ed9 | ||
|
e40ea028d0 | ||
|
56bbbb0ffb | ||
|
228f79dbc3 | ||
|
e44c153f9b | ||
|
3a8776c000 | ||
|
b8aa96b5b3 | ||
|
be0e56728a | ||
|
85b4db87ec | ||
|
c12f94855d | ||
|
6942f5e1bb | ||
|
7499722867 | ||
|
1ea4022e80 | ||
|
a8502884dc | ||
|
b29461f29d | ||
|
983a038420 | ||
|
233d2be63f | ||
|
64377c0300 | ||
|
0f36f34bfb | ||
|
ea85c5fc5a | ||
|
9a825e56e4 | ||
|
9043ee9565 | ||
|
a11400fa98 | ||
|
44a260b5b6 | ||
|
49f7bf27e8 | ||
|
dd01ada61e | ||
|
a974c8c275 | ||
|
988cdc12e6 | ||
|
548d43b563 | ||
|
23426012af | ||
|
2b031f51ac | ||
|
d7496df100 | ||
|
6f489b2734 | ||
|
a09b3f379f | ||
|
937c3c6a68 | ||
|
43b8275fc1 | ||
|
3b5240dffe | ||
|
d2933854ff | ||
|
0ce101594f | ||
|
b166058d36 | ||
|
15d34c88dc | ||
|
af2778ff61 | ||
|
2982a4044d | ||
|
658764fb58 | ||
|
847193a0ae | ||
|
8531855f46 | ||
|
af8a9acbae | ||
|
8041f67ba1 | ||
|
cd833884e8 | ||
|
47c219affd | ||
|
cde293c4bd | ||
|
04c3402e14 | ||
|
b4c5e22662 | ||
|
7d5750049b | ||
|
16a7772003 | ||
|
731b7e9db1 | ||
|
ca4ef79837 | ||
|
13d3b24ec2 | ||
|
113d41ca30 | ||
|
b71109fd09 | ||
|
a3cd940065 | ||
|
6eebd5b70a | ||
|
44ede92b92 | ||
|
fe25f8e2c8 | ||
|
794df82ec6 | ||
|
db63b6e7d8 | ||
|
4ccfa6e42c | ||
|
f79b06f6b3 | ||
|
1042a3edcc | ||
|
771579ef3d | ||
|
dbd417ca87 | ||
|
6e1fbbfc3a | ||
|
76ee4c73e0 | ||
|
c402dff9a7 | ||
|
f554bb8777 | ||
|
876c5e83b4 | ||
|
1dc8e10758 | ||
|
9fd2a142cb | ||
|
6eb57d1d6e | ||
|
6f720a154f | ||
|
585f050a30 | ||
|
3b6d437f29 | ||
|
b82e4b6f0d | ||
|
4e543fad55 | ||
|
eb541225bd | ||
|
a38828eb45 | ||
|
9adf1d158a | ||
|
ea61b5e67a | ||
|
189cd0ee69 | ||
|
c2fc249c92 | ||
|
a640934370 | ||
|
7fbcf170d0 | ||
|
d26d3a2128 | ||
|
50a732b4d7 | ||
|
d9a88b644f | ||
|
b7d6d6af56 | ||
|
4db72d9719 | ||
|
eaab1f8a7c | ||
|
ed76c1426e | ||
|
a16df1640d | ||
|
fee6c66eab | ||
|
6d3b4c1e8e | ||
|
4759ff71a1 | ||
|
7a63e1227f | ||
|
689d2af21c | ||
|
3e0639e6f7 | ||
|
3c9aec4bfb | ||
|
b1068d27b0 | ||
|
d5311bb71e | ||
|
00e4ec64ae | ||
|
b61083f7df | ||
|
d80805a181 | ||
|
ea36b104b6 | ||
|
232e01bf8f | ||
|
1c15e85986 | ||
|
7cea432353 | ||
|
a7513d6c06 | ||
|
b4496508dd | ||
|
2713b3640f | ||
|
670e499d8f | ||
|
16fc9bc70e | ||
|
577eb9cceb | ||
|
af33acec66 | ||
|
00f0fc9acf | ||
|
d31b95289d | ||
|
b5d6788c11 | ||
|
9e5e2456fa | ||
|
60b5bbb3c8 | ||
|
299b190f69 | ||
|
cf4691beaf | ||
|
68924d7ecc | ||
|
1351f26ba0 | ||
|
57db1e088f | ||
|
cbcf2a70d7 | ||
|
d4f9abd158 | ||
|
a899579a02 | ||
|
d2cb862103 | ||
|
d1f50dfa17 | ||
|
271cba9abc | ||
|
921e756aef | ||
|
f7ff8f30b0 | ||
|
9b54af8d40 | ||
|
5f344cad83 | ||
|
a00d2abe0d | ||
|
e93909e7ea | ||
|
8ea8043beb | ||
|
9c3a52ae85 | ||
|
ad5fb02ebb | ||
|
ed1e24252c | ||
|
df60184f23 | ||
|
da9c2ba80a | ||
|
5b42e8b372 | ||
|
28b2a918e8 | ||
|
4da34032e9 | ||
|
dc169d1046 | ||
|
659c56f02d | ||
|
bdb17a3177 | ||
|
7d71c84fd2 | ||
|
c1807826d0 | ||
|
341de6daea | ||
|
9cdd502264 | ||
|
cc6a98d23b | ||
|
94fca45af0 | ||
|
c7d34f6c48 | ||
|
08bfeac837 | ||
|
aaacacbd60 | ||
|
bc08362a4c | ||
|
85b55660f9 | ||
|
6d80969fdc | ||
|
defd97fc02 | ||
|
afdc894f23 | ||
|
41cc47d631 | ||
|
145627b1eb | ||
|
896c537791 | ||
|
b68e2dedaa | ||
|
db077b5fd7 | ||
|
697851e210 | ||
|
3468e82b04 | ||
|
680a2378d9 | ||
|
f5dc0ceb0a | ||
|
d326d38329 | ||
|
6a5bfbda2d | ||
|
37fca9ba1d | ||
|
abaee8c9c4 | ||
|
6b090096d6 | ||
|
8fef53fd24 | ||
|
8fee537d8b | ||
|
69967b759f | ||
|
f04a6e30a7 | ||
|
9e66c67c62 | ||
|
12a6429812 | ||
|
0eb4bc706a | ||
|
6ea0e07775 | ||
|
d5fe7eeff8 | ||
|
1447a948c2 | ||
|
10230e926c | ||
|
3f30819d25 | ||
|
6e28e5234e | ||
|
1b3cf6ab39 | ||
|
f9cf92041d | ||
|
64d2bdebce | ||
|
30c58ca118 | ||
|
25edec460b | ||
|
1f3abf7f32 | ||
|
94c3e3d363 | ||
|
a88e59869e | ||
|
3ccd078508 | ||
|
e9538b707f | ||
|
e0fa62c1ea | ||
|
aa216f5688 | ||
|
433599dc20 | ||
|
f7e183f9a3 | ||
|
f10e171a8e | ||
|
d60945d5b7 | ||
|
9132ef39ec | ||
|
8f6e655378 | ||
|
1a7643b8a7 | ||
|
fcec4a420c | ||
|
75162bbf7b | ||
|
ae8617a9fb | ||
|
8af53f8f01 | ||
|
a508dd8d96 | ||
|
8f1f2e139a | ||
|
e9084db832 | ||
|
6289c7e305 | ||
|
0cee4c386d | ||
|
f4450b6a38 | ||
|
5b4092ba6c | ||
|
2b78021155 | ||
|
9ceee13edc | ||
|
f56abd2312 | ||
|
62efa2478e | ||
|
0588555707 | ||
|
bcbe7657ad | ||
|
5f1a611671 | ||
|
21345e0971 | ||
|
b4c9cd1f27 | ||
|
92a52d65f2 | ||
|
2c1b540c20 | ||
|
743774dbca | ||
|
5cce76274a | ||
|
16cdda2b82 | ||
|
611509a289 | ||
|
af4026300b | ||
|
ab2ad829f2 | ||
|
ce87afeeb9 | ||
|
5965b82780 | ||
|
4a1e51e12a | ||
|
7be21fcace | ||
|
c084a40cab | ||
|
b16b1a1e44 | ||
|
69673fb5ef | ||
|
b023078e04 | ||
|
f6605bc1bf | ||
|
e8f2c7ea81 | ||
|
187f4c0a4f | ||
|
ef44836328 | ||
|
96ff727b57 | ||
|
a8e84be28e | ||
|
4c84ac0979 | ||
|
62d2fd7c6a | ||
|
609f68b10d | ||
|
4a36fbb4c1 | ||
|
145a3f00c5 | ||
|
062111d7fe | ||
|
ec3ada986d | ||
|
a010afcc43 | ||
|
563373dd54 | ||
|
a766a07ea1 | ||
|
f27453824a | ||
|
ac37bc98c4 | ||
|
53d500b7d5 | ||
|
9a7667fd62 | ||
|
7f2c3c33a5 | ||
|
6252f3cf14 | ||
|
6413b9a985 | ||
|
3b5b5d83b9 | ||
|
0f828dd0bf | ||
|
32125efed4 | ||
|
1f7d75acfc | ||
|
30f1eaef1c | ||
|
af1d43ddf3 | ||
|
b04a8b8a9e | ||
|
fa60db1d93 | ||
|
e8f3674101 | ||
|
cd06f838b0 | ||
|
377420226e | ||
|
5cccadad15 | ||
|
3bde752234 | ||
|
2cd60adc8c | ||
|
2221b1dad9 | ||
|
88d62eb869 | ||
|
76ee4a7290 | ||
|
a50f051079 | ||
|
ef996cd302 | ||
|
ae3c43f7c8 | ||
|
b1a3379604 | ||
|
1e48152e1a | ||
|
de8764499b | ||
|
013a2cc751 | ||
|
22790ae7c0 | ||
|
abe870506f | ||
|
80cec30fda | ||
|
44810e6343 | ||
|
a883d4104d | ||
|
f670fbc93a | ||
|
548702890d | ||
|
a5aa09ed7b | ||
|
e19781d7ac | ||
|
59b41c01df | ||
|
128c33d9a1 | ||
|
a9c2af9649 | ||
|
4fdc16da58 | ||
|
604cfa05b3 | ||
|
3d22621a26 | ||
|
9e4846a66a | ||
|
a4df852744 | ||
|
56244329f5 | ||
|
230a786d6e | ||
|
259f2e75c2 | ||
|
82a1134019 | ||
|
50e0d4a34e | ||
|
3a024e1e18 | ||
|
57e367d112 | ||
|
6651557738 | ||
|
c6fa603a93 | ||
|
991efa8d08 | ||
|
73036dcef8 | ||
|
eea87e59a5 | ||
|
386014db92 | ||
|
81b60d6021 | ||
|
cee9f16cf5 | ||
|
5d12d103fc | ||
|
67f6af8ca3 | ||
|
15fd15ba40 | ||
|
dc89743569 | ||
|
66ce80226e | ||
|
79db20a903 | ||
|
d5ff2fc6b7 | ||
|
fd7f285c57 | ||
|
b5ac66a1cc | ||
|
bc6cf42b8e | ||
|
8716efb613 | ||
|
7cf634def8 | ||
|
697c40fca0 | ||
|
5d3ec181a0 | ||
|
46e3e91679 | ||
|
8f7551f4be | ||
|
df2ce01910 | ||
|
f7c998ab58 | ||
|
c3782cc9d7 | ||
|
c11395cbd6 | ||
|
c9dd5fe33d | ||
|
d6eb4edddd | ||
|
c3fddb1889 | ||
|
7c68dc839a | ||
|
57f2bdb8ba | ||
|
dd08a6fe24 | ||
|
4de6fa675f | ||
|
7d609d01ea | ||
|
e0296543b6 | ||
|
edc5fdf1cc | ||
|
f3c3e19d51 | ||
|
54c859b2a8 | ||
|
6cf17ce56e | ||
|
c77b3573d4 | ||
|
febbdfa252 | ||
|
148568fca4 | ||
|
10dbafd1ee | ||
|
c966b73eba | ||
|
0c27f4b8a4 | ||
|
4839edde7b | ||
|
c0fd91ef8d | ||
|
0376709325 | ||
|
9bf0849b92 | ||
|
1b54f8ed69 | ||
|
7b7db1c530 | ||
|
673a56c6a0 | ||
|
54d7a1a229 | ||
|
2ccbf4be83 | ||
|
0272c6b076 | ||
|
f7742ca37d | ||
|
2f321517a6 | ||
|
57f3be0938 | ||
|
914028ea2f | ||
|
6a00a2ed55 | ||
|
91a51515dd | ||
|
56a4292f4f | ||
|
64105808b5 | ||
|
ca66b85838 | ||
|
d44cb06e31 | ||
|
f0603f7dbd | ||
|
0616fe19f3 | ||
|
a39e22b0a8 | ||
|
82040d5c85 | ||
|
88dbd41b92 | ||
|
21d8b376b3 | ||
|
dc29f48ab2 | ||
|
4ecad7f46d | ||
|
0a2b172405 | ||
|
6ba047d2a5 | ||
|
50dc0424a9 | ||
|
84566b8ec1 | ||
|
c65fcc2558 | ||
|
b86c7258e7 | ||
|
1f4a02467b | ||
|
aecb3ca70e | ||
|
2d24cb8aba | ||
|
0d9c063c58 | ||
|
f119e6fdc2 | ||
|
53dc57453c | ||
|
9bc20be70e | ||
|
bde2e6a82d | ||
|
7defdac3a8 | ||
|
0878008a05 | ||
|
0b08dfbab9 | ||
|
888bde042e | ||
|
335b5c2498 | ||
|
9f9e4fd12e | ||
|
30e2606a2f | ||
|
df0d49298f | ||
|
2ea3637c4b | ||
|
84c013fa11 | ||
|
f618c24a7b | ||
|
39991c1877 | ||
|
483c297af8 | ||
|
66713ea76d | ||
|
ec4935ecdd | ||
|
173c6183b3 | ||
|
f5a0f388b7 | ||
|
9d2f83d4b6 | ||
|
7a3ec33fa7 | ||
|
958e9de84e | ||
|
06f0b93dd5 | ||
|
734208d869 | ||
|
fd3c30f540 | ||
|
6963fd858e | ||
|
74ff1b0b7f | ||
|
4dbcd96581 | ||
|
def642960c | ||
|
d20de4aeed | ||
|
a0aae8c237 | ||
|
02f534662b | ||
|
477e76a0af | ||
|
f878167a36 | ||
|
adf45ff557 | ||
|
ce0b82acb7 | ||
|
17d8784d8c | ||
|
d7baf6961e | ||
|
b1ec7dc815 | ||
|
8e5a20ec62 | ||
|
736ede2417 | ||
|
a6630b7de2 | ||
|
9b28d9a315 | ||
|
86d213bb8b | ||
|
129c76078e | ||
|
42f07dc2fb | ||
|
ae92fc2027 | ||
|
4a7f720773 | ||
|
0ea948c62c | ||
|
c3f37b66d0 | ||
|
954c154add | ||
|
10a0963a1e | ||
|
f16a7f1e94 | ||
|
39fce5ace7 | ||
|
0a7704aade | ||
|
adb92a1d41 | ||
|
bde33260fa | ||
|
3dc193d098 | ||
|
742cb9dd94 | ||
|
6132b1c0d6 | ||
|
efd19da10b | ||
|
98e545be6f | ||
|
add691b678 | ||
|
b32c780266 | ||
|
c7207ccf52 | ||
|
bcba4f4425 | ||
|
2c3fb41e5c | ||
|
04b332e031 | ||
|
de45296dc1 | ||
|
c27bf4baba | ||
|
87928932c2 | ||
|
6eff9f6456 | ||
|
44c0ffc1d7 | ||
|
40cb5daa07 | ||
|
9c6e11b16d | ||
|
9ac4a8f4e9 | ||
|
7cd869a507 | ||
|
7988ba4d68 | ||
|
3df124b250 | ||
|
c0aaec1436 | ||
|
4bbbc10097 | ||
|
172f07acca | ||
|
6137411b84 | ||
|
07263c5697 | ||
|
e6c5bc9ca8 | ||
|
b60455b50a | ||
|
a7a49227c4 | ||
|
25ed72afbc | ||
|
727daf0cfd | ||
|
9d42dbac98 | ||
|
83d06fc0a4 | ||
|
05076a6732 | ||
|
fcd2d27221 | ||
|
5011829e6e | ||
|
4f40d0de63 | ||
|
8068fe93f7 | ||
|
91c0ec8c07 | ||
|
6cf62cfb82 | ||
|
6f8864a13d | ||
|
6daacabc1b | ||
|
ae70c96ddc | ||
|
5435208d3e | ||
|
f03c74cd74 | ||
|
de873c9eb5 | ||
|
ef3f2aee10 | ||
|
78ab387055 | ||
|
874a384477 | ||
|
075257c846 | ||
|
1e67de6e14 | ||
|
0a8ff18560 | ||
|
e22e175ae5 | ||
|
53cfd276f2 | ||
|
fdf4f07156 | ||
|
f34d533dc6 | ||
|
c084f348d9 | ||
|
792d9bcda2 | ||
|
a9b42439cc | ||
|
8175daf773 | ||
|
3a66a433ca | ||
|
ca0d54034f | ||
|
aa8d456e41 | ||
|
c7653e59a5 | ||
|
daa05c1fc7 | ||
|
cb94c2ece8 | ||
|
8acc781bcf | ||
|
3508b3b04f | ||
|
2601b07b5f | ||
|
3ee9625fe8 | ||
|
5b7aaa6aad | ||
|
7621c55896 | ||
|
01797bdeb9 | ||
|
63fe90070e | ||
|
3856b4840f | ||
|
17ecf20cdf | ||
|
70c78635fc | ||
|
1e61032692 | ||
|
eaeff3c42a | ||
|
7d9bc16588 | ||
|
30d1bd14c0 | ||
|
8a1acb5d04 | ||
|
670d27921a | ||
|
81998d5e84 | ||
|
01cdcf67a2 | ||
|
fd9ddc1872 | ||
|
413aa69ac5 | ||
|
ed37ad45e4 | ||
|
f354cd1ffe | ||
|
d0791faad5 | ||
|
5ff4f66fdb | ||
|
b9cae8a687 | ||
|
1eadac90f1 | ||
|
6cb31aa125 | ||
|
c6ecfca91d | ||
|
44db008f02 | ||
|
e41d9382ab | ||
|
7e110d8670 | ||
|
c1664e82bf | ||
|
ad195911ff | ||
|
86cefc8b2f | ||
|
9a672e51cd | ||
|
0fdc119028 | ||
|
0911826501 | ||
|
6dec37d3b9 | ||
|
7c5b448c64 | ||
|
eab312e94e | ||
|
78f56a3a5f | ||
|
0fd9e04599 | ||
|
0b808401d9 | ||
|
18a4fb95e1 | ||
|
47cc1cce10 | ||
|
f12f9c06e5 | ||
|
1ced1b8b1d | ||
|
6defb19e46 | ||
|
3c353fed14 | ||
|
3c43f3cfad | ||
|
9e4a3111b9 | ||
|
4648ae7798 | ||
|
cc7c04b0ec | ||
|
6ac3f0541f | ||
|
4dc11db21d | ||
|
2f01232144 | ||
|
abee735aae | ||
|
bd6d60d24d | ||
|
9ba5b25ab5 | ||
|
6e9724979a | ||
|
5df1c4cba9 | ||
|
4a293798eb | ||
|
3a2f095ab6 | ||
|
4c858ab8b5 | ||
|
f7c440c364 | ||
|
eab2369352 | ||
|
45cc925451 | ||
|
2f78411a49 | ||
|
5f8ea0040d | ||
|
e1c25fcdfa | ||
|
dd17e24f44 | ||
|
fe8a41f51b | ||
|
ba89f90e53 | ||
|
f150423c1e | ||
|
a9c7cdb1cb | ||
|
2c280b24d6 | ||
|
2d45be3ab1 | ||
|
4ea7ef69a6 | ||
|
4d17484f86 | ||
|
9b1ce529e9 | ||
|
6380fd3abe | ||
|
c867494a17 | ||
|
7d228b302b | ||
|
a70b1f2818 | ||
|
1c9c74958b | ||
|
7375ad223d | ||
|
2d7fe56086 | ||
|
bdb37c5ca1 | ||
|
6b778dea79 | ||
|
5ca5e1f69c | ||
|
ee249fd682 | ||
|
711b974add | ||
|
ac0e917208 | ||
|
5784eec38b | ||
|
524b7fca0e | ||
|
3d3111c46e | ||
|
1c8c6fe40a | ||
|
e09ca2333a | ||
|
9c95022b0a | ||
|
4558c30d74 | ||
|
04c358a72e | ||
|
1344625bd7 | ||
|
70c812daca | ||
|
acb3bc838d | ||
|
c12693bed9 | ||
|
dcae936738 | ||
|
011e291d23 | ||
|
12ad8db047 | ||
|
c58e2e537a | ||
|
c83ef1e904 | ||
|
3915afbc22 | ||
|
d340934376 | ||
|
0664d9434c | ||
|
347f6f6913 | ||
|
f2ba479c8e | ||
|
3ce3866114 | ||
|
15755c5252 | ||
|
52264a2895 | ||
|
4b93312600 | ||
|
f237f480df | ||
|
17f36e90b7 | ||
|
824fbcb42f | ||
|
030cacf4b1 | ||
|
bed96b1a9b | ||
|
c197c074bc | ||
|
8a77cd98bb | ||
|
ffde90e6f5 | ||
|
e489a70980 | ||
|
dab6efbe32 | ||
|
c13d6f4f21 | ||
|
afe83bb03e | ||
|
43c134bf2b | ||
|
f75c650a20 | ||
|
b11c3de461 | ||
|
45196f9823 | ||
|
283431085f | ||
|
eaab74057e | ||
|
528811d0d3 | ||
|
9dfc5fc809 | ||
|
8431809d77 | ||
|
254844923b | ||
|
f32a3393d9 | ||
|
4cdbb75791 | ||
|
02d2d62f47 | ||
|
d1c194dc3a | ||
|
be384bd990 | ||
|
425b7b4b3d | ||
|
704d26f867 | ||
|
2ef4917adf | ||
|
256efc6304 | ||
|
91ef71da7a | ||
|
4241a1024e | ||
|
590fa9edc0 | ||
|
dce04fd6c4 | ||
|
f5e721cd82 | ||
|
ede5f19f8a | ||
|
fcb2fe3788 | ||
|
0943b99dfe | ||
|
f15fbbea68 | ||
|
e3479ae491 | ||
|
c038dce654 | ||
|
53272a58f8 | ||
|
0f4cf33a1a | ||
|
027956a015 | ||
|
df1fda4ce6 | ||
|
02fe21c723 | ||
|
3b936f7eac | ||
|
aada13ca40 | ||
|
e1cff9cf68 | ||
|
d5814fe6df | ||
|
2beb5819c8 | ||
|
6fea57d773 | ||
|
4e422d527a | ||
|
a7d84c0a60 | ||
|
7728be707e | ||
|
a9f2ff63b7 | ||
|
dd8999a45f | ||
|
1d65ecb761 | ||
|
2d4d98393c | ||
|
14b2ba2ae3 | ||
|
c7959350c4 | ||
|
8fa5801e00 | ||
|
7e04c9bf75 | ||
|
b7c406ec0c | ||
|
45a9045739 | ||
|
39fb4ad1ca | ||
|
de759e1b58 | ||
|
ad4c0b37b8 | ||
|
e1e750f424 | ||
|
f78c901ed4 | ||
|
b434e218a0 | ||
|
03e0530e90 | ||
|
276ea42138 | ||
|
7c446666ae | ||
|
2dc3ac3aa3 | ||
|
b8d73635f3 | ||
|
d1a49b7dd9 | ||
|
add2e2bafa | ||
|
cfe14b3708 | ||
|
987b228b7d | ||
|
c87a0d2a41 | ||
|
f0efdaa933 | ||
|
b14cf9ccd9 | ||
|
1ab375e6b4 | ||
|
c35795144e | ||
|
d552c50349 | ||
|
620c7298a9 | ||
|
d7db09693a | ||
|
48ac320238 | ||
|
254a0d9498 | ||
|
167154bed4 | ||
|
b9ebbafd76 | ||
|
6b9cd48603 | ||
|
9c75af5b7f | ||
|
0479026b11 | ||
|
d4d6b4855b | ||
|
1f3a3a5be6 | ||
|
b6348d9b73 | ||
|
68c52821fa | ||
|
63eb996b31 | ||
|
e2fed8763b | ||
|
06cd6a6c2e | ||
|
84facd073e | ||
|
0214861857 | ||
|
2b16712496 | ||
|
ff27ff31c5 | ||
|
4d193bc44d | ||
|
96663bb17b | ||
|
816e0c08fd | ||
|
175a2371b1 | ||
|
a264da39f5 | ||
|
af0088da10 | ||
|
53c9d482ef | ||
|
03927a2394 | ||
|
1fcb82188a | ||
|
f8338c6754 | ||
|
15cca42675 | ||
|
28ad207896 | ||
|
d585f30dfa | ||
|
9f574c8505 | ||
|
e9ebd7da7e | ||
|
80883202bc | ||
|
fc3f318110 | ||
|
8ff054fbc1 | ||
|
3fb4a67e3c | ||
|
3b586b7bee | ||
|
963a0d3185 | ||
|
7f41ac74eb | ||
|
4c85f8601e | ||
|
56f16ad254 | ||
|
241d4a1344 | ||
|
fa35526cd1 | ||
|
281f337dc1 | ||
|
a48b2bf752 | ||
|
e4de8a39a4 | ||
|
2f51f88f00 | ||
|
6e39a9784d | ||
|
5621e90665 | ||
|
5e22abc3f4 | ||
|
54d16e27b1 | ||
|
0109aefc6c | ||
|
2f0eba993a | ||
|
36609c4da8 | ||
|
132ad44c08 | ||
|
f846f46283 | ||
|
28b68afb12 | ||
|
83e907a9c6 | ||
|
9a7d85d544 | ||
|
54ff856036 | ||
|
a1094f805a | ||
|
25c6d3fce3 | ||
|
a3f1dc7471 | ||
|
2a072f22cb | ||
|
70a2fc45fd | ||
|
fc9e755b00 | ||
|
ffe9d6fe97 | ||
|
0a6a4019b9 | ||
|
5aef1eb8bd | ||
|
8ea07245ab | ||
|
cd55437f91 | ||
|
3da15264bd | ||
|
b88cd5df8d | ||
|
d12a396626 | ||
|
a656889905 | ||
|
2425107090 | ||
|
78c5331117 | ||
|
a6041ec654 | ||
|
b5e2211123 | ||
|
6220e5905d | ||
|
cc0e50076f | ||
|
303eeab113 | ||
|
a08a91388d | ||
|
96eb73a224 | ||
|
f40714ac2c | ||
|
58d53f784f | ||
|
e51e072722 | ||
|
a5b7377b2f | ||
|
1fb4c0a642 | ||
|
03771538f0 | ||
|
844dd0c797 | ||
|
879b182e56 | ||
|
14e4a5c86d | ||
|
4f3edec9f1 | ||
|
8b72641a31 | ||
|
584b40d42b | ||
|
48dbe1b60c | ||
|
a87797f6af | ||
|
1858790308 | ||
|
1efa19b60e | ||
|
493c25018c | ||
|
290505d4c0 | ||
|
304097fb9d | ||
|
3b002c0c50 | ||
|
5288439934 | ||
|
8453be8003 | ||
|
82e69ca56a | ||
|
1f2699ed21 | ||
|
967a125b2f | ||
|
5386ffa582 | ||
|
143f84e910 | ||
|
fd096940da | ||
|
b6628fe2b3 | ||
|
18ef919a11 | ||
|
d5f93c5d9d | ||
|
f2888f26fe | ||
|
62f33c7b0a | ||
|
7d5324a8bc | ||
|
f522e478a6 | ||
|
d9e554ad42 | ||
|
b944c6e8e0 | ||
|
77c11fefea | ||
|
44cad30528 | ||
|
32f5c1a806 | ||
|
885112f168 | ||
|
7c61fa3363 | ||
|
10466f5913 | ||
|
c01b0b43df | ||
|
64dec7fe5f | ||
|
e066ed7be6 | ||
|
e753d023ad | ||
|
fd94f03008 | ||
|
12595483fc | ||
|
c150eee1c6 | ||
|
8dd44e23a6 | ||
|
4bbb9f10f6 | ||
|
860e6d4034 | ||
|
0c3664acf3 | ||
|
89bf310340 | ||
|
7c2b0e927d | ||
|
3f900bc41a | ||
|
4f1ad09470 | ||
|
b8994a531f | ||
|
2bb1d80a77 | ||
|
0e44b1cd6c | ||
|
48b70b5bec | ||
|
ad1799b79e | ||
|
1c0d29f5b7 | ||
|
db9e771310 | ||
|
331f25ebab | ||
|
9c6fcea589 | ||
|
c5cbea1c20 | ||
|
bb286a56cd | ||
|
b2ceda819c | ||
|
b380b55942 | ||
|
0685065bf6 | ||
|
e0162ff69a | ||
|
06df5d370d | ||
|
8ead67a265 | ||
|
17498121a3 | ||
|
4e44203239 | ||
|
1293b43976 | ||
|
999440ff79 | ||
|
0392bf3da9 | ||
|
42f6c84633 | ||
|
31aefff74e | ||
|
053c1ff681 | ||
|
30c8bea112 | ||
|
3a01178acb | ||
|
bef9eb199f | ||
|
f98ca62aad | ||
|
103500b5e1 | ||
|
d5c5551ce1 | ||
|
03ca0770df | ||
|
589eb094d5 | ||
|
54ef1677e8 | ||
|
6155d531ab | ||
|
61c3d23efa | ||
|
2e2932a030 | ||
|
581e5548d5 | ||
|
7c9afd8931 | ||
|
ae9a7f5479 | ||
|
66a2e30711 | ||
|
acb7470fbb | ||
|
87a804dbc2 | ||
|
0ea9f1d73e | ||
|
dbe2f01b8d | ||
|
59a3a2d72a | ||
|
c94a4379c7 | ||
|
055290ce3f | ||
|
57eee7bb5d | ||
|
9221e4bf45 | ||
|
70d08eff8a | ||
|
a38887a602 | ||
|
03ee6606fd | ||
|
7d931c7a97 | ||
|
65ad5348e2 | ||
|
9884b2bdee | ||
|
e1a9602481 | ||
|
ea5329cf34 | ||
|
d37ae6842a | ||
|
c10aa873de | ||
|
13590c5c3c | ||
|
3e328f408a | ||
|
31063c92cb | ||
|
efa13d85cc | ||
|
d2f4379998 | ||
|
0887579129 | ||
|
0720481937 | ||
|
f6aa5f089f | ||
|
6a5e8ba1ec | ||
|
dad42c4a3a | ||
|
f1748a2cf0 | ||
|
9e610c250c | ||
|
dd18837358 | ||
|
b9c9021627 | ||
|
70615a6a16 | ||
|
43c392963e | ||
|
8d61a7ddce | ||
|
c8ce0e06e6 | ||
|
58a40f1d09 | ||
|
fe05e5c6cf | ||
|
e093be31af | ||
|
fc782d9354 | ||
|
b3c76b054c | ||
|
f44a6a2dfd |
447 changed files with 44078 additions and 19341 deletions
47
.env.example
Normal file
47
.env.example
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# 🌐 Frontend
|
||||||
|
PUBLIC_SERVER_URL=http://server:8000 # PLEASE DON'T CHANGE :) - Should be the service name of the backend with port 8000, even if you change the port in the backend service. Only change if you are using a custom more complex setup.
|
||||||
|
ORIGIN=http://localhost:8015
|
||||||
|
BODY_SIZE_LIMIT=Infinity
|
||||||
|
FRONTEND_PORT=8015
|
||||||
|
|
||||||
|
# 🐘 PostgreSQL Database
|
||||||
|
PGHOST=db
|
||||||
|
POSTGRES_DB=database
|
||||||
|
POSTGRES_USER=adventure
|
||||||
|
POSTGRES_PASSWORD=changeme123
|
||||||
|
|
||||||
|
# 🔒 Django Backend
|
||||||
|
SECRET_KEY=changeme123
|
||||||
|
DJANGO_ADMIN_USERNAME=admin
|
||||||
|
DJANGO_ADMIN_PASSWORD=admin
|
||||||
|
DJANGO_ADMIN_EMAIL=admin@example.com
|
||||||
|
PUBLIC_URL=http://localhost:8016 # Match the outward port, used for the creation of image urls
|
||||||
|
CSRF_TRUSTED_ORIGINS=http://localhost:8016,http://localhost:8015
|
||||||
|
DEBUG=False
|
||||||
|
FRONTEND_URL=http://localhost:8015 # Used for email generation. This should be the url of the frontend
|
||||||
|
BACKEND_PORT=8016
|
||||||
|
|
||||||
|
# Optional: use Google Maps integration
|
||||||
|
# https://adventurelog.app/docs/configuration/google_maps_integration.html
|
||||||
|
# GOOGLE_MAPS_API_KEY=your_google_maps_api_key
|
||||||
|
|
||||||
|
# Optional: disable registration
|
||||||
|
# https://adventurelog.app/docs/configuration/disable_registration.html
|
||||||
|
DISABLE_REGISTRATION=False
|
||||||
|
# DISABLE_REGISTRATION_MESSAGE=Registration is disabled for this instance of AdventureLog.
|
||||||
|
|
||||||
|
# Optional: Use email
|
||||||
|
# https://adventurelog.app/docs/configuration/email.html
|
||||||
|
# EMAIL_BACKEND=email
|
||||||
|
# EMAIL_HOST=smtp.gmail.com
|
||||||
|
# EMAIL_USE_TLS=True
|
||||||
|
# EMAIL_PORT=587
|
||||||
|
# EMAIL_USE_SSL=False
|
||||||
|
# EMAIL_HOST_USER=user
|
||||||
|
# EMAIL_HOST_PASSWORD=password
|
||||||
|
# DEFAULT_FROM_EMAIL=user@example.com
|
||||||
|
|
||||||
|
# Optional: Use Umami for analytics
|
||||||
|
# https://adventurelog.app/docs/configuration/analytics.html
|
||||||
|
# PUBLIC_UMAMI_SRC=https://cloud.umami.is/script.js # If you are using the hosted version of Umami
|
||||||
|
# PUBLIC_UMAMI_WEBSITE_ID=
|
16
.github/.docker-compose-database.yml
vendored
Normal file
16
.github/.docker-compose-database.yml
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgis/postgis:15-3.3
|
||||||
|
container_name: adventurelog-db
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:5432:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: database
|
||||||
|
POSTGRES_USER: adventure
|
||||||
|
POSTGRES_PASSWORD: changeme123
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data/
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* @seanmorley15
|
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
github: seanmorley15
|
||||||
|
buy_me_a_coffee: seanmorley15
|
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Detailed bug reports help me diagnose and fix bugs quicker! Thanks!
|
||||||
|
title: "[BUG]"
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Docker Compose**
|
||||||
|
If the issue is related to deployment and docker, please post an **obfuscated** (remove secrets and confidential information) version of your compose file.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
15
.github/ISSUE_TEMPLATE/deployment-issue.md
vendored
Normal file
15
.github/ISSUE_TEMPLATE/deployment-issue.md
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
name: Deployment Issue
|
||||||
|
about: Request help deploying AdventureLog on your machine. The more details, the
|
||||||
|
better I can help!
|
||||||
|
title: "[DEPLOYMENT]"
|
||||||
|
labels: deployment
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Explain your issue
|
||||||
|
|
||||||
|
## Provide an **obfuscated** `docker-compose.yml`
|
||||||
|
|
||||||
|
## Provide any necessary logs from the containers and browser
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for AdventureLog
|
||||||
|
title: "[REQUEST]"
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
46
.github/workflows/backend-beta.yml
vendored
Normal file
46
.github/workflows/backend-beta.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Upload beta backend image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- development
|
||||||
|
paths:
|
||||||
|
- "backend/**"
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-backend"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: "${{ github.repository_owner }}"
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:beta -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:beta ./backend
|
46
.github/workflows/backend-latest.yml
vendored
Normal file
46
.github/workflows/backend-latest.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Upload latest backend image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "backend/**"
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-backend"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: '${{ github.repository_owner }}'
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:latest -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:latest ./backend
|
43
.github/workflows/backend-release.yml
vendored
Normal file
43
.github/workflows/backend-release.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: Upload the tagged release backend image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-backend"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: "${{ github.repository_owner }}"
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:${{ github.event.release.tag_name }} -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:${{ github.event.release.tag_name }} ./backend
|
64
.github/workflows/backend-test.yml
vendored
Normal file
64
.github/workflows/backend-test.yml
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
name: Test Backend
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'backend/server/**'
|
||||||
|
- '.github/workflows/backend-test.yml'
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'backend/server/**'
|
||||||
|
- '.github/workflows/backend-test.yml'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: set up python 3.12
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt update -q
|
||||||
|
sudo apt install -y -q \
|
||||||
|
python3-gdal
|
||||||
|
|
||||||
|
- name: start database
|
||||||
|
run: |
|
||||||
|
docker compose -f .github/.docker-compose-database.yml up -d
|
||||||
|
|
||||||
|
- name: install python libreries
|
||||||
|
working-directory: backend/server
|
||||||
|
run: |
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
- name: run server
|
||||||
|
working-directory: backend/server
|
||||||
|
env:
|
||||||
|
PGHOST: "127.0.0.1"
|
||||||
|
PGDATABASE: "database"
|
||||||
|
PGUSER: "adventure"
|
||||||
|
PGPASSWORD: "changeme123"
|
||||||
|
SECRET_KEY: "changeme123"
|
||||||
|
DJANGO_ADMIN_USERNAME: "admin"
|
||||||
|
DJANGO_ADMIN_PASSWORD: "admin"
|
||||||
|
DJANGO_ADMIN_EMAIL: "admin@example.com"
|
||||||
|
PUBLIC_URL: "http://localhost:8000"
|
||||||
|
CSRF_TRUSTED_ORIGINS: "http://localhost:5173,http://localhost:8000"
|
||||||
|
DEBUG: "True"
|
||||||
|
FRONTEND_URL: "http://localhost:5173"
|
||||||
|
run: |
|
||||||
|
python manage.py migrate
|
||||||
|
python manage.py runserver &
|
||||||
|
|
||||||
|
- name: wait for backend to boot
|
||||||
|
run: >
|
||||||
|
curl -fisS --retry 60 --retry-delay 1 --retry-all-errors
|
||||||
|
http://localhost:8000/
|
46
.github/workflows/cdn-beta.yml
vendored
Normal file
46
.github/workflows/cdn-beta.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Upload beta CDN image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- development
|
||||||
|
paths:
|
||||||
|
- "cdn/**"
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-cdn"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: "${{ github.repository_owner }}"
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:beta -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:beta ./cdn
|
46
.github/workflows/cdn-latest.yml
vendored
Normal file
46
.github/workflows/cdn-latest.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Upload latest CDN image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "cdn/**"
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-cdn"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: "${{ github.repository_owner }}"
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:latest -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:latest ./cdn
|
43
.github/workflows/cdn-release.yml
vendored
Normal file
43
.github/workflows/cdn-release.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: Upload the tagged release CDN image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-cdn"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: "${{ github.repository_owner }}"
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:${{ github.event.release.tag_name }} -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:${{ github.event.release.tag_name }} ./cdn
|
34
.github/workflows/docker-image.yml
vendored
34
.github/workflows/docker-image.yml
vendored
|
@ -1,34 +0,0 @@
|
||||||
name: Upload Docker image to GHCR
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- "backend/**"
|
|
||||||
|
|
||||||
env:
|
|
||||||
IMAGE_NAME: "adventurelog-backend"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
upload:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.ACCESS_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
run: docker build -t $IMAGE_NAME:latest ./backend
|
|
||||||
|
|
||||||
- name: Tag Docker image
|
|
||||||
run: docker tag $IMAGE_NAME:latest ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest
|
|
||||||
|
|
||||||
- name: Push Docker image to GHCR
|
|
||||||
run: docker push ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest
|
|
46
.github/workflows/frontend-beta.yml
vendored
Normal file
46
.github/workflows/frontend-beta.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Upload beta frontend image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- development
|
||||||
|
paths:
|
||||||
|
- "frontend/**"
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-frontend"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: "${{ github.repository_owner }}"
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:beta -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:beta ./frontend
|
30
.github/workflows/frontend-latest.yml
vendored
30
.github/workflows/frontend-latest.yml
vendored
|
@ -1,11 +1,11 @@
|
||||||
name: Upload Docker image to GHCR
|
name: Upload latest frontend image to GHCR and Docker Hub
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- 'frontend/**'
|
- "frontend/**"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: "adventurelog-frontend"
|
IMAGE_NAME: "adventurelog-frontend"
|
||||||
|
@ -24,11 +24,23 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.ACCESS_TOKEN }}
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Login to Docker Hub
|
||||||
run: docker build -t $IMAGE_NAME:latest ./frontend
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: '${{ github.repository_owner }}'
|
||||||
|
|
||||||
- name: Tag Docker image
|
- name: Build Docker images
|
||||||
run: docker tag $IMAGE_NAME:latest ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:latest -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:latest ./frontend
|
||||||
|
|
||||||
- name: Push Docker image to GHCR
|
|
||||||
run: docker push ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:latest
|
|
||||||
|
|
43
.github/workflows/frontend-release.yml
vendored
Normal file
43
.github/workflows/frontend-release.yml
vendored
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: Upload tagged release frontend image to GHCR and Docker Hub
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: "adventurelog-frontend"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: set lower case owner name
|
||||||
|
run: |
|
||||||
|
echo "REPO_OWNER=${OWNER,,}" >>${GITHUB_ENV}
|
||||||
|
env:
|
||||||
|
OWNER: "${{ github.repository_owner }}"
|
||||||
|
|
||||||
|
- name: Build Docker images
|
||||||
|
run: docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/$REPO_OWNER/$IMAGE_NAME:${{ github.event.release.tag_name }} -t ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:${{ github.event.release.tag_name }} ./frontend
|
32
.github/workflows/frontend-test.yml
vendored
Normal file
32
.github/workflows/frontend-test.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
name: Test Frontend
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- "frontend/**"
|
||||||
|
- ".github/workflows/frontend-test.yml"
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- "frontend/**"
|
||||||
|
- ".github/workflows/frontend-test.yml"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
|
working-directory: frontend
|
||||||
|
run: npm i
|
||||||
|
|
||||||
|
- name: build frontend
|
||||||
|
working-directory: frontend
|
||||||
|
run: npm run build
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Ignore everything in the .venv folder
|
||||||
|
.venv/
|
||||||
|
.vscode/settings.json
|
||||||
|
.pnpm-store/
|
||||||
|
.env
|
6
.vscode/extensions.json
vendored
Normal file
6
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"lokalise.i18n-ally",
|
||||||
|
"svelte.svelte-vscode"
|
||||||
|
]
|
||||||
|
}
|
40
.vscode/settings.json
vendored
Normal file
40
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"git.ignoreLimitWarning": true,
|
||||||
|
"i18n-ally.localesPaths": [
|
||||||
|
"frontend/src/locales",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/allauth/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/dj_rest_auth/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/rest_framework/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/rest_framework_simplejwt/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/conf/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/messages",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/allauth/templates/account/messages",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/allauth/templates/mfa/messages",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/allauth/templates/socialaccount/messages",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/allauth/templates/usersessions/messages",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/admindocs/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/auth/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/admin/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/contenttypes/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/flatpages/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/humanize/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/gis/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/redirects/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/postgres/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/sessions/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/django/contrib/sites/locale",
|
||||||
|
"backend/server/backend/lib/python3.12/site-packages/rest_framework/templates/rest_framework/docs/langs"
|
||||||
|
],
|
||||||
|
"i18n-ally.keystyle": "nested",
|
||||||
|
"i18n-ally.keysInUse": [
|
||||||
|
"navbar.themes.dim",
|
||||||
|
"navbar.themes.northernLights",
|
||||||
|
"navbar.themes.aqua",
|
||||||
|
"navbar.themes.aestheticDark",
|
||||||
|
"navbar.themes.aestheticLight",
|
||||||
|
"navbar.themes.forest",
|
||||||
|
"navbar.themes.night",
|
||||||
|
"navbar.themes.dark",
|
||||||
|
"navbar.themes.light"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,91 +1,50 @@
|
||||||
# Contributing to AdventureLog
|
# Contributing to AdventureLog
|
||||||
|
|
||||||
When contributing to this repository, please first discuss the change you wish to make via issue,
|
We’re excited to have you contribute to AdventureLog! To ensure that this community remains welcoming and productive for all users and developers, please follow this simple Code of Conduct.
|
||||||
email, or any other method with the owners of this repository before making a change.
|
|
||||||
|
|
||||||
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
|
||||||
|
|
||||||
## Pull Request Process
|
## Pull Request Process
|
||||||
|
|
||||||
1. Please make sure you create an issue first for your change so you can link any pull requests to this issue. There should be a clear relationship between pull requests and issues.
|
1. **Open an Issue First**: Discuss any changes or features you plan to implement by opening an issue. This helps to clarify your idea and ensures there’s a shared understanding.
|
||||||
2. Update the README.md with details of changes to the interface, this includes new environment
|
2. **Document Changes**: If your changes impact the user interface, add new environment variables, or introduce new container configurations, make sure to update the documentation accordingly. The documentation is located in the `documentation` folder.
|
||||||
variables, exposed ports, useful file locations and container parameters.
|
3. **Pull Request**: Submit a pull request with your changes. Make sure to reference the issue you opened in the description.
|
||||||
3. Increase the version numbers in any examples files and the README.md to the new version that this
|
|
||||||
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
|
|
||||||
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
|
|
||||||
do not have permission to do that, you may request the second reviewer to merge it for you.
|
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
### Our Pledge
|
### Our Pledge
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as
|
At AdventureLog, we are committed to creating a community that fosters adventure, exploration, and innovation. We encourage diverse participation and strive to maintain a space where everyone feels welcome to contribute, regardless of their background or experience level. We ask that you contribute with respect and kindness, making sure to prioritize collaboration and mutual growth.
|
||||||
contributors and maintainers pledge to making participation in our project and
|
|
||||||
our community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
||||||
nationality, personal appearance, race, religion, or sexual identity and
|
|
||||||
orientation.
|
|
||||||
|
|
||||||
### Our Standards
|
### Our Standards
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment
|
In order to maintain a positive environment, we encourage the following behaviors:
|
||||||
include:
|
|
||||||
|
|
||||||
- Using welcoming and inclusive language
|
- **Inclusivity**: Use welcoming and inclusive language that fosters collaboration across all perspectives and experiences.
|
||||||
- Being respectful of differing viewpoints and experiences
|
- **Respect**: Respect differing opinions and engage with empathy, understanding that each person’s perspective is valuable.
|
||||||
- Gracefully accepting constructive criticism
|
- **Constructive Feedback**: Offer feedback that helps improve the project and allows contributors to grow from it.
|
||||||
- Focusing on what is best for the community
|
- **Adventure Spirit**: Bring the same sense of curiosity, discovery, and positivity that drives AdventureLog into all interactions with the community.
|
||||||
- Showing empathy towards other community members
|
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
- The use of sexualized language or imagery and unwelcome sexual attention or
|
- Personal attacks, trolling, or any form of harassment.
|
||||||
advances
|
- Insensitive or discriminatory language, including sexualized comments or imagery.
|
||||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
- Spamming or misusing project spaces for personal gain.
|
||||||
- Public or private harassment
|
- Publishing or using others’ private information without permission.
|
||||||
- Publishing others' private information, such as a physical or electronic
|
- Anything else that could be seen as disrespectful or unprofessional in a collaborative environment.
|
||||||
address, without explicit permission
|
|
||||||
- Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
### Our Responsibilities
|
### Our Responsibilities
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable
|
As maintainers of AdventureLog, we are committed to enforcing this Code of Conduct and taking corrective action when necessary. This may involve moderating comments, pulling code, or banning users who engage in harmful behaviors.
|
||||||
behavior and are expected to take appropriate and fair corrective action in
|
|
||||||
response to any instances of unacceptable behavior.
|
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or
|
We strive to foster a community that balances open collaboration with respect for all contributors.
|
||||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
||||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
||||||
permanently any contributor for other behaviors that they deem inappropriate,
|
|
||||||
threatening, offensive, or harmful.
|
|
||||||
|
|
||||||
### Scope
|
### Scope
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces
|
This Code of Conduct applies in all spaces related to AdventureLog. This includes our GitHub repository, discussions, documentation, social media accounts, and events—both online and in person.
|
||||||
when an individual is representing the project or its community. Examples of
|
|
||||||
representing a project or community include using an official project e-mail
|
|
||||||
address, posting via an official social media account, or acting as an appointed
|
|
||||||
representative at an online or offline event. Representation of a project may be
|
|
||||||
further defined and clarified by project maintainers.
|
|
||||||
|
|
||||||
### Enforcement
|
### Enforcement
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
If you experience or witness unacceptable behavior, please report it to the project team at `contact@adventurelog.app`. All reports will be confidential and handled swiftly. The maintainers will investigate the issue and take appropriate action as needed.
|
||||||
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
||||||
Further details of specific enforcement policies may be posted separately.
|
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
||||||
faith may face temporary or permanent repercussions as determined by other
|
|
||||||
members of the project's leadership.
|
|
||||||
|
|
||||||
### Attribution
|
### Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
This Code of Conduct is inspired by the [Contributor Covenant](http://contributor-covenant.org), version 1.4, and adapted to fit the unique spirit of AdventureLog.
|
||||||
available at [http://contributor-covenant.org/version/1/4][version]
|
|
||||||
|
|
||||||
[homepage]: http://contributor-covenant.org
|
|
||||||
[version]: http://contributor-covenant.org/version/1/4/
|
|
||||||
|
|
380
LICENSE
380
LICENSE
|
@ -1,190 +1,207 @@
|
||||||
|
AdventureLog: Self-hostable travel tracker and trip planner.
|
||||||
|
Copyright (C) 2023-2025 Sean Morley
|
||||||
|
Contact: contact@seanmorley.com
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU General Public License is a free, copyleft license for
|
The GNU General Public License is a free, copyleft license for
|
||||||
software and other kinds of works.
|
software and other kinds of works.
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
The licenses for most software and other practical works are designed
|
||||||
to take away your freedom to share and change the works. By contrast,
|
to take away your freedom to share and change the works. By contrast,
|
||||||
the GNU General Public License is intended to guarantee your freedom to
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
share and change all versions of a program--to make sure it remains free
|
share and change all versions of a program--to make sure it remains free
|
||||||
software for all its users. We, the Free Software Foundation, use the
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
GNU General Public License for most of our software; it applies also to
|
GNU General Public License for most of our software; it applies also to
|
||||||
any other work released this way by its authors. You can apply it to
|
any other work released this way by its authors. You can apply it to
|
||||||
your programs, too.
|
your programs, too.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
have the freedom to distribute copies of free software (and charge for
|
have the freedom to distribute copies of free software (and charge for
|
||||||
them if you wish), that you receive source code or can get it if you
|
them if you wish), that you receive source code or can get it if you
|
||||||
want it, that you can change the software or use pieces of it in new
|
want it, that you can change the software or use pieces of it in new
|
||||||
free programs, and that you know you can do these things.
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
To protect your rights, we need to prevent others from denying you
|
To protect your rights, we need to prevent others from denying you
|
||||||
these rights or asking you to surrender the rights. Therefore, you have
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
certain responsibilities if you distribute copies of the software, or if
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
you modify it: responsibilities to respect the freedom of others.
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
For example, if you distribute copies of such a program, whether
|
||||||
gratis or for a fee, you must pass on to the recipients the same
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
freedoms that you received. You must make sure that they, too, receive
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
or can get the source code. And you must show them these terms so they
|
or can get the source code. And you must show them these terms so they
|
||||||
know their rights.
|
know their rights.
|
||||||
|
|
||||||
Developers that use the GNU GPL protect your rights with two steps:
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
(1) assert copyright on the software, and (2) offer you this License
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
giving you legal permission to copy, distribute and/or modify it.
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
that there is no warranty for this free software. For both users' and
|
that there is no warranty for this free software. For both users' and
|
||||||
authors' sake, the GPL requires that modified versions be marked as
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
changed, so that their problems will not be attributed erroneously to
|
changed, so that their problems will not be attributed erroneously to
|
||||||
authors of previous versions.
|
authors of previous versions.
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run
|
Some devices are designed to deny users access to install or run
|
||||||
modified versions of the software inside them, although the manufacturer
|
modified versions of the software inside them, although the manufacturer
|
||||||
can do so. This is fundamentally incompatible with the aim of
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
protecting users' freedom to change the software. The systematic
|
protecting users' freedom to change the software. The systematic
|
||||||
pattern of such abuse occurs in the area of products for individuals to
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
use, which is precisely where it is most unacceptable. Therefore, we
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
have designed this version of the GPL to prohibit the practice for those
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
products. If such problems arise substantially in other domains, we
|
products. If such problems arise substantially in other domains, we
|
||||||
stand ready to extend this provision to those domains in future versions
|
stand ready to extend this provision to those domains in future versions
|
||||||
of the GPL, as needed to protect the freedom of users.
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents.
|
Finally, every program is threatened constantly by software patents.
|
||||||
States should not allow patents to restrict development and use of
|
States should not allow patents to restrict development and use of
|
||||||
software on general-purpose computers, but in those that do, we wish to
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
avoid the special danger that patents applied to a free program could
|
avoid the special danger that patents applied to a free program could
|
||||||
make it effectively proprietary. To prevent this, the GPL assures that
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
patents cannot be used to render the program non-free.
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
0. Definitions.
|
0. Definitions.
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU General Public License.
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
works, such as semiconductor masks.
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
"recipients" may be individuals or organizations.
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
earlier work or a work "based on" the earlier work.
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
A "covered work" means either the unmodified Program or a work based
|
||||||
on the Program.
|
on the Program.
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
To "propagate" a work means to do anything with it that, without
|
||||||
permission, would make you directly or secondarily liable for
|
permission, would make you directly or secondarily liable for
|
||||||
infringement under applicable copyright law, except executing it on a
|
infringement under applicable copyright law, except executing it on a
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
distribution (with or without modification), making available to the
|
distribution (with or without modification), making available to the
|
||||||
public, and in some countries other activities as well.
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
To "convey" a work means any kind of propagation that enables other
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
to the extent that it includes a convenient and prominently visible
|
to the extent that it includes a convenient and prominently visible
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
tells the user that there is no warranty for the work (except to the
|
tells the user that there is no warranty for the work (except to the
|
||||||
extent that warranties are provided), that licensees may convey the
|
extent that warranties are provided), that licensees may convey the
|
||||||
work under this License, and how to view a copy of this License. If
|
work under this License, and how to view a copy of this License. If
|
||||||
the interface presents a list of user commands or options, such as a
|
the interface presents a list of user commands or options, such as a
|
||||||
menu, a prominent item in the list meets this criterion.
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
1. Source Code.
|
1. Source Code.
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
The "source code" for a work means the preferred form of the work
|
||||||
for making modifications to it. "Object code" means any non-source
|
for making modifications to it. "Object code" means any non-source
|
||||||
form of a work.
|
form of a work.
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
A "Standard Interface" means an interface that either is an official
|
||||||
standard defined by a recognized standards body, or, in the case of
|
standard defined by a recognized standards body, or, in the case of
|
||||||
interfaces specified for a particular programming language, one that
|
interfaces specified for a particular programming language, one that
|
||||||
is widely used among developers working in that language.
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
The "System Libraries" of an executable work include anything, other
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
packaging a Major Component, but which is not part of that Major
|
packaging a Major Component, but which is not part of that Major
|
||||||
Component, and (b) serves only to enable use of the work with that
|
Component, and (b) serves only to enable use of the work with that
|
||||||
Major Component, or to implement a Standard Interface for which an
|
Major Component, or to implement a Standard Interface for which an
|
||||||
implementation is available to the public in source code form. A
|
implementation is available to the public in source code form. A
|
||||||
"Major Component", in this context, means a major essential component
|
"Major Component", in this context, means a major essential component
|
||||||
(kernel, window system, and so on) of the specific operating system
|
(kernel, window system, and so on) of the specific operating system
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
produce the work, or an object code interpreter used to run it.
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
The "Corresponding Source" for a work in object code form means all
|
||||||
the source code needed to generate, install, and (for an executable
|
the source code needed to generate, install, and (for an executable
|
||||||
work) run the object code and to modify the work, including scripts to
|
work) run the object code and to modify the work, including scripts to
|
||||||
control those activities. However, it does not include the work's
|
control those activities. However, it does not include the work's
|
||||||
System Libraries, or general-purpose tools or generally available free
|
System Libraries, or general-purpose tools or generally available free
|
||||||
programs which are used unmodified in performing those activities but
|
programs which are used unmodified in performing those activities but
|
||||||
which are not part of the work. For example, Corresponding Source
|
which are not part of the work. For example, Corresponding Source
|
||||||
includes interface definition files associated with source files for
|
includes interface definition files associated with source files for
|
||||||
the work, and the source code for shared libraries and dynamically
|
the work, and the source code for shared libraries and dynamically
|
||||||
linked subprograms that the work is specifically designed to require,
|
linked subprograms that the work is specifically designed to require,
|
||||||
such as by intimate data communication or control flow between those
|
such as by intimate data communication or control flow between those
|
||||||
subprograms and other parts of the work.
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
The Corresponding Source need not include anything that users
|
||||||
can regenerate automatically from other parts of the Corresponding
|
can regenerate automatically from other parts of the Corresponding
|
||||||
Source.
|
Source.
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
The Corresponding Source for a work in source code form is that
|
||||||
same work.
|
same work.
|
||||||
|
|
||||||
2. Basic Permissions.
|
2. Basic Permissions.
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
All rights granted under this License are granted for the term of
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
permission to run the unmodified Program. The output from running a
|
permission to run the unmodified Program. The output from running a
|
||||||
covered work is covered by this License only if the output, given its
|
covered work is covered by this License only if the output, given its
|
||||||
content, constitutes a covered work. This License acknowledges your
|
content, constitutes a covered work. This License acknowledges your
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
You may make, run and propagate covered works that you do not
|
||||||
convey, without conditions so long as your license otherwise remains
|
convey, without conditions so long as your license otherwise remains
|
||||||
in force. You may convey covered works to others for the sole purpose
|
in force. You may convey covered works to others for the sole purpose
|
||||||
of having them make modifications exclusively for you, or provide you
|
of having them make modifications exclusively for you, or provide you
|
||||||
with facilities for running those works, provided that you comply with
|
with facilities for running those works, provided that you comply with
|
||||||
the terms of this License in conveying all material for which you do
|
the terms of this License in conveying all material for which you do
|
||||||
not control copyright. Those thus making or running the covered works
|
not control copyright. Those thus making or running the covered works
|
||||||
for you must do so exclusively on your behalf, under your direction
|
for you must do so exclusively on your behalf, under your direction
|
||||||
and control, on terms that prohibit them from making any copies of
|
and control, on terms that prohibit them from making any copies of
|
||||||
your copyrighted material outside their relationship with you.
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
Conveying under any other circumstances is permitted solely under
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
makes it unnecessary.
|
makes it unnecessary.
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
No covered work shall be deemed part of an effective technological
|
||||||
measure under any applicable law fulfilling obligations under article
|
measure under any applicable law fulfilling obligations under article
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
similar laws prohibiting or restricting circumvention of such
|
similar laws prohibiting or restricting circumvention of such
|
||||||
measures.
|
measures.
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
circumvention of technological measures to the extent such circumvention
|
circumvention of technological measures to the extent such circumvention
|
||||||
is effected by exercising rights under this License with respect to
|
is effected by exercising rights under this License with respect to
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
@ -192,9 +209,9 @@ modification of the work as a means of enforcing, against the work's
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
technological measures.
|
technological measures.
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
You may convey verbatim copies of the Program's source code as you
|
||||||
receive it, in any medium, provided that you conspicuously and
|
receive it, in any medium, provided that you conspicuously and
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
keep intact all notices stating that this License and any
|
keep intact all notices stating that this License and any
|
||||||
|
@ -202,12 +219,12 @@ non-permissive terms added in accord with section 7 apply to the code;
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
recipients a copy of this License along with the Program.
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
You may charge any price or no price for each copy that you convey,
|
||||||
and you may offer support or warranty protection for a fee.
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
You may convey a work based on the Program, or the modifications to
|
||||||
produce it from the Program, in the form of source code under the
|
produce it from the Program, in the form of source code under the
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
@ -232,19 +249,19 @@ terms of section 4, provided that you also meet all of these conditions:
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
work need not make them do so.
|
work need not make them do so.
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
A compilation of a covered work with other separate and independent
|
||||||
works, which are not by their nature extensions of the covered work,
|
works, which are not by their nature extensions of the covered work,
|
||||||
and which are not combined with it such as to form a larger program,
|
and which are not combined with it such as to form a larger program,
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
used to limit the access or legal rights of the compilation's users
|
used to limit the access or legal rights of the compilation's users
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
in an aggregate does not cause this License to apply to the other
|
in an aggregate does not cause this License to apply to the other
|
||||||
parts of the aggregate.
|
parts of the aggregate.
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
You may convey a covered work in object code form under the terms
|
||||||
of sections 4 and 5, provided that you also convey the
|
of sections 4 and 5, provided that you also convey the
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
in one of these ways:
|
in one of these ways:
|
||||||
|
@ -290,75 +307,75 @@ in one of these ways:
|
||||||
Source of the work are being offered to the general public at no
|
Source of the work are being offered to the general public at no
|
||||||
charge under subsection 6d.
|
charge under subsection 6d.
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
A separable portion of the object code, whose source code is excluded
|
||||||
from the Corresponding Source as a System Library, need not be
|
from the Corresponding Source as a System Library, need not be
|
||||||
included in conveying the object code work.
|
included in conveying the object code work.
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
tangible personal property which is normally used for personal, family,
|
tangible personal property which is normally used for personal, family,
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
product received by a particular user, "normally used" refers to a
|
product received by a particular user, "normally used" refers to a
|
||||||
typical or common use of that class of product, regardless of the status
|
typical or common use of that class of product, regardless of the status
|
||||||
of the particular user or of the way in which the particular user
|
of the particular user or of the way in which the particular user
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
is a consumer product regardless of whether the product has substantial
|
is a consumer product regardless of whether the product has substantial
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
the only significant mode of use of the product.
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
"Installation Information" for a User Product means any methods,
|
||||||
procedures, authorization keys, or other information required to install
|
procedures, authorization keys, or other information required to install
|
||||||
and execute modified versions of a covered work in that User Product from
|
and execute modified versions of a covered work in that User Product from
|
||||||
a modified version of its Corresponding Source. The information must
|
a modified version of its Corresponding Source. The information must
|
||||||
suffice to ensure that the continued functioning of the modified object
|
suffice to ensure that the continued functioning of the modified object
|
||||||
code is in no case prevented or interfered with solely because
|
code is in no case prevented or interfered with solely because
|
||||||
modification has been made.
|
modification has been made.
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
If you convey an object code work under this section in, or with, or
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
part of a transaction in which the right of possession and use of the
|
part of a transaction in which the right of possession and use of the
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
by the Installation Information. But this requirement does not apply
|
by the Installation Information. But this requirement does not apply
|
||||||
if neither you nor any third party retains the ability to install
|
if neither you nor any third party retains the ability to install
|
||||||
modified object code on the User Product (for example, the work has
|
modified object code on the User Product (for example, the work has
|
||||||
been installed in ROM).
|
been installed in ROM).
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
The requirement to provide Installation Information does not include a
|
||||||
requirement to continue to provide support service, warranty, or updates
|
requirement to continue to provide support service, warranty, or updates
|
||||||
for a work that has been modified or installed by the recipient, or for
|
for a work that has been modified or installed by the recipient, or for
|
||||||
the User Product in which it has been modified or installed. Access to a
|
the User Product in which it has been modified or installed. Access to a
|
||||||
network may be denied when the modification itself materially and
|
network may be denied when the modification itself materially and
|
||||||
adversely affects the operation of the network or violates the rules and
|
adversely affects the operation of the network or violates the rules and
|
||||||
protocols for communication across the network.
|
protocols for communication across the network.
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
in accord with this section must be in a format that is publicly
|
in accord with this section must be in a format that is publicly
|
||||||
documented (and with an implementation available to the public in
|
documented (and with an implementation available to the public in
|
||||||
source code form), and must require no special password or key for
|
source code form), and must require no special password or key for
|
||||||
unpacking, reading or copying.
|
unpacking, reading or copying.
|
||||||
|
|
||||||
7. Additional Terms.
|
7. Additional Terms.
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
License by making exceptions from one or more of its conditions.
|
License by making exceptions from one or more of its conditions.
|
||||||
Additional permissions that are applicable to the entire Program shall
|
Additional permissions that are applicable to the entire Program shall
|
||||||
be treated as though they were included in this License, to the extent
|
be treated as though they were included in this License, to the extent
|
||||||
that they are valid under applicable law. If additional permissions
|
that they are valid under applicable law. If additional permissions
|
||||||
apply only to part of the Program, that part may be used separately
|
apply only to part of the Program, that part may be used separately
|
||||||
under those permissions, but the entire Program remains governed by
|
under those permissions, but the entire Program remains governed by
|
||||||
this License without regard to the additional permissions.
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
When you convey a copy of a covered work, you may at your option
|
||||||
remove any additional permissions from that copy, or from any part of
|
remove any additional permissions from that copy, or from any part of
|
||||||
it. (Additional permissions may be written to require their own
|
it. (Additional permissions may be written to require their own
|
||||||
removal in certain cases when you modify the work.) You may place
|
removal in certain cases when you modify the work.) You may place
|
||||||
additional permissions on material, added by you to a covered work,
|
additional permissions on material, added by you to a covered work,
|
||||||
for which you have or can give appropriate copyright permission.
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
Notwithstanding any other provision of this License, for material you
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
that material) supplement the terms of this License with terms:
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
@ -385,74 +402,74 @@ that material) supplement the terms of this License with terms:
|
||||||
any liability that these contractual assumptions directly impose on
|
any liability that these contractual assumptions directly impose on
|
||||||
those licensors and authors.
|
those licensors and authors.
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
All other non-permissive additional terms are considered "further
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
received it, or any part of it, contains a notice stating that it is
|
received it, or any part of it, contains a notice stating that it is
|
||||||
governed by this License along with a term that is a further
|
governed by this License along with a term that is a further
|
||||||
restriction, you may remove that term. If a license document contains
|
restriction, you may remove that term. If a license document contains
|
||||||
a further restriction but permits relicensing or conveying under this
|
a further restriction but permits relicensing or conveying under this
|
||||||
License, you may add to a covered work material governed by the terms
|
License, you may add to a covered work material governed by the terms
|
||||||
of that license document, provided that the further restriction does
|
of that license document, provided that the further restriction does
|
||||||
not survive such relicensing or conveying.
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
If you add terms to a covered work in accord with this section, you
|
||||||
must place, in the relevant source files, a statement of the
|
must place, in the relevant source files, a statement of the
|
||||||
additional terms that apply to those files, or a notice indicating
|
additional terms that apply to those files, or a notice indicating
|
||||||
where to find the applicable terms.
|
where to find the applicable terms.
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
form of a separately written license, or stated as exceptions;
|
form of a separately written license, or stated as exceptions;
|
||||||
the above requirements apply either way.
|
the above requirements apply either way.
|
||||||
|
|
||||||
8. Termination.
|
8. Termination.
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
You may not propagate or modify a covered work except as expressly
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
modify it is void, and will automatically terminate your rights under
|
modify it is void, and will automatically terminate your rights under
|
||||||
this License (including any patent licenses granted under the third
|
this License (including any patent licenses granted under the third
|
||||||
paragraph of section 11).
|
paragraph of section 11).
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
However, if you cease all violation of this License, then your
|
||||||
license from a particular copyright holder is reinstated (a)
|
license from a particular copyright holder is reinstated (a)
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
holder fails to notify you of the violation by some reasonable means
|
holder fails to notify you of the violation by some reasonable means
|
||||||
prior to 60 days after the cessation.
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
Moreover, your license from a particular copyright holder is
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
violation by some reasonable means, this is the first time you have
|
violation by some reasonable means, this is the first time you have
|
||||||
received notice of violation of this License (for any work) from that
|
received notice of violation of this License (for any work) from that
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
your receipt of the notice.
|
your receipt of the notice.
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
Termination of your rights under this section does not terminate the
|
||||||
licenses of parties who have received copies or rights from you under
|
licenses of parties who have received copies or rights from you under
|
||||||
this License. If your rights have been terminated and not permanently
|
this License. If your rights have been terminated and not permanently
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
material under section 10.
|
material under section 10.
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
You are not required to accept this License in order to receive or
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
to receive a copy likewise does not require acceptance. However,
|
to receive a copy likewise does not require acceptance. However,
|
||||||
nothing other than this License grants you permission to propagate or
|
nothing other than this License grants you permission to propagate or
|
||||||
modify any covered work. These actions infringe copyright if you do
|
modify any covered work. These actions infringe copyright if you do
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
Each time you convey a covered work, the recipient automatically
|
||||||
receives a license from the original licensors, to run, modify and
|
receives a license from the original licensors, to run, modify and
|
||||||
propagate that work, subject to this License. You are not responsible
|
propagate that work, subject to this License. You are not responsible
|
||||||
for enforcing compliance by third parties with this License.
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
An "entity transaction" is a transaction transferring control of an
|
||||||
organization, or substantially all assets of one, or subdividing an
|
organization, or substantially all assets of one, or subdividing an
|
||||||
organization, or merging organizations. If propagation of a covered
|
organization, or merging organizations. If propagation of a covered
|
||||||
work results from an entity transaction, each party to that
|
work results from an entity transaction, each party to that
|
||||||
transaction who receives a copy of the work also receives whatever
|
transaction who receives a copy of the work also receives whatever
|
||||||
licenses to the work the party's predecessor in interest had or could
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
@ -460,43 +477,43 @@ give under the previous paragraph, plus a right to possession of the
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
You may not impose any further restrictions on the exercise of the
|
||||||
rights granted or affirmed under this License. For example, you may
|
rights granted or affirmed under this License. For example, you may
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
rights granted under this License, and you may not initiate litigation
|
rights granted under this License, and you may not initiate litigation
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
sale, or importing the Program or any portion of it.
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
11. Patents.
|
11. Patents.
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
License of the Program or a work on which the Program is based. The
|
License of the Program or a work on which the Program is based. The
|
||||||
work thus licensed is called the contributor's "contributor version".
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
A contributor's "essential patent claims" are all patent claims
|
||||||
owned or controlled by the contributor, whether already acquired or
|
owned or controlled by the contributor, whether already acquired or
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
by this License, of making, using, or selling its contributor version,
|
by this License, of making, using, or selling its contributor version,
|
||||||
but do not include claims that would be infringed only as a
|
but do not include claims that would be infringed only as a
|
||||||
consequence of further modification of the contributor version. For
|
consequence of further modification of the contributor version. For
|
||||||
purposes of this definition, "control" includes the right to grant
|
purposes of this definition, "control" includes the right to grant
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
this License.
|
this License.
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
patent license under the contributor's essential patent claims, to
|
patent license under the contributor's essential patent claims, to
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
propagate the contents of its contributor version.
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
In the following three paragraphs, a "patent license" is any express
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
(such as an express permission to practice a patent or covenant not to
|
(such as an express permission to practice a patent or covenant not to
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
party means to make such an agreement or commitment not to enforce a
|
party means to make such an agreement or commitment not to enforce a
|
||||||
patent against the party.
|
patent against the party.
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
and the Corresponding Source of the work is not available for anyone
|
and the Corresponding Source of the work is not available for anyone
|
||||||
to copy, free of charge and under the terms of this License, through a
|
to copy, free of charge and under the terms of this License, through a
|
||||||
publicly available network server or other readily accessible means,
|
publicly available network server or other readily accessible means,
|
||||||
|
@ -504,13 +521,13 @@ then you must either (1) cause the Corresponding Source to be so
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
consistent with the requirements of this License, to extend the patent
|
consistent with the requirements of this License, to extend the patent
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
covered work in a country, or your recipient's use of the covered work
|
covered work in a country, or your recipient's use of the covered work
|
||||||
in a country, would infringe one or more identifiable patents in that
|
in a country, would infringe one or more identifiable patents in that
|
||||||
country that you have reason to believe are valid.
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
If, pursuant to or in connection with a single transaction or
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
covered work, and grant a patent license to some of the parties
|
covered work, and grant a patent license to some of the parties
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
@ -518,10 +535,10 @@ or convey a specific copy of the covered work, then the patent license
|
||||||
you grant is automatically extended to all recipients of the covered
|
you grant is automatically extended to all recipients of the covered
|
||||||
work and works based on it.
|
work and works based on it.
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
A patent license is "discriminatory" if it does not include within
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
specifically granted under this License. You may not convey a covered
|
specifically granted under this License. You may not convey a covered
|
||||||
work if you are a party to an arrangement with a third party that is
|
work if you are a party to an arrangement with a third party that is
|
||||||
in the business of distributing software, under which you make payment
|
in the business of distributing software, under which you make payment
|
||||||
to the third party based on the extent of your activity of conveying
|
to the third party based on the extent of your activity of conveying
|
||||||
|
@ -533,73 +550,73 @@ for and in connection with specific products or compilations that
|
||||||
contain the covered work, unless you entered into that arrangement,
|
contain the covered work, unless you entered into that arrangement,
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
any implied license or other defenses to infringement that may
|
any implied license or other defenses to infringement that may
|
||||||
otherwise be available to you under applicable patent law.
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
the Program, the only way you could satisfy both those terms and this
|
the Program, the only way you could satisfy both those terms and this
|
||||||
License would be to refrain entirely from conveying the Program.
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
Notwithstanding any other provision of this License, you have
|
||||||
permission to link or combine any covered work with a work licensed
|
permission to link or combine any covered work with a work licensed
|
||||||
under version 3 of the GNU Affero General Public License into a single
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
combined work, and to convey the resulting work. The terms of this
|
combined work, and to convey the resulting work. The terms of this
|
||||||
License will continue to apply to the part which is the covered work,
|
License will continue to apply to the part which is the covered work,
|
||||||
but the special requirements of the GNU Affero General Public License,
|
but the special requirements of the GNU Affero General Public License,
|
||||||
section 13, concerning interaction through a network will apply to the
|
section 13, concerning interaction through a network will apply to the
|
||||||
combination as such.
|
combination as such.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
the GNU General Public License from time to time. Such new versions will
|
the GNU General Public License from time to time. Such new versions will
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the
|
||||||
Program specifies that a certain numbered version of the GNU General
|
Program specifies that a certain numbered version of the GNU General
|
||||||
Public License "or any later version" applies to it, you have the
|
Public License "or any later version" applies to it, you have the
|
||||||
option of following the terms and conditions either of that numbered
|
option of following the terms and conditions either of that numbered
|
||||||
version or of any later version published by the Free Software
|
version or of any later version published by the Free Software
|
||||||
Foundation. If the Program does not specify a version number of the
|
Foundation. If the Program does not specify a version number of the
|
||||||
GNU General Public License, you may choose any version ever published
|
GNU General Public License, you may choose any version ever published
|
||||||
by the Free Software Foundation.
|
by the Free Software Foundation.
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
If the Program specifies that a proxy can decide which future
|
||||||
versions of the GNU General Public License can be used, that proxy's
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
public statement of acceptance of a version permanently authorizes you
|
public statement of acceptance of a version permanently authorizes you
|
||||||
to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
Later license versions may give you additional or different
|
||||||
permissions. However, no additional obligations are imposed on any
|
permissions. However, no additional obligations are imposed on any
|
||||||
author or copyright holder as a result of your choosing to follow a
|
author or copyright holder as a result of your choosing to follow a
|
||||||
later version.
|
later version.
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
16. Limitation of Liability.
|
16. Limitation of Liability.
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
@ -609,9 +626,9 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGES.
|
SUCH DAMAGES.
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
above cannot be given local legal effect according to their terms,
|
above cannot be given local legal effect according to their terms,
|
||||||
reviewing courts shall apply local law that most closely approximates
|
reviewing courts shall apply local law that most closely approximates
|
||||||
an absolute waiver of all civil liability in connection with the
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
@ -619,56 +636,3 @@ Program, unless a warranty or assumption of liability accompanies a
|
||||||
copy of the Program in return for a fee.
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU 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 General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short
|
|
||||||
notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, your program's commands
|
|
||||||
might be different; for a GUI interface, you would use an "about box".
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU GPL, see
|
|
||||||
<https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program
|
|
||||||
into proprietary programs. If your program is a subroutine library, you
|
|
||||||
may consider it more useful to permit linking proprietary applications with
|
|
||||||
the library. If this is what you want to do, use the GNU Lesser General
|
|
||||||
Public License instead of this License. But first, please read
|
|
||||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
188
README.md
188
README.md
|
@ -1,110 +1,150 @@
|
||||||
# AdventureLog: Embark, Explore, Remember. 🌍
|
<div align="center">
|
||||||
|
|
||||||
_**⚠️ AdventureLog is in early development and is not recommended for production use until version 1.0!**_
|
<img src="brand/adventurelog.png" alt="logo" width="200" height="auto" />
|
||||||
|
<h1>AdventureLog</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The ultimate travel companion for the modern-day explorer.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h4>
|
||||||
|
<a href="https://demo.adventurelog.app">View Demo</a>
|
||||||
|
<span> · </span>
|
||||||
|
<a href="https://adventurelog.app">Documentation</a>
|
||||||
|
<span> · </span>
|
||||||
|
<a href="https://discord.gg/wRbQ9Egr8C">Discord</a>
|
||||||
|
<span> · </span>
|
||||||
|
<a href="https://buymeacoffee.com/seanmorley15">Support 💖</a>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
### _"Never forget an adventure with AdventureLog - Your ultimate travel companion!"_
|
<br />
|
||||||
|
|
||||||
---
|
<!-- Table of Contents -->
|
||||||
|
|
||||||
# Installation
|
# Table of Contents
|
||||||
|
|
||||||
# Docker 🐋
|
- [About the Project](#-about-the-project)
|
||||||
|
- [Screenshots](#-screenshots)
|
||||||
|
- [Tech Stack](#-tech-stack)
|
||||||
|
- [Features](#-features)
|
||||||
|
- [Roadmap](#-roadmap)
|
||||||
|
- [Contributing](#-contributing)
|
||||||
|
- [License](#-license)
|
||||||
|
- [Contact](#-contact)
|
||||||
|
- [Acknowledgements](#-acknowledgements)
|
||||||
|
|
||||||
Docker is the preferred way to run AdventureLog on your local machine. It is a lightweight containerization technology that allows you to run applications in isolated environments called containers.
|
<!-- About the Project -->
|
||||||
**Note**: This guide mainly focuses on installation with a linux based host machine, but the steps are similar for other operating systems.
|
|
||||||
|
|
||||||
## Prerequisites
|
## ⭐ About the Project
|
||||||
|
|
||||||
- Docker installed on your machine/server. You can learn how to download it [here](https://docs.docker.com/engine/install/).
|
Starting from a simple idea of tracking travel locations (called adventures), AdventureLog has grown into a full-fledged travel companion. With AdventureLog, you can log your adventures, keep track of where you've been on the world map, plan your next trip collaboratively, and share your experiences with friends and family.
|
||||||
|
|
||||||
## Getting Started
|
AdventureLog was created to solve a problem: the lack of a modern, open-source, user-friendly travel companion. Many existing travel apps are either too complex, too expensive, or too closed-off to be useful for the average traveler. AdventureLog aims to be the opposite: simple, beautiful, and open to everyone.
|
||||||
|
|
||||||
Get the `docker-compose.yml` file from the AdventureLog repository. You can download it from [here](https://github.com/seanmorley15/AdventureLog/blob/main/docker-compose.yml) or run this command to download it directly to your machine:
|
<!-- Screenshots -->
|
||||||
|
|
||||||
```bash
|
### 📷 Screenshots
|
||||||
wget https://raw.githubusercontent.com/seanmorley15/AdventureLog/main/docker-compose.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
<div align="center">
|
||||||
|
<img src="./brand/screenshots/adventures.png" alt="Adventures" />
|
||||||
|
<p>Displays the adventures you have visited and the ones you plan to embark on. You can also filter and sort the adventures.</p>
|
||||||
|
<img src="./brand/screenshots/details.png" alt="Adventure Details" />
|
||||||
|
<p>Shows specific details about an adventure, including the name, date, location, description, and rating.</p>
|
||||||
|
<img src="./brand/screenshots/edit.png" alt="Edit Modal" />
|
||||||
|
<img src="./brand/screenshots/map.png" alt="Adventure Details" />
|
||||||
|
<p>View all of your adventures on a map, with the ability to filter by visit status and add new ones by click on the map</p>
|
||||||
|
<img src="./brand/screenshots/dashboard.png" alt="Dashboard" />
|
||||||
|
<p>Displays a summary of your adventures, including your world travel stats.</p>
|
||||||
|
<img src="./brand/screenshots/itinerary.png" alt="Itinerary" />
|
||||||
|
<p>Plan your adventures and travel itinerary with a list of activities and a map view. View your trip in a variety of ways, including an itinerary list, a map view, and a calendar view.</p>
|
||||||
|
<img src="./brand/screenshots/countries.png" alt="Countries" />
|
||||||
|
<p>Lists all the countries you have visited and plan to visit, with the ability to filter by visit status.</p>
|
||||||
|
<img src="./brand/screenshots/regions.png" alt="Regions" />
|
||||||
|
<p>Displays the regions for a specific country, includes a map view to visually select regions.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
Here is a summary of the configuration options available in the `docker-compose.yml` file:
|
<!-- TechStack -->
|
||||||
|
|
||||||
<!-- make a table with colum name, is required, other -->
|
### 🚀 Tech Stack
|
||||||
|
|
||||||
### Frontend Container (web)
|
<details>
|
||||||
|
<summary>Client</summary>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://svelte.dev/">SvelteKit</a></li>
|
||||||
|
<li><a href="https://tailwindcss.com/">TailwindCSS</a></li>
|
||||||
|
<li><a href="https://daisyui.com/">DaisyUI</a></li>
|
||||||
|
<li><a href="https://github.com/dimfeld/svelte-maplibre/">Svelte MapLibre</a></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
|
||||||
| Name | Required | Description | Default Value |
|
<details>
|
||||||
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
|
<summary>Server</summary>
|
||||||
| `PUBLIC_SERVER_URL` | Yes | What the frontend SSR server uses to connect to the backend. | http://server:8000 |
|
<ul>
|
||||||
| `ORIGIN` | Sometimes | Not needed if using HTTPS. If not, set it to the domain of what you will acess the app from. | http://localhost:8080 |
|
<li><a href="https://www.djangoproject.com/">Django</a></li>
|
||||||
| `BODY_SIZE_LIMIT` | Yes | Used to set the maximum upload size to the server. Should be changed to prevent someone from uploading too much! Custom values must be set in **kiliobytes**. | Infinity |
|
<li><a href="https://postgis.net/">PostGIS</a></li>
|
||||||
|
<li><a href="https://www.django-rest-framework.org/">Django REST Framework</a></li>
|
||||||
|
<li><a href="https://allauth.org/">AllAuth</a></li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
<!-- Features -->
|
||||||
|
|
||||||
### Backend Container (server)
|
### 🎯 Features
|
||||||
|
|
||||||
| Name | Required | Description | Default Value |
|
- **Track Your Adventures** 🌍: Log your adventures and keep track of where you've been on the world map.
|
||||||
| ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
|
- Adventures can store a variety of information, including the location, date, and description.
|
||||||
| `PGHOST` | Yes | Databse host. | db |
|
- Adventures can be sorted into custom categories for easy organization.
|
||||||
| `PGDATABASE` | Yes | Database. | database |
|
- Adventures can be marked as private or public, allowing you to share your adventures with friends and family.
|
||||||
| `PGUSER` | Yes | Database user. | adventure |
|
- Keep track of the countries and regions you've visited with the world travel book.
|
||||||
| `PGPASSWORD` | Yes | Database password. | changeme123 |
|
- **Plan Your Next Trip** 📃: Take the guesswork out of planning your next adventure with an easy-to-use itinerary planner.
|
||||||
| `DJANGO_ADMIN_USERNAME` | Yes | Default username. | admin |
|
- Itineraries can be created for any number of days and can include multiple destinations.
|
||||||
| `DJANGO_ADMIN_PASSWORD` | Yes | Default password, change after inital login. | admin |
|
- Itineraries include many planning features like flight information, notes, checklists, and links to external resources.
|
||||||
| `DJANGO_ADMIN_EMAIL` | Yes | Default user's email. | admin@example.com |
|
- Itineraries can be shared with friends and family for collaborative planning.
|
||||||
| `PUBLIC_URL` | Yes | This is the publically accessible url to the **nginx** container. You should be able to acess nginx from this url where you access your app. | http://127.0.0.1:81 |
|
- **Share Your Experiences** 📸: Share your adventures with friends and family and collaborate on trips together.
|
||||||
| `CSRF_TRUSTED_ORIGINS` | Yes | Need to be changed to the orgins where you use your backend server and frontend. These values are comma seperated. | Needs to be changed. |
|
- Adventures and itineraries can be shared via a public link or directly with other AdventureLog users.
|
||||||
|
- Collaborators can view and edit shared itineraries (collections), making planning a breeze.
|
||||||
|
|
||||||
### Proxy Container (nginx) Configuration
|
<!-- Roadmap -->
|
||||||
|
|
||||||
In order to use media files in a production environment, you need to configure the `nginx` container to serve the media files. The container is already in the docker compose file but you need to do a few things to make it work.
|
## 🧭 Roadmap
|
||||||
|
|
||||||
1. Create a directory called `proxy` in the same directory as the `docker-compose.yml` file.
|
The AdventureLog Roadmap can be found [here](https://github.com/users/seanmorley15/projects/5)
|
||||||
2. Create a file called `nginx.conf` in the `proxy` directory.
|
|
||||||
3. Add the following configuration to the `nginx.conf` file:
|
|
||||||
|
|
||||||
```nginx
|
<!-- Contributing -->
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location /media/ {
|
## 👋 Contributing
|
||||||
alias /app/media/;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running the Containers
|
<a href="https://github.com/seanmorley15/AdventureLog/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=seanmorley15/AdventureLog" />
|
||||||
|
</a>
|
||||||
|
|
||||||
To start the containers, run the following command:
|
Contributions are always welcome!
|
||||||
|
|
||||||
```bash
|
See `contributing.md` for ways to get started.
|
||||||
docker compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
Enjoy AdventureLog! 🎉
|
<!-- License -->
|
||||||
|
|
||||||
# About AdventureLog
|
## 📃 License
|
||||||
|
|
||||||
AdventureLog is a Svelte Kit and Django application that utilizes a PostgreSQL database. Users can log the adventures they have experienced, as well as plan future ones. Key features include:
|
Distributed under the GNU General Public License v3.0. See `LICENSE` for more information.
|
||||||
|
|
||||||
- Logging past adventures with fields like name, date, location, description, and rating.
|
<!-- Contact -->
|
||||||
- Planning future adventures with similar fields.
|
|
||||||
- Tagging different activity types for better organization.
|
|
||||||
- Viewing countries, regions, and marking visited regions.
|
|
||||||
|
|
||||||
AdventureLog aims to be your ultimate travel companion, helping you document your adventures and plan new ones effortlessly.
|
## 🤝 Contact
|
||||||
|
|
||||||
AdventureLog is licensed under the GNU General Public License v3.0.
|
Sean Morley - [website](https://seanmorley.com)
|
||||||
|
|
||||||
<!-- ## Screenshots 🖼️
|
Hi! I'm Sean, the creator of AdventureLog. I'm a college student and software developer with a passion for travel and adventure. I created AdventureLog to help people like me document their adventures and plan new ones effortlessly. As a student, I am always looking for more opportunities to learn and grow, so feel free to reach out via the contact on my website if you would like to collaborate or chat!
|
||||||
|
|
||||||

|
<!-- Acknowledgments -->
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
## Roadmap 🛣️
|
## 💎 Acknowledgements
|
||||||
|
|
||||||
- Improved mobile device support
|
- Logo Design by [nordtektiger](https://github.com/nordtektiger)
|
||||||
- Password reset functionality
|
- WorldTravel Dataset [dr5hn/countries-states-cities-database](https://github.com/dr5hn/countries-states-cities-database)
|
||||||
- Improved error handling
|
|
||||||
- Handling of adventure cards with variable width -->
|
### Top Supporters 💖
|
||||||
|
|
||||||
|
- [Veymax](https://x.com/veymax)
|
||||||
|
- [nebriv](https://github.com/nebriv)
|
||||||
|
- [Victor Butler](https://x.com/victor_butler)
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
http://github.com/iMerica/dj-rest-auth/contributors
|
|
|
@ -1,32 +1,60 @@
|
||||||
# Dockerfile
|
# Use the official Python slim image as the base image
|
||||||
|
FROM python:3.13-slim
|
||||||
|
|
||||||
FROM python:3.10-slim
|
# Metadata labels for the AdventureLog image
|
||||||
|
LABEL maintainer="Sean Morley" \
|
||||||
LABEL Developers="Sean Morley"
|
version="v0.10.0" \
|
||||||
|
description="AdventureLog — the ultimate self-hosted travel companion." \
|
||||||
|
org.opencontainers.image.title="AdventureLog" \
|
||||||
|
org.opencontainers.image.description="AdventureLog is a self-hosted travel companion that helps you plan, track, and share your adventures." \
|
||||||
|
org.opencontainers.image.version="v0.10.0" \
|
||||||
|
org.opencontainers.image.authors="Sean Morley" \
|
||||||
|
org.opencontainers.image.url="https://raw.githubusercontent.com/seanmorley15/AdventureLog/refs/heads/main/brand/banner.png" \
|
||||||
|
org.opencontainers.image.source="https://github.com/seanmorley15/AdventureLog" \
|
||||||
|
org.opencontainers.image.vendor="Sean Morley" \
|
||||||
|
org.opencontainers.image.created="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
||||||
|
org.opencontainers.image.licenses="GPL-3.0"
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV PYTHONDONTWRITEBYTECODE 1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies (Nginx included)
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y git postgresql-client \
|
&& apt-get install -y git postgresql-client gdal-bin libgdal-dev nginx supervisor \
|
||||||
&& apt-get clean
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
COPY ./server/requirements.txt /code/
|
COPY ./server/requirements.txt /code/
|
||||||
RUN pip install --upgrade pip
|
RUN pip install --upgrade pip \
|
||||||
RUN pip install -r requirements.txt
|
&& pip install -r requirements.txt
|
||||||
|
|
||||||
|
# Create necessary directories
|
||||||
|
RUN mkdir -p /code/static /code/media
|
||||||
|
# RUN mkdir -p /code/staticfiles /code/media
|
||||||
|
|
||||||
# Copy the Django project code into the Docker image
|
# Copy the Django project code into the Docker image
|
||||||
COPY ./server /code/
|
COPY ./server /code/
|
||||||
|
|
||||||
RUN python3 manage.py collectstatic --verbosity 2
|
# Copy Nginx configuration
|
||||||
|
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
# Copy Supervisor configuration
|
||||||
|
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|
||||||
|
# Collect static files
|
||||||
|
RUN python3 manage.py collectstatic --noinput --verbosity 2
|
||||||
|
|
||||||
# Set the entrypoint script
|
# Set the entrypoint script
|
||||||
COPY ./entrypoint.sh /code/entrypoint.sh
|
COPY ./entrypoint.sh /code/entrypoint.sh
|
||||||
RUN chmod +x /code/entrypoint.sh
|
RUN chmod +x /code/entrypoint.sh
|
||||||
ENTRYPOINT ["/code/entrypoint.sh"]
|
|
||||||
|
# Expose ports for NGINX and Gunicorn
|
||||||
|
EXPOSE 80 8000
|
||||||
|
|
||||||
|
# Command to start Supervisor (which starts Nginx and Gunicorn)
|
||||||
|
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 iMerica https://github.com/iMerica/
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,5 +0,0 @@
|
||||||
include AUTHORS
|
|
||||||
include LICENSE
|
|
||||||
include MANIFEST.in
|
|
||||||
include README.md
|
|
||||||
graft dj_rest_auth
|
|
|
@ -1,4 +0,0 @@
|
||||||
# AdventureLog Django Backend
|
|
||||||
A demo of a possible AdventureLog 2.0 version using Django as the backend with a REST API.
|
|
||||||
|
|
||||||
Based of django-rest-framework and dj-rest-auth.
|
|
|
@ -1,10 +1,32 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Function to check PostgreSQL availability
|
# Function to check PostgreSQL availability
|
||||||
check_postgres() {
|
# Helper to get the first non-empty environment variable
|
||||||
PGPASSWORD=$PGPASSWORD psql -h "$PGHOST" -U "$PGUSER" -d "$PGDATABASE" -c '\q' >/dev/null 2>&1
|
get_env() {
|
||||||
|
for var in "$@"; do
|
||||||
|
value="${!var}"
|
||||||
|
if [ -n "$value" ]; then
|
||||||
|
echo "$value"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_postgres() {
|
||||||
|
local db_host
|
||||||
|
local db_user
|
||||||
|
local db_name
|
||||||
|
local db_pass
|
||||||
|
|
||||||
|
db_host=$(get_env PGHOST)
|
||||||
|
db_user=$(get_env PGUSER POSTGRES_USER)
|
||||||
|
db_name=$(get_env PGDATABASE POSTGRES_DB)
|
||||||
|
db_pass=$(get_env PGPASSWORD POSTGRES_PASSWORD)
|
||||||
|
|
||||||
|
PGPASSWORD="$db_pass" psql -h "$db_host" -U "$db_user" -d "$db_name" -c '\q' >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Wait for PostgreSQL to become available
|
# Wait for PostgreSQL to become available
|
||||||
until check_postgres; do
|
until check_postgres; do
|
||||||
>&2 echo "PostgreSQL is unavailable - sleeping"
|
>&2 echo "PostgreSQL is unavailable - sleeping"
|
||||||
|
@ -13,25 +35,57 @@ done
|
||||||
|
|
||||||
>&2 echo "PostgreSQL is up - continuing..."
|
>&2 echo "PostgreSQL is up - continuing..."
|
||||||
|
|
||||||
|
# run sql commands
|
||||||
|
# psql -h "$PGHOST" -U "$PGUSER" -d "$PGDATABASE" -f /app/backend/init-postgis.sql
|
||||||
|
|
||||||
# Apply Django migrations
|
# Apply Django migrations
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
|
|
||||||
# Check for default data
|
# Create superuser if environment variables are set and there are no users present at all.
|
||||||
python manage.py worldtravel-seed
|
if [ -n "$DJANGO_ADMIN_USERNAME" ] && [ -n "$DJANGO_ADMIN_PASSWORD" ] && [ -n "$DJANGO_ADMIN_EMAIL" ]; then
|
||||||
|
|
||||||
# Create superuser if environment variables are set
|
|
||||||
if [ -n "$DJANGO_ADMIN_USERNAME" ] && [ -n "$DJANGO_ADMIN_PASSWORD" ]; then
|
|
||||||
echo "Creating superuser..."
|
echo "Creating superuser..."
|
||||||
python manage.py shell << EOF
|
python manage.py shell << EOF
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
from allauth.account.models import EmailAddress
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
# Check if the user already exists
|
||||||
if not User.objects.filter(username='$DJANGO_ADMIN_USERNAME').exists():
|
if not User.objects.filter(username='$DJANGO_ADMIN_USERNAME').exists():
|
||||||
User.objects.create_superuser('$DJANGO_ADMIN_USERNAME', '$DJANGO_ADMIN_EMAIL', '$DJANGO_ADMIN_PASSWORD')
|
# Create the superuser
|
||||||
|
superuser = User.objects.create_superuser(
|
||||||
|
username='$DJANGO_ADMIN_USERNAME',
|
||||||
|
email='$DJANGO_ADMIN_EMAIL',
|
||||||
|
password='$DJANGO_ADMIN_PASSWORD'
|
||||||
|
)
|
||||||
print("Superuser created successfully.")
|
print("Superuser created successfully.")
|
||||||
|
|
||||||
|
# Create the EmailAddress object for AllAuth
|
||||||
|
EmailAddress.objects.create(
|
||||||
|
user=superuser,
|
||||||
|
email='$DJANGO_ADMIN_EMAIL',
|
||||||
|
verified=True,
|
||||||
|
primary=True
|
||||||
|
)
|
||||||
|
print("EmailAddress object created successfully for AllAuth.")
|
||||||
else:
|
else:
|
||||||
print("Superuser already exists.")
|
print("Superuser already exists.")
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start Django server
|
|
||||||
python manage.py runserver 0.0.0.0:8000
|
# Sync the countries and world travel regions
|
||||||
|
# Sync the countries and world travel regions
|
||||||
|
python manage.py download-countries
|
||||||
|
if [ $? -eq 137 ]; then
|
||||||
|
>&2 echo "WARNING: The download-countries command was interrupted. This is likely due to lack of memory allocated to the container or the host. Please try again with more memory."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat /code/adventurelog.txt
|
||||||
|
|
||||||
|
# Start Gunicorn in foreground
|
||||||
|
exec gunicorn main.wsgi:application \
|
||||||
|
--bind [::]:8000 \
|
||||||
|
--workers 2 \
|
||||||
|
--timeout 120
|
||||||
|
|
42
backend/nginx.conf
Normal file
42
backend/nginx.conf
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
worker_processes 1;
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
client_max_body_size 100M;
|
||||||
|
# The backend is running in the same container, so reference localhost
|
||||||
|
upstream django {
|
||||||
|
server 127.0.0.1:8000; # Use localhost to point to Gunicorn running internally
|
||||||
|
}
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
location / {
|
||||||
|
proxy_pass http://django; # Forward to the upstream block
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
location /static/ {
|
||||||
|
alias /code/staticfiles/; # Serve static files directly
|
||||||
|
}
|
||||||
|
# Serve protected media files with X-Accel-Redirect
|
||||||
|
location /protectedMedia/ {
|
||||||
|
internal; # Only internal requests are allowed
|
||||||
|
alias /code/media/; # This should match Django MEDIA_ROOT
|
||||||
|
try_files $uri =404; # Return a 404 if the file doesn't exist
|
||||||
|
|
||||||
|
# Security headers for all protected files
|
||||||
|
add_header Content-Security-Policy "default-src 'self'; script-src 'none'; object-src 'none'; base-uri 'none'" always;
|
||||||
|
add_header X-Content-Type-Options nosniff always;
|
||||||
|
add_header X-Frame-Options SAMEORIGIN always;
|
||||||
|
add_header X-XSS-Protection "1; mode=block" always;
|
||||||
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,4 +7,30 @@ SECRET_KEY='pleasechangethisbecauseifyoudontitwillbeverybadandyouwillgethackedin
|
||||||
|
|
||||||
PUBLIC_URL='http://127.0.0.1:8000'
|
PUBLIC_URL='http://127.0.0.1:8000'
|
||||||
|
|
||||||
DEBUG=True
|
DEBUG=True
|
||||||
|
|
||||||
|
FRONTEND_URL='http://localhost:3000'
|
||||||
|
|
||||||
|
EMAIL_BACKEND='console'
|
||||||
|
|
||||||
|
# EMAIL_BACKEND='email'
|
||||||
|
# EMAIL_HOST='smtp.gmail.com'
|
||||||
|
# EMAIL_USE_TLS=False
|
||||||
|
# EMAIL_PORT=587
|
||||||
|
# EMAIL_USE_SSL=True
|
||||||
|
# EMAIL_HOST_USER='user'
|
||||||
|
# EMAIL_HOST_PASSWORD='password'
|
||||||
|
# DEFAULT_FROM_EMAIL='user@example.com'
|
||||||
|
|
||||||
|
# GOOGLE_MAPS_API_KEY='key'
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------- #
|
||||||
|
# For Developers to start a Demo Database
|
||||||
|
# docker run --name adventurelog-development -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin -e POSTGRES_DB=adventurelog -p 5432:5432 -d postgis/postgis:15-3.3
|
||||||
|
|
||||||
|
# PGHOST='localhost'
|
||||||
|
# PGDATABASE='adventurelog'
|
||||||
|
# PGUSER='admin'
|
||||||
|
# PGPASSWORD='admin'
|
||||||
|
# ------------------- #
|
9
backend/server/achievements/admin.py
Normal file
9
backend/server/achievements/admin.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from allauth.account.decorators import secure_admin_login
|
||||||
|
from achievements.models import Achievement, UserAchievement
|
||||||
|
|
||||||
|
admin.autodiscover()
|
||||||
|
admin.site.login = secure_admin_login(admin.site.login)
|
||||||
|
|
||||||
|
admin.site.register(Achievement)
|
||||||
|
admin.site.register(UserAchievement)
|
6
backend/server/achievements/apps.py
Normal file
6
backend/server/achievements/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class AchievementsConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'achievements'
|
|
@ -0,0 +1,66 @@
|
||||||
|
import json
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from achievements.models import Achievement
|
||||||
|
|
||||||
|
US_STATE_CODES = [
|
||||||
|
'US-AL', 'US-AK', 'US-AZ', 'US-AR', 'US-CA', 'US-CO', 'US-CT', 'US-DE',
|
||||||
|
'US-FL', 'US-GA', 'US-HI', 'US-ID', 'US-IL', 'US-IN', 'US-IA', 'US-KS',
|
||||||
|
'US-KY', 'US-LA', 'US-ME', 'US-MD', 'US-MA', 'US-MI', 'US-MN', 'US-MS',
|
||||||
|
'US-MO', 'US-MT', 'US-NE', 'US-NV', 'US-NH', 'US-NJ', 'US-NM', 'US-NY',
|
||||||
|
'US-NC', 'US-ND', 'US-OH', 'US-OK', 'US-OR', 'US-PA', 'US-RI', 'US-SC',
|
||||||
|
'US-SD', 'US-TN', 'US-TX', 'US-UT', 'US-VT', 'US-VA', 'US-WA', 'US-WV',
|
||||||
|
'US-WI', 'US-WY'
|
||||||
|
]
|
||||||
|
|
||||||
|
ACHIEVEMENTS = [
|
||||||
|
{
|
||||||
|
"name": "First Adventure",
|
||||||
|
"key": "achievements.first_adventure",
|
||||||
|
"type": "adventure_count",
|
||||||
|
"description": "Log your first adventure!",
|
||||||
|
"condition": {"type": "adventure_count", "value": 1},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Explorer",
|
||||||
|
"key": "achievements.explorer",
|
||||||
|
"type": "adventure_count",
|
||||||
|
"description": "Log 10 adventures.",
|
||||||
|
"condition": {"type": "adventure_count", "value": 10},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Globetrotter",
|
||||||
|
"key": "achievements.globetrotter",
|
||||||
|
"type": "country_count",
|
||||||
|
"description": "Visit 5 different countries.",
|
||||||
|
"condition": {"type": "country_count", "value": 5},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "American Dream",
|
||||||
|
"key": "achievements.american_dream",
|
||||||
|
"type": "country_count",
|
||||||
|
"description": "Visit all 50 states in the USA.",
|
||||||
|
"condition": {"type": "country_count", "items": US_STATE_CODES},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = "Seeds the database with predefined achievements"
|
||||||
|
|
||||||
|
def handle(self, *args, **kwargs):
|
||||||
|
for achievement_data in ACHIEVEMENTS:
|
||||||
|
achievement, created = Achievement.objects.update_or_create(
|
||||||
|
name=achievement_data["name"],
|
||||||
|
defaults={
|
||||||
|
"description": achievement_data["description"],
|
||||||
|
"condition": json.dumps(achievement_data["condition"]),
|
||||||
|
"type": achievement_data["type"],
|
||||||
|
"key": achievement_data["key"],
|
||||||
|
},
|
||||||
|
)
|
||||||
|
if created:
|
||||||
|
self.stdout.write(self.style.SUCCESS(f"✅ Created: {achievement.name}"))
|
||||||
|
else:
|
||||||
|
self.stdout.write(self.style.WARNING(f"🔄 Updated: {achievement.name}"))
|
34
backend/server/achievements/models.py
Normal file
34
backend/server/achievements/models.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import uuid
|
||||||
|
from django.db import models
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
VALID_ACHIEVEMENT_TYPES = [
|
||||||
|
"adventure_count",
|
||||||
|
"country_count",
|
||||||
|
]
|
||||||
|
|
||||||
|
class Achievement(models.Model):
|
||||||
|
"""Stores all possible achievements"""
|
||||||
|
name = models.CharField(max_length=255, unique=True)
|
||||||
|
key = models.CharField(max_length=255, unique=True, default='achievements.other') # Used for frontend lookups, e.g. "achievements.first_adventure"
|
||||||
|
type = models.CharField(max_length=255, choices=[(tag, tag) for tag in VALID_ACHIEVEMENT_TYPES], default='adventure_count') # adventure_count, country_count, etc.
|
||||||
|
description = models.TextField()
|
||||||
|
icon = models.ImageField(upload_to="achievements/", null=True, blank=True)
|
||||||
|
condition = models.JSONField() # Stores rules like {"type": "adventure_count", "value": 10}
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class UserAchievement(models.Model):
|
||||||
|
"""Tracks which achievements a user has earned"""
|
||||||
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
|
achievement = models.ForeignKey(Achievement, on_delete=models.CASCADE)
|
||||||
|
earned_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ("user", "achievement") # Prevent duplicates
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.user.username} - {self.achievement.name}"
|
3
backend/server/achievements/tests.py
Normal file
3
backend/server/achievements/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
3
backend/server/achievements/views.py
Normal file
3
backend/server/achievements/views.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
7
backend/server/adventurelog.txt
Normal file
7
backend/server/adventurelog.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
█████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗████████╗██╗ ██╗██████╗ ███████╗██╗ ██████╗ ██████╗
|
||||||
|
██╔══██╗██╔══██╗██║ ██║██╔════╝████╗ ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██║ ██╔═══██╗██╔════╝
|
||||||
|
███████║██║ ██║██║ ██║█████╗ ██╔██╗ ██║ ██║ ██║ ██║██████╔╝█████╗ ██║ ██║ ██║██║ ███╗
|
||||||
|
██╔══██║██║ ██║╚██╗ ██╔╝██╔══╝ ██║╚██╗██║ ██║ ██║ ██║██╔══██╗██╔══╝ ██║ ██║ ██║██║ ██║
|
||||||
|
██║ ██║██████╔╝ ╚████╔╝ ███████╗██║ ╚████║ ██║ ╚██████╔╝██║ ██║███████╗███████╗╚██████╔╝╚██████╔╝
|
||||||
|
╚═╝ ╚═╝╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝
|
||||||
|
“The world is full of wonderful things you haven't seen yet. Don't ever give up on the chance of seeing them.” - J.K. Rowling
|
|
@ -1,28 +1,53 @@
|
||||||
import os
|
import os
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.utils.html import mark_safe
|
from django.utils.html import mark_safe
|
||||||
from .models import Adventure, Collection
|
from .models import Adventure, Checklist, ChecklistItem, Collection, Transportation, Note, AdventureImage, Visit, Category, Attachment, Lodging
|
||||||
from worldtravel.models import Country, Region, VisitedRegion
|
from worldtravel.models import Country, Region, VisitedRegion, City, VisitedCity
|
||||||
|
from allauth.account.decorators import secure_admin_login
|
||||||
|
|
||||||
|
admin.autodiscover()
|
||||||
|
admin.site.login = secure_admin_login(admin.site.login)
|
||||||
|
|
||||||
|
@admin.action(description="Trigger geocoding")
|
||||||
|
def trigger_geocoding(modeladmin, request, queryset):
|
||||||
|
count = 0
|
||||||
|
for adventure in queryset:
|
||||||
|
try:
|
||||||
|
adventure.save() # Triggers geocoding logic in your model
|
||||||
|
count += 1
|
||||||
|
except Exception as e:
|
||||||
|
modeladmin.message_user(request, f"Error geocoding {adventure}: {e}", level='error')
|
||||||
|
modeladmin.message_user(request, f"Geocoding triggered for {count} adventures.", level='success')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AdventureAdmin(admin.ModelAdmin):
|
class AdventureAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'type', 'user_id', 'date', 'is_public', 'image_display')
|
list_display = ('name', 'get_category', 'get_visit_count', 'user_id', 'is_public')
|
||||||
list_filter = ('type', 'user_id', 'is_public')
|
list_filter = ( 'user_id', 'is_public')
|
||||||
|
search_fields = ('name',)
|
||||||
|
readonly_fields = ('city', 'region', 'country')
|
||||||
|
actions = [trigger_geocoding]
|
||||||
|
|
||||||
def image_display(self, obj):
|
def get_category(self, obj):
|
||||||
if obj.image:
|
if obj.category and obj.category.display_name and obj.category.icon:
|
||||||
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
return obj.category.display_name + ' ' + obj.category.icon
|
||||||
public_url = public_url.replace("'", "")
|
elif obj.category and obj.category.name:
|
||||||
return mark_safe(f'<img src="{public_url}/media/{obj.image.name}" width="100px" height="100px"')
|
return obj.category.name
|
||||||
else:
|
else:
|
||||||
return
|
return 'No Category'
|
||||||
|
|
||||||
|
get_category.short_description = 'Category'
|
||||||
|
|
||||||
image_display.short_description = 'Image Preview'
|
def get_visit_count(self, obj):
|
||||||
|
return obj.visits.count()
|
||||||
|
|
||||||
|
get_visit_count.short_description = 'Visit Count'
|
||||||
|
|
||||||
|
|
||||||
class CountryAdmin(admin.ModelAdmin):
|
class CountryAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'country_code', 'continent', 'number_of_regions')
|
list_display = ('name', 'country_code', 'number_of_regions')
|
||||||
list_filter = ('continent', 'country_code')
|
list_filter = ('subregion',)
|
||||||
|
search_fields = ('name', 'country_code')
|
||||||
|
|
||||||
def number_of_regions(self, obj):
|
def number_of_regions(self, obj):
|
||||||
return Region.objects.filter(country=obj).count()
|
return Region.objects.filter(country=obj).count()
|
||||||
|
@ -32,6 +57,8 @@ class CountryAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
class RegionAdmin(admin.ModelAdmin):
|
class RegionAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'country', 'number_of_visits')
|
list_display = ('name', 'country', 'number_of_visits')
|
||||||
|
list_filter = ('country',)
|
||||||
|
search_fields = ('name', 'country__name')
|
||||||
# list_filter = ('country', 'number_of_visits')
|
# list_filter = ('country', 'number_of_visits')
|
||||||
|
|
||||||
def number_of_visits(self, obj):
|
def number_of_visits(self, obj):
|
||||||
|
@ -39,15 +66,27 @@ class RegionAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
number_of_visits.short_description = 'Number of Visits'
|
number_of_visits.short_description = 'Number of Visits'
|
||||||
|
|
||||||
|
class CityAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name', 'region', 'country')
|
||||||
|
list_filter = ('region', 'region__country')
|
||||||
|
search_fields = ('name', 'region__name', 'region__country__name')
|
||||||
|
|
||||||
|
def country(self, obj):
|
||||||
|
return obj.region.country.name
|
||||||
|
|
||||||
|
country.short_description = 'Country'
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth.admin import UserAdmin
|
from django.contrib.auth.admin import UserAdmin
|
||||||
from users.models import CustomUser
|
from users.models import CustomUser
|
||||||
|
|
||||||
class CustomUserAdmin(UserAdmin):
|
class CustomUserAdmin(UserAdmin):
|
||||||
model = CustomUser
|
model = CustomUser
|
||||||
list_display = ['username', 'email', 'is_staff', 'is_active', 'image_display']
|
list_display = ['username', 'is_staff', 'is_active', 'image_display']
|
||||||
|
readonly_fields = ('uuid',)
|
||||||
|
search_fields = ('username',)
|
||||||
fieldsets = UserAdmin.fieldsets + (
|
fieldsets = UserAdmin.fieldsets + (
|
||||||
(None, {'fields': ('profile_pic',)}),
|
(None, {'fields': ('profile_pic', 'uuid', 'public_profile', 'disable_password')}),
|
||||||
)
|
)
|
||||||
def image_display(self, obj):
|
def image_display(self, obj):
|
||||||
if obj.profile_pic:
|
if obj.profile_pic:
|
||||||
|
@ -56,16 +95,64 @@ class CustomUserAdmin(UserAdmin):
|
||||||
return mark_safe(f'<img src="{public_url}/media/{obj.profile_pic.name}" width="100px" height="100px"')
|
return mark_safe(f'<img src="{public_url}/media/{obj.profile_pic.name}" width="100px" height="100px"')
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
class AdventureImageAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('user_id', 'image_display')
|
||||||
|
|
||||||
|
def image_display(self, obj):
|
||||||
|
if obj.image:
|
||||||
|
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
||||||
|
public_url = public_url.replace("'", "")
|
||||||
|
return mark_safe(f'<img src="{public_url}/media/{obj.image.name}" width="100px" height="100px"')
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
class VisitAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('adventure', 'start_date', 'end_date', 'notes')
|
||||||
|
list_filter = ('start_date', 'end_date')
|
||||||
|
search_fields = ('notes',)
|
||||||
|
|
||||||
|
|
||||||
|
def image_display(self, obj):
|
||||||
|
if obj.image: # Ensure this field matches your model's image field
|
||||||
|
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
||||||
|
public_url = public_url.replace("'", "")
|
||||||
|
return mark_safe(f'<img src="{public_url}/media/{obj.image.name}" width="100px" height="100px"')
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
image_display.short_description = 'Image Preview'
|
||||||
|
|
||||||
|
class CategoryAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ('name', 'user_id', 'display_name', 'icon')
|
||||||
|
search_fields = ('name', 'display_name')
|
||||||
|
|
||||||
|
class CollectionAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
|
list_display = ('name', 'user_id', 'is_public')
|
||||||
|
|
||||||
admin.site.register(CustomUser, CustomUserAdmin)
|
admin.site.register(CustomUser, CustomUserAdmin)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Adventure, AdventureAdmin)
|
admin.site.register(Adventure, AdventureAdmin)
|
||||||
|
admin.site.register(Collection, CollectionAdmin)
|
||||||
|
admin.site.register(Visit, VisitAdmin)
|
||||||
admin.site.register(Country, CountryAdmin)
|
admin.site.register(Country, CountryAdmin)
|
||||||
admin.site.register(Region, RegionAdmin)
|
admin.site.register(Region, RegionAdmin)
|
||||||
admin.site.register(VisitedRegion)
|
admin.site.register(VisitedRegion)
|
||||||
admin.site.register(Collection)
|
admin.site.register(Transportation)
|
||||||
|
admin.site.register(Note)
|
||||||
|
admin.site.register(Checklist)
|
||||||
|
admin.site.register(ChecklistItem)
|
||||||
|
admin.site.register(AdventureImage, AdventureImageAdmin)
|
||||||
|
admin.site.register(Category, CategoryAdmin)
|
||||||
|
admin.site.register(City, CityAdmin)
|
||||||
|
admin.site.register(VisitedCity)
|
||||||
|
admin.site.register(Attachment)
|
||||||
|
admin.site.register(Lodging)
|
||||||
|
|
||||||
admin.site.site_header = 'AdventureLog Admin'
|
admin.site.site_header = 'AdventureLog Admin'
|
||||||
admin.site.site_title = 'AdventureLog Admin Site'
|
admin.site.site_title = 'AdventureLog Admin Site'
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class AdventuresConfig(AppConfig):
|
class AdventuresConfig(AppConfig):
|
||||||
default_auto_field = "django.db.models.BigAutoField"
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
name = "adventures"
|
name = 'adventures'
|
||||||
|
|
||||||
|
def ready(self):
|
||||||
|
import adventures.signals # Import signals when the app is ready
|
273
backend/server/adventures/geocoding.py
Normal file
273
backend/server/adventures/geocoding.py
Normal file
|
@ -0,0 +1,273 @@
|
||||||
|
import requests
|
||||||
|
import time
|
||||||
|
import socket
|
||||||
|
from worldtravel.models import Region, City, VisitedRegion, VisitedCity
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# SEARCHING
|
||||||
|
def search_google(query):
|
||||||
|
try:
|
||||||
|
api_key = settings.GOOGLE_MAPS_API_KEY
|
||||||
|
if not api_key:
|
||||||
|
return {"error": "Missing Google Maps API key"}
|
||||||
|
|
||||||
|
# Updated to use the new Places API (New) endpoint
|
||||||
|
url = "https://places.googleapis.com/v1/places:searchText"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'X-Goog-Api-Key': api_key,
|
||||||
|
'X-Goog-FieldMask': 'places.displayName.text,places.formattedAddress,places.location,places.types,places.rating,places.userRatingCount'
|
||||||
|
}
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"textQuery": query,
|
||||||
|
"maxResultCount": 20 # Adjust as needed
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(url, json=payload, headers=headers, timeout=(2, 5))
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
# Check if we have places in the response
|
||||||
|
places = data.get("places", [])
|
||||||
|
if not places:
|
||||||
|
return {"error": "No results found"}
|
||||||
|
|
||||||
|
results = []
|
||||||
|
for place in places:
|
||||||
|
location = place.get("location", {})
|
||||||
|
types = place.get("types", [])
|
||||||
|
primary_type = types[0] if types else None
|
||||||
|
category = _extract_google_category(types)
|
||||||
|
addresstype = _infer_addresstype(primary_type)
|
||||||
|
|
||||||
|
importance = None
|
||||||
|
rating = place.get("rating")
|
||||||
|
ratings_total = place.get("userRatingCount")
|
||||||
|
if rating is not None and ratings_total:
|
||||||
|
importance = round(float(rating) * ratings_total / 100, 2)
|
||||||
|
|
||||||
|
# Extract display name from the new API structure
|
||||||
|
display_name_obj = place.get("displayName", {})
|
||||||
|
name = display_name_obj.get("text") if display_name_obj else None
|
||||||
|
|
||||||
|
results.append({
|
||||||
|
"lat": location.get("latitude"),
|
||||||
|
"lon": location.get("longitude"),
|
||||||
|
"name": name,
|
||||||
|
"display_name": place.get("formattedAddress"),
|
||||||
|
"type": primary_type,
|
||||||
|
"category": category,
|
||||||
|
"importance": importance,
|
||||||
|
"addresstype": addresstype,
|
||||||
|
"powered_by": "google",
|
||||||
|
})
|
||||||
|
|
||||||
|
if results:
|
||||||
|
results.sort(key=lambda r: r["importance"] if r["importance"] is not None else 0, reverse=True)
|
||||||
|
|
||||||
|
return results
|
||||||
|
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
return {"error": "Network error while contacting Google Maps", "details": str(e)}
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
return {"error": "Unexpected error during Google search", "details": str(e)}
|
||||||
|
|
||||||
|
def _extract_google_category(types):
|
||||||
|
# Basic category inference based on common place types
|
||||||
|
if not types:
|
||||||
|
return None
|
||||||
|
if "restaurant" in types:
|
||||||
|
return "food"
|
||||||
|
if "lodging" in types:
|
||||||
|
return "accommodation"
|
||||||
|
if "park" in types or "natural_feature" in types:
|
||||||
|
return "nature"
|
||||||
|
if "museum" in types or "tourist_attraction" in types:
|
||||||
|
return "attraction"
|
||||||
|
if "locality" in types or "administrative_area_level_1" in types:
|
||||||
|
return "region"
|
||||||
|
return types[0] # fallback to first type
|
||||||
|
|
||||||
|
|
||||||
|
def _infer_addresstype(type_):
|
||||||
|
# Rough mapping of Google place types to OSM-style addresstypes
|
||||||
|
mapping = {
|
||||||
|
"locality": "city",
|
||||||
|
"sublocality": "neighborhood",
|
||||||
|
"administrative_area_level_1": "region",
|
||||||
|
"administrative_area_level_2": "county",
|
||||||
|
"country": "country",
|
||||||
|
"premise": "building",
|
||||||
|
"point_of_interest": "poi",
|
||||||
|
"route": "road",
|
||||||
|
"street_address": "address",
|
||||||
|
}
|
||||||
|
return mapping.get(type_, None)
|
||||||
|
|
||||||
|
|
||||||
|
def search_osm(query):
|
||||||
|
url = f"https://nominatim.openstreetmap.org/search?q={query}&format=jsonv2"
|
||||||
|
headers = {'User-Agent': 'AdventureLog Server'}
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
return [{
|
||||||
|
"lat": item.get("lat"),
|
||||||
|
"lon": item.get("lon"),
|
||||||
|
"name": item.get("name"),
|
||||||
|
"display_name": item.get("display_name"),
|
||||||
|
"type": item.get("type"),
|
||||||
|
"category": item.get("category"),
|
||||||
|
"importance": item.get("importance"),
|
||||||
|
"addresstype": item.get("addresstype"),
|
||||||
|
"powered_by": "nominatim",
|
||||||
|
} for item in data]
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# REVERSE GEOCODING
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
def extractIsoCode(user, data):
|
||||||
|
"""
|
||||||
|
Extract the ISO code from the response data.
|
||||||
|
Returns a dictionary containing the region name, country name, and ISO code if found.
|
||||||
|
"""
|
||||||
|
iso_code = None
|
||||||
|
town_city_or_county = None
|
||||||
|
display_name = None
|
||||||
|
country_code = None
|
||||||
|
city = None
|
||||||
|
visited_city = None
|
||||||
|
location_name = None
|
||||||
|
|
||||||
|
# town = None
|
||||||
|
# city = None
|
||||||
|
# county = None
|
||||||
|
|
||||||
|
if 'name' in data.keys():
|
||||||
|
location_name = data['name']
|
||||||
|
|
||||||
|
if 'address' in data.keys():
|
||||||
|
keys = data['address'].keys()
|
||||||
|
for key in keys:
|
||||||
|
if key.find("ISO") != -1:
|
||||||
|
iso_code = data['address'][key]
|
||||||
|
if 'town' in keys:
|
||||||
|
town_city_or_county = data['address']['town']
|
||||||
|
if 'county' in keys:
|
||||||
|
town_city_or_county = data['address']['county']
|
||||||
|
if 'city' in keys:
|
||||||
|
town_city_or_county = data['address']['city']
|
||||||
|
if not iso_code:
|
||||||
|
return {"error": "No region found"}
|
||||||
|
|
||||||
|
region = Region.objects.filter(id=iso_code).first()
|
||||||
|
visited_region = VisitedRegion.objects.filter(region=region, user_id=user).first()
|
||||||
|
|
||||||
|
region_visited = False
|
||||||
|
city_visited = False
|
||||||
|
country_code = iso_code[:2]
|
||||||
|
|
||||||
|
if region:
|
||||||
|
if town_city_or_county:
|
||||||
|
display_name = f"{town_city_or_county}, {region.name}, {country_code}"
|
||||||
|
city = City.objects.filter(name__contains=town_city_or_county, region=region).first()
|
||||||
|
visited_city = VisitedCity.objects.filter(city=city, user_id=user).first()
|
||||||
|
|
||||||
|
if visited_region:
|
||||||
|
region_visited = True
|
||||||
|
if visited_city:
|
||||||
|
city_visited = True
|
||||||
|
if region:
|
||||||
|
return {"region_id": iso_code, "region": region.name, "country": region.country.name, "country_id": region.country.country_code, "region_visited": region_visited, "display_name": display_name, "city": city.name if city else None, "city_id": city.id if city else None, "city_visited": city_visited, 'location_name': location_name}
|
||||||
|
return {"error": "No region found"}
|
||||||
|
|
||||||
|
def is_host_resolvable(hostname: str) -> bool:
|
||||||
|
try:
|
||||||
|
socket.gethostbyname(hostname)
|
||||||
|
return True
|
||||||
|
except socket.error:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def reverse_geocode(lat, lon, user):
|
||||||
|
if getattr(settings, 'GOOGLE_MAPS_API_KEY', None):
|
||||||
|
return reverse_geocode_google(lat, lon, user)
|
||||||
|
return reverse_geocode_osm(lat, lon, user)
|
||||||
|
|
||||||
|
def reverse_geocode_osm(lat, lon, user):
|
||||||
|
url = f"https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat={lat}&lon={lon}"
|
||||||
|
headers = {'User-Agent': 'AdventureLog Server'}
|
||||||
|
connect_timeout = 1
|
||||||
|
read_timeout = 5
|
||||||
|
|
||||||
|
if not is_host_resolvable("nominatim.openstreetmap.org"):
|
||||||
|
return {"error": "DNS resolution failed"}
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = requests.get(url, headers=headers, timeout=(connect_timeout, read_timeout))
|
||||||
|
response.raise_for_status()
|
||||||
|
data = response.json()
|
||||||
|
return extractIsoCode(user, data)
|
||||||
|
except Exception:
|
||||||
|
return {"error": "An internal error occurred while processing the request"}
|
||||||
|
|
||||||
|
def reverse_geocode_google(lat, lon, user):
|
||||||
|
api_key = settings.GOOGLE_MAPS_API_KEY
|
||||||
|
|
||||||
|
# Updated to use the new Geocoding API endpoint (this one is still supported)
|
||||||
|
# The Geocoding API is separate from Places API and still uses the old format
|
||||||
|
url = "https://maps.googleapis.com/maps/api/geocode/json"
|
||||||
|
params = {"latlng": f"{lat},{lon}", "key": api_key}
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = requests.get(url, params=params)
|
||||||
|
response.raise_for_status()
|
||||||
|
data = response.json()
|
||||||
|
|
||||||
|
if data.get("status") != "OK":
|
||||||
|
return {"error": "Geocoding failed"}
|
||||||
|
|
||||||
|
# Convert Google schema to Nominatim-style for extractIsoCode
|
||||||
|
first_result = data.get("results", [])[0]
|
||||||
|
result_data = {
|
||||||
|
"name": first_result.get("formatted_address"),
|
||||||
|
"address": _parse_google_address_components(first_result.get("address_components", []))
|
||||||
|
}
|
||||||
|
return extractIsoCode(user, result_data)
|
||||||
|
except Exception:
|
||||||
|
return {"error": "An internal error occurred while processing the request"}
|
||||||
|
|
||||||
|
def _parse_google_address_components(components):
|
||||||
|
parsed = {}
|
||||||
|
country_code = None
|
||||||
|
state_code = None
|
||||||
|
|
||||||
|
for comp in components:
|
||||||
|
types = comp.get("types", [])
|
||||||
|
long_name = comp.get("long_name")
|
||||||
|
short_name = comp.get("short_name")
|
||||||
|
|
||||||
|
if "country" in types:
|
||||||
|
parsed["country"] = long_name
|
||||||
|
country_code = short_name
|
||||||
|
parsed["ISO3166-1"] = short_name
|
||||||
|
if "administrative_area_level_1" in types:
|
||||||
|
parsed["state"] = long_name
|
||||||
|
state_code = short_name
|
||||||
|
if "administrative_area_level_2" in types:
|
||||||
|
parsed["county"] = long_name
|
||||||
|
if "locality" in types:
|
||||||
|
parsed["city"] = long_name
|
||||||
|
if "sublocality" in types:
|
||||||
|
parsed["town"] = long_name
|
||||||
|
|
||||||
|
# Build composite ISO 3166-2 code like US-ME
|
||||||
|
if country_code and state_code:
|
||||||
|
parsed["ISO3166-2-lvl1"] = f"{country_code}-{state_code}"
|
||||||
|
|
||||||
|
return parsed
|
17
backend/server/adventures/managers.py
Normal file
17
backend/server/adventures/managers.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
from django.db import models
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
|
class AdventureManager(models.Manager):
|
||||||
|
def retrieve_adventures(self, user, include_owned=False, include_shared=False, include_public=False):
|
||||||
|
query = Q()
|
||||||
|
|
||||||
|
if include_owned:
|
||||||
|
query |= Q(user_id=user)
|
||||||
|
|
||||||
|
if include_shared:
|
||||||
|
query |= Q(collections__shared_with=user)
|
||||||
|
|
||||||
|
if include_public:
|
||||||
|
query |= Q(is_public=True)
|
||||||
|
|
||||||
|
return self.filter(query).distinct()
|
|
@ -1,13 +1,40 @@
|
||||||
class AppVersionMiddleware:
|
from django.conf import settings
|
||||||
|
from django.utils.deprecation import MiddlewareMixin
|
||||||
|
import os
|
||||||
|
|
||||||
|
class OverrideHostMiddleware:
|
||||||
def __init__(self, get_response):
|
def __init__(self, get_response):
|
||||||
self.get_response = get_response
|
self.get_response = get_response
|
||||||
|
|
||||||
def __call__(self, request):
|
def __call__(self, request):
|
||||||
# Process request (if needed)
|
public_url = os.getenv('PUBLIC_URL', None)
|
||||||
|
if public_url:
|
||||||
|
# Extract host and scheme
|
||||||
|
scheme, host = public_url.split("://")
|
||||||
|
request.META['HTTP_HOST'] = host
|
||||||
|
request.META['wsgi.url_scheme'] = scheme
|
||||||
|
|
||||||
|
# Set X-Forwarded-Proto for Django
|
||||||
|
request.META['HTTP_X_FORWARDED_PROTO'] = scheme
|
||||||
|
|
||||||
response = self.get_response(request)
|
response = self.get_response(request)
|
||||||
|
|
||||||
# Add custom header to response
|
|
||||||
# Replace with your app version
|
|
||||||
response['X-AdventureLog-Version'] = '1.0.0'
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
class XSessionTokenMiddleware(MiddlewareMixin):
|
||||||
|
def process_request(self, request):
|
||||||
|
session_token = request.headers.get('X-Session-Token')
|
||||||
|
if session_token:
|
||||||
|
request.COOKIES[settings.SESSION_COOKIE_NAME] = session_token
|
||||||
|
|
||||||
|
class DisableCSRFForSessionTokenMiddleware(MiddlewareMixin):
|
||||||
|
def process_request(self, request):
|
||||||
|
if 'X-Session-Token' in request.headers:
|
||||||
|
setattr(request, '_dont_enforce_csrf_checks', True)
|
||||||
|
|
||||||
|
class DisableCSRFForMobileLoginSignup(MiddlewareMixin):
|
||||||
|
def process_request(self, request):
|
||||||
|
is_mobile = request.headers.get('X-Is-Mobile', '').lower() == 'true'
|
||||||
|
is_login_or_signup = request.path in ['/auth/browser/v1/auth/login', '/auth/browser/v1/auth/signup']
|
||||||
|
if is_mobile and is_login_or_signup:
|
||||||
|
setattr(request, '_dont_enforce_csrf_checks', True)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 5.0.6 on 2024-07-18 15:06
|
# Generated by Django 5.0.8 on 2024-08-15 23:20
|
||||||
|
|
||||||
import django_resized.forms
|
import django_resized.forms
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
@ -7,11 +7,11 @@ from django.db import migrations
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('adventures', '0008_collection_description'),
|
('adventures', 'migrate_images'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AlterField(
|
migrations.AddField(
|
||||||
model_name='adventure',
|
model_name='adventure',
|
||||||
name='image',
|
name='image',
|
||||||
field=django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/'),
|
field=django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/'),
|
|
@ -1,6 +1,10 @@
|
||||||
# Generated by Django 5.0.6 on 2024-06-28 01:01
|
# Generated by Django 5.0.8 on 2024-08-11 13:37
|
||||||
|
|
||||||
import django.contrib.postgres.fields
|
import django.contrib.postgres.fields
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django_resized.forms
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,23 +13,109 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Checklist',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('date', models.DateField(blank=True, null=True)),
|
||||||
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ChecklistItem',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('is_checked', models.BooleanField(default=False)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('checklist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='adventures.checklist')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Collection',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('description', models.TextField(blank=True, null=True)),
|
||||||
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('start_date', models.DateField(blank=True, null=True)),
|
||||||
|
('end_date', models.DateField(blank=True, null=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('is_archived', models.BooleanField(default=False)),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='checklist',
|
||||||
|
name='collection',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection'),
|
||||||
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Adventure',
|
name='Adventure',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
('type', models.CharField(max_length=100)),
|
('type', models.CharField(choices=[('visited', 'Visited'), ('planned', 'Planned'), ('lodging', 'Lodging'), ('dining', 'Dining')], max_length=100)),
|
||||||
('name', models.CharField(max_length=200)),
|
('name', models.CharField(max_length=200)),
|
||||||
('location', models.CharField(blank=True, max_length=200, null=True)),
|
('location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
('activity_types', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, null=True, size=None)),
|
('activity_types', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), blank=True, null=True, size=None)),
|
||||||
('description', models.TextField(blank=True, null=True)),
|
('description', models.TextField(blank=True, null=True)),
|
||||||
('rating', models.FloatField(blank=True, null=True)),
|
('rating', models.FloatField(blank=True, null=True)),
|
||||||
('link', models.URLField(blank=True, null=True)),
|
('link', models.URLField(blank=True, null=True)),
|
||||||
('image', models.ImageField(blank=True, null=True, upload_to='images/')),
|
('image', django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/')),
|
||||||
('date', models.DateField(blank=True, null=True)),
|
('date', models.DateField(blank=True, null=True)),
|
||||||
('trip_id', models.IntegerField(blank=True, null=True)),
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Note',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('content', models.TextField(blank=True, null=True)),
|
||||||
|
('links', django.contrib.postgres.fields.ArrayField(base_field=models.URLField(), blank=True, null=True, size=None)),
|
||||||
|
('date', models.DateField(blank=True, null=True)),
|
||||||
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Transportation',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('type', models.CharField(choices=[('car', 'Car'), ('plane', 'Plane'), ('train', 'Train'), ('bus', 'Bus'), ('boat', 'Boat'), ('bike', 'Bike'), ('walking', 'Walking'), ('other', 'Other')], max_length=100)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('description', models.TextField(blank=True, null=True)),
|
||||||
|
('rating', models.FloatField(blank=True, null=True)),
|
||||||
|
('link', models.URLField(blank=True, null=True)),
|
||||||
|
('date', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('flight_number', models.CharField(blank=True, max_length=100, null=True)),
|
||||||
|
('from_location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
|
('to_location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
27
backend/server/adventures/migrations/0002_adventureimage.py
Normal file
27
backend/server/adventures/migrations/0002_adventureimage.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-08-15 23:17
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import django_resized.forms
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0001_initial'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='AdventureImage',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('image', django_resized.forms.ResizedImageField(crop=None, force_format='WEBP', keep_meta=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/')),
|
||||||
|
('adventure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='adventures.adventure')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-08-15 23:31
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0001_adventure_image'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventureimage',
|
||||||
|
name='adventure',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='adventures.adventure'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,23 +0,0 @@
|
||||||
# Generated by Django 5.0.6 on 2024-06-28 01:01
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0001_initial'),
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='user_id',
|
|
||||||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 5.0.6 on 2024-07-19 12:55
|
# Generated by Django 5.0.8 on 2024-08-18 16:16
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@ from django.db import migrations, models
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('adventures', '0010_adventure_created_at_collection_created_at'),
|
('adventures', '0002_alter_adventureimage_adventure'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='adventure',
|
model_name='adventure',
|
||||||
name='updated_at',
|
name='end_date',
|
||||||
field=models.DateTimeField(auto_now=True),
|
field=models.DateField(blank=True, null=True),
|
||||||
),
|
),
|
||||||
]
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-08-19 20:04
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0003_adventure_end_date'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='transportation',
|
||||||
|
name='end_date',
|
||||||
|
field=models.DateTimeField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-09-02 13:21
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0004_transportation_end_date'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='collection',
|
||||||
|
name='shared_with',
|
||||||
|
field=models.ManyToManyField(blank=True, related_name='shared_with', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,37 +0,0 @@
|
||||||
# Generated by Django 5.0.6 on 2024-07-09 16:49
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0004_adventure_latitude_adventure_longitude'),
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='trip_id',
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Trip',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
|
||||||
('name', models.CharField(max_length=200)),
|
|
||||||
('type', models.CharField(max_length=100)),
|
|
||||||
('location', models.CharField(blank=True, max_length=200, null=True)),
|
|
||||||
('date', models.DateField(blank=True, null=True)),
|
|
||||||
('is_public', models.BooleanField(default=False)),
|
|
||||||
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='trip',
|
|
||||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.trip'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-09-17 14:18
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0005_collection_shared_with'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='link',
|
||||||
|
field=models.URLField(blank=True, max_length=2083, null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,23 +0,0 @@
|
||||||
# Generated by Django 5.0.6 on 2024-07-09 16:58
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0005_remove_adventure_trip_id_trip_adventure_trip'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='type',
|
|
||||||
field=models.CharField(choices=[('visited', 'Visited'), ('planned', 'Planned'), ('featured', 'Featured')], max_length=100),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='trip',
|
|
||||||
name='type',
|
|
||||||
field=models.CharField(choices=[('visited', 'Visited'), ('planned', 'Planned'), ('featured', 'Featured')], max_length=100),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,42 +0,0 @@
|
||||||
# Generated by Django 5.0.6 on 2024-07-15 12:57
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0006_alter_adventure_type_alter_trip_type'),
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='trip',
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='type',
|
|
||||||
field=models.CharField(choices=[('visited', 'Visited'), ('planned', 'Planned')], max_length=100),
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Collection',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
|
||||||
('name', models.CharField(max_length=200)),
|
|
||||||
('is_public', models.BooleanField(default=False)),
|
|
||||||
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='collection',
|
|
||||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection'),
|
|
||||||
),
|
|
||||||
migrations.DeleteModel(
|
|
||||||
name='Trip',
|
|
||||||
),
|
|
||||||
]
|
|
32
backend/server/adventures/migrations/0007_visit_model.py
Normal file
32
backend/server/adventures/migrations/0007_visit_model.py
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-09-23 18:06
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0006_alter_adventure_link'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='type',
|
||||||
|
field=models.CharField(choices=[('general', 'General 🌍'), ('Outdoor', 'Outdoor 🏞️'), ('lodging', 'Lodging 🛌'), ('dining', 'Dining 🍽️'), ('activity', 'Activity 🏄'), ('attraction', 'Attraction 🎢'), ('shopping', 'Shopping 🛍️'), ('nightlife', 'Nightlife 🌃'), ('event', 'Event 🎉'), ('transportation', 'Transportation 🚗'), ('culture', 'Culture 🎭'), ('water_sports', 'Water Sports 🚤'), ('hiking', 'Hiking 🥾'), ('wildlife', 'Wildlife 🦒'), ('historical_sites', 'Historical Sites 🏛️'), ('music_concerts', 'Music & Concerts 🎶'), ('fitness', 'Fitness 🏋️'), ('art_museums', 'Art & Museums 🎨'), ('festivals', 'Festivals 🎪'), ('spiritual_journeys', 'Spiritual Journeys 🧘\u200d♀️'), ('volunteer_work', 'Volunteer Work 🤝'), ('other', 'Other')], default='general', max_length=100),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Visit',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('start_date', models.DateField(blank=True, null=True)),
|
||||||
|
('end_date', models.DateField(blank=True, null=True)),
|
||||||
|
('notes', models.TextField(blank=True, null=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('adventure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='visits', to='adventures.adventure')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 5.0.6 on 2024-07-15 13:05
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0007_remove_adventure_trip_alter_adventure_type_and_more'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='collection',
|
|
||||||
name='description',
|
|
||||||
field=models.TextField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-09-23 18:06
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', 'migrate_visits_categories'),
|
||||||
|
('adventures', 'migrate_images'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='date',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='end_date',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='image',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-09-30 00:33
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0008_remove_date_field'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='type',
|
||||||
|
field=models.CharField(choices=[('general', 'General 🌍'), ('outdoor', 'Outdoor 🏞️'), ('lodging', 'Lodging 🛌'), ('dining', 'Dining 🍽️'), ('activity', 'Activity 🏄'), ('attraction', 'Attraction 🎢'), ('shopping', 'Shopping 🛍️'), ('nightlife', 'Nightlife 🌃'), ('event', 'Event 🎉'), ('transportation', 'Transportation 🚗'), ('culture', 'Culture 🎭'), ('water_sports', 'Water Sports 🚤'), ('hiking', 'Hiking 🥾'), ('wildlife', 'Wildlife 🦒'), ('historical_sites', 'Historical Sites 🏛️'), ('music_concerts', 'Music & Concerts 🎶'), ('fitness', 'Fitness 🏋️'), ('art_museums', 'Art & Museums 🎨'), ('festivals', 'Festivals 🎪'), ('spiritual_journeys', 'Spiritual Journeys 🧘\u200d♀️'), ('volunteer_work', 'Volunteer Work 🤝'), ('other', 'Other')], default='general', max_length=100),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,26 +0,0 @@
|
||||||
# Generated by Django 5.0.6 on 2024-07-18 19:27
|
|
||||||
|
|
||||||
import django.utils.timezone
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('adventures', '0009_alter_adventure_image'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='adventure',
|
|
||||||
name='created_at',
|
|
||||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='collection',
|
|
||||||
name='created_at',
|
|
||||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
]
|
|
18
backend/server/adventures/migrations/0010_collection_link.py
Normal file
18
backend/server/adventures/migrations/0010_collection_link.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-10-08 03:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0009_alter_adventure_type'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='collection',
|
||||||
|
name='link',
|
||||||
|
field=models.URLField(blank=True, max_length=2083, null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-11-14 04:30
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0010_collection_link'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Category',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('display_name', models.CharField(max_length=200)),
|
||||||
|
('icon', models.CharField(default='🌍', max_length=200)),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name_plural': 'Categories',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='category',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.category'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,59 @@
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
def migrate_categories(apps, schema_editor):
|
||||||
|
# Use the historical models
|
||||||
|
Adventure = apps.get_model('adventures', 'Adventure')
|
||||||
|
Category = apps.get_model('adventures', 'Category')
|
||||||
|
|
||||||
|
ADVENTURE_TYPES = {
|
||||||
|
'general': ('General', '🌍'),
|
||||||
|
'outdoor': ('Outdoor', '🏞️'),
|
||||||
|
'lodging': ('Lodging', '🛌'),
|
||||||
|
'dining': ('Dining', '🍽️'),
|
||||||
|
'activity': ('Activity', '🏄'),
|
||||||
|
'attraction': ('Attraction', '🎢'),
|
||||||
|
'shopping': ('Shopping', '🛍️'),
|
||||||
|
'nightlife': ('Nightlife', '🌃'),
|
||||||
|
'event': ('Event', '🎉'),
|
||||||
|
'transportation': ('Transportation', '🚗'),
|
||||||
|
'culture': ('Culture', '🎭'),
|
||||||
|
'water_sports': ('Water Sports', '🚤'),
|
||||||
|
'hiking': ('Hiking', '🥾'),
|
||||||
|
'wildlife': ('Wildlife', '🦒'),
|
||||||
|
'historical_sites': ('Historical Sites', '🏛️'),
|
||||||
|
'music_concerts': ('Music & Concerts', '🎶'),
|
||||||
|
'fitness': ('Fitness', '🏋️'),
|
||||||
|
'art_museums': ('Art & Museums', '🎨'),
|
||||||
|
'festivals': ('Festivals', '🎪'),
|
||||||
|
'spiritual_journeys': ('Spiritual Journeys', '🧘♀️'),
|
||||||
|
'volunteer_work': ('Volunteer Work', '🤝'),
|
||||||
|
'other': ('Other', '❓'),
|
||||||
|
}
|
||||||
|
|
||||||
|
adventures = Adventure.objects.all()
|
||||||
|
for adventure in adventures:
|
||||||
|
# Access the old 'type' field using __dict__ because it's not in the model anymore
|
||||||
|
old_type = adventure.__dict__.get('type')
|
||||||
|
if old_type in ADVENTURE_TYPES:
|
||||||
|
category, created = Category.objects.get_or_create(
|
||||||
|
name=old_type,
|
||||||
|
user_id=adventure.user_id,
|
||||||
|
defaults={
|
||||||
|
'display_name': ADVENTURE_TYPES[old_type][0],
|
||||||
|
'icon': ADVENTURE_TYPES[old_type][1],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
adventure.category = category
|
||||||
|
adventure.save()
|
||||||
|
else:
|
||||||
|
print(f"Unknown type: {old_type}")
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0011_category_adventure_category'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(migrate_categories),
|
||||||
|
]
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-11-14 04:51
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0012_migrate_types_to_categories'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='type',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='category',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='adventures.category'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-11-17 21:43
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0013_remove_adventure_type_alter_adventure_category'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='category',
|
||||||
|
unique_together={('name', 'user_id')},
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Generated by Django 5.0.8 on 2024-12-19 17:16
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0014_alter_category_unique_together'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='transportation',
|
||||||
|
name='destination_latitude',
|
||||||
|
field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='transportation',
|
||||||
|
name='destination_longitude',
|
||||||
|
field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='transportation',
|
||||||
|
name='origin_latitude',
|
||||||
|
field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='transportation',
|
||||||
|
name='origin_longitude',
|
||||||
|
field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-01-01 21:40
|
||||||
|
|
||||||
|
import adventures.models
|
||||||
|
import django_resized.forms
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0015_transportation_destination_latitude_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventureimage',
|
||||||
|
name='image',
|
||||||
|
field=django_resized.forms.ResizedImageField(crop=None, force_format='WEBP', keep_meta=True, quality=75, scale=None, size=[1920, 1080], upload_to=adventures.models.PathAndRename('images/')),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-01-03 04:05
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0016_alter_adventureimage_image'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adventureimage',
|
||||||
|
name='is_primary',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
26
backend/server/adventures/migrations/0018_attachment.py
Normal file
26
backend/server/adventures/migrations/0018_attachment.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-01-19 00:39
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0017_adventureimage_is_primary'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Attachment',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('file', models.FileField(upload_to='attachments/')),
|
||||||
|
('adventure', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='attachments', to='adventures.adventure')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-01-19 22:17
|
||||||
|
|
||||||
|
import adventures.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0018_attachment'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='attachment',
|
||||||
|
name='file',
|
||||||
|
field=models.FileField(upload_to=adventures.models.PathAndRename('attachments/')),
|
||||||
|
),
|
||||||
|
]
|
19
backend/server/adventures/migrations/0020_attachment_name.py
Normal file
19
backend/server/adventures/migrations/0020_attachment_name.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-01-19 22:32
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0019_alter_attachment_file'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='attachment',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(default='', max_length=200),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-01-19 22:32
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0020_attachment_name'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='attachment',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(blank=True, max_length=200, null=True),
|
||||||
|
),
|
||||||
|
]
|
39
backend/server/adventures/migrations/0022_hotel.py
Normal file
39
backend/server/adventures/migrations/0022_hotel.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-02-02 15:36
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0021_alter_attachment_name'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Hotel',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('description', models.TextField(blank=True, null=True)),
|
||||||
|
('rating', models.FloatField(blank=True, null=True)),
|
||||||
|
('link', models.URLField(blank=True, max_length=2083, null=True)),
|
||||||
|
('check_in', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('check_out', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('reservation_number', models.CharField(blank=True, max_length=100, null=True)),
|
||||||
|
('price', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
|
||||||
|
('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-02-08 01:50
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0022_hotel'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Lodging',
|
||||||
|
fields=[
|
||||||
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
|
||||||
|
('name', models.CharField(max_length=200)),
|
||||||
|
('type', models.CharField(choices=[('hotel', 'Hotel'), ('hostel', 'Hostel'), ('resort', 'Resort'), ('bnb', 'Bed & Breakfast'), ('campground', 'Campground'), ('cabin', 'Cabin'), ('apartment', 'Apartment'), ('house', 'House'), ('villa', 'Villa'), ('motel', 'Motel'), ('other', 'Other')], default='other', max_length=100)),
|
||||||
|
('description', models.TextField(blank=True, null=True)),
|
||||||
|
('rating', models.FloatField(blank=True, null=True)),
|
||||||
|
('link', models.URLField(blank=True, max_length=2083, null=True)),
|
||||||
|
('check_in', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('check_out', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('reservation_number', models.CharField(blank=True, max_length=100, null=True)),
|
||||||
|
('price', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
|
||||||
|
('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
|
||||||
|
('location', models.CharField(blank=True, max_length=200, null=True)),
|
||||||
|
('is_public', models.BooleanField(default=False)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('updated_at', models.DateTimeField(auto_now=True)),
|
||||||
|
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='adventures.collection')),
|
||||||
|
('user_id', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Hotel',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-03-17 01:15
|
||||||
|
|
||||||
|
import adventures.models
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0023_lodging_delete_hotel'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='attachment',
|
||||||
|
name='file',
|
||||||
|
field=models.FileField(upload_to=adventures.models.PathAndRename('attachments/'), validators=[adventures.models.validate_file_extension]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 5.0.8 on 2025-03-17 21:41
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0024_alter_attachment_file'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='visit',
|
||||||
|
name='end_date',
|
||||||
|
field=models.DateTimeField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='visit',
|
||||||
|
name='start_date',
|
||||||
|
field=models.DateTimeField(blank=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
18
backend/server/adventures/migrations/0026_visit_timezone.py
Normal file
18
backend/server/adventures/migrations/0026_visit_timezone.py
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,30 @@
|
||||||
|
# Generated by Django 5.0.11 on 2025-05-22 22:48
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0028_lodging_timezone'),
|
||||||
|
('worldtravel', '0015_city_insert_id_country_insert_id_region_insert_id'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='city',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='worldtravel.city'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='country',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='worldtravel.country'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='region',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='worldtravel.region'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,18 @@
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
def set_end_date_equal_to_start(apps, schema_editor):
|
||||||
|
Visit = apps.get_model('adventures', 'Visit')
|
||||||
|
for visit in Visit.objects.filter(end_date__isnull=True):
|
||||||
|
if visit.start_date:
|
||||||
|
visit.end_date = visit.start_date
|
||||||
|
visit.save()
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0029_adventure_city_adventure_country_adventure_region'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(set_end_date_equal_to_start),
|
||||||
|
]
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Generated by Django 5.2.1 on 2025-06-01 16:57
|
||||||
|
|
||||||
|
import adventures.models
|
||||||
|
import django_resized.forms
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0030_set_end_date_equal_start'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adventureimage',
|
||||||
|
name='immich_id',
|
||||||
|
field=models.CharField(blank=True, max_length=200, null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='adventureimage',
|
||||||
|
name='image',
|
||||||
|
field=django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to=adventures.models.PathAndRename('images/')),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='adventureimage',
|
||||||
|
constraint=models.CheckConstraint(condition=models.Q(models.Q(('image__isnull', False), ('immich_id__isnull', True)), models.Q(('image__isnull', True), ('immich_id__isnull', False)), _connector='OR'), name='image_xor_immich_id'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 5.2.1 on 2025-06-01 17:18
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0031_adventureimage_immich_id_alter_adventureimage_image_and_more'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveConstraint(
|
||||||
|
model_name='adventureimage',
|
||||||
|
name='image_xor_immich_id',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 5.2.1 on 2025-06-02 02:31
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0032_remove_adventureimage_image_xor_immich_id'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='adventureimage',
|
||||||
|
constraint=models.UniqueConstraint(fields=('immich_id', 'user_id'), name='unique_immich_id_per_user'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Generated by Django 5.2.1 on 2025-06-02 02:44
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0033_adventureimage_unique_immich_id_per_user'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveConstraint(
|
||||||
|
model_name='adventureimage',
|
||||||
|
name='unique_immich_id_per_user',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,59 @@
|
||||||
|
# Generated by Django 5.2.1 on 2025-06-10 03:04
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_collection_relationships(apps, schema_editor):
|
||||||
|
"""
|
||||||
|
Migrate existing ForeignKey relationships to ManyToMany relationships
|
||||||
|
"""
|
||||||
|
Adventure = apps.get_model('adventures', 'Adventure')
|
||||||
|
|
||||||
|
# Get all adventures that have a collection assigned
|
||||||
|
adventures_with_collections = Adventure.objects.filter(collection__isnull=False)
|
||||||
|
|
||||||
|
for adventure in adventures_with_collections:
|
||||||
|
# Add the existing collection to the new many-to-many field
|
||||||
|
adventure.collections.add(adventure.collection_id)
|
||||||
|
|
||||||
|
|
||||||
|
def reverse_migrate_collection_relationships(apps, schema_editor):
|
||||||
|
"""
|
||||||
|
Reverse migration - convert first collection back to ForeignKey
|
||||||
|
Note: This will only preserve the first collection if an adventure has multiple
|
||||||
|
"""
|
||||||
|
Adventure = apps.get_model('adventures', 'Adventure')
|
||||||
|
|
||||||
|
for adventure in Adventure.objects.all():
|
||||||
|
first_collection = adventure.collections.first()
|
||||||
|
if first_collection:
|
||||||
|
adventure.collection = first_collection
|
||||||
|
adventure.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0034_remove_adventureimage_unique_immich_id_per_user'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
# First, add the new ManyToMany field
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='collections',
|
||||||
|
field=models.ManyToManyField(blank=True, related_name='adventures', to='adventures.collection'),
|
||||||
|
),
|
||||||
|
|
||||||
|
# Migrate existing data from old field to new field
|
||||||
|
migrations.RunPython(
|
||||||
|
migrate_collection_relationships,
|
||||||
|
reverse_migrate_collection_relationships
|
||||||
|
),
|
||||||
|
|
||||||
|
# Finally, remove the old ForeignKey field
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='adventure',
|
||||||
|
name='collection',
|
||||||
|
),
|
||||||
|
]
|
29
backend/server/adventures/migrations/migrate_images.py
Normal file
29
backend/server/adventures/migrations/migrate_images.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
def move_images_to_new_model(apps, schema_editor):
|
||||||
|
Adventure = apps.get_model('adventures', 'Adventure')
|
||||||
|
AdventureImage = apps.get_model('adventures', 'AdventureImage')
|
||||||
|
|
||||||
|
for adventure in Adventure.objects.all():
|
||||||
|
if adventure.image:
|
||||||
|
AdventureImage.objects.create(
|
||||||
|
adventure=adventure,
|
||||||
|
image=adventure.image,
|
||||||
|
user_id=adventure.user_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0001_initial'),
|
||||||
|
('adventures', '0002_adventureimage'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(move_images_to_new_model),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='Adventure',
|
||||||
|
name='image',
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,31 @@
|
||||||
|
from django.db import migrations
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
def move_images_to_new_model(apps, schema_editor):
|
||||||
|
Adventure = apps.get_model('adventures', 'Adventure')
|
||||||
|
Visit = apps.get_model('adventures', 'Visit')
|
||||||
|
|
||||||
|
for adventure in Adventure.objects.all():
|
||||||
|
# if the type is visited and there is no date, set note to 'No date provided.'
|
||||||
|
note = 'No date provided.' if adventure.type == 'visited' and not adventure.date else ''
|
||||||
|
if adventure.date or adventure.type == 'visited':
|
||||||
|
Visit.objects.create(
|
||||||
|
adventure=adventure,
|
||||||
|
start_date=adventure.date,
|
||||||
|
end_date=adventure.end_date,
|
||||||
|
notes=note,
|
||||||
|
)
|
||||||
|
if adventure.type == 'visited' or adventure.type == 'planned':
|
||||||
|
adventure.type = 'general'
|
||||||
|
adventure.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('adventures', '0007_visit_model'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(move_images_to_new_model),
|
||||||
|
]
|
|
@ -1,39 +1,741 @@
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
import os
|
||||||
|
from typing import Iterable
|
||||||
|
import uuid
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils.deconstruct import deconstructible
|
||||||
|
from adventures.managers import AdventureManager
|
||||||
|
import threading
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.postgres.fields import ArrayField
|
from django.contrib.postgres.fields import ArrayField
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
from django_resized import ResizedImageField
|
from django_resized import ResizedImageField
|
||||||
|
from worldtravel.models import City, Country, Region, VisitedCity, VisitedRegion
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
def background_geocode_and_assign(adventure_id: str):
|
||||||
|
print(f"[Adventure Geocode Thread] Starting geocode for adventure {adventure_id}")
|
||||||
|
try:
|
||||||
|
adventure = Adventure.objects.get(id=adventure_id)
|
||||||
|
if not (adventure.latitude and adventure.longitude):
|
||||||
|
return
|
||||||
|
|
||||||
|
from adventures.geocoding import reverse_geocode # or wherever you defined it
|
||||||
|
is_visited = adventure.is_visited_status()
|
||||||
|
result = reverse_geocode(adventure.latitude, adventure.longitude, adventure.user_id)
|
||||||
|
|
||||||
|
if 'region_id' in result:
|
||||||
|
region = Region.objects.filter(id=result['region_id']).first()
|
||||||
|
if region:
|
||||||
|
adventure.region = region
|
||||||
|
if is_visited:
|
||||||
|
VisitedRegion.objects.get_or_create(user_id=adventure.user_id, region=region)
|
||||||
|
|
||||||
|
if 'city_id' in result:
|
||||||
|
city = City.objects.filter(id=result['city_id']).first()
|
||||||
|
if city:
|
||||||
|
adventure.city = city
|
||||||
|
if is_visited:
|
||||||
|
VisitedCity.objects.get_or_create(user_id=adventure.user_id, city=city)
|
||||||
|
|
||||||
|
if 'country_id' in result:
|
||||||
|
country = Country.objects.filter(country_code=result['country_id']).first()
|
||||||
|
if country:
|
||||||
|
adventure.country = country
|
||||||
|
|
||||||
|
# Save updated location info
|
||||||
|
# Save updated location info, skip geocode threading
|
||||||
|
adventure.save(update_fields=["region", "city", "country"], _skip_geocode=True)
|
||||||
|
|
||||||
|
# print(f"[Adventure Geocode Thread] Successfully processed {adventure_id}: {adventure.name} - {adventure.latitude}, {adventure.longitude}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# Optional: log or print the error
|
||||||
|
print(f"[Adventure Geocode Thread] Error processing {adventure_id}: {e}")
|
||||||
|
|
||||||
|
def validate_file_extension(value):
|
||||||
|
import os
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
ext = os.path.splitext(value.name)[1] # [0] returns path+filename
|
||||||
|
valid_extensions = ['.pdf', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.txt', '.png', '.jpg', '.jpeg', '.gif', '.webp', '.mp4', '.mov', '.avi', '.mkv', '.mp3', '.wav', '.flac', '.ogg', '.m4a', '.wma', '.aac', '.opus', '.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.xz', '.zst', '.lz4', '.lzma', '.lzo', '.z', '.tar.gz', '.tar.bz2', '.tar.xz', '.tar.zst', '.tar.lz4', '.tar.lzma', '.tar.lzo', '.tar.z', '.gpx', '.md']
|
||||||
|
if not ext.lower() in valid_extensions:
|
||||||
|
raise ValidationError('Unsupported file extension.')
|
||||||
|
|
||||||
ADVENTURE_TYPES = [
|
ADVENTURE_TYPES = [
|
||||||
('visited', 'Visited'),
|
('general', 'General 🌍'),
|
||||||
('planned', 'Planned'),
|
('outdoor', 'Outdoor 🏞️'),
|
||||||
|
('lodging', 'Lodging 🛌'),
|
||||||
|
('dining', 'Dining 🍽️'),
|
||||||
|
('activity', 'Activity 🏄'),
|
||||||
|
('attraction', 'Attraction 🎢'),
|
||||||
|
('shopping', 'Shopping 🛍️'),
|
||||||
|
('nightlife', 'Nightlife 🌃'),
|
||||||
|
('event', 'Event 🎉'),
|
||||||
|
('transportation', 'Transportation 🚗'),
|
||||||
|
('culture', 'Culture 🎭'),
|
||||||
|
('water_sports', 'Water Sports 🚤'),
|
||||||
|
('hiking', 'Hiking 🥾'),
|
||||||
|
('wildlife', 'Wildlife 🦒'),
|
||||||
|
('historical_sites', 'Historical Sites 🏛️'),
|
||||||
|
('music_concerts', 'Music & Concerts 🎶'),
|
||||||
|
('fitness', 'Fitness 🏋️'),
|
||||||
|
('art_museums', 'Art & Museums 🎨'),
|
||||||
|
('festivals', 'Festivals 🎪'),
|
||||||
|
('spiritual_journeys', 'Spiritual Journeys 🧘♀️'),
|
||||||
|
('volunteer_work', 'Volunteer Work 🤝'),
|
||||||
|
('other', 'Other')
|
||||||
]
|
]
|
||||||
|
|
||||||
|
TIMEZONES = [
|
||||||
|
"Africa/Abidjan",
|
||||||
|
"Africa/Accra",
|
||||||
|
"Africa/Addis_Ababa",
|
||||||
|
"Africa/Algiers",
|
||||||
|
"Africa/Asmera",
|
||||||
|
"Africa/Bamako",
|
||||||
|
"Africa/Bangui",
|
||||||
|
"Africa/Banjul",
|
||||||
|
"Africa/Bissau",
|
||||||
|
"Africa/Blantyre",
|
||||||
|
"Africa/Brazzaville",
|
||||||
|
"Africa/Bujumbura",
|
||||||
|
"Africa/Cairo",
|
||||||
|
"Africa/Casablanca",
|
||||||
|
"Africa/Ceuta",
|
||||||
|
"Africa/Conakry",
|
||||||
|
"Africa/Dakar",
|
||||||
|
"Africa/Dar_es_Salaam",
|
||||||
|
"Africa/Djibouti",
|
||||||
|
"Africa/Douala",
|
||||||
|
"Africa/El_Aaiun",
|
||||||
|
"Africa/Freetown",
|
||||||
|
"Africa/Gaborone",
|
||||||
|
"Africa/Harare",
|
||||||
|
"Africa/Johannesburg",
|
||||||
|
"Africa/Juba",
|
||||||
|
"Africa/Kampala",
|
||||||
|
"Africa/Khartoum",
|
||||||
|
"Africa/Kigali",
|
||||||
|
"Africa/Kinshasa",
|
||||||
|
"Africa/Lagos",
|
||||||
|
"Africa/Libreville",
|
||||||
|
"Africa/Lome",
|
||||||
|
"Africa/Luanda",
|
||||||
|
"Africa/Lubumbashi",
|
||||||
|
"Africa/Lusaka",
|
||||||
|
"Africa/Malabo",
|
||||||
|
"Africa/Maputo",
|
||||||
|
"Africa/Maseru",
|
||||||
|
"Africa/Mbabane",
|
||||||
|
"Africa/Mogadishu",
|
||||||
|
"Africa/Monrovia",
|
||||||
|
"Africa/Nairobi",
|
||||||
|
"Africa/Ndjamena",
|
||||||
|
"Africa/Niamey",
|
||||||
|
"Africa/Nouakchott",
|
||||||
|
"Africa/Ouagadougou",
|
||||||
|
"Africa/Porto-Novo",
|
||||||
|
"Africa/Sao_Tome",
|
||||||
|
"Africa/Tripoli",
|
||||||
|
"Africa/Tunis",
|
||||||
|
"Africa/Windhoek",
|
||||||
|
"America/Adak",
|
||||||
|
"America/Anchorage",
|
||||||
|
"America/Anguilla",
|
||||||
|
"America/Antigua",
|
||||||
|
"America/Araguaina",
|
||||||
|
"America/Argentina/La_Rioja",
|
||||||
|
"America/Argentina/Rio_Gallegos",
|
||||||
|
"America/Argentina/Salta",
|
||||||
|
"America/Argentina/San_Juan",
|
||||||
|
"America/Argentina/San_Luis",
|
||||||
|
"America/Argentina/Tucuman",
|
||||||
|
"America/Argentina/Ushuaia",
|
||||||
|
"America/Aruba",
|
||||||
|
"America/Asuncion",
|
||||||
|
"America/Bahia",
|
||||||
|
"America/Bahia_Banderas",
|
||||||
|
"America/Barbados",
|
||||||
|
"America/Belem",
|
||||||
|
"America/Belize",
|
||||||
|
"America/Blanc-Sablon",
|
||||||
|
"America/Boa_Vista",
|
||||||
|
"America/Bogota",
|
||||||
|
"America/Boise",
|
||||||
|
"America/Buenos_Aires",
|
||||||
|
"America/Cambridge_Bay",
|
||||||
|
"America/Campo_Grande",
|
||||||
|
"America/Cancun",
|
||||||
|
"America/Caracas",
|
||||||
|
"America/Catamarca",
|
||||||
|
"America/Cayenne",
|
||||||
|
"America/Cayman",
|
||||||
|
"America/Chicago",
|
||||||
|
"America/Chihuahua",
|
||||||
|
"America/Ciudad_Juarez",
|
||||||
|
"America/Coral_Harbour",
|
||||||
|
"America/Cordoba",
|
||||||
|
"America/Costa_Rica",
|
||||||
|
"America/Creston",
|
||||||
|
"America/Cuiaba",
|
||||||
|
"America/Curacao",
|
||||||
|
"America/Danmarkshavn",
|
||||||
|
"America/Dawson",
|
||||||
|
"America/Dawson_Creek",
|
||||||
|
"America/Denver",
|
||||||
|
"America/Detroit",
|
||||||
|
"America/Dominica",
|
||||||
|
"America/Edmonton",
|
||||||
|
"America/Eirunepe",
|
||||||
|
"America/El_Salvador",
|
||||||
|
"America/Fort_Nelson",
|
||||||
|
"America/Fortaleza",
|
||||||
|
"America/Glace_Bay",
|
||||||
|
"America/Godthab",
|
||||||
|
"America/Goose_Bay",
|
||||||
|
"America/Grand_Turk",
|
||||||
|
"America/Grenada",
|
||||||
|
"America/Guadeloupe",
|
||||||
|
"America/Guatemala",
|
||||||
|
"America/Guayaquil",
|
||||||
|
"America/Guyana",
|
||||||
|
"America/Halifax",
|
||||||
|
"America/Havana",
|
||||||
|
"America/Hermosillo",
|
||||||
|
"America/Indiana/Knox",
|
||||||
|
"America/Indiana/Marengo",
|
||||||
|
"America/Indiana/Petersburg",
|
||||||
|
"America/Indiana/Tell_City",
|
||||||
|
"America/Indiana/Vevay",
|
||||||
|
"America/Indiana/Vincennes",
|
||||||
|
"America/Indiana/Winamac",
|
||||||
|
"America/Indianapolis",
|
||||||
|
"America/Inuvik",
|
||||||
|
"America/Iqaluit",
|
||||||
|
"America/Jamaica",
|
||||||
|
"America/Jujuy",
|
||||||
|
"America/Juneau",
|
||||||
|
"America/Kentucky/Monticello",
|
||||||
|
"America/Kralendijk",
|
||||||
|
"America/La_Paz",
|
||||||
|
"America/Lima",
|
||||||
|
"America/Los_Angeles",
|
||||||
|
"America/Louisville",
|
||||||
|
"America/Lower_Princes",
|
||||||
|
"America/Maceio",
|
||||||
|
"America/Managua",
|
||||||
|
"America/Manaus",
|
||||||
|
"America/Marigot",
|
||||||
|
"America/Martinique",
|
||||||
|
"America/Matamoros",
|
||||||
|
"America/Mazatlan",
|
||||||
|
"America/Mendoza",
|
||||||
|
"America/Menominee",
|
||||||
|
"America/Merida",
|
||||||
|
"America/Metlakatla",
|
||||||
|
"America/Mexico_City",
|
||||||
|
"America/Miquelon",
|
||||||
|
"America/Moncton",
|
||||||
|
"America/Monterrey",
|
||||||
|
"America/Montevideo",
|
||||||
|
"America/Montserrat",
|
||||||
|
"America/Nassau",
|
||||||
|
"America/New_York",
|
||||||
|
"America/Nome",
|
||||||
|
"America/Noronha",
|
||||||
|
"America/North_Dakota/Beulah",
|
||||||
|
"America/North_Dakota/Center",
|
||||||
|
"America/North_Dakota/New_Salem",
|
||||||
|
"America/Ojinaga",
|
||||||
|
"America/Panama",
|
||||||
|
"America/Paramaribo",
|
||||||
|
"America/Phoenix",
|
||||||
|
"America/Port-au-Prince",
|
||||||
|
"America/Port_of_Spain",
|
||||||
|
"America/Porto_Velho",
|
||||||
|
"America/Puerto_Rico",
|
||||||
|
"America/Punta_Arenas",
|
||||||
|
"America/Rankin_Inlet",
|
||||||
|
"America/Recife",
|
||||||
|
"America/Regina",
|
||||||
|
"America/Resolute",
|
||||||
|
"America/Rio_Branco",
|
||||||
|
"America/Santarem",
|
||||||
|
"America/Santiago",
|
||||||
|
"America/Santo_Domingo",
|
||||||
|
"America/Sao_Paulo",
|
||||||
|
"America/Scoresbysund",
|
||||||
|
"America/Sitka",
|
||||||
|
"America/St_Barthelemy",
|
||||||
|
"America/St_Johns",
|
||||||
|
"America/St_Kitts",
|
||||||
|
"America/St_Lucia",
|
||||||
|
"America/St_Thomas",
|
||||||
|
"America/St_Vincent",
|
||||||
|
"America/Swift_Current",
|
||||||
|
"America/Tegucigalpa",
|
||||||
|
"America/Thule",
|
||||||
|
"America/Tijuana",
|
||||||
|
"America/Toronto",
|
||||||
|
"America/Tortola",
|
||||||
|
"America/Vancouver",
|
||||||
|
"America/Whitehorse",
|
||||||
|
"America/Winnipeg",
|
||||||
|
"America/Yakutat",
|
||||||
|
"Antarctica/Casey",
|
||||||
|
"Antarctica/Davis",
|
||||||
|
"Antarctica/DumontDUrville",
|
||||||
|
"Antarctica/Macquarie",
|
||||||
|
"Antarctica/Mawson",
|
||||||
|
"Antarctica/McMurdo",
|
||||||
|
"Antarctica/Palmer",
|
||||||
|
"Antarctica/Rothera",
|
||||||
|
"Antarctica/Syowa",
|
||||||
|
"Antarctica/Troll",
|
||||||
|
"Antarctica/Vostok",
|
||||||
|
"Arctic/Longyearbyen",
|
||||||
|
"Asia/Aden",
|
||||||
|
"Asia/Almaty",
|
||||||
|
"Asia/Amman",
|
||||||
|
"Asia/Anadyr",
|
||||||
|
"Asia/Aqtau",
|
||||||
|
"Asia/Aqtobe",
|
||||||
|
"Asia/Ashgabat",
|
||||||
|
"Asia/Atyrau",
|
||||||
|
"Asia/Baghdad",
|
||||||
|
"Asia/Bahrain",
|
||||||
|
"Asia/Baku",
|
||||||
|
"Asia/Bangkok",
|
||||||
|
"Asia/Barnaul",
|
||||||
|
"Asia/Beirut",
|
||||||
|
"Asia/Bishkek",
|
||||||
|
"Asia/Brunei",
|
||||||
|
"Asia/Calcutta",
|
||||||
|
"Asia/Chita",
|
||||||
|
"Asia/Colombo",
|
||||||
|
"Asia/Damascus",
|
||||||
|
"Asia/Dhaka",
|
||||||
|
"Asia/Dili",
|
||||||
|
"Asia/Dubai",
|
||||||
|
"Asia/Dushanbe",
|
||||||
|
"Asia/Famagusta",
|
||||||
|
"Asia/Gaza",
|
||||||
|
"Asia/Hebron",
|
||||||
|
"Asia/Hong_Kong",
|
||||||
|
"Asia/Hovd",
|
||||||
|
"Asia/Irkutsk",
|
||||||
|
"Asia/Jakarta",
|
||||||
|
"Asia/Jayapura",
|
||||||
|
"Asia/Jerusalem",
|
||||||
|
"Asia/Kabul",
|
||||||
|
"Asia/Kamchatka",
|
||||||
|
"Asia/Karachi",
|
||||||
|
"Asia/Katmandu",
|
||||||
|
"Asia/Khandyga",
|
||||||
|
"Asia/Krasnoyarsk",
|
||||||
|
"Asia/Kuala_Lumpur",
|
||||||
|
"Asia/Kuching",
|
||||||
|
"Asia/Kuwait",
|
||||||
|
"Asia/Macau",
|
||||||
|
"Asia/Magadan",
|
||||||
|
"Asia/Makassar",
|
||||||
|
"Asia/Manila",
|
||||||
|
"Asia/Muscat",
|
||||||
|
"Asia/Nicosia",
|
||||||
|
"Asia/Novokuznetsk",
|
||||||
|
"Asia/Novosibirsk",
|
||||||
|
"Asia/Omsk",
|
||||||
|
"Asia/Oral",
|
||||||
|
"Asia/Phnom_Penh",
|
||||||
|
"Asia/Pontianak",
|
||||||
|
"Asia/Pyongyang",
|
||||||
|
"Asia/Qatar",
|
||||||
|
"Asia/Qostanay",
|
||||||
|
"Asia/Qyzylorda",
|
||||||
|
"Asia/Rangoon",
|
||||||
|
"Asia/Riyadh",
|
||||||
|
"Asia/Saigon",
|
||||||
|
"Asia/Sakhalin",
|
||||||
|
"Asia/Samarkand",
|
||||||
|
"Asia/Seoul",
|
||||||
|
"Asia/Shanghai",
|
||||||
|
"Asia/Singapore",
|
||||||
|
"Asia/Srednekolymsk",
|
||||||
|
"Asia/Taipei",
|
||||||
|
"Asia/Tashkent",
|
||||||
|
"Asia/Tbilisi",
|
||||||
|
"Asia/Tehran",
|
||||||
|
"Asia/Thimphu",
|
||||||
|
"Asia/Tokyo",
|
||||||
|
"Asia/Tomsk",
|
||||||
|
"Asia/Ulaanbaatar",
|
||||||
|
"Asia/Urumqi",
|
||||||
|
"Asia/Ust-Nera",
|
||||||
|
"Asia/Vientiane",
|
||||||
|
"Asia/Vladivostok",
|
||||||
|
"Asia/Yakutsk",
|
||||||
|
"Asia/Yekaterinburg",
|
||||||
|
"Asia/Yerevan",
|
||||||
|
"Atlantic/Azores",
|
||||||
|
"Atlantic/Bermuda",
|
||||||
|
"Atlantic/Canary",
|
||||||
|
"Atlantic/Cape_Verde",
|
||||||
|
"Atlantic/Faeroe",
|
||||||
|
"Atlantic/Madeira",
|
||||||
|
"Atlantic/Reykjavik",
|
||||||
|
"Atlantic/South_Georgia",
|
||||||
|
"Atlantic/St_Helena",
|
||||||
|
"Atlantic/Stanley",
|
||||||
|
"Australia/Adelaide",
|
||||||
|
"Australia/Brisbane",
|
||||||
|
"Australia/Broken_Hill",
|
||||||
|
"Australia/Darwin",
|
||||||
|
"Australia/Eucla",
|
||||||
|
"Australia/Hobart",
|
||||||
|
"Australia/Lindeman",
|
||||||
|
"Australia/Lord_Howe",
|
||||||
|
"Australia/Melbourne",
|
||||||
|
"Australia/Perth",
|
||||||
|
"Australia/Sydney",
|
||||||
|
"Europe/Amsterdam",
|
||||||
|
"Europe/Andorra",
|
||||||
|
"Europe/Astrakhan",
|
||||||
|
"Europe/Athens",
|
||||||
|
"Europe/Belgrade",
|
||||||
|
"Europe/Berlin",
|
||||||
|
"Europe/Bratislava",
|
||||||
|
"Europe/Brussels",
|
||||||
|
"Europe/Bucharest",
|
||||||
|
"Europe/Budapest",
|
||||||
|
"Europe/Busingen",
|
||||||
|
"Europe/Chisinau",
|
||||||
|
"Europe/Copenhagen",
|
||||||
|
"Europe/Dublin",
|
||||||
|
"Europe/Gibraltar",
|
||||||
|
"Europe/Guernsey",
|
||||||
|
"Europe/Helsinki",
|
||||||
|
"Europe/Isle_of_Man",
|
||||||
|
"Europe/Istanbul",
|
||||||
|
"Europe/Jersey",
|
||||||
|
"Europe/Kaliningrad",
|
||||||
|
"Europe/Kiev",
|
||||||
|
"Europe/Kirov",
|
||||||
|
"Europe/Lisbon",
|
||||||
|
"Europe/Ljubljana",
|
||||||
|
"Europe/London",
|
||||||
|
"Europe/Luxembourg",
|
||||||
|
"Europe/Madrid",
|
||||||
|
"Europe/Malta",
|
||||||
|
"Europe/Mariehamn",
|
||||||
|
"Europe/Minsk",
|
||||||
|
"Europe/Monaco",
|
||||||
|
"Europe/Moscow",
|
||||||
|
"Europe/Oslo",
|
||||||
|
"Europe/Paris",
|
||||||
|
"Europe/Podgorica",
|
||||||
|
"Europe/Prague",
|
||||||
|
"Europe/Riga",
|
||||||
|
"Europe/Rome",
|
||||||
|
"Europe/Samara",
|
||||||
|
"Europe/San_Marino",
|
||||||
|
"Europe/Sarajevo",
|
||||||
|
"Europe/Saratov",
|
||||||
|
"Europe/Simferopol",
|
||||||
|
"Europe/Skopje",
|
||||||
|
"Europe/Sofia",
|
||||||
|
"Europe/Stockholm",
|
||||||
|
"Europe/Tallinn",
|
||||||
|
"Europe/Tirane",
|
||||||
|
"Europe/Ulyanovsk",
|
||||||
|
"Europe/Vaduz",
|
||||||
|
"Europe/Vatican",
|
||||||
|
"Europe/Vienna",
|
||||||
|
"Europe/Vilnius",
|
||||||
|
"Europe/Volgograd",
|
||||||
|
"Europe/Warsaw",
|
||||||
|
"Europe/Zagreb",
|
||||||
|
"Europe/Zurich",
|
||||||
|
"Indian/Antananarivo",
|
||||||
|
"Indian/Chagos",
|
||||||
|
"Indian/Christmas",
|
||||||
|
"Indian/Cocos",
|
||||||
|
"Indian/Comoro",
|
||||||
|
"Indian/Kerguelen",
|
||||||
|
"Indian/Mahe",
|
||||||
|
"Indian/Maldives",
|
||||||
|
"Indian/Mauritius",
|
||||||
|
"Indian/Mayotte",
|
||||||
|
"Indian/Reunion",
|
||||||
|
"Pacific/Apia",
|
||||||
|
"Pacific/Auckland",
|
||||||
|
"Pacific/Bougainville",
|
||||||
|
"Pacific/Chatham",
|
||||||
|
"Pacific/Easter",
|
||||||
|
"Pacific/Efate",
|
||||||
|
"Pacific/Enderbury",
|
||||||
|
"Pacific/Fakaofo",
|
||||||
|
"Pacific/Fiji",
|
||||||
|
"Pacific/Funafuti",
|
||||||
|
"Pacific/Galapagos",
|
||||||
|
"Pacific/Gambier",
|
||||||
|
"Pacific/Guadalcanal",
|
||||||
|
"Pacific/Guam",
|
||||||
|
"Pacific/Honolulu",
|
||||||
|
"Pacific/Kiritimati",
|
||||||
|
"Pacific/Kosrae",
|
||||||
|
"Pacific/Kwajalein",
|
||||||
|
"Pacific/Majuro",
|
||||||
|
"Pacific/Marquesas",
|
||||||
|
"Pacific/Midway",
|
||||||
|
"Pacific/Nauru",
|
||||||
|
"Pacific/Niue",
|
||||||
|
"Pacific/Norfolk",
|
||||||
|
"Pacific/Noumea",
|
||||||
|
"Pacific/Pago_Pago",
|
||||||
|
"Pacific/Palau",
|
||||||
|
"Pacific/Pitcairn",
|
||||||
|
"Pacific/Ponape",
|
||||||
|
"Pacific/Port_Moresby",
|
||||||
|
"Pacific/Rarotonga",
|
||||||
|
"Pacific/Saipan",
|
||||||
|
"Pacific/Tahiti",
|
||||||
|
"Pacific/Tarawa",
|
||||||
|
"Pacific/Tongatapu",
|
||||||
|
"Pacific/Truk",
|
||||||
|
"Pacific/Wake",
|
||||||
|
"Pacific/Wallis"
|
||||||
|
]
|
||||||
|
|
||||||
|
LODGING_TYPES = [
|
||||||
|
('hotel', 'Hotel'),
|
||||||
|
('hostel', 'Hostel'),
|
||||||
|
('resort', 'Resort'),
|
||||||
|
('bnb', 'Bed & Breakfast'),
|
||||||
|
('campground', 'Campground'),
|
||||||
|
('cabin', 'Cabin'),
|
||||||
|
('apartment', 'Apartment'),
|
||||||
|
('house', 'House'),
|
||||||
|
('villa', 'Villa'),
|
||||||
|
('motel', 'Motel'),
|
||||||
|
('other', 'Other')
|
||||||
|
]
|
||||||
|
|
||||||
|
TRANSPORTATION_TYPES = [
|
||||||
|
('car', 'Car'),
|
||||||
|
('plane', 'Plane'),
|
||||||
|
('train', 'Train'),
|
||||||
|
('bus', 'Bus'),
|
||||||
|
('boat', 'Boat'),
|
||||||
|
('bike', 'Bike'),
|
||||||
|
('walking', 'Walking'),
|
||||||
|
('other', 'Other')
|
||||||
|
]
|
||||||
|
|
||||||
# Assuming you have a default user ID you want to use
|
# Assuming you have a default user ID you want to use
|
||||||
default_user_id = 1 # Replace with an actual user ID
|
default_user_id = 1 # Replace with an actual user ID
|
||||||
|
|
||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
|
class Visit(models.Model):
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
adventure = models.ForeignKey('Adventure', on_delete=models.CASCADE, related_name='visits')
|
||||||
|
start_date = models.DateTimeField(null=True, blank=True)
|
||||||
|
end_date = models.DateTimeField(null=True, blank=True)
|
||||||
|
timezone = models.CharField(max_length=50, choices=[(tz, tz) for tz in TIMEZONES], null=True, blank=True)
|
||||||
|
notes = models.TextField(blank=True, null=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
if self.start_date > self.end_date:
|
||||||
|
raise ValidationError('The start date must be before or equal to the end date.')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.adventure.name} - {self.start_date} to {self.end_date}"
|
||||||
|
|
||||||
class Adventure(models.Model):
|
class Adventure(models.Model):
|
||||||
id = models.AutoField(primary_key=True)
|
#id = models.AutoField(primary_key=True)
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
user_id = models.ForeignKey(
|
user_id = models.ForeignKey(
|
||||||
User, on_delete=models.CASCADE, default=default_user_id)
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
type = models.CharField(max_length=100, choices=ADVENTURE_TYPES)
|
|
||||||
|
category = models.ForeignKey('Category', on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
name = models.CharField(max_length=200)
|
name = models.CharField(max_length=200)
|
||||||
location = models.CharField(max_length=200, blank=True, null=True)
|
location = models.CharField(max_length=200, blank=True, null=True)
|
||||||
activity_types = ArrayField(models.CharField(
|
activity_types = ArrayField(models.CharField(
|
||||||
max_length=100), blank=True, null=True)
|
max_length=100), blank=True, null=True)
|
||||||
description = models.TextField(blank=True, null=True)
|
description = models.TextField(blank=True, null=True)
|
||||||
rating = models.FloatField(blank=True, null=True)
|
rating = models.FloatField(blank=True, null=True)
|
||||||
link = models.URLField(blank=True, null=True)
|
link = models.URLField(blank=True, null=True, max_length=2083)
|
||||||
image = ResizedImageField(force_format="WEBP", quality=75, null=True, blank=True, upload_to='images/')
|
|
||||||
date = models.DateField(blank=True, null=True)
|
|
||||||
is_public = models.BooleanField(default=False)
|
is_public = models.BooleanField(default=False)
|
||||||
|
|
||||||
longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
|
||||||
|
city = models.ForeignKey(City, on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
|
region = models.ForeignKey(Region, on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
|
country = models.ForeignKey(Country, on_delete=models.SET_NULL, blank=True, null=True)
|
||||||
|
|
||||||
|
# Changed from ForeignKey to ManyToManyField
|
||||||
|
collections = models.ManyToManyField('Collection', blank=True, related_name='adventures')
|
||||||
|
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
objects = AdventureManager()
|
||||||
|
|
||||||
|
def is_visited_status(self):
|
||||||
|
current_date = timezone.now().date()
|
||||||
|
for visit in self.visits.all():
|
||||||
|
start_date = visit.start_date.date() if isinstance(visit.start_date, timezone.datetime) else visit.start_date
|
||||||
|
end_date = visit.end_date.date() if isinstance(visit.end_date, timezone.datetime) else visit.end_date
|
||||||
|
if start_date and end_date and (start_date <= current_date):
|
||||||
|
return True
|
||||||
|
elif start_date and not end_date and (start_date <= current_date):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def clean(self, skip_shared_validation=False):
|
||||||
|
"""
|
||||||
|
Validate model constraints.
|
||||||
|
skip_shared_validation: Skip validation when called by shared users
|
||||||
|
"""
|
||||||
|
# Skip validation if this is a shared user update
|
||||||
|
if skip_shared_validation:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Check collections after the instance is saved (in save method or separate validation)
|
||||||
|
if self.pk: # Only check if the instance has been saved
|
||||||
|
for collection in self.collections.all():
|
||||||
|
if collection.is_public and not self.is_public:
|
||||||
|
raise ValidationError(f'Adventures associated with a public collection must be public. Collection: {collection.name} Adventure: {self.name}')
|
||||||
|
|
||||||
|
# Only enforce same-user constraint for non-shared collections
|
||||||
|
if self.user_id != collection.user_id:
|
||||||
|
# Check if this is a shared collection scenario
|
||||||
|
# Allow if the adventure owner has access to the collection through sharing
|
||||||
|
if not collection.shared_with.filter(uuid=self.user_id.uuid).exists():
|
||||||
|
raise ValidationError(f'Adventures must be associated with collections owned by the same user or shared collections. Collection owner: {collection.user_id.username} Adventure owner: {self.user_id.username}')
|
||||||
|
|
||||||
|
if self.category:
|
||||||
|
if self.user_id != self.category.user_id:
|
||||||
|
raise ValidationError(f'Adventures must be associated with categories owned by the same user. Category owner: {self.category.user_id.username} Adventure owner: {self.user_id.username}')
|
||||||
|
|
||||||
|
def save(self, force_insert=False, force_update=False, using=None, update_fields=None, _skip_geocode=False, _skip_shared_validation=False):
|
||||||
|
if force_insert and force_update:
|
||||||
|
raise ValueError("Cannot force both insert and updating in model saving.")
|
||||||
|
|
||||||
|
if not self.category:
|
||||||
|
category, _ = Category.objects.get_or_create(
|
||||||
|
user_id=self.user_id,
|
||||||
|
name='general',
|
||||||
|
defaults={'display_name': 'General', 'icon': '🌍'}
|
||||||
|
)
|
||||||
|
self.category = category
|
||||||
|
|
||||||
|
result = super().save(force_insert, force_update, using, update_fields)
|
||||||
|
|
||||||
|
# Validate collections after saving (since M2M relationships require saved instance)
|
||||||
|
if self.pk:
|
||||||
|
try:
|
||||||
|
self.clean(skip_shared_validation=_skip_shared_validation)
|
||||||
|
except ValidationError as e:
|
||||||
|
# If validation fails, you might want to handle this differently
|
||||||
|
# For now, we'll re-raise the error
|
||||||
|
raise e
|
||||||
|
|
||||||
|
# ⛔ Skip threading if called from geocode background thread
|
||||||
|
if _skip_geocode:
|
||||||
|
return result
|
||||||
|
|
||||||
|
if self.latitude and self.longitude:
|
||||||
|
thread = threading.Thread(target=background_geocode_and_assign, args=(str(self.id),))
|
||||||
|
thread.daemon = True # Allows the thread to exit when the main program ends
|
||||||
|
thread.start()
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Collection(models.Model):
|
||||||
|
#id = models.AutoField(primary_key=True)
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
description = models.TextField(blank=True, null=True)
|
||||||
|
is_public = models.BooleanField(default=False)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
start_date = models.DateField(blank=True, null=True)
|
||||||
|
end_date = models.DateField(blank=True, null=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
is_archived = models.BooleanField(default=False)
|
||||||
|
shared_with = models.ManyToManyField(User, related_name='shared_with', blank=True)
|
||||||
|
link = models.URLField(blank=True, null=True, max_length=2083)
|
||||||
|
|
||||||
|
# if connected adventures are private and collection is public, raise an error
|
||||||
|
def clean(self):
|
||||||
|
if self.is_public and self.pk: # Only check if the instance has a primary key
|
||||||
|
# Updated to use the new related_name 'adventures'
|
||||||
|
for adventure in self.adventures.all():
|
||||||
|
if not adventure.is_public:
|
||||||
|
raise ValidationError(f'Public collections cannot be associated with private adventures. Collection: {self.name} Adventure: {adventure.name}')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Transportation(models.Model):
|
||||||
|
#id = models.AutoField(primary_key=True)
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
type = models.CharField(max_length=100, choices=TRANSPORTATION_TYPES)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
description = models.TextField(blank=True, null=True)
|
||||||
|
rating = models.FloatField(blank=True, null=True)
|
||||||
|
link = models.URLField(blank=True, null=True)
|
||||||
|
date = models.DateTimeField(blank=True, null=True)
|
||||||
|
end_date = models.DateTimeField(blank=True, null=True)
|
||||||
|
start_timezone = models.CharField(max_length=50, choices=[(tz, tz) for tz in TIMEZONES], null=True, blank=True)
|
||||||
|
end_timezone = models.CharField(max_length=50, choices=[(tz, tz) for tz in TIMEZONES], null=True, blank=True)
|
||||||
|
flight_number = models.CharField(max_length=100, blank=True, null=True)
|
||||||
|
from_location = models.CharField(max_length=200, blank=True, null=True)
|
||||||
|
origin_latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
origin_longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
destination_latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
destination_longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
to_location = models.CharField(max_length=200, blank=True, null=True)
|
||||||
|
is_public = models.BooleanField(default=False)
|
||||||
|
collection = models.ForeignKey('Collection', on_delete=models.CASCADE, blank=True, null=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
print(self.date)
|
||||||
|
if self.date and self.end_date and self.date > self.end_date:
|
||||||
|
raise ValidationError('The start date must be before the end date. Start date: ' + str(self.date) + ' End date: ' + str(self.end_date))
|
||||||
|
|
||||||
|
if self.collection:
|
||||||
|
if self.collection.is_public and not self.is_public:
|
||||||
|
raise ValidationError('Transportations associated with a public collection must be public. Collection: ' + self.collection.name + ' Transportation: ' + self.name)
|
||||||
|
if self.user_id != self.collection.user_id:
|
||||||
|
raise ValidationError('Transportations must be associated with collections owned by the same user. Collection owner: ' + self.collection.user_id.username + ' Transportation owner: ' + self.user_id.username)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Note(models.Model):
|
||||||
|
#id = models.AutoField(primary_key=True)
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
content = models.TextField(blank=True, null=True)
|
||||||
|
links = ArrayField(models.URLField(), blank=True, null=True)
|
||||||
|
date = models.DateField(blank=True, null=True)
|
||||||
|
is_public = models.BooleanField(default=False)
|
||||||
collection = models.ForeignKey('Collection', on_delete=models.CASCADE, blank=True, null=True)
|
collection = models.ForeignKey('Collection', on_delete=models.CASCADE, blank=True, null=True)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
@ -41,28 +743,167 @@ class Adventure(models.Model):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.collection:
|
if self.collection:
|
||||||
if self.collection.is_public and not self.is_public:
|
if self.collection.is_public and not self.is_public:
|
||||||
raise ValidationError('Adventures associated with a public collection must be public. Collection: ' + self.trip.name + ' Adventure: ' + self.name)
|
raise ValidationError('Notes associated with a public collection must be public. Collection: ' + self.collection.name + ' Transportation: ' + self.name)
|
||||||
if self.user_id != self.collection.user_id:
|
if self.user_id != self.collection.user_id:
|
||||||
raise ValidationError('Adventures must be associated with collections owned by the same user. Collection owner: ' + self.collection.user_id.username + ' Adventure owner: ' + self.user_id.username)
|
raise ValidationError('Notes must be associated with collections owned by the same user. Collection owner: ' + self.collection.user_id.username + ' Transportation owner: ' + self.user_id.username)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Checklist(models.Model):
|
||||||
|
# id = models.AutoField(primary_key=True)
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
date = models.DateField(blank=True, null=True)
|
||||||
|
is_public = models.BooleanField(default=False)
|
||||||
|
collection = models.ForeignKey('Collection', on_delete=models.CASCADE, blank=True, null=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
if self.collection:
|
||||||
|
if self.collection.is_public and not self.is_public:
|
||||||
|
raise ValidationError('Checklists associated with a public collection must be public. Collection: ' + self.collection.name + ' Checklist: ' + self.name)
|
||||||
|
if self.user_id != self.collection.user_id:
|
||||||
|
raise ValidationError('Checklists must be associated with collections owned by the same user. Collection owner: ' + self.collection.user_id.username + ' Checklist owner: ' + self.user_id.username)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Collection(models.Model):
|
class ChecklistItem(models.Model):
|
||||||
id = models.AutoField(primary_key=True)
|
#id = models.AutoField(primary_key=True)
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
user_id = models.ForeignKey(
|
user_id = models.ForeignKey(
|
||||||
User, on_delete=models.CASCADE, default=default_user_id)
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
name = models.CharField(max_length=200)
|
name = models.CharField(max_length=200)
|
||||||
description = models.TextField(blank=True, null=True)
|
is_checked = models.BooleanField(default=False)
|
||||||
is_public = models.BooleanField(default=False)
|
checklist = models.ForeignKey('Checklist', on_delete=models.CASCADE)
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
# if connected adventures are private and collection is public, raise an error
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.is_public and self.pk: # Only check if the instance has a primary key
|
if self.checklist.is_public and not self.checklist.is_public:
|
||||||
for adventure in self.adventure_set.all():
|
raise ValidationError('Checklist items associated with a public checklist must be public. Checklist: ' + self.checklist.name + ' Checklist item: ' + self.name)
|
||||||
if not adventure.is_public:
|
if self.user_id != self.checklist.user_id:
|
||||||
raise ValidationError('Public collections cannot be associated with private adventures. Collection: ' + self.name + ' Adventure: ' + adventure.name)
|
raise ValidationError('Checklist items must be associated with checklists owned by the same user. Checklist owner: ' + self.checklist.user_id.username + ' Checklist item owner: ' + self.user_id.username)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
@deconstructible
|
||||||
|
class PathAndRename:
|
||||||
|
def __init__(self, path):
|
||||||
|
self.path = path
|
||||||
|
|
||||||
|
def __call__(self, instance, filename):
|
||||||
|
ext = filename.split('.')[-1]
|
||||||
|
# Generate a new UUID for the filename
|
||||||
|
filename = f"{uuid.uuid4()}.{ext}"
|
||||||
|
return os.path.join(self.path, filename)
|
||||||
|
|
||||||
|
class AdventureImage(models.Model):
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
image = ResizedImageField(
|
||||||
|
force_format="WEBP",
|
||||||
|
quality=75,
|
||||||
|
upload_to=PathAndRename('images/'),
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
)
|
||||||
|
immich_id = models.CharField(max_length=200, null=True, blank=True)
|
||||||
|
adventure = models.ForeignKey(Adventure, related_name='images', on_delete=models.CASCADE)
|
||||||
|
is_primary = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
|
||||||
|
# One of image or immich_id must be set, but not both
|
||||||
|
has_image = bool(self.image and str(self.image).strip())
|
||||||
|
has_immich_id = bool(self.immich_id and str(self.immich_id).strip())
|
||||||
|
|
||||||
|
if has_image and has_immich_id:
|
||||||
|
raise ValidationError("Cannot have both image file and Immich ID. Please provide only one.")
|
||||||
|
if not has_image and not has_immich_id:
|
||||||
|
raise ValidationError("Must provide either an image file or an Immich ID.")
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
# Clean empty strings to None for proper database storage
|
||||||
|
if not self.image:
|
||||||
|
self.image = None
|
||||||
|
if not self.immich_id or not str(self.immich_id).strip():
|
||||||
|
self.immich_id = None
|
||||||
|
|
||||||
|
self.full_clean() # This calls clean() method
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.image.url if self.image else f"Immich ID: {self.immich_id or 'No image'}"
|
||||||
|
|
||||||
|
class Attachment(models.Model):
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
file = models.FileField(upload_to=PathAndRename('attachments/'),validators=[validate_file_extension])
|
||||||
|
adventure = models.ForeignKey(Adventure, related_name='attachments', on_delete=models.CASCADE)
|
||||||
|
name = models.CharField(max_length=200, null=True, blank=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.file.url
|
||||||
|
|
||||||
|
class Category(models.Model):
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
display_name = models.CharField(max_length=200)
|
||||||
|
icon = models.CharField(max_length=200, default='🌍')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name_plural = 'Categories'
|
||||||
|
unique_together = ['name', 'user_id']
|
||||||
|
|
||||||
|
def clean(self) -> None:
|
||||||
|
self.name = self.name.lower().strip()
|
||||||
|
|
||||||
|
return super().clean()
|
||||||
|
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name + ' - ' + self.display_name + ' - ' + self.icon
|
||||||
|
|
||||||
|
class Lodging(models.Model):
|
||||||
|
id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True)
|
||||||
|
user_id = models.ForeignKey(
|
||||||
|
User, on_delete=models.CASCADE, default=default_user_id)
|
||||||
|
name = models.CharField(max_length=200)
|
||||||
|
type = models.CharField(max_length=100, choices=LODGING_TYPES, default='other')
|
||||||
|
description = models.TextField(blank=True, null=True)
|
||||||
|
rating = models.FloatField(blank=True, null=True)
|
||||||
|
link = models.URLField(blank=True, null=True, max_length=2083)
|
||||||
|
check_in = models.DateTimeField(blank=True, null=True)
|
||||||
|
check_out = models.DateTimeField(blank=True, null=True)
|
||||||
|
timezone = models.CharField(max_length=50, choices=[(tz, tz) for tz in TIMEZONES], null=True, blank=True)
|
||||||
|
reservation_number = models.CharField(max_length=100, blank=True, null=True)
|
||||||
|
price = models.DecimalField(max_digits=9, decimal_places=2, blank=True, null=True)
|
||||||
|
latitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||||
|
location = models.CharField(max_length=200, blank=True, null=True)
|
||||||
|
is_public = models.BooleanField(default=False)
|
||||||
|
collection = models.ForeignKey('Collection', on_delete=models.CASCADE, blank=True, null=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
if self.check_in and self.check_out and self.check_in > self.check_out:
|
||||||
|
raise ValidationError('The start date must be before the end date. Start date: ' + str(self.check_in) + ' End date: ' + str(self.check_out))
|
||||||
|
|
||||||
|
if self.collection:
|
||||||
|
if self.collection.is_public and not self.is_public:
|
||||||
|
raise ValidationError('Lodging associated with a public collection must be public. Collection: ' + self.collection.name + ' Loging: ' + self.name)
|
||||||
|
if self.user_id != self.collection.user_id:
|
||||||
|
raise ValidationError('Lodging must be associated with collections owned by the same user. Collection owner: ' + self.collection.user_id.username + ' Lodging owner: ' + self.user_id.username)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
|
@ -2,29 +2,99 @@ from rest_framework import permissions
|
||||||
|
|
||||||
class IsOwnerOrReadOnly(permissions.BasePermission):
|
class IsOwnerOrReadOnly(permissions.BasePermission):
|
||||||
"""
|
"""
|
||||||
Custom permission to only allow owners of an object to edit it.
|
Owners can edit, others have read-only access.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def has_object_permission(self, request, view, obj):
|
def has_object_permission(self, request, view, obj):
|
||||||
# Read permissions are allowed to any request,
|
|
||||||
# so we'll always allow GET, HEAD or OPTIONS requests.
|
|
||||||
if request.method in permissions.SAFE_METHODS:
|
if request.method in permissions.SAFE_METHODS:
|
||||||
return True
|
return True
|
||||||
|
# obj.user_id is FK to User, compare with request.user
|
||||||
# Write permissions are only allowed to the owner of the object.
|
|
||||||
return obj.user_id == request.user
|
return obj.user_id == request.user
|
||||||
|
|
||||||
|
|
||||||
class IsPublicReadOnly(permissions.BasePermission):
|
class IsPublicReadOnly(permissions.BasePermission):
|
||||||
"""
|
"""
|
||||||
Custom permission to only allow read-only access to public objects,
|
Read-only if public or owner, write only for owner.
|
||||||
and write access to the owner of the object.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def has_object_permission(self, request, view, obj):
|
def has_object_permission(self, request, view, obj):
|
||||||
# Read permissions are allowed if the object is public
|
|
||||||
if request.method in permissions.SAFE_METHODS:
|
if request.method in permissions.SAFE_METHODS:
|
||||||
return obj.is_public or obj.user_id == request.user
|
return obj.is_public or obj.user_id == request.user
|
||||||
|
return obj.user_id == request.user
|
||||||
|
|
||||||
# Write permissions are only allowed to the owner of the object
|
|
||||||
return obj.user_id == request.user
|
class CollectionShared(permissions.BasePermission):
|
||||||
|
"""
|
||||||
|
Allow full access if user is in shared_with of collection(s) or owner,
|
||||||
|
read-only if public or shared_with,
|
||||||
|
write only if owner or shared_with.
|
||||||
|
"""
|
||||||
|
def has_object_permission(self, request, view, obj):
|
||||||
|
user = request.user
|
||||||
|
if not user or not user.is_authenticated:
|
||||||
|
# Anonymous: only read public
|
||||||
|
return request.method in permissions.SAFE_METHODS and obj.is_public
|
||||||
|
|
||||||
|
# Check if user is in shared_with of any collections related to the obj
|
||||||
|
# If obj is a Collection itself:
|
||||||
|
if hasattr(obj, 'shared_with'):
|
||||||
|
if obj.shared_with.filter(id=user.id).exists():
|
||||||
|
return True
|
||||||
|
|
||||||
|
# If obj is an Adventure (has collections M2M)
|
||||||
|
if hasattr(obj, 'collections'):
|
||||||
|
# Check if user is in shared_with of any related collection
|
||||||
|
shared_collections = obj.collections.filter(shared_with=user)
|
||||||
|
if shared_collections.exists():
|
||||||
|
return True
|
||||||
|
|
||||||
|
# Read permission if public or owner
|
||||||
|
if request.method in permissions.SAFE_METHODS:
|
||||||
|
return obj.is_public or obj.user_id == user
|
||||||
|
|
||||||
|
# Write permission only if owner or shared user via collections
|
||||||
|
if obj.user_id == user:
|
||||||
|
return True
|
||||||
|
|
||||||
|
if hasattr(obj, 'collections'):
|
||||||
|
if obj.collections.filter(shared_with=user).exists():
|
||||||
|
return True
|
||||||
|
|
||||||
|
# Default deny
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class IsOwnerOrSharedWithFullAccess(permissions.BasePermission):
|
||||||
|
"""
|
||||||
|
Full access for owners and users shared via collections,
|
||||||
|
read-only for others if public.
|
||||||
|
"""
|
||||||
|
def has_object_permission(self, request, view, obj):
|
||||||
|
user = request.user
|
||||||
|
if not user or not user.is_authenticated:
|
||||||
|
return request.method in permissions.SAFE_METHODS and obj.is_public
|
||||||
|
|
||||||
|
# If safe method (read), allow if:
|
||||||
|
if request.method in permissions.SAFE_METHODS:
|
||||||
|
if obj.is_public:
|
||||||
|
return True
|
||||||
|
if obj.user_id == user:
|
||||||
|
return True
|
||||||
|
# If user in shared_with of any collection related to obj
|
||||||
|
if hasattr(obj, 'collections') and obj.collections.filter(shared_with=user).exists():
|
||||||
|
return True
|
||||||
|
if hasattr(obj, 'collection') and obj.collection and obj.collection.shared_with.filter(id=user.id).exists():
|
||||||
|
return True
|
||||||
|
if hasattr(obj, 'shared_with') and obj.shared_with.filter(id=user.id).exists():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
# For write methods, allow if owner or shared user
|
||||||
|
if obj.user_id == user:
|
||||||
|
return True
|
||||||
|
if hasattr(obj, 'collections') and obj.collections.filter(shared_with=user).exists():
|
||||||
|
return True
|
||||||
|
if hasattr(obj, 'collection') and obj.collection and obj.collection.shared_with.filter(id=user.id).exists():
|
||||||
|
return True
|
||||||
|
if hasattr(obj, 'shared_with') and obj.shared_with.filter(id=user.id).exists():
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
|
@ -1,35 +1,412 @@
|
||||||
|
from django.utils import timezone
|
||||||
import os
|
import os
|
||||||
from .models import Adventure, Collection
|
from .models import Adventure, AdventureImage, ChecklistItem, Collection, Note, Transportation, Checklist, Visit, Category, Attachment, Lodging
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
from main.utils import CustomModelSerializer
|
||||||
|
from users.serializers import CustomUserDetailsSerializer
|
||||||
|
from worldtravel.serializers import CountrySerializer, RegionSerializer, CitySerializer
|
||||||
|
from geopy.distance import geodesic
|
||||||
|
from integrations.models import ImmichIntegration
|
||||||
|
|
||||||
class AdventureSerializer(serializers.ModelSerializer):
|
|
||||||
|
|
||||||
|
class AdventureImageSerializer(CustomModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Adventure
|
model = AdventureImage
|
||||||
fields = '__all__'
|
fields = ['id', 'image', 'adventure', 'is_primary', 'user_id', 'immich_id']
|
||||||
|
read_only_fields = ['id', 'user_id']
|
||||||
|
|
||||||
|
def to_representation(self, instance):
|
||||||
|
# If immich_id is set, check for user integration once
|
||||||
|
integration = None
|
||||||
|
if instance.immich_id:
|
||||||
|
integration = ImmichIntegration.objects.filter(user=instance.user_id).first()
|
||||||
|
if not integration:
|
||||||
|
return None # Skip if Immich image but no integration
|
||||||
|
|
||||||
|
# Base representation
|
||||||
|
representation = super().to_representation(instance)
|
||||||
|
|
||||||
|
# Prepare public URL once
|
||||||
|
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/').replace("'", "")
|
||||||
|
|
||||||
|
if instance.immich_id:
|
||||||
|
# Use Immich integration URL
|
||||||
|
representation['image'] = f"{public_url}/api/integrations/immich/{integration.id}/get/{instance.immich_id}"
|
||||||
|
elif instance.image:
|
||||||
|
# Use local image URL
|
||||||
|
representation['image'] = f"{public_url}/media/{instance.image.name}"
|
||||||
|
|
||||||
|
return representation
|
||||||
|
|
||||||
|
class AttachmentSerializer(CustomModelSerializer):
|
||||||
|
extension = serializers.SerializerMethodField()
|
||||||
|
class Meta:
|
||||||
|
model = Attachment
|
||||||
|
fields = ['id', 'file', 'adventure', 'extension', 'name', 'user_id']
|
||||||
|
read_only_fields = ['id', 'user_id']
|
||||||
|
|
||||||
|
def get_extension(self, obj):
|
||||||
|
return obj.file.name.split('.')[-1]
|
||||||
|
|
||||||
def to_representation(self, instance):
|
def to_representation(self, instance):
|
||||||
representation = super().to_representation(instance)
|
representation = super().to_representation(instance)
|
||||||
if instance.image:
|
if instance.file:
|
||||||
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
public_url = os.environ.get('PUBLIC_URL', 'http://127.0.0.1:8000').rstrip('/')
|
||||||
print(public_url)
|
#print(public_url)
|
||||||
# remove any ' from the url
|
# remove any ' from the url
|
||||||
public_url = public_url.replace("'", "")
|
public_url = public_url.replace("'", "")
|
||||||
representation['image'] = f"{public_url}/media/{instance.image.name}"
|
representation['file'] = f"{public_url}/media/{instance.file.name}"
|
||||||
return representation
|
return representation
|
||||||
|
|
||||||
def validate_activity_types(self, value):
|
class CategorySerializer(serializers.ModelSerializer):
|
||||||
if value:
|
num_adventures = serializers.SerializerMethodField()
|
||||||
return [activity.lower() for activity in value]
|
class Meta:
|
||||||
return value
|
model = Category
|
||||||
|
fields = ['id', 'name', 'display_name', 'icon', 'num_adventures']
|
||||||
|
read_only_fields = ['id', 'num_adventures']
|
||||||
|
|
||||||
|
def validate_name(self, value):
|
||||||
|
return value.lower()
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
user = self.context['request'].user
|
||||||
|
validated_data['name'] = validated_data['name'].lower()
|
||||||
|
return Category.objects.create(user_id=user, **validated_data)
|
||||||
|
|
||||||
|
def update(self, instance, validated_data):
|
||||||
|
for attr, value in validated_data.items():
|
||||||
|
setattr(instance, attr, value)
|
||||||
|
if 'name' in validated_data:
|
||||||
|
instance.name = validated_data['name'].lower()
|
||||||
|
instance.save()
|
||||||
|
return instance
|
||||||
|
|
||||||
class CollectionSerializer(serializers.ModelSerializer):
|
def get_num_adventures(self, obj):
|
||||||
adventures = AdventureSerializer(many=True, read_only=True, source='adventure_set')
|
return Adventure.objects.filter(category=obj, user_id=obj.user_id).count()
|
||||||
|
|
||||||
|
class VisitSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Visit
|
||||||
|
fields = ['id', 'start_date', 'end_date', 'timezone', 'notes']
|
||||||
|
read_only_fields = ['id']
|
||||||
|
|
||||||
|
class AdventureSerializer(CustomModelSerializer):
|
||||||
|
images = serializers.SerializerMethodField()
|
||||||
|
visits = VisitSerializer(many=True, read_only=False, required=False)
|
||||||
|
attachments = AttachmentSerializer(many=True, read_only=True)
|
||||||
|
category = CategorySerializer(read_only=False, required=False)
|
||||||
|
is_visited = serializers.SerializerMethodField()
|
||||||
|
user = serializers.SerializerMethodField()
|
||||||
|
country = CountrySerializer(read_only=True)
|
||||||
|
region = RegionSerializer(read_only=True)
|
||||||
|
city = CitySerializer(read_only=True)
|
||||||
|
collections = serializers.PrimaryKeyRelatedField(
|
||||||
|
many=True,
|
||||||
|
queryset=Collection.objects.all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Adventure
|
||||||
|
fields = [
|
||||||
|
'id', 'user_id', 'name', 'description', 'rating', 'activity_types', 'location',
|
||||||
|
'is_public', 'collections', 'created_at', 'updated_at', 'images', 'link', 'longitude',
|
||||||
|
'latitude', 'visits', 'is_visited', 'category', 'attachments', 'user', 'city', 'country', 'region'
|
||||||
|
]
|
||||||
|
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id', 'is_visited', 'user']
|
||||||
|
|
||||||
|
def get_images(self, obj):
|
||||||
|
serializer = AdventureImageSerializer(obj.images.all(), many=True, context=self.context)
|
||||||
|
# Filter out None values from the serialized data
|
||||||
|
return [image for image in serializer.data if image is not None]
|
||||||
|
|
||||||
|
def validate_collections(self, collections):
|
||||||
|
"""Validate that collections belong to the same user"""
|
||||||
|
if not collections:
|
||||||
|
return collections
|
||||||
|
|
||||||
|
user = self.context['request'].user
|
||||||
|
for collection in collections:
|
||||||
|
if collection.user_id != user and not collection.shared_with.filter(id=user.id).exists():
|
||||||
|
raise serializers.ValidationError(
|
||||||
|
f"Collection '{collection.name}' does not belong to the current user."
|
||||||
|
)
|
||||||
|
return collections
|
||||||
|
|
||||||
|
def validate_category(self, category_data):
|
||||||
|
if isinstance(category_data, Category):
|
||||||
|
return category_data
|
||||||
|
if category_data:
|
||||||
|
user = self.context['request'].user
|
||||||
|
name = category_data.get('name', '').lower()
|
||||||
|
existing_category = Category.objects.filter(user_id=user, name=name).first()
|
||||||
|
if existing_category:
|
||||||
|
return existing_category
|
||||||
|
category_data['name'] = name
|
||||||
|
return category_data
|
||||||
|
|
||||||
|
def get_or_create_category(self, category_data):
|
||||||
|
user = self.context['request'].user
|
||||||
|
|
||||||
|
if isinstance(category_data, Category):
|
||||||
|
return category_data
|
||||||
|
|
||||||
|
if isinstance(category_data, dict):
|
||||||
|
name = category_data.get('name', '').lower()
|
||||||
|
display_name = category_data.get('display_name', name)
|
||||||
|
icon = category_data.get('icon', '🌍')
|
||||||
|
else:
|
||||||
|
name = category_data.name.lower()
|
||||||
|
display_name = category_data.display_name
|
||||||
|
icon = category_data.icon
|
||||||
|
|
||||||
|
category, created = Category.objects.get_or_create(
|
||||||
|
user_id=user,
|
||||||
|
name=name,
|
||||||
|
defaults={
|
||||||
|
'display_name': display_name,
|
||||||
|
'icon': icon
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return category
|
||||||
|
|
||||||
|
def get_user(self, obj):
|
||||||
|
user = obj.user_id
|
||||||
|
return CustomUserDetailsSerializer(user).data
|
||||||
|
|
||||||
|
def get_is_visited(self, obj):
|
||||||
|
return obj.is_visited_status()
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
visits_data = validated_data.pop('visits', None)
|
||||||
|
category_data = validated_data.pop('category', None)
|
||||||
|
collections_data = validated_data.pop('collections', [])
|
||||||
|
|
||||||
|
print(category_data)
|
||||||
|
adventure = Adventure.objects.create(**validated_data)
|
||||||
|
|
||||||
|
# Handle visits
|
||||||
|
for visit_data in visits_data:
|
||||||
|
Visit.objects.create(adventure=adventure, **visit_data)
|
||||||
|
|
||||||
|
# Handle category
|
||||||
|
if category_data:
|
||||||
|
category = self.get_or_create_category(category_data)
|
||||||
|
adventure.category = category
|
||||||
|
|
||||||
|
# Handle collections - set after adventure is saved
|
||||||
|
if collections_data:
|
||||||
|
adventure.collections.set(collections_data)
|
||||||
|
|
||||||
|
adventure.save()
|
||||||
|
|
||||||
|
return adventure
|
||||||
|
|
||||||
|
def update(self, instance, validated_data):
|
||||||
|
has_visits = 'visits' in validated_data
|
||||||
|
visits_data = validated_data.pop('visits', [])
|
||||||
|
category_data = validated_data.pop('category', None)
|
||||||
|
|
||||||
|
collections_data = validated_data.pop('collections', None)
|
||||||
|
|
||||||
|
# Update regular fields
|
||||||
|
for attr, value in validated_data.items():
|
||||||
|
setattr(instance, attr, value)
|
||||||
|
|
||||||
|
# Handle category - ONLY allow the adventure owner to change categories
|
||||||
|
user = self.context['request'].user
|
||||||
|
if category_data and instance.user_id == user:
|
||||||
|
# Only the owner can set categories
|
||||||
|
category = self.get_or_create_category(category_data)
|
||||||
|
instance.category = category
|
||||||
|
# If not the owner, ignore category changes
|
||||||
|
|
||||||
|
# Handle collections - only update if collections were provided
|
||||||
|
if collections_data is not None:
|
||||||
|
instance.collections.set(collections_data)
|
||||||
|
|
||||||
|
# Handle visits
|
||||||
|
if has_visits:
|
||||||
|
current_visits = instance.visits.all()
|
||||||
|
current_visit_ids = set(current_visits.values_list('id', flat=True))
|
||||||
|
|
||||||
|
updated_visit_ids = set()
|
||||||
|
for visit_data in visits_data:
|
||||||
|
visit_id = visit_data.get('id')
|
||||||
|
if visit_id and visit_id in current_visit_ids:
|
||||||
|
visit = current_visits.get(id=visit_id)
|
||||||
|
for attr, value in visit_data.items():
|
||||||
|
setattr(visit, attr, value)
|
||||||
|
visit.save()
|
||||||
|
updated_visit_ids.add(visit_id)
|
||||||
|
else:
|
||||||
|
new_visit = Visit.objects.create(adventure=instance, **visit_data)
|
||||||
|
updated_visit_ids.add(new_visit.id)
|
||||||
|
|
||||||
|
visits_to_delete = current_visit_ids - updated_visit_ids
|
||||||
|
instance.visits.filter(id__in=visits_to_delete).delete()
|
||||||
|
|
||||||
|
# call save on the adventure to update the updated_at field and trigger any geocoding
|
||||||
|
instance.save()
|
||||||
|
|
||||||
|
return instance
|
||||||
|
|
||||||
|
class TransportationSerializer(CustomModelSerializer):
|
||||||
|
distance = serializers.SerializerMethodField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Transportation
|
||||||
|
fields = [
|
||||||
|
'id', 'user_id', 'type', 'name', 'description', 'rating',
|
||||||
|
'link', 'date', 'flight_number', 'from_location', 'to_location',
|
||||||
|
'is_public', 'collection', 'created_at', 'updated_at', 'end_date',
|
||||||
|
'origin_latitude', 'origin_longitude', 'destination_latitude', 'destination_longitude',
|
||||||
|
'start_timezone', 'end_timezone', 'distance' # ✅ Add distance here
|
||||||
|
]
|
||||||
|
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id', 'distance']
|
||||||
|
|
||||||
|
def get_distance(self, obj):
|
||||||
|
if (
|
||||||
|
obj.origin_latitude and obj.origin_longitude and
|
||||||
|
obj.destination_latitude and obj.destination_longitude
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
origin = (float(obj.origin_latitude), float(obj.origin_longitude))
|
||||||
|
destination = (float(obj.destination_latitude), float(obj.destination_longitude))
|
||||||
|
return round(geodesic(origin, destination).km, 2)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
return None
|
||||||
|
|
||||||
|
class LodgingSerializer(CustomModelSerializer):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Lodging
|
||||||
|
fields = [
|
||||||
|
'id', 'user_id', 'name', 'description', 'rating', 'link', 'check_in', 'check_out',
|
||||||
|
'reservation_number', 'price', 'latitude', 'longitude', 'location', 'is_public',
|
||||||
|
'collection', 'created_at', 'updated_at', 'type', 'timezone'
|
||||||
|
]
|
||||||
|
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id']
|
||||||
|
|
||||||
|
class NoteSerializer(CustomModelSerializer):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Note
|
||||||
|
fields = [
|
||||||
|
'id', 'user_id', 'name', 'content', 'date', 'links',
|
||||||
|
'is_public', 'collection', 'created_at', 'updated_at'
|
||||||
|
]
|
||||||
|
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id']
|
||||||
|
|
||||||
|
class ChecklistItemSerializer(CustomModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = ChecklistItem
|
||||||
|
fields = [
|
||||||
|
'id', 'user_id', 'name', 'is_checked', 'checklist', 'created_at', 'updated_at'
|
||||||
|
]
|
||||||
|
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id', 'checklist']
|
||||||
|
|
||||||
|
class ChecklistSerializer(CustomModelSerializer):
|
||||||
|
items = ChecklistItemSerializer(many=True, source='checklistitem_set')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = Checklist
|
||||||
|
fields = [
|
||||||
|
'id', 'user_id', 'name', 'date', 'is_public', 'collection', 'created_at', 'updated_at', 'items'
|
||||||
|
]
|
||||||
|
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id']
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
items_data = validated_data.pop('checklistitem_set')
|
||||||
|
checklist = Checklist.objects.create(**validated_data)
|
||||||
|
|
||||||
|
for item_data in items_data:
|
||||||
|
# Remove user_id from item_data to avoid constraint issues
|
||||||
|
item_data.pop('user_id', None)
|
||||||
|
# Set user_id from the parent checklist
|
||||||
|
ChecklistItem.objects.create(
|
||||||
|
checklist=checklist,
|
||||||
|
user_id=checklist.user_id,
|
||||||
|
**item_data
|
||||||
|
)
|
||||||
|
return checklist
|
||||||
|
|
||||||
|
def update(self, instance, validated_data):
|
||||||
|
items_data = validated_data.pop('checklistitem_set', [])
|
||||||
|
|
||||||
|
# Update Checklist fields
|
||||||
|
for attr, value in validated_data.items():
|
||||||
|
setattr(instance, attr, value)
|
||||||
|
instance.save()
|
||||||
|
|
||||||
|
# Get current items
|
||||||
|
current_items = instance.checklistitem_set.all()
|
||||||
|
current_item_ids = set(current_items.values_list('id', flat=True))
|
||||||
|
|
||||||
|
# Update or create items
|
||||||
|
updated_item_ids = set()
|
||||||
|
for item_data in items_data:
|
||||||
|
# Remove user_id from item_data to avoid constraint issues
|
||||||
|
item_data.pop('user_id', None)
|
||||||
|
|
||||||
|
item_id = item_data.get('id')
|
||||||
|
if item_id:
|
||||||
|
if item_id in current_item_ids:
|
||||||
|
item = current_items.get(id=item_id)
|
||||||
|
for attr, value in item_data.items():
|
||||||
|
setattr(item, attr, value)
|
||||||
|
item.save()
|
||||||
|
updated_item_ids.add(item_id)
|
||||||
|
else:
|
||||||
|
# If ID is provided but doesn't exist, create new item
|
||||||
|
ChecklistItem.objects.create(
|
||||||
|
checklist=instance,
|
||||||
|
user_id=instance.user_id,
|
||||||
|
**item_data
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# If no ID is provided, create new item
|
||||||
|
ChecklistItem.objects.create(
|
||||||
|
checklist=instance,
|
||||||
|
user_id=instance.user_id,
|
||||||
|
**item_data
|
||||||
|
)
|
||||||
|
|
||||||
|
# Delete items that are not in the updated data
|
||||||
|
items_to_delete = current_item_ids - updated_item_ids
|
||||||
|
instance.checklistitem_set.filter(id__in=items_to_delete).delete()
|
||||||
|
|
||||||
|
return instance
|
||||||
|
|
||||||
|
def validate(self, data):
|
||||||
|
# Check if the collection is public and the checklist is not
|
||||||
|
collection = data.get('collection')
|
||||||
|
is_public = data.get('is_public', False)
|
||||||
|
if collection and collection.is_public and not is_public:
|
||||||
|
raise serializers.ValidationError(
|
||||||
|
'Checklists associated with a public collection must be public.'
|
||||||
|
)
|
||||||
|
return data
|
||||||
|
|
||||||
|
class CollectionSerializer(CustomModelSerializer):
|
||||||
|
adventures = AdventureSerializer(many=True, read_only=True)
|
||||||
|
transportations = TransportationSerializer(many=True, read_only=True, source='transportation_set')
|
||||||
|
notes = NoteSerializer(many=True, read_only=True, source='note_set')
|
||||||
|
checklists = ChecklistSerializer(many=True, read_only=True, source='checklist_set')
|
||||||
|
lodging = LodgingSerializer(many=True, read_only=True, source='lodging_set')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Collection
|
model = Collection
|
||||||
# fields are all plus the adventures field
|
fields = ['id', 'description', 'user_id', 'name', 'is_public', 'adventures', 'created_at', 'start_date', 'end_date', 'transportations', 'notes', 'updated_at', 'checklists', 'is_archived', 'shared_with', 'link', 'lodging']
|
||||||
fields = ['id', 'description', 'user_id', 'name', 'is_public', 'adventures']
|
read_only_fields = ['id', 'created_at', 'updated_at', 'user_id']
|
||||||
|
|
||||||
|
def to_representation(self, instance):
|
||||||
|
representation = super().to_representation(instance)
|
||||||
|
# Make it display the user uuid for the shared users instead of the PK
|
||||||
|
shared_uuids = []
|
||||||
|
for user in instance.shared_with.all():
|
||||||
|
shared_uuids.append(str(user.uuid))
|
||||||
|
representation['shared_with'] = shared_uuids
|
||||||
|
return representation
|
23
backend/server/adventures/signals.py
Normal file
23
backend/server/adventures/signals.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
from django.db.models.signals import m2m_changed
|
||||||
|
from django.dispatch import receiver
|
||||||
|
from adventures.models import Adventure
|
||||||
|
|
||||||
|
@receiver(m2m_changed, sender=Adventure.collections.through)
|
||||||
|
def update_adventure_publicity(sender, instance, action, **kwargs):
|
||||||
|
"""
|
||||||
|
Signal handler to update adventure publicity when collections are added/removed
|
||||||
|
"""
|
||||||
|
# Only process when collections are added or removed
|
||||||
|
if action in ('post_add', 'post_remove', 'post_clear'):
|
||||||
|
collections = instance.collections.all()
|
||||||
|
|
||||||
|
if collections.exists():
|
||||||
|
# If any collection is public, make the adventure public
|
||||||
|
has_public_collection = collections.filter(is_public=True).exists()
|
||||||
|
|
||||||
|
if has_public_collection and not instance.is_public:
|
||||||
|
instance.is_public = True
|
||||||
|
instance.save(update_fields=['is_public'])
|
||||||
|
elif not has_public_collection and instance.is_public:
|
||||||
|
instance.is_public = False
|
||||||
|
instance.save(update_fields=['is_public'])
|
|
@ -1,6 +1,6 @@
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework.routers import DefaultRouter
|
||||||
from .views import AdventureViewSet, CollectionViewSet, StatsViewSet, GenerateDescription, ActivityTypesView
|
from adventures.views import *
|
||||||
|
|
||||||
router = DefaultRouter()
|
router = DefaultRouter()
|
||||||
router.register(r'adventures', AdventureViewSet, basename='adventures')
|
router.register(r'adventures', AdventureViewSet, basename='adventures')
|
||||||
|
@ -8,7 +8,17 @@ router.register(r'collections', CollectionViewSet, basename='collections')
|
||||||
router.register(r'stats', StatsViewSet, basename='stats')
|
router.register(r'stats', StatsViewSet, basename='stats')
|
||||||
router.register(r'generate', GenerateDescription, basename='generate')
|
router.register(r'generate', GenerateDescription, basename='generate')
|
||||||
router.register(r'activity-types', ActivityTypesView, basename='activity-types')
|
router.register(r'activity-types', ActivityTypesView, basename='activity-types')
|
||||||
|
router.register(r'transportations', TransportationViewSet, basename='transportations')
|
||||||
|
router.register(r'notes', NoteViewSet, basename='notes')
|
||||||
|
router.register(r'checklists', ChecklistViewSet, basename='checklists')
|
||||||
|
router.register(r'images', AdventureImageViewSet, basename='images')
|
||||||
|
router.register(r'reverse-geocode', ReverseGeocodeViewSet, basename='reverse-geocode')
|
||||||
|
router.register(r'categories', CategoryViewSet, basename='categories')
|
||||||
|
router.register(r'ics-calendar', IcsCalendarGeneratorViewSet, basename='ics-calendar')
|
||||||
|
router.register(r'search', GlobalSearchView, basename='search')
|
||||||
|
router.register(r'attachments', AttachmentViewSet, basename='attachments')
|
||||||
|
router.register(r'lodging', LodgingViewSet, basename='lodging')
|
||||||
|
router.register(r'recommendations', RecommendationsViewSet, basename='recommendations')
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# Include the router under the 'api/' prefix
|
# Include the router under the 'api/' prefix
|
||||||
|
|
48
backend/server/adventures/utils/file_permissions.py
Normal file
48
backend/server/adventures/utils/file_permissions.py
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
from adventures.models import AdventureImage, Attachment
|
||||||
|
|
||||||
|
protected_paths = ['images/', 'attachments/']
|
||||||
|
|
||||||
|
def checkFilePermission(fileId, user, mediaType):
|
||||||
|
if mediaType not in protected_paths:
|
||||||
|
return True
|
||||||
|
if mediaType == 'images/':
|
||||||
|
try:
|
||||||
|
# Construct the full relative path to match the database field
|
||||||
|
image_path = f"images/{fileId}"
|
||||||
|
# Fetch the AdventureImage object
|
||||||
|
adventure = AdventureImage.objects.get(image=image_path).adventure
|
||||||
|
if adventure.is_public:
|
||||||
|
return True
|
||||||
|
elif adventure.user_id == user:
|
||||||
|
return True
|
||||||
|
elif adventure.collections.exists():
|
||||||
|
# Check if the user is in any collection's shared_with list
|
||||||
|
for collection in adventure.collections.all():
|
||||||
|
if collection.shared_with.filter(id=user.id).exists():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
except AdventureImage.DoesNotExist:
|
||||||
|
return False
|
||||||
|
elif mediaType == 'attachments/':
|
||||||
|
try:
|
||||||
|
# Construct the full relative path to match the database field
|
||||||
|
attachment_path = f"attachments/{fileId}"
|
||||||
|
# Fetch the Attachment object
|
||||||
|
attachment = Attachment.objects.get(file=attachment_path)
|
||||||
|
adventure = attachment.adventure
|
||||||
|
if adventure.is_public:
|
||||||
|
return True
|
||||||
|
elif adventure.user_id == user:
|
||||||
|
return True
|
||||||
|
elif adventure.collections.exists():
|
||||||
|
# Check if the user is in any collection's shared_with list
|
||||||
|
for collection in adventure.collections.all():
|
||||||
|
if collection.shared_with.filter(id=user.id).exists():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
except Attachment.DoesNotExist:
|
||||||
|
return False
|
6
backend/server/adventures/utils/pagination.py
Normal file
6
backend/server/adventures/utils/pagination.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from rest_framework.pagination import PageNumberPagination
|
||||||
|
|
||||||
|
class StandardResultsSetPagination(PageNumberPagination):
|
||||||
|
page_size = 25
|
||||||
|
page_size_query_param = 'page_size'
|
||||||
|
max_page_size = 1000
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue