refactor: вся основа кода в отдельной папке
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(
|
box::use(
|
||||||
modules/utils,
|
R/modules/utils,
|
||||||
)
|
)
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
@@ -5,9 +5,9 @@ box::use(
|
|||||||
|
|
||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(
|
box::use(
|
||||||
modules/db,
|
R/modules/db,
|
||||||
modules/utils,
|
R/modules/utils,
|
||||||
app/forms
|
R/app/forms
|
||||||
)
|
)
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
@@ -5,9 +5,9 @@ box::use(
|
|||||||
|
|
||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(
|
box::use(
|
||||||
modules/db,
|
R/modules/db,
|
||||||
modules/utils,
|
R/modules/utils,
|
||||||
app/forms
|
R/app/forms
|
||||||
)
|
)
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(modules/data_manipulations[is_this_empty_value])
|
box::use(R/modules/data_manipulations[is_this_empty_value])
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
init_val = function(scheme, ns) {
|
init_val = function(scheme, ns) {
|
||||||
@@ -103,7 +103,7 @@ get_dummy_data = function(type) {
|
|||||||
get_dummy_df = function(forms_id_type_list) {
|
get_dummy_df = function(forms_id_type_list) {
|
||||||
|
|
||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(modules/utils)
|
box::use(R/modules/utils)
|
||||||
|
|
||||||
purrr::map(
|
purrr::map(
|
||||||
.x = forms_id_type_list,
|
.x = forms_id_type_list,
|
||||||
@@ -136,7 +136,7 @@ compare_existing_table_with_schema = function(
|
|||||||
}
|
}
|
||||||
|
|
||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(modules/utils)
|
box::use(R/modules/utils)
|
||||||
|
|
||||||
# checking if db structure in form compatible with alrady writed data (in case on changig form)
|
# checking if db structure in form compatible with alrady writed data (in case on changig form)
|
||||||
if (identical(colnames(DBI::dbReadTable(con, table_name)), all_ids_from_schema)) {
|
if (identical(colnames(DBI::dbReadTable(con, table_name)), all_ids_from_schema)) {
|
||||||
@@ -45,13 +45,13 @@ check_and_init_scheme = function() {
|
|||||||
cli::cli_inform(c("*" = "проверка схемы..."))
|
cli::cli_inform(c("*" = "проверка схемы..."))
|
||||||
|
|
||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(modules/db[local_db_backup])
|
box::use(R/modules/db[local_db_backup])
|
||||||
|
|
||||||
# список файлов, изменение которых, приведут к переинициализиации схемы
|
# список файлов, изменение которых, приведут к переинициализиации схемы
|
||||||
files_to_watch <- c(
|
files_to_watch <- c(
|
||||||
"config.yml",
|
"config.yml",
|
||||||
"modules/scheme_generator.R",
|
"R/modules/scheme_generator.R",
|
||||||
"modules/utils.R"
|
"R/modules/utils.R"
|
||||||
)
|
)
|
||||||
|
|
||||||
# проверка существования отслеживаемых файлов
|
# проверка существования отслеживаемых файлов
|
||||||
@@ -111,8 +111,8 @@ init_scheme = function(scheme_file) {
|
|||||||
|
|
||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(
|
box::use(
|
||||||
modules/db,
|
R/modules/db,
|
||||||
modules/scheme_generator[scheme_R6]
|
R/modules/scheme_generator[scheme_R6]
|
||||||
)
|
)
|
||||||
|
|
||||||
db_path <- fs::path(config::get("form_app_configure_path"), "db")
|
db_path <- fs::path(config::get("form_app_configure_path"), "db")
|
||||||
@@ -56,7 +56,7 @@ scheme_R6 <- R6::R6Class(
|
|||||||
# extract main key
|
# extract main key
|
||||||
private$main_key_id <- self$get_key_id("main")
|
private$main_key_id <- self$get_key_id("main")
|
||||||
|
|
||||||
box::use(modules/utils)
|
box::use(R/modules/utils)
|
||||||
private$bslib_rendered_ui <- bslib::navset_card_underline(
|
private$bslib_rendered_ui <- bslib::navset_card_underline(
|
||||||
id = "main",
|
id = "main",
|
||||||
!!!utils$make_list_of_pages(private$schemes_list[["main"]], private$main_key_id),
|
!!!utils$make_list_of_pages(private$schemes_list[["main"]], private$main_key_id),
|
||||||
@@ -266,7 +266,7 @@ update_forms_with_data = function(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
options(box.path = here::here())
|
options(box.path = here::here())
|
||||||
box::use(modules/data_manipulations[is_this_empty_value])
|
box::use(R/modules/data_manipulations[is_this_empty_value])
|
||||||
|
|
||||||
# print("-----------------")
|
# print("-----------------")
|
||||||
# cli::cli_inform("form_id: {form_id} | form_type: {form_type}")
|
# cli::cli_inform("form_id: {form_id} | form_type: {form_type}")
|
||||||
18
app.R
18
app.R
@@ -12,14 +12,14 @@ suppressPackageStartupMessages({
|
|||||||
# SOURCE FILES ============================
|
# SOURCE FILES ============================
|
||||||
box::purge_cache()
|
box::purge_cache()
|
||||||
box::use(
|
box::use(
|
||||||
modules/utils,
|
R/modules/utils,
|
||||||
modules/global_options,
|
R/modules/global_options,
|
||||||
modules/db,
|
R/modules/db,
|
||||||
modules/data_validation,
|
R/modules/data_validation,
|
||||||
app/forms,
|
R/app/forms,
|
||||||
app/tasks,
|
R/app/tasks,
|
||||||
app/logs,
|
R/app/logs,
|
||||||
modules/data_manipulations[is_this_empty_value]
|
R/modules/data_manipulations[is_this_empty_value]
|
||||||
)
|
)
|
||||||
|
|
||||||
# global settings:
|
# global settings:
|
||||||
@@ -33,7 +33,7 @@ global_options$check_and_init_scheme()
|
|||||||
|
|
||||||
# global vars:
|
# global vars:
|
||||||
box::use(
|
box::use(
|
||||||
modules/global_options[AUTH_ENABLED]
|
R/modules/global_options[AUTH_ENABLED]
|
||||||
)
|
)
|
||||||
enabled_schemes <- unlist(config::get()$form_schemes)
|
enabled_schemes <- unlist(config::get()$form_schemes)
|
||||||
enabled_schemes <- setNames(names(enabled_schemes), enabled_schemes)
|
enabled_schemes <- setNames(names(enabled_schemes), enabled_schemes)
|
||||||
|
|||||||
Reference in New Issue
Block a user