refactor: вся основа кода в отдельной папке
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
options(box.path = here::here())
|
||||
box::use(
|
||||
modules/utils,
|
||||
R/modules/utils,
|
||||
)
|
||||
|
||||
#' @export
|
||||
@@ -5,9 +5,9 @@ box::use(
|
||||
|
||||
options(box.path = here::here())
|
||||
box::use(
|
||||
modules/db,
|
||||
modules/utils,
|
||||
app/forms
|
||||
R/modules/db,
|
||||
R/modules/utils,
|
||||
R/app/forms
|
||||
)
|
||||
|
||||
#' @export
|
||||
@@ -5,9 +5,9 @@ box::use(
|
||||
|
||||
options(box.path = here::here())
|
||||
box::use(
|
||||
modules/db,
|
||||
modules/utils,
|
||||
app/forms
|
||||
R/modules/db,
|
||||
R/modules/utils,
|
||||
R/app/forms
|
||||
)
|
||||
|
||||
#' @export
|
||||
@@ -1,5 +1,5 @@
|
||||
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
|
||||
init_val = function(scheme, ns) {
|
||||
@@ -103,7 +103,7 @@ get_dummy_data = function(type) {
|
||||
get_dummy_df = function(forms_id_type_list) {
|
||||
|
||||
options(box.path = here::here())
|
||||
box::use(modules/utils)
|
||||
box::use(R/modules/utils)
|
||||
|
||||
purrr::map(
|
||||
.x = forms_id_type_list,
|
||||
@@ -136,7 +136,7 @@ compare_existing_table_with_schema = function(
|
||||
}
|
||||
|
||||
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)
|
||||
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("*" = "проверка схемы..."))
|
||||
|
||||
options(box.path = here::here())
|
||||
box::use(modules/db[local_db_backup])
|
||||
box::use(R/modules/db[local_db_backup])
|
||||
|
||||
# список файлов, изменение которых, приведут к переинициализиации схемы
|
||||
files_to_watch <- c(
|
||||
"config.yml",
|
||||
"modules/scheme_generator.R",
|
||||
"modules/utils.R"
|
||||
"R/modules/scheme_generator.R",
|
||||
"R/modules/utils.R"
|
||||
)
|
||||
|
||||
# проверка существования отслеживаемых файлов
|
||||
@@ -111,8 +111,8 @@ init_scheme = function(scheme_file) {
|
||||
|
||||
options(box.path = here::here())
|
||||
box::use(
|
||||
modules/db,
|
||||
modules/scheme_generator[scheme_R6]
|
||||
R/modules/db,
|
||||
R/modules/scheme_generator[scheme_R6]
|
||||
)
|
||||
|
||||
db_path <- fs::path(config::get("form_app_configure_path"), "db")
|
||||
@@ -56,7 +56,7 @@ scheme_R6 <- R6::R6Class(
|
||||
# extract main key
|
||||
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(
|
||||
id = "main",
|
||||
!!!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())
|
||||
box::use(modules/data_manipulations[is_this_empty_value])
|
||||
box::use(R/modules/data_manipulations[is_this_empty_value])
|
||||
|
||||
# print("-----------------")
|
||||
# cli::cli_inform("form_id: {form_id} | form_type: {form_type}")
|
||||
18
app.R
18
app.R
@@ -12,14 +12,14 @@ suppressPackageStartupMessages({
|
||||
# SOURCE FILES ============================
|
||||
box::purge_cache()
|
||||
box::use(
|
||||
modules/utils,
|
||||
modules/global_options,
|
||||
modules/db,
|
||||
modules/data_validation,
|
||||
app/forms,
|
||||
app/tasks,
|
||||
app/logs,
|
||||
modules/data_manipulations[is_this_empty_value]
|
||||
R/modules/utils,
|
||||
R/modules/global_options,
|
||||
R/modules/db,
|
||||
R/modules/data_validation,
|
||||
R/app/forms,
|
||||
R/app/tasks,
|
||||
R/app/logs,
|
||||
R/modules/data_manipulations[is_this_empty_value]
|
||||
)
|
||||
|
||||
# global settings:
|
||||
@@ -33,7 +33,7 @@ global_options$check_and_init_scheme()
|
||||
|
||||
# global vars:
|
||||
box::use(
|
||||
modules/global_options[AUTH_ENABLED]
|
||||
R/modules/global_options[AUTH_ENABLED]
|
||||
)
|
||||
enabled_schemes <- unlist(config::get()$form_schemes)
|
||||
enabled_schemes <- setNames(names(enabled_schemes), enabled_schemes)
|
||||
|
||||
Reference in New Issue
Block a user