goodmap 1.0.4__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- goodmap/config.py +42 -0
- goodmap/db.py +74 -13
- goodmap/goodmap.py +11 -5
- goodmap/templates/goodmap-admin.html +1 -1
- goodmap/templates/map.html +1 -1
- {goodmap-1.0.4.dist-info → goodmap-1.1.1.dist-info}/METADATA +2 -2
- goodmap-1.1.1.dist-info/RECORD +15 -0
- goodmap-1.0.4.dist-info/RECORD +0 -14
- {goodmap-1.0.4.dist-info → goodmap-1.1.1.dist-info}/WHEEL +0 -0
- {goodmap-1.0.4.dist-info → goodmap-1.1.1.dist-info}/licenses/LICENSE.md +0 -0
goodmap/config.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import typing as t
|
|
3
|
+
|
|
4
|
+
import yaml
|
|
5
|
+
from platzky.config import Config as PlatzkyConfig
|
|
6
|
+
from pydantic import Field
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GoodmapConfig(PlatzkyConfig):
|
|
10
|
+
"""Extended configuration for Goodmap with additional frontend library URL."""
|
|
11
|
+
|
|
12
|
+
goodmap_frontend_lib_url: str = Field(
|
|
13
|
+
default="https://cdn.jsdelivr.net/npm/@problematy/goodmap@0.4.2",
|
|
14
|
+
alias="GOODMAP_FRONTEND_LIB_URL",
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def model_validate(
|
|
19
|
+
cls,
|
|
20
|
+
obj: t.Any,
|
|
21
|
+
*,
|
|
22
|
+
strict: bool | None = None,
|
|
23
|
+
from_attributes: bool | None = None,
|
|
24
|
+
context: dict[str, t.Any] | None = None,
|
|
25
|
+
) -> "GoodmapConfig":
|
|
26
|
+
"""Override to return correct type for GoodmapConfig."""
|
|
27
|
+
return t.cast(
|
|
28
|
+
"GoodmapConfig",
|
|
29
|
+
super().model_validate(
|
|
30
|
+
obj, strict=strict, from_attributes=from_attributes, context=context
|
|
31
|
+
),
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def parse_yaml(cls, path: str) -> "GoodmapConfig":
|
|
36
|
+
"""Parse YAML configuration file and return GoodmapConfig instance."""
|
|
37
|
+
try:
|
|
38
|
+
with open(path, "r") as f:
|
|
39
|
+
return cls.model_validate(yaml.safe_load(f))
|
|
40
|
+
except FileNotFoundError:
|
|
41
|
+
print(f"Config file not found: {path}", file=sys.stderr)
|
|
42
|
+
raise SystemExit(1)
|
goodmap/db.py
CHANGED
|
@@ -786,6 +786,12 @@ def mongodb_db_add_suggestion(self, suggestion_data):
|
|
|
786
786
|
CRUDHelper.add_item_to_mongodb(self.db.suggestions, suggestion_data, "Suggestion", "pending")
|
|
787
787
|
|
|
788
788
|
|
|
789
|
+
def google_json_db_add_suggestion(self, suggestion_data):
|
|
790
|
+
# Temporary workaround: just use notifier without storing
|
|
791
|
+
# Full implementation would require writing back to Google Cloud Storage
|
|
792
|
+
pass
|
|
793
|
+
|
|
794
|
+
|
|
789
795
|
def add_suggestion(db, suggestion_data):
|
|
790
796
|
return globals()[f"{db.module_name}_add_suggestion"](db, suggestion_data)
|
|
791
797
|
|
|
@@ -876,6 +882,16 @@ def mongodb_db_get_suggestions_paginated(self, query):
|
|
|
876
882
|
return __build_pagination_response(items, total_count, page, per_page)
|
|
877
883
|
|
|
878
884
|
|
|
885
|
+
def google_json_db_get_suggestions(self, query_params):
|
|
886
|
+
# GoogleJsonDb is read-only, suggestions not stored in blob
|
|
887
|
+
return []
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
def google_json_db_get_suggestions_paginated(self, query):
|
|
891
|
+
"""Google JSON suggestions with pagination (read-only)."""
|
|
892
|
+
return PaginationHelper.create_paginated_response([], query)
|
|
893
|
+
|
|
894
|
+
|
|
879
895
|
def get_suggestions(db):
|
|
880
896
|
return globals()[f"{db.module_name}_get_suggestions"]
|
|
881
897
|
|
|
@@ -906,6 +922,11 @@ def mongodb_db_get_suggestion(self, suggestion_id):
|
|
|
906
922
|
return self.db.suggestions.find_one({"uuid": suggestion_id}, {"_id": 0})
|
|
907
923
|
|
|
908
924
|
|
|
925
|
+
def google_json_db_get_suggestion(self, suggestion_id):
|
|
926
|
+
# GoogleJsonDb is read-only, suggestions not stored in blob
|
|
927
|
+
return None
|
|
928
|
+
|
|
929
|
+
|
|
909
930
|
def get_suggestion(db):
|
|
910
931
|
return globals()[f"{db.module_name}_get_suggestion"]
|
|
911
932
|
|
|
@@ -946,6 +967,11 @@ def mongodb_db_update_suggestion(self, suggestion_id, status):
|
|
|
946
967
|
raise ValueError(f"Suggestion with uuid {suggestion_id} not found")
|
|
947
968
|
|
|
948
969
|
|
|
970
|
+
def google_json_db_update_suggestion(self, suggestion_id, status):
|
|
971
|
+
# GoogleJsonDb is read-only, no-op
|
|
972
|
+
pass
|
|
973
|
+
|
|
974
|
+
|
|
949
975
|
def update_suggestion(db, suggestion_id, status):
|
|
950
976
|
return globals()[f"{db.module_name}_update_suggestion"](db, suggestion_id, status)
|
|
951
977
|
|
|
@@ -984,6 +1010,11 @@ def mongodb_db_delete_suggestion(self, suggestion_id):
|
|
|
984
1010
|
raise ValueError(f"Suggestion with uuid {suggestion_id} not found")
|
|
985
1011
|
|
|
986
1012
|
|
|
1013
|
+
def google_json_db_delete_suggestion(self, suggestion_id):
|
|
1014
|
+
# GoogleJsonDb is read-only, no-op
|
|
1015
|
+
pass
|
|
1016
|
+
|
|
1017
|
+
|
|
987
1018
|
def delete_suggestion(db, suggestion_id):
|
|
988
1019
|
return globals()[f"{db.module_name}_delete_suggestion"](db, suggestion_id)
|
|
989
1020
|
|
|
@@ -1022,6 +1053,12 @@ def mongodb_db_add_report(self, report_data):
|
|
|
1022
1053
|
self.db.reports.insert_one(report_data)
|
|
1023
1054
|
|
|
1024
1055
|
|
|
1056
|
+
def google_json_db_add_report(self, report_data):
|
|
1057
|
+
# Temporary workaround: just use notifier without storing
|
|
1058
|
+
# Full implementation would require writing back to Google Cloud Storage
|
|
1059
|
+
pass
|
|
1060
|
+
|
|
1061
|
+
|
|
1025
1062
|
def add_report(db, report_data):
|
|
1026
1063
|
return globals()[f"{db.module_name}_add_report"](db, report_data)
|
|
1027
1064
|
|
|
@@ -1128,6 +1165,16 @@ def mongodb_db_get_reports_paginated(self, query):
|
|
|
1128
1165
|
return __build_pagination_response(items, total_count, page, per_page)
|
|
1129
1166
|
|
|
1130
1167
|
|
|
1168
|
+
def google_json_db_get_reports(self, query_params):
|
|
1169
|
+
# GoogleJsonDb is read-only, reports not stored in blob
|
|
1170
|
+
return []
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
def google_json_db_get_reports_paginated(self, query):
|
|
1174
|
+
"""Google JSON reports with pagination (read-only)."""
|
|
1175
|
+
return PaginationHelper.create_paginated_response([], query)
|
|
1176
|
+
|
|
1177
|
+
|
|
1131
1178
|
def get_reports(db):
|
|
1132
1179
|
return globals()[f"{db.module_name}_get_reports"]
|
|
1133
1180
|
|
|
@@ -1157,6 +1204,11 @@ def mongodb_db_get_report(self, report_id):
|
|
|
1157
1204
|
return self.db.reports.find_one({"uuid": report_id}, {"_id": 0})
|
|
1158
1205
|
|
|
1159
1206
|
|
|
1207
|
+
def google_json_db_get_report(self, report_id):
|
|
1208
|
+
# GoogleJsonDb is read-only, reports not stored in blob
|
|
1209
|
+
return None
|
|
1210
|
+
|
|
1211
|
+
|
|
1160
1212
|
def get_report(db):
|
|
1161
1213
|
return globals()[f"{db.module_name}_get_report"]
|
|
1162
1214
|
|
|
@@ -1210,6 +1262,11 @@ def mongodb_db_update_report(self, report_id, status=None, priority=None):
|
|
|
1210
1262
|
raise ValueError(f"Report with uuid {report_id} not found")
|
|
1211
1263
|
|
|
1212
1264
|
|
|
1265
|
+
def google_json_db_update_report(self, report_id, status=None, priority=None):
|
|
1266
|
+
# GoogleJsonDb is read-only, no-op
|
|
1267
|
+
pass
|
|
1268
|
+
|
|
1269
|
+
|
|
1213
1270
|
def update_report(db, report_id, status=None, priority=None):
|
|
1214
1271
|
return globals()[f"{db.module_name}_update_report"](db, report_id, status, priority)
|
|
1215
1272
|
|
|
@@ -1247,6 +1304,11 @@ def mongodb_db_delete_report(self, report_id):
|
|
|
1247
1304
|
raise ValueError(f"Report with uuid {report_id} not found")
|
|
1248
1305
|
|
|
1249
1306
|
|
|
1307
|
+
def google_json_db_delete_report(self, report_id):
|
|
1308
|
+
# GoogleJsonDb is read-only, no-op
|
|
1309
|
+
pass
|
|
1310
|
+
|
|
1311
|
+
|
|
1250
1312
|
def delete_report(db, report_id):
|
|
1251
1313
|
return globals()[f"{db.module_name}_delete_report"](db, report_id)
|
|
1252
1314
|
|
|
@@ -1266,17 +1328,16 @@ def extend_db_with_goodmap_queries(db, location_model):
|
|
|
1266
1328
|
db.extend("delete_location", delete_location)
|
|
1267
1329
|
db.extend("get_categories", get_categories(db))
|
|
1268
1330
|
db.extend("get_category_data", get_category_data(db))
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
db.extend("delete_report", delete_report)
|
|
1331
|
+
db.extend("add_suggestion", add_suggestion)
|
|
1332
|
+
db.extend("get_suggestions", get_suggestions(db))
|
|
1333
|
+
db.extend("get_suggestions_paginated", get_suggestions_paginated(db))
|
|
1334
|
+
db.extend("get_suggestion", get_suggestion(db))
|
|
1335
|
+
db.extend("update_suggestion", update_suggestion)
|
|
1336
|
+
db.extend("delete_suggestion", delete_suggestion)
|
|
1337
|
+
db.extend("add_report", add_report)
|
|
1338
|
+
db.extend("get_reports", get_reports(db))
|
|
1339
|
+
db.extend("get_reports_paginated", get_reports_paginated(db))
|
|
1340
|
+
db.extend("get_report", get_report(db))
|
|
1341
|
+
db.extend("update_report", update_report)
|
|
1342
|
+
db.extend("delete_report", delete_report)
|
|
1282
1343
|
return db
|
goodmap/goodmap.py
CHANGED
|
@@ -3,25 +3,26 @@ import os
|
|
|
3
3
|
from flask import Blueprint, redirect, render_template, session
|
|
4
4
|
from flask_wtf.csrf import CSRFProtect, generate_csrf
|
|
5
5
|
from platzky import platzky
|
|
6
|
-
from platzky.config import
|
|
6
|
+
from platzky.config import languages_dict
|
|
7
7
|
from platzky.models import CmsModule
|
|
8
8
|
|
|
9
|
+
from goodmap.config import GoodmapConfig
|
|
9
10
|
from goodmap.core_api import core_pages
|
|
10
11
|
from goodmap.data_models.location import create_location_model
|
|
11
12
|
from goodmap.db import extend_db_with_goodmap_queries, get_location_obligatory_fields
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
def create_app(config_path: str) -> platzky.Engine:
|
|
15
|
-
config =
|
|
16
|
+
config = GoodmapConfig.parse_yaml(config_path)
|
|
16
17
|
return create_app_from_config(config)
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
# TODO Checking if there is a feature flag secition should be part of configs logic not client app
|
|
20
|
-
def is_feature_enabled(config:
|
|
21
|
+
def is_feature_enabled(config: GoodmapConfig, feature: str) -> bool:
|
|
21
22
|
return config.feature_flags.get(feature, False) if config.feature_flags else False
|
|
22
23
|
|
|
23
24
|
|
|
24
|
-
def create_app_from_config(config:
|
|
25
|
+
def create_app_from_config(config: GoodmapConfig) -> platzky.Engine:
|
|
25
26
|
directory = os.path.dirname(os.path.realpath(__file__))
|
|
26
27
|
|
|
27
28
|
locale_dir = os.path.join(directory, "locale")
|
|
@@ -52,7 +53,11 @@ def create_app_from_config(config: Config) -> platzky.Engine:
|
|
|
52
53
|
|
|
53
54
|
@goodmap.route("/")
|
|
54
55
|
def index():
|
|
55
|
-
return render_template(
|
|
56
|
+
return render_template(
|
|
57
|
+
"map.html",
|
|
58
|
+
feature_flags=config.feature_flags,
|
|
59
|
+
goodmap_frontend_lib_url=config.goodmap_frontend_lib_url,
|
|
60
|
+
)
|
|
56
61
|
|
|
57
62
|
@goodmap.route("/goodmap-admin")
|
|
58
63
|
def admin():
|
|
@@ -65,6 +70,7 @@ def create_app_from_config(config: Config) -> platzky.Engine:
|
|
|
65
70
|
return render_template(
|
|
66
71
|
"goodmap-admin.html",
|
|
67
72
|
feature_flags=config.feature_flags,
|
|
73
|
+
goodmap_frontend_lib_url=config.goodmap_frontend_lib_url,
|
|
68
74
|
user=user,
|
|
69
75
|
cms_modules=app.cms_modules,
|
|
70
76
|
)
|
|
@@ -739,5 +739,5 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
739
739
|
window.USE_LAZY_LOADING = {{ feature_flags.USE_LAZY_LOADING | default(false) | tojson }};
|
|
740
740
|
window.SHOW_ACCESSIBILITY_TABLE = {{ feature_flags.SHOW_ACCESSIBILITY_TABLE | default(false) | tojson }};
|
|
741
741
|
</script>
|
|
742
|
-
<script src="
|
|
742
|
+
<script src="{{ goodmap_frontend_lib_url }}"></script>
|
|
743
743
|
{% endblock %}
|
goodmap/templates/map.html
CHANGED
|
@@ -119,5 +119,5 @@ window.USE_LAZY_LOADING = {{ feature_flags.USE_LAZY_LOADING | default(false) | t
|
|
|
119
119
|
window.SHOW_ACCESSIBILITY_TABLE = {{ feature_flags.SHOW_ACCESSIBILITY_TABLE | default(false) | tojson }};
|
|
120
120
|
window.FEATURE_FLAGS = {{ feature_flags | tojson }};
|
|
121
121
|
</script>
|
|
122
|
-
<script src="
|
|
122
|
+
<script src="{{ goodmap_frontend_lib_url }}"></script>
|
|
123
123
|
{% endblock %}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: goodmap
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: Map engine to serve all the people :)
|
|
5
5
|
License-File: LICENSE.md
|
|
6
6
|
Author: Krzysztof Kolodzinski
|
|
@@ -24,7 +24,7 @@ Requires-Dist: google-cloud-storage (>=2.7.0,<3.0.0)
|
|
|
24
24
|
Requires-Dist: gql (>=3.4.0,<4.0.0)
|
|
25
25
|
Requires-Dist: gunicorn (>=20.1.0,<21.0.0)
|
|
26
26
|
Requires-Dist: humanize (>=4.6.0,<5.0.0)
|
|
27
|
-
Requires-Dist: platzky (>=0.
|
|
27
|
+
Requires-Dist: platzky (>=1.0.0,<2.0.0)
|
|
28
28
|
Requires-Dist: pydantic (>=2.7.1,<3.0.0)
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
goodmap/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
2
|
+
goodmap/config.py,sha256=sseE4sceFB8OBuFsrRpQJvjv0Vg5KFdkzihBX_hbE2c,1313
|
|
3
|
+
goodmap/core.py,sha256=rzMhOIYnR1jxTX6uHQJKIPLYxdUm4_v2d6LrtHtJpHU,1465
|
|
4
|
+
goodmap/core_api.py,sha256=MxJ7SGOFBBnV_cBIiZoImHLaY8_FtEW-dl3od5-mIt8,13529
|
|
5
|
+
goodmap/data_models/location.py,sha256=H3EKozc-WZvrYm6cwajl8_gaw4rQhxdlvxR1mk4mpkA,1104
|
|
6
|
+
goodmap/data_validator.py,sha256=lBmVAPxvSmEOdUGeVYSjUvVVmKfPyq4CWoHfczTtEMM,4090
|
|
7
|
+
goodmap/db.py,sha256=UKWrd0b0zvz8T-bjnclXXLAtW-1fcxv8Rd6z_Dqmpvg,43695
|
|
8
|
+
goodmap/formatter.py,sha256=VlUHcK1HtM_IEU0VE3S5TOkZLVheMdakvUeW2tCKdq0,783
|
|
9
|
+
goodmap/goodmap.py,sha256=q6okPopWBH6jDkKJcGDegebaapHLFUVilJ3p3aKi97k,2960
|
|
10
|
+
goodmap/templates/goodmap-admin.html,sha256=39PJ1drk_xdkyzXgPZZNXYq9gA9oTVeR8hsgeae6E0g,35614
|
|
11
|
+
goodmap/templates/map.html,sha256=N4N0ONzEFUS4bFtOA2jgXVbMQ7cKd1cRYIVnGLUzBIE,3995
|
|
12
|
+
goodmap-1.1.1.dist-info/METADATA,sha256=GHTcCxF_L_qMoEoFI6Re3DAyriNrKA9Y6Hau-8vji7Y,5356
|
|
13
|
+
goodmap-1.1.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
14
|
+
goodmap-1.1.1.dist-info/licenses/LICENSE.md,sha256=nkCQOR7uheLRvHRfXmwx9LhBnMcPeBU9d4ebLojDiQU,1067
|
|
15
|
+
goodmap-1.1.1.dist-info/RECORD,,
|
goodmap-1.0.4.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
goodmap/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
2
|
-
goodmap/core.py,sha256=rzMhOIYnR1jxTX6uHQJKIPLYxdUm4_v2d6LrtHtJpHU,1465
|
|
3
|
-
goodmap/core_api.py,sha256=MxJ7SGOFBBnV_cBIiZoImHLaY8_FtEW-dl3od5-mIt8,13529
|
|
4
|
-
goodmap/data_models/location.py,sha256=H3EKozc-WZvrYm6cwajl8_gaw4rQhxdlvxR1mk4mpkA,1104
|
|
5
|
-
goodmap/data_validator.py,sha256=lBmVAPxvSmEOdUGeVYSjUvVVmKfPyq4CWoHfczTtEMM,4090
|
|
6
|
-
goodmap/db.py,sha256=i-fe_f_s9hQxvTqq4alA-RK9j6vQpnaNpXEDPci3s1Y,42049
|
|
7
|
-
goodmap/formatter.py,sha256=VlUHcK1HtM_IEU0VE3S5TOkZLVheMdakvUeW2tCKdq0,783
|
|
8
|
-
goodmap/goodmap.py,sha256=OOcuDEY7GZsHh8vjIJ9brd4SuGxNRq_lC_DMmNuome8,2731
|
|
9
|
-
goodmap/templates/goodmap-admin.html,sha256=zGuau239BXyBerV21mDXcHy34ke8cLmZcMngcX1xhAs,35598
|
|
10
|
-
goodmap/templates/map.html,sha256=-qbJ313t2EdSyIwULnQy3j81pH4MqI5yjtJ4Xoo7N7M,3979
|
|
11
|
-
goodmap-1.0.4.dist-info/METADATA,sha256=XZ4XugRInA3jVCXDDi1lTQQ2Y6uLaScVmAkpMKIs9dc,5356
|
|
12
|
-
goodmap-1.0.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
13
|
-
goodmap-1.0.4.dist-info/licenses/LICENSE.md,sha256=nkCQOR7uheLRvHRfXmwx9LhBnMcPeBU9d4ebLojDiQU,1067
|
|
14
|
-
goodmap-1.0.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|