ApiLogicServer 14.3.25__py3-none-any.whl → 14.5.0__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.
- api_logic_server_cli/add_cust/add_cust.py +283 -0
- api_logic_server_cli/api_logic_server.py +18 -250
- api_logic_server_cli/api_logic_server_info.yaml +3 -3
- api_logic_server_cli/cli.py +54 -35
- api_logic_server_cli/create_from_model/__pycache__/api_logic_server_utils.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/create_db_from_model.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/dbml.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_create.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/api_logic_server_utils.py +47 -0
- api_logic_server_cli/create_from_model/create_db_from_model.py +2 -0
- api_logic_server_cli/create_from_model/dbml.py +113 -58
- api_logic_server_cli/create_from_model/ont_build.py +102 -74
- api_logic_server_cli/create_from_model/ont_create.py +7 -6
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/.DS_Store +0 -0
- api_logic_server_cli/database/basic_demo.sqlite +0 -0
- api_logic_server_cli/database/basic_demo.txt +1 -0
- api_logic_server_cli/database/basic_demo_wg.sqlite +0 -0
- api_logic_server_cli/database/nw-gold-fix.sql +62 -0
- api_logic_server_cli/database/nw-gold.sqlite +0 -0
- api_logic_server_cli/{prototypes/manager/webgenai → fragments}/docker-compose.yml +1 -1
- api_logic_server_cli/genai/genai.py +42 -11
- api_logic_server_cli/genai/genai_graphics.py +252 -38
- api_logic_server_cli/genai/genai_svcs.py +20 -12
- api_logic_server_cli/manager.py +22 -12
- api_logic_server_cli/prototypes/.DS_Store +0 -0
- api_logic_server_cli/prototypes/base/.DS_Store +0 -0
- api_logic_server_cli/prototypes/base/.vscode/launch.json +22 -2
- api_logic_server_cli/prototypes/base/api/expose_api_models.py +3 -1
- api_logic_server_cli/prototypes/base/api_logic_server_run.py +5 -2
- api_logic_server_cli/prototypes/base/config/activate_logicbank.py +1 -0
- api_logic_server_cli/prototypes/base/config/config.py +123 -25
- api_logic_server_cli/prototypes/base/config/default.env +7 -1
- api_logic_server_cli/prototypes/base/config/logging.yml +1 -0
- api_logic_server_cli/prototypes/base/config/server_setup.py +33 -1
- api_logic_server_cli/prototypes/base/database/test_data/readme.md +5 -2
- api_logic_server_cli/prototypes/base/devops/docker-standard-image/docker-compose-standard-image.yml +7 -2
- api_logic_server_cli/prototypes/base/docs/training/logic_bank_api.prompt +314 -0
- api_logic_server_cli/prototypes/base/docs/training/logic_example.py +41 -0
- api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py +12 -5
- api_logic_server_cli/prototypes/base/integration/n8n/n8n_producer.py +68 -21
- api_logic_server_cli/prototypes/base/integration/n8n/n8n_readme.md +19 -0
- api_logic_server_cli/prototypes/base/integration/system/FlaskKafka.py +5 -1
- api_logic_server_cli/prototypes/base/test/basic/server_test.py +1 -1
- api_logic_server_cli/prototypes/base/ui/templates/bar_chart.jinja +64 -0
- api_logic_server_cli/prototypes/basic_demo/README.md +29 -52
- api_logic_server_cli/prototypes/basic_demo/customizations/api/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/mcp_server_executor.py +138 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/openapi.py +92 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/proper_update_def.json +71 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/config/default.env +13 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/db.sqlite +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/models.py +131 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/1_langchain_loader.py +71 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/2_gpt_mcp_prompt.txt +19 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/README_mcp.md +13 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_client_executor.py +295 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_schema.txt +47 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_server_discovery.json +9 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_flow.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_orchestration.yaml +49 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/wny mcp flows.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/natlang_to_api.py +73 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/curl.txt +5 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP Overview.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Arch.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Overview_Executor.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/1 - prompt_messages_array.json +10 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/2 - completion_tool_context.json +12 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/llm_schema.txt +38 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_2.yaml +17393 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3.yaml +16660 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3_relaxed.yaml +109 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_server.py +51 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_serverZ.py +72 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/validate_jsonapi.py +64 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/run_executor.py +23 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/swagger_converter.py +65 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/z_old/3_executor_test_agent.py +52 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/3_executor_test_agent.py +52 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/README_functon.md +201 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/ai_plugin.json +17 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/nw-swagger_3.json +1731 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/snippets.txt +5 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3 genai_demo_with_get.json +1731 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3.json +1782 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo.json +264 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo_with_update.json +1782 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/logic/declare_logic.py +62 -44
- api_logic_server_cli/prototypes/basic_demo/customizations/security/declare_security.py +11 -12
- api_logic_server_cli/prototypes/basic_demo/customizations/ui/admin/admin.yaml +166 -0
- api_logic_server_cli/prototypes/basic_demo/iteration/api/{customize_api.py → api_discovery/order_b2b.py} +17 -23
- api_logic_server_cli/prototypes/basic_demo/iteration/database/db.sqlite +0 -0
- api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/OrderB2B.py +6 -5
- api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/OrderShipping.py +4 -4
- api_logic_server_cli/prototypes/basic_demo/iteration/logic/declare_logic.py +69 -43
- api_logic_server_cli/prototypes/basic_demo/iteration/ui/admin/admin.yaml +125 -50
- api_logic_server_cli/prototypes/genai_demo/ui/admin/admin.yaml +1 -1
- api_logic_server_cli/prototypes/manager/README.md +30 -4
- api_logic_server_cli/prototypes/manager/README_X.md +663 -0
- api_logic_server_cli/prototypes/manager/system/genai/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.prompt +0 -10
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.response_example +32 -10
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_docs_logic/docs/002_create_db_models.prompt +4 -4
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_docs_logic/docs/003_create_db_models.response +77 -47
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_informal.prompt +1 -1
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/dashboard_services.jinja +83 -0
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/graphics_dashboard_WIP.py +34 -0
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/{graphics_services.py → graphics_services_api_xxx.py} +0 -9
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/graphics_services_db.jinja +46 -0
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/graphics_services_db_each_method.jinja +36 -0
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/graphics.prompt +7 -3
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/response_format.prompt +8 -1
- api_logic_server_cli/prototypes/manager/system/install-ApiLogicServer-dev/install-ApiLogicServer-dev.ps1 +100 -0
- api_logic_server_cli/prototypes/manager/system/install-ApiLogicServer-dev/install-ApiLogicServer-dev.sh +116 -0
- api_logic_server_cli/prototypes/manager/system/install-ApiLogicServer-dev/readme.md +7 -0
- api_logic_server_cli/prototypes/manager/system/style-guide.yaml +2 -2
- api_logic_server_cli/prototypes/manager/webgenai/README.md +6 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/count_orders_by_category.prompt +1 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/order_count_by_month.prompt +1 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/request copy.json +892 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/request.json +6 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/response.json +17 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/response.yaml +59 -0
- api_logic_server_cli/prototypes/nw/docs/graphics/sales_by_category.prompt +1 -0
- api_logic_server_cli/prototypes/nw/ui/admin/home.js +5 -4
- api_logic_server_cli/prototypes/nw/ui/app_model_custom.yaml +851 -1082
- api_logic_server_cli/prototypes/nw_no_cust/Tutorial.md +45 -26
- api_logic_server_cli/prototypes/nw_no_cust/api/api_discovery/openapi.py +130 -0
- api_logic_server_cli/prototypes/nw_no_cust/api/api_discovery/proper_update_def.json +71 -0
- api_logic_server_cli/prototypes/nw_no_cust/config/default.env +13 -0
- api_logic_server_cli/prototypes/nw_no_cust/docs/graphics/count_orders_by_category.prompt +1 -0
- api_logic_server_cli/prototypes/nw_no_cust/docs/graphics/sales_by_employee.prompt +1 -0
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/nginx/nginx.conf +2 -2
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/package-lock.json +9725 -1180
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/package.json +6 -9
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/app/app.config.ts +2 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/app/shared/app.services.config.ts +1 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/css/app.scss +4 -0
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/i18n/en.json +1 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/i18n/es.json +14 -12
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/environments/environment.prod.ts +5 -5
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/environments/environment.ts +5 -5
- api_logic_server_cli/prototypes/ont_app/templates/app_config.jinja +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/date_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/detail_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/new_template.html +16 -16
- api_logic_server_cli/prototypes/ont_app/templates/textarea_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/timestamp_template.html +1 -1
- api_logic_server_cli/prototypes/sample_ai/logic/declare_logic.py +30 -13
- apilogicserver-14.5.0.dist-info/METADATA +76 -0
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/RECORD +160 -88
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/WHEEL +1 -1
- api_logic_server_cli/prototypes/basic_demo/apply_customizations.ps1 +0 -17
- api_logic_server_cli/prototypes/basic_demo/apply_customizations.sh +0 -14
- api_logic_server_cli/prototypes/basic_demo/apply_iteration.ps1 +0 -20
- api_logic_server_cli/prototypes/basic_demo/apply_iteration.sh +0 -15
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/service_template_jsonapi_rpc.jinja +0 -37
- api_logic_server_cli/prototypes/manager/system/genai/graphics_templates/service_template_unused.jinja +0 -38
- apilogicserver-14.3.25.dist-info/METADATA +0 -167
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/entry_points.txt +0 -0
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-14.3.25.dist-info → apilogicserver-14.5.0.dist-info}/top_level.txt +0 -0
|
@@ -80,7 +80,7 @@ class OntBuilder(object):
|
|
|
80
80
|
self.currency_symbol_position="left" # "right"
|
|
81
81
|
self.thousand_separator="," # "."
|
|
82
82
|
self.decimal_separator="." # ","
|
|
83
|
-
self.date_format="
|
|
83
|
+
self.date_format="YYYY-DD-MM" #not sure what this means
|
|
84
84
|
self.edit_on_mode = "dblclick" # edit or click
|
|
85
85
|
self.include_translation = False
|
|
86
86
|
self.row_height = "medium"
|
|
@@ -90,7 +90,7 @@ class OntBuilder(object):
|
|
|
90
90
|
self.keycloak_realm = "kcals"
|
|
91
91
|
self.keycloak_client_id = "alsclient"
|
|
92
92
|
self.exclude_listpicker = False
|
|
93
|
-
self.apiEndpoint = f"http://{project.host}:{project.port}/
|
|
93
|
+
self.apiEndpoint = f"http://{project.host}:{project.port}/api"
|
|
94
94
|
self.title_translation = []
|
|
95
95
|
self.languages = ["en", "es"] # "fr", "it", "de" etc - used to create i18n json files
|
|
96
96
|
self.locale = "en"
|
|
@@ -156,14 +156,15 @@ class OntBuilder(object):
|
|
|
156
156
|
with contextlib.suppress(Exception):
|
|
157
157
|
return self.template_env.get_template(template_name)
|
|
158
158
|
use_local=True
|
|
159
|
-
if use_local:
|
|
160
|
-
with contextlib.suppress(Exception):
|
|
161
|
-
return self.local_env.get_template(template_name)
|
|
162
159
|
try:
|
|
160
|
+
if use_local:
|
|
161
|
+
with contextlib.suppress(Exception):
|
|
162
|
+
return self.local_env.get_template(template_name)
|
|
163
|
+
|
|
163
164
|
return self.env.get_template(template_name)
|
|
164
165
|
except Exception as e:
|
|
165
166
|
log.error(f"Error loading template {template_name} - {e}")
|
|
166
|
-
|
|
167
|
+
return None
|
|
167
168
|
|
|
168
169
|
|
|
169
170
|
def build_application(self, show_messages: bool = True):
|
|
@@ -201,7 +202,7 @@ class OntBuilder(object):
|
|
|
201
202
|
for setting_name, each_setting in app_model.settings.style_guide.items():
|
|
202
203
|
#style guide
|
|
203
204
|
self.set_style(setting_name, each_setting)
|
|
204
|
-
self.global_values[setting_name] = each_setting
|
|
205
|
+
self.global_values[setting_name] = each_setting if setting_name is not DotMap() else None
|
|
205
206
|
|
|
206
207
|
'''
|
|
207
208
|
# Breaking change - added to app.config.ts - values may not be on older version
|
|
@@ -210,23 +211,25 @@ class OntBuilder(object):
|
|
|
210
211
|
applicationLocales = ["en","es"]
|
|
211
212
|
startSessionPath = "/auth/login"
|
|
212
213
|
'''
|
|
213
|
-
if getattr(self.global_values,"serviceType",None) is None:
|
|
214
|
-
self.global_values["serviceType"] = "
|
|
215
|
-
if getattr(self.global_values,"locale",None) is None:
|
|
216
|
-
self.global_values["locale"] =
|
|
217
|
-
if getattr(self.global_values,"applicationLocales",None) is None:
|
|
218
|
-
self.global_values["applicationLocales"] =
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if getattr(self.global_values,"exclude_listpicker",None) is None:
|
|
214
|
+
if getattr(self.global_values,"serviceType",None) is None or getattr(self.global_values,"serviceType",None) == DotMap():
|
|
215
|
+
self.global_values["serviceType"] = "JSONAPI"
|
|
216
|
+
if getattr(self.global_values,"locale",None) is None or getattr(self.global_values,"locale",None) == DotMap():
|
|
217
|
+
self.global_values["locale"] = "en"
|
|
218
|
+
if getattr(self.global_values,"applicationLocales",None) is None or getattr(self.global_values,"applicationLocales",None) == DotMap():
|
|
219
|
+
self.global_values["applicationLocales"] = ['en','es']
|
|
220
|
+
|
|
221
|
+
if getattr(self.global_values,"exclude_listpicker",None) is None or getattr(self.global_values,"exclude_listpicker",None) == DotMap():
|
|
222
222
|
self.global_values["exclude_listpicker"] = False
|
|
223
|
+
|
|
224
|
+
self.global_values["startSessionPath"] = '/auth/login'
|
|
225
|
+
self.global_values["api_endpoint"] = self.apiEndpoint
|
|
223
226
|
|
|
224
227
|
# If the application yaml has been included = we will use the values from the yaml
|
|
225
228
|
if "application" in app_model:
|
|
226
229
|
for app in app_model.application:
|
|
227
230
|
# yaml may have multiple apps = only work on the one selected app-build --app={app}
|
|
228
|
-
if self.app != app:
|
|
229
|
-
|
|
231
|
+
#if self.app != app:
|
|
232
|
+
# continue
|
|
230
233
|
menu_group = app_model.application[app]["menu_group"]
|
|
231
234
|
for mg in menu_group:
|
|
232
235
|
for mi in menu_group[mg]["menu_item"]:
|
|
@@ -234,12 +237,13 @@ class OntBuilder(object):
|
|
|
234
237
|
for p in menu_group[mg]["menu_item"][mi]["page"]:
|
|
235
238
|
if p == 'home':
|
|
236
239
|
self.generate_home_template(app_path, entity_favorites, mi, each_entity, mi)
|
|
240
|
+
home_template_name = menu_group[mg]["menu_item"][mi]["page"][p]["template_name"]
|
|
241
|
+
self.generate_routing(app_path, mi, each_entity, mi, home_template_name)
|
|
237
242
|
elif p == "detail":
|
|
238
243
|
self.generate_detail_template(app_path, entity_favorites, mi, each_entity, mi)
|
|
239
244
|
elif p == "new":
|
|
240
245
|
self.generate_new_template(app_path, entity_favorites, mi, each_entity, mi)
|
|
241
246
|
|
|
242
|
-
self.generate_routing(app_path, mi, each_entity, mi)
|
|
243
247
|
self.generate_card_home_template(app_path, entity_favorites, mi, each_entity, mi)
|
|
244
248
|
else:
|
|
245
249
|
for each_entity_name, each_entity in app_model.entities.items():
|
|
@@ -250,10 +254,11 @@ class OntBuilder(object):
|
|
|
250
254
|
entity_name = each_entity_name
|
|
251
255
|
|
|
252
256
|
# Each entity will have a home, new, detail, routing template
|
|
257
|
+
template_name = self.find_template(each_entity, "home_template","home_template.html")
|
|
253
258
|
self.generate_home_template(app_path, entity_favorites, each_entity_name, each_entity, entity_name)
|
|
254
259
|
self.generate_new_template(app_path, entity_favorites, each_entity_name, each_entity, entity_name)
|
|
255
260
|
self.generate_detail_template(app_path, entity_favorites, each_entity_name, each_entity, entity_name)
|
|
256
|
-
self.generate_routing(app_path, each_entity_name, each_entity, entity_name)
|
|
261
|
+
self.generate_routing(app_path, each_entity_name, each_entity, entity_name, template_name)
|
|
257
262
|
self.generate_card_home_template(app_path, entity_favorites, each_entity_name, each_entity, entity_name)
|
|
258
263
|
|
|
259
264
|
# menu groups/routing and service config
|
|
@@ -269,7 +274,8 @@ class OntBuilder(object):
|
|
|
269
274
|
# Generates KeyCloak or SQL Auth - if already set - do not overwrite - use rebuild=from
|
|
270
275
|
self.gen_auth_components(app_path, keycloak_args, self.use_keycloak,overwrite=False)
|
|
271
276
|
rv_app_config = self.gen_app_config()
|
|
272
|
-
|
|
277
|
+
apiEndpoint = self.global_values.api_endpoint or self.apiEndpoint
|
|
278
|
+
rv_environment = self.environment_template.render(apiEndpoint=apiEndpoint)
|
|
273
279
|
write_root_file(
|
|
274
280
|
app_path=app_path,
|
|
275
281
|
dir_name="environments",
|
|
@@ -288,8 +294,7 @@ class OntBuilder(object):
|
|
|
288
294
|
file_name="app.config.ts",
|
|
289
295
|
source=app_config,
|
|
290
296
|
)
|
|
291
|
-
def generate_routing(self, app_path, each_entity_name, each_entity, entity_name):
|
|
292
|
-
home_template_name = self.find_template(each_entity, "home_template","home_template.html")
|
|
297
|
+
def generate_routing(self, app_path, each_entity_name, each_entity, entity_name, home_template_name:str ):
|
|
293
298
|
if home_template_name == "home_tree_template.html":
|
|
294
299
|
routing = self.load_routing("tree_routing.jinja", entity_name, each_entity)
|
|
295
300
|
else:
|
|
@@ -317,20 +322,20 @@ class OntBuilder(object):
|
|
|
317
322
|
)
|
|
318
323
|
|
|
319
324
|
def build_entity_list_from_app(self):
|
|
320
|
-
entity_list = self.app_model.entities
|
|
325
|
+
entity_list = self.app_model.entities
|
|
321
326
|
if "application" in self.app_model:
|
|
322
|
-
entities =
|
|
327
|
+
entities = {}
|
|
323
328
|
for app in self.app_model.application:
|
|
324
329
|
# yaml may have multiple apps = only work on the one selected app-build --app={app}
|
|
325
|
-
if self.app != app:
|
|
326
|
-
|
|
330
|
+
#if self.app != app:
|
|
331
|
+
# continue
|
|
327
332
|
menu_group = self.app_model.application[app]["menu_group"]
|
|
328
333
|
for mg in menu_group:
|
|
329
334
|
for mi in menu_group[mg]["menu_item"]:
|
|
330
335
|
each_entity = self.app_model.entities[mi]
|
|
331
|
-
for each_entity_name, each_entity in entity_list:
|
|
336
|
+
for each_entity_name, each_entity in entity_list.items():
|
|
332
337
|
if each_entity_name == mi:
|
|
333
|
-
entities
|
|
338
|
+
entities[mi] = each_entity
|
|
334
339
|
return entities
|
|
335
340
|
|
|
336
341
|
return entity_list
|
|
@@ -438,7 +443,7 @@ class OntBuilder(object):
|
|
|
438
443
|
def build_entity_favorites(self):
|
|
439
444
|
entity_favorites = []
|
|
440
445
|
entity_list = self.build_entity_list_from_app()
|
|
441
|
-
for each_entity_name, each_entity in entity_list:
|
|
446
|
+
for each_entity_name, each_entity in entity_list.items():
|
|
442
447
|
datatype = 'INTEGER'
|
|
443
448
|
pkey_datatype = 'INTEGER'
|
|
444
449
|
primary_key = each_entity["primary_key"]
|
|
@@ -504,7 +509,7 @@ class OntBuilder(object):
|
|
|
504
509
|
|
|
505
510
|
def get_entity(self, entity_name):
|
|
506
511
|
entity_list = self.build_entity_list_from_app()
|
|
507
|
-
for each_entity_name, each_entity in entity_list:
|
|
512
|
+
for each_entity_name, each_entity in entity_list.items():
|
|
508
513
|
if each_entity_name == entity_name:
|
|
509
514
|
return each_entity
|
|
510
515
|
|
|
@@ -541,9 +546,9 @@ class OntBuilder(object):
|
|
|
541
546
|
return template.render(entity_vars)
|
|
542
547
|
|
|
543
548
|
def load_home_template(self, template_name: str, entity: any, entity_name:str, entity_favorites: any) -> str:
|
|
544
|
-
template = self.get_template(template_name)
|
|
549
|
+
template = self.get_template(template_name) or self.get_template("home_template.html")
|
|
545
550
|
entity_vars = self.get_entity_vars(entity_name=entity_name, entity=entity)
|
|
546
|
-
entity_vars["row_columns"] = self.get_entity_columns(entity)
|
|
551
|
+
entity_vars["row_columns"] = self.get_entity_columns(entity, entity_vars=entity_vars)
|
|
547
552
|
entity_vars["has_tabs"] = False
|
|
548
553
|
if template_name.endswith("_expand.html"):
|
|
549
554
|
self.gen_expanded_template(entity, entity_favorites, entity_vars)
|
|
@@ -571,13 +576,14 @@ class OntBuilder(object):
|
|
|
571
576
|
entity_vars["single_tab_panel"] = self.single_tab_panel.render(tab_vars)
|
|
572
577
|
entity_vars["has_tabs"] = True
|
|
573
578
|
|
|
574
|
-
def get_entity_columns(self, entity):
|
|
579
|
+
def get_entity_columns(self, entity, entity_vars: dict = None) -> list:
|
|
575
580
|
row_cols = []
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
+
|
|
582
|
+
visible_columns = entity_vars["visibleColumns"].split(";") if entity_vars else entity.columns
|
|
583
|
+
for col in visible_columns:
|
|
584
|
+
if column := find_column(entity, col):
|
|
585
|
+
rv = self.gen_home_columns(entity, entity, column)
|
|
586
|
+
row_cols.append(rv)
|
|
581
587
|
return row_cols
|
|
582
588
|
|
|
583
589
|
def get_entity_vars(self, entity_name:str, entity, page_name: str = "home") -> dict:
|
|
@@ -588,7 +594,7 @@ class OntBuilder(object):
|
|
|
588
594
|
fav_column = find_column(entity,favorite)
|
|
589
595
|
if page := self.get_page(page_name, entity.type):
|
|
590
596
|
cols = page.visible_columns.replace(",",";",100)
|
|
591
|
-
visible_columns = page.visible_columns.replace(",",";",100)
|
|
597
|
+
visible_columns = page.visible_columns.replace(" ","",100).replace(",",";",100)
|
|
592
598
|
else:
|
|
593
599
|
cols = self.get_columns(entity)
|
|
594
600
|
visible_columns = self.get_visible_columns(entity, True)
|
|
@@ -651,24 +657,24 @@ class OntBuilder(object):
|
|
|
651
657
|
|
|
652
658
|
def get_columns(self, entity) -> str:
|
|
653
659
|
cols = []
|
|
654
|
-
for column in entity.columns
|
|
655
|
-
cols.append(column.name)
|
|
660
|
+
cols.extend(column.name for column in entity.columns)
|
|
656
661
|
return ";".join(cols)
|
|
657
662
|
|
|
658
663
|
def get_page(self, page_name, entity_name: str) -> dict:
|
|
664
|
+
#page_name = home, detail, new
|
|
659
665
|
if "application" in self.app_model:
|
|
660
666
|
for app in self.app_model.application:
|
|
661
667
|
# yaml may have multiple apps = only work on the one selected app-build --app={app}
|
|
662
|
-
if self.app != app:
|
|
663
|
-
|
|
668
|
+
#if self.app != app:
|
|
669
|
+
# continue
|
|
664
670
|
menu_group = self.app_model.application[app]["menu_group"]
|
|
665
671
|
for mg in menu_group:
|
|
666
672
|
for mi in menu_group[mg]["menu_item"]:
|
|
667
673
|
#each_entity = self.app_model.entities[mi]
|
|
668
674
|
if mi == entity_name:
|
|
669
|
-
for
|
|
670
|
-
if page_name ==
|
|
671
|
-
return menu_group[mg]["menu_item"][mi]["page"][
|
|
675
|
+
for pg_name in menu_group[mg]["menu_item"][mi]["page"]:
|
|
676
|
+
if page_name == pg_name:
|
|
677
|
+
return menu_group[mg]["menu_item"][mi]["page"][pg_name]
|
|
672
678
|
return None
|
|
673
679
|
def get_menu_group(self):
|
|
674
680
|
menu_groups = []
|
|
@@ -677,13 +683,13 @@ class OntBuilder(object):
|
|
|
677
683
|
if "application" in self.app_model:
|
|
678
684
|
for app in self.app_model.application:
|
|
679
685
|
# yaml may have multiple apps = only work on the one selected app-build --app={app}
|
|
680
|
-
if self.app != app:
|
|
681
|
-
|
|
686
|
+
#if self.app != app:
|
|
687
|
+
# continue
|
|
682
688
|
menu_group = self.app_model.application[app]["menu_group"]
|
|
683
689
|
for mg in menu_group:
|
|
684
690
|
entities = []
|
|
685
691
|
for mi in menu_group[mg]["menu_item"]:
|
|
686
|
-
for entity_name, each_entity in entity_list:
|
|
692
|
+
for entity_name, each_entity in entity_list.items():
|
|
687
693
|
if entity_name == mi:
|
|
688
694
|
get_group(menu_groups, mg, each_entity)
|
|
689
695
|
return menu_groups
|
|
@@ -695,6 +701,7 @@ class OntBuilder(object):
|
|
|
695
701
|
# Lookup real Entity Table Name Here
|
|
696
702
|
self.title_translation.append({title: entity_name})
|
|
697
703
|
def gen_home_columns(self, entity, parent_entity, column):
|
|
704
|
+
# sourcery skip: low-code-quality
|
|
698
705
|
col_var = self.get_column_attrs(column)
|
|
699
706
|
if getattr(entity,"tab_groups",None) != None:
|
|
700
707
|
for tg in entity["tab_groups"]:
|
|
@@ -718,9 +725,11 @@ class OntBuilder(object):
|
|
|
718
725
|
elif template_type == 'INTEGER':
|
|
719
726
|
return self.table_integer_template.render(col_var)
|
|
720
727
|
elif template_type == "DATE":
|
|
721
|
-
return self.
|
|
728
|
+
return self.table_column.render(col_var)
|
|
729
|
+
#return self.date_template.render(col_var)
|
|
722
730
|
elif template_type == "TIMESTAMP":
|
|
723
|
-
return self.
|
|
731
|
+
return self.table_column.render(col_var)
|
|
732
|
+
#return self.timestamp_template.render(col_var)
|
|
724
733
|
elif template_type in ["REAL", "DECIMAL", "NUMERIC"]:
|
|
725
734
|
return self.table_real_template.render(col_var)
|
|
726
735
|
elif template_type == "table_column":
|
|
@@ -729,7 +738,8 @@ class OntBuilder(object):
|
|
|
729
738
|
return self.check_circle_template.render(col_var)
|
|
730
739
|
else:
|
|
731
740
|
if template_type == "TEXTAREA":
|
|
732
|
-
return self.
|
|
741
|
+
return self.table_column.render(col_var)
|
|
742
|
+
#return self.table_textarea_template.render(col_var)
|
|
733
743
|
else:
|
|
734
744
|
return self.table_text_template.render(col_var)
|
|
735
745
|
|
|
@@ -738,7 +748,7 @@ class OntBuilder(object):
|
|
|
738
748
|
if hasattr(column, "template") and column.template != DotMap():
|
|
739
749
|
return column.template.upper()
|
|
740
750
|
if hasattr(column, "type") and column.type != DotMap():
|
|
741
|
-
if column.type.startswith("DECIMAL") or column.type.startswith("NUMERIC"):
|
|
751
|
+
if column.type.startswith("DECIMAL") or column.type.startswith("NUMERIC") or column.type.startswith("FLOAT"):
|
|
742
752
|
return "REAL"
|
|
743
753
|
elif column.type == 'INTEGER':
|
|
744
754
|
return "INTEGER"
|
|
@@ -762,9 +772,15 @@ class OntBuilder(object):
|
|
|
762
772
|
fks = get_foreign_keys(entity, favorites)
|
|
763
773
|
row_cols = []
|
|
764
774
|
defaultValues = {}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
775
|
+
if page := self.get_page("new", entity.type):
|
|
776
|
+
visible_columns = page.visible_columns.replace(" ","",100).replace(",",";",100)
|
|
777
|
+
else:
|
|
778
|
+
visible_columns = self.get_visible_columns(entity, True)
|
|
779
|
+
for col in visible_columns.split(";"):
|
|
780
|
+
for column in entity.columns:
|
|
781
|
+
if col == column.name:
|
|
782
|
+
rv = self.get_new_column(column, fks, entity)
|
|
783
|
+
row_cols.append(rv)
|
|
768
784
|
|
|
769
785
|
entity_vars["row_columns"] = row_cols
|
|
770
786
|
return template.render(entity_vars)
|
|
@@ -833,11 +849,17 @@ class OntBuilder(object):
|
|
|
833
849
|
entity_vars = self.get_entity_vars(entity_name, entity)
|
|
834
850
|
fks = get_foreign_keys(entity, favorites)
|
|
835
851
|
row_cols = []
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
852
|
+
if page := self.get_page("detail", entity.type):
|
|
853
|
+
visible_columns = page.visible_columns.replace(" ","",100).replace(",",";",100)
|
|
854
|
+
else:
|
|
855
|
+
visible_columns = self.get_visible_columns(entity, True)
|
|
856
|
+
for col in visible_columns.split(";"):
|
|
857
|
+
for column in entity.columns:
|
|
858
|
+
if col == column.name:
|
|
859
|
+
if column.get("exclude", "false") == "true":
|
|
860
|
+
continue
|
|
861
|
+
rv = self.gen_detail_rows(column, fks, entity)
|
|
862
|
+
row_cols.append(rv)
|
|
841
863
|
|
|
842
864
|
entity_vars["row_columns"] = row_cols
|
|
843
865
|
entity_vars["has_tabs"] = len(fks) > 0
|
|
@@ -893,12 +915,18 @@ class OntBuilder(object):
|
|
|
893
915
|
entity_vars = self.get_entity_vars(entity.type, entity, 'detail')
|
|
894
916
|
template_var |= entity_vars
|
|
895
917
|
row_cols = []
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
918
|
+
if page := self.get_page("home", entity.type):
|
|
919
|
+
visible_columns = page.visible_columns.replace(" ","",100).replace(",",";",100)
|
|
920
|
+
else:
|
|
921
|
+
visible_columns = self.get_visible_columns(entity, True)
|
|
922
|
+
for col in visible_columns.split(";"):
|
|
923
|
+
for column in entity.columns:
|
|
924
|
+
if col == column.name:
|
|
925
|
+
if column.get("exclude", "false") == "true":
|
|
926
|
+
continue
|
|
927
|
+
rv = self.gen_home_columns(entity,parent_entity, column)
|
|
928
|
+
row_cols.append(rv)
|
|
929
|
+
template_var['visibleColumns'] = visible_columns
|
|
902
930
|
template_var["row_columns"] = row_cols
|
|
903
931
|
return tab_template.render(template_var)
|
|
904
932
|
|
|
@@ -925,7 +953,7 @@ class OntBuilder(object):
|
|
|
925
953
|
tab_name, tab_vars = self.get_tab_attrs(entity, parent_entity, fk_tab)
|
|
926
954
|
primaryKey = make_keys(entity["primary_key"])
|
|
927
955
|
entity_list = self.build_entity_list_from_app()
|
|
928
|
-
for each_entity_name, each_entity in entity_list:
|
|
956
|
+
for each_entity_name, each_entity in entity_list.items():
|
|
929
957
|
if each_entity_name == tab_name:
|
|
930
958
|
template = self.load_tab_template(each_entity,entity,tab_vars, primaryKey )
|
|
931
959
|
panels.append(template)
|
|
@@ -999,7 +1027,7 @@ class OntBuilder(object):
|
|
|
999
1027
|
|
|
1000
1028
|
sidebarTemplate = self.sidebar_template
|
|
1001
1029
|
# sep = ","
|
|
1002
|
-
for each_entity_name, each_entity in entities:
|
|
1030
|
+
for each_entity_name, each_entity in entities.items():
|
|
1003
1031
|
name = each_entity_name
|
|
1004
1032
|
entity_first_cap = f"{name[:1].upper()}{name[1:]}"
|
|
1005
1033
|
var = {"entity": name, "entity_first_cap": entity_first_cap}
|
|
@@ -1081,7 +1109,7 @@ class OntBuilder(object):
|
|
|
1081
1109
|
if tg.direction == "tomany":
|
|
1082
1110
|
var["tab_name"] = tg.resource
|
|
1083
1111
|
var["tab_key"] = tg.fks[0]
|
|
1084
|
-
if next((e for e in entity_list if e
|
|
1112
|
+
if next((e for e in entity_list if e == tg.resource), None):
|
|
1085
1113
|
additional_routes += f",{self.detail_route_template.render(var)}"
|
|
1086
1114
|
|
|
1087
1115
|
var["additional_routes"] = additional_routes
|
|
@@ -1119,7 +1147,7 @@ class OntBuilder(object):
|
|
|
1119
1147
|
menu_separator = ""
|
|
1120
1148
|
groups = self.get_menu_group()
|
|
1121
1149
|
if len(groups) == 0:
|
|
1122
|
-
for each_entity_name, each_entity in entities:
|
|
1150
|
+
for each_entity_name, each_entity in entities.items():
|
|
1123
1151
|
group = getattr(each_entity, "group") or "data"
|
|
1124
1152
|
get_group(groups, group, each_entity)
|
|
1125
1153
|
|
|
@@ -1300,12 +1328,12 @@ def find_column(entity, column_name) -> any:
|
|
|
1300
1328
|
)
|
|
1301
1329
|
|
|
1302
1330
|
def gen_app_service_config(entities: any) -> str:
|
|
1303
|
-
t = Template("export const SERVICE_CONFIG
|
|
1331
|
+
t = Template("export const SERVICE_CONFIG ={ {{ children }} };")
|
|
1304
1332
|
child_template = Template("'{{ name }}': { 'path': '/{{ name }}' }")
|
|
1305
1333
|
sep = ""
|
|
1306
1334
|
config = ""
|
|
1307
1335
|
children = ""
|
|
1308
|
-
for each_entity_name, each_entity in entities:
|
|
1336
|
+
for each_entity_name, each_entity in entities.items():
|
|
1309
1337
|
name = each_entity_name
|
|
1310
1338
|
title = each_entity["label"].replace("*","") if hasattr(each_entity, "label") and each_entity.label != DotMap() else name
|
|
1311
1339
|
child = child_template.render(title=title, name=name)
|
|
@@ -268,10 +268,10 @@ class OntCreator(object):
|
|
|
268
268
|
each_attribute.type = "text"
|
|
269
269
|
each_attribute.template = "text"
|
|
270
270
|
else:
|
|
271
|
-
each_attribute.type = resource_attribute.db_type
|
|
271
|
+
each_attribute.type = resource_attribute.db_type.upper().split("(")[0] #VARCHAR, DECIMAL, NUMERIC, etc
|
|
272
272
|
each_attribute.template = self.compute_field_template(each_attribute)
|
|
273
|
-
if hasattr(resource_attribute,"default"):
|
|
274
|
-
|
|
273
|
+
if hasattr(resource_attribute,"default") and "::" not in resource_attribute.default:
|
|
274
|
+
each_attribute.default = resource_attribute.default
|
|
275
275
|
return each_attribute
|
|
276
276
|
|
|
277
277
|
|
|
@@ -286,7 +286,7 @@ class OntCreator(object):
|
|
|
286
286
|
"""
|
|
287
287
|
if hasattr(column, "type") and column.type != DotMap():
|
|
288
288
|
col_type = column.type.upper().split("(")[0]
|
|
289
|
-
if col_type in ["SERIAL","SERIAL4"]:
|
|
289
|
+
if col_type in ["SERIAL","SERIAL4","SERIAL8"]:
|
|
290
290
|
rv = "nif"
|
|
291
291
|
if col_type in ["DECIMAL","NUMERIC"]:
|
|
292
292
|
rv = "real"
|
|
@@ -316,6 +316,7 @@ class OntCreator(object):
|
|
|
316
316
|
def style_guide(self) -> DotMap:
|
|
317
317
|
style_guide = DotMap()
|
|
318
318
|
# GLOBAL Style settings for all forms
|
|
319
|
+
style_guide.api_endpoint = "http://localhost:5656/api" # "http://localhost:8080"
|
|
319
320
|
style_guide.mode = "tab" # "dialog"
|
|
320
321
|
style_guide.pick_style = "list" #"combo" or"list"
|
|
321
322
|
style_guide.style = "light" # "dark"
|
|
@@ -323,7 +324,7 @@ class OntCreator(object):
|
|
|
323
324
|
style_guide.currency_symbol_position="left" # "right"
|
|
324
325
|
style_guide.thousand_separator="," # "."
|
|
325
326
|
style_guide.decimal_separator="." # ","
|
|
326
|
-
style_guide.date_format="
|
|
327
|
+
style_guide.date_format="YYYY-MM-DD" #not sure what this means
|
|
327
328
|
style_guide.edit_on_mode = "dblclick" # edit #click
|
|
328
329
|
style_guide.min_decimal_digits="2"
|
|
329
330
|
style_guide.max_decimal_digits="4"
|
|
@@ -334,7 +335,7 @@ class OntCreator(object):
|
|
|
334
335
|
style_guide.keycloak_url= "http://localhost:8080"
|
|
335
336
|
style_guide.keycloak_realm = "kcals"
|
|
336
337
|
style_guide.keycloak_client_id = "alsclient"
|
|
337
|
-
style_guide.serviceType = "
|
|
338
|
+
style_guide.serviceType = "JSONAPI" # OntimizeEE or JSONAPI
|
|
338
339
|
style_guide.locale = "en"
|
|
339
340
|
style_guide.applicationLocales = ["en","es"]
|
|
340
341
|
style_guide.startSessionPath = "/auth/login" #Used by JSONAPI only
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
see tests/test_databases/basic_demo/basic_demo.sql
|
|
Binary file
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Alter table "Product" rename to TempData;
|
|
2
|
+
|
|
3
|
+
CREATE TABLE "Product" (
|
|
4
|
+
"Id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
5
|
+
"ProductName" VARCHAR(8000) NULL,
|
|
6
|
+
"SupplierId" INTEGER NOT NULL,
|
|
7
|
+
"CategoryId" INTEGER NOT NULL,
|
|
8
|
+
"QuantityPerUnit" VARCHAR(8000) NULL,
|
|
9
|
+
"UnitPrice" DECIMAL NOT NULL,
|
|
10
|
+
"UnitsInStock" INTEGER NOT NULL,
|
|
11
|
+
"UnitsOnOrder" INTEGER NOT NULL,
|
|
12
|
+
"ReorderLevel" INTEGER NOT NULL,
|
|
13
|
+
"Discontinued" INTEGER NOT NULL,
|
|
14
|
+
"UnitsShipped" INTEGER,
|
|
15
|
+
FOREIGN KEY("CategoryId") REFERENCES "CategoryTableNameTest"("Id")
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
INSERT INTO Product
|
|
19
|
+
SELECT *
|
|
20
|
+
FROM TempData;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Drop table TempData;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Alter table "OrderDetail" rename to TempData1;
|
|
27
|
+
|
|
28
|
+
CREATE TABLE OrderDetail (
|
|
29
|
+
"Id" INTEGER,
|
|
30
|
+
"OrderId" INTEGER NOT NULL,
|
|
31
|
+
"ProductId" INTEGER NOT NULL,
|
|
32
|
+
"UnitPrice" DECIMAL,
|
|
33
|
+
"Quantity" INTEGER NOT NULL DEFAULT 1,
|
|
34
|
+
"Discount" DOUBLE DEFAULT 0,
|
|
35
|
+
"Amount" Decimal,
|
|
36
|
+
"ShippedDate" VARCHAR(8000),
|
|
37
|
+
PRIMARY KEY("Id" AUTOINCREMENT),
|
|
38
|
+
FOREIGN KEY("OrderId") REFERENCES "Order" on delete cascade
|
|
39
|
+
FOREIGN KEY("ProductId") REFERENCES "Product" on delete set null
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
INSERT INTO OrderDetail
|
|
43
|
+
SELECT *
|
|
44
|
+
FROM TempData1;
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
drop table TempData1;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
CREATE VIEW ProductDetails_View as
|
|
51
|
+
select
|
|
52
|
+
p.*,
|
|
53
|
+
c.CategoryName_ColumnName, c.Description as [CategoryDescription],
|
|
54
|
+
s.CompanyName as [SupplierName], s.Region as [SupplierRegion]
|
|
55
|
+
from "Product" p
|
|
56
|
+
join "CategoryTableNameTest" c on p.CategoryId = c.id
|
|
57
|
+
join [Supplier] s on s.id = p.SupplierId
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
INSERT INTO Region (RegionDescription)
|
|
61
|
+
SELECT DISTINCT ShipRegion
|
|
62
|
+
FROM "Order";
|
|
Binary file
|