fam-archetype-app 0.0.1
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.
- package/README.md +38 -0
- package/package.json +25 -0
- package/src/collection.json +10 -0
- package/src/fam-archetype-app/files/.editorconfig +16 -0
- package/src/fam-archetype-app/files/.prettierignore +15 -0
- package/src/fam-archetype-app/files/.prettierrc.json +29 -0
- package/src/fam-archetype-app/files/LICENSE.md +21 -0
- package/src/fam-archetype-app/files/README.md +59 -0
- package/src/fam-archetype-app/files/angular.json.template +178 -0
- package/src/fam-archetype-app/files/cli +361 -0
- package/src/fam-archetype-app/files/eslint.config.js +89 -0
- package/src/fam-archetype-app/files/package-lock.json.template +18812 -0
- package/src/fam-archetype-app/files/package.json.template +62 -0
- package/src/fam-archetype-app/files/src/assets/fonts/DiBaScreen-Regular.woff2 +0 -0
- package/src/fam-archetype-app/files/src/assets/translations/translations-ca.json +284 -0
- package/src/fam-archetype-app/files/src/assets/translations/translations-en.json +28 -0
- package/src/fam-archetype-app/files/src/assets/translations/translations-es.json +28 -0
- package/src/fam-archetype-app/files/src/core/layout/component/footer/footer.component.html.template +3 -0
- package/src/fam-archetype-app/files/src/core/layout/component/footer/footer.component.scss +8 -0
- package/src/fam-archetype-app/files/src/core/layout/component/layout/layout.component.html +19 -0
- package/src/fam-archetype-app/files/src/core/layout/component/layout/layout.component.scss +28 -0
- package/src/fam-archetype-app/files/src/core/layout/component/main-info-popup/main-info-popup.component.html +33 -0
- package/src/fam-archetype-app/files/src/core/layout/component/main-info-popup/main-info-popup.component.scss +3 -0
- package/src/fam-archetype-app/files/src/core/layout/component/menu/menu.component.html +3 -0
- package/src/fam-archetype-app/files/src/core/layout/component/menu/menu.component.scss +163 -0
- package/src/fam-archetype-app/files/src/core/layout/component/menuitem/menuitem.component.html +39 -0
- package/src/fam-archetype-app/files/src/core/layout/component/menuitem/menuitem.component.scss +44 -0
- package/src/fam-archetype-app/files/src/core/layout/component/not-found/not-found.component.html +12 -0
- package/src/fam-archetype-app/files/src/core/layout/component/not-found/not-found.component.scss +17 -0
- package/src/fam-archetype-app/files/src/core/layout/component/sidebar/sidebar.component.html +13 -0
- package/src/fam-archetype-app/files/src/core/layout/component/sidebar/sidebar.component.scss +33 -0
- package/src/fam-archetype-app/files/src/core/layout/component/top-menu/top-menu.component.html +12 -0
- package/src/fam-archetype-app/files/src/core/layout/component/top-menu/top-menu.component.scss +9 -0
- package/src/fam-archetype-app/files/src/core/layout/component/topbar/_mixins.scss +8 -0
- package/src/fam-archetype-app/files/src/core/layout/component/topbar/topbar.component.html.template +45 -0
- package/src/fam-archetype-app/files/src/core/layout/component/topbar/topbar.component.scss +77 -0
- package/src/fam-archetype-app/files/src/environments/environment.dev.ts.template +12 -0
- package/src/fam-archetype-app/files/src/environments/environment.int.ts.template +12 -0
- package/src/fam-archetype-app/files/src/environments/environment.pre.ts.template +12 -0
- package/src/fam-archetype-app/files/src/environments/environment.ts.template +12 -0
- package/src/fam-archetype-app/files/src/index.html.template +18 -0
- package/src/fam-archetype-app/files/src/shared/filters/diba-filters/diba-filters.component.html +69 -0
- package/src/fam-archetype-app/files/src/shared/filters/diba-filters/diba-filters.component.scss +0 -0
- package/src/fam-archetype-app/files/src/shared/styles/_movements.scss +19 -0
- package/src/fam-archetype-app/files/src/shared/styles/global/_core.scss +20 -0
- package/src/fam-archetype-app/files/src/shared/styles/global/_icons.scss +37 -0
- package/src/fam-archetype-app/files/src/shared/styles/global/_tooltips.scss +14 -0
- package/src/fam-archetype-app/files/src/shared/styles/global/_typography.scss +68 -0
- package/src/fam-archetype-app/files/src/shared/styles/global/_utils.scss +24 -0
- package/src/fam-archetype-app/files/src/shared/styles/global/layout.scss +5 -0
- package/src/fam-archetype-app/files/src/shared/table/column-visibility-selector/column-visibility-selector.component.html +10 -0
- package/src/fam-archetype-app/files/src/shared/table/column-visibility-selector/column-visibility-selector.component.scss +0 -0
- package/src/fam-archetype-app/files/src/shared/table/diba-table/diba-table.component.html +136 -0
- package/src/fam-archetype-app/files/src/shared/table/diba-table/diba-table.component.scss +0 -0
- package/src/fam-archetype-app/files/src/styles.scss +109 -0
- package/src/fam-archetype-app/files/src/tailwind.css +3 -0
- package/src/fam-archetype-app/files/tailwind.config.js +36 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/commands/commands.txt +1 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/commands/db_to_entities.txt +1 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/commands/test_db_connection.txt +1 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/databases.yaml +188 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/downloads/.keep +0 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/lib/.keep +0 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamActivitat.entity +26 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamActivitatsUbicacio.entity +40 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamAlumne.entity +76 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamArea.entity +33 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamComanda.entity +37 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamCurs.entity +50 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamDocument.entity +53 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamDocumentTipus.entity +26 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamEntitatBase.entity +84 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamExpedient.entity +71 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamExpedientDocument.entity +51 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamExpedientEstat.entity +26 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamExpedientTipus.entity +26 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamJerarquia.entity +33 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamLinia.entity +56 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamMatricula.entity +63 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamTipusArticle.entity +26 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamUbicacio.entity +35 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FamZona.entity +27 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/Funcionalitat.entity +65 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/FuncionalitatGrupFunc.entity +58 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/GrupFuncionalitat.entity +54 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/PerfilGrupFuncionalitat.entity +50 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/VusPerfil.entity +31 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/models/app/model.yaml +4 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/telosys-tools.cfg +31 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/telosys.env +5 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/README.md +12 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/database.properties +23 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/include/init_var_entity.vm +169 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/include/macros.vm +218 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/app_config_ts.vm +56 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/app_routes_ts.vm +21 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/core/layout/component/menu/menu_component_ts.vm +30 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/core/layout/component/top-menu/top-menu_component_ts.vm +36 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/core/layout/service/menu_model_service_ts.vm +49 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/application/create-Xxx_use-case_ts.vm +18 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/application/create-file-Xxx_use-case_ts.vm +17 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/application/delete-Xxx_use-case_ts.vm +17 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/application/download-Xxx-file_use-case_ts.vm +24 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/application/find-Xxx_use-case_ts.vm +18 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/application/search-Xxx_use-case_ts.vm +25 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/application/update-Xxx_use-case_ts.vm +18 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/domain/Xxx_entity_ts.vm +36 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/domain/Xxx_repository_interface_ts.vm +27 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/mappers/Xxx_jsona_mapper_ts.vm +52 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/mappers/Xxx_mapper_ts.vm +36 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/Xxx_routes_ts.vm +15 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/detail/Xxx_detail_html.vm +178 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/detail/Xxx_detail_scss.vm +0 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/detail/Xxx_detail_spec_ts.vm +29 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/detail/Xxx_detail_ts.vm +382 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/list/Xxx_list_html.vm +37 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/list/Xxx_list_scss.vm +10 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/list/Xxx_list_spec_ts.vm +29 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/pages/list/Xxx_list_ts.vm +430 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/inbound/resources/Xxx_resource_ts.vm +43 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/modules/infrastructure/outbound/Xxx_repository_impl_ts.vm +162 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/main-angular/test_code.vm +3 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/templates.cfg +52 -0
- package/src/fam-archetype-app/files/tools/cli/TelosysTools/templates/fam-app-templates/tools-test/test-api_Xxx_rest.vm +181 -0
- package/src/fam-archetype-app/files/tools/cli/telosys +5 -0
- package/src/fam-archetype-app/files/tools/cli/telosys-cli-4.2.0-001.jar +0 -0
- package/src/fam-archetype-app/files/tools/cli/telosys-cli.cfg +55 -0
- package/src/fam-archetype-app/files/tools/cli/telosys-term.sh +30 -0
- package/src/fam-archetype-app/files/tools/cli/telosys.bat +4 -0
- package/src/fam-archetype-app/files/tools/cli/telosys.ico +0 -0
- package/src/fam-archetype-app/files/tools/db/develop/data/.keep +0 -0
- package/src/fam-archetype-app/files/tools/db/production/data/.keep +0 -0
- package/src/fam-archetype-app/files/tools/db/production/migrations/.keep +0 -0
- package/src/fam-archetype-app/files/tools/docs/.keep +0 -0
- package/src/fam-archetype-app/files/tools/test/test-api.rest +80 -0
- package/src/fam-archetype-app/files/tsconfig.app.json +15 -0
- package/src/fam-archetype-app/files/tsconfig.json +42 -0
- package/src/fam-archetype-app/files/tsconfig.spec.json +15 -0
- package/src/fam-archetype-app/files/vercel.json +9 -0
- package/src/fam-archetype-app/index.d.ts +2 -0
- package/src/fam-archetype-app/index.js +18 -0
- package/src/fam-archetype-app/index.js.map +1 -0
- package/src/fam-archetype-app/index_spec.d.ts +1 -0
- package/src/fam-archetype-app/index_spec.js +23 -0
- package/src/fam-archetype-app/index_spec.js.map +1 -0
- package/src/fam-archetype-app/schema.json +21 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
## ############################################################################
|
|
2
|
+
## Macros
|
|
3
|
+
## ############################################################################
|
|
4
|
+
## Macro: camelCase. Convierte un fieldName a camelCase
|
|
5
|
+
#macro( camelCase $fieldName )
|
|
6
|
+
#set( $result = $fieldName.replaceAll("[-_ ]+([a-zA-Z0-9])", "$1") )
|
|
7
|
+
$fn.uncapitalize($result)#end
|
|
8
|
+
## Macro: camelCaseCapitalize. Convierte un fieldName a camelCaseCapitalize
|
|
9
|
+
#macro( camelCaseCapitalize $fieldName )
|
|
10
|
+
#set( $result = $fieldName.replaceAll("[-_ ]+([a-zA-Z0-9])", "$1") )
|
|
11
|
+
$fn.capitalize($result)#end
|
|
12
|
+
## Macro: camelCaseUpper. Convierte un fieldName a camelCase y lo convierte todo a mayúsculas
|
|
13
|
+
#macro( camelCaseUpper $fieldName )
|
|
14
|
+
#set( $result = $fieldName.replaceAll("[-_ ]+([a-zA-Z0-9])", "$1") )
|
|
15
|
+
$fn.uncapitalize($result).toUpperCase()#end
|
|
16
|
+
## Macro: kebabCase. Convert a fieldName to kebabCase
|
|
17
|
+
#macro(kebabCase $fieldName)
|
|
18
|
+
$fieldName.replaceAll("([a-z])([A-Z])", "$1-$2").toLowerCase()#end
|
|
19
|
+
## Macro: snakeLowerCase. Convert a fieldName to SnakeCase
|
|
20
|
+
#macro( snakeLowerCase $fieldName )
|
|
21
|
+
#set( $fieldNameUncapitalized = $fn.uncapitalize($fieldName) )
|
|
22
|
+
$fieldNameUncapitalized.replaceAll("([A-Z])", "_$1").toLowerCase()#end
|
|
23
|
+
## Macro: snakeCase. Convert a fieldName to SnakeCase
|
|
24
|
+
#macro( snakeUpperCase $fieldName )
|
|
25
|
+
#set( $fieldNameUncapitalized = $fn.uncapitalize($fieldName) )
|
|
26
|
+
$fieldNameUncapitalized.replaceAll("([A-Z])", "_$1").toUpperCase()#end
|
|
27
|
+
## Macro: operator. Returns the mandatory 'of' or optional 'fromNullable' operator.
|
|
28
|
+
#macro( operator $isNotBlank )#if($isNotBlank)of#{else}fromNullable#end#end
|
|
29
|
+
## Macro: resolveType. Returns the corresponding type of attribute.
|
|
30
|
+
#macro( resolveType $attribute )
|
|
31
|
+
#if( $attribute.isTemporalType() )
|
|
32
|
+
#set( $type = "String" )
|
|
33
|
+
#else
|
|
34
|
+
#set( $type = $attribute.type )
|
|
35
|
+
#end
|
|
36
|
+
$type#end
|
|
37
|
+
## Macro: resolveValue. Returns the corresponding value of attribute.
|
|
38
|
+
#macro( resolveValue $attribute )
|
|
39
|
+
#if( $attribute.isTemporalType() )
|
|
40
|
+
#set( $value = "toDatetime()" )
|
|
41
|
+
#else
|
|
42
|
+
#set( $value = "value()" )
|
|
43
|
+
#end
|
|
44
|
+
$value#end
|
|
45
|
+
## Macro: comma. Returns the comma (,) separator between arguments (attributes only)
|
|
46
|
+
#macro( comma $hasNext )#if( $hasNext ),#end#end
|
|
47
|
+
## Macro: comma. Returns the comma (,) separator between arguments (attributes + links)
|
|
48
|
+
#macro( commaAndContinue $hasNext )#if( $hasNext || !$toOneLinks.isEmpty() || !$toManyLinks.isEmpty() ),#end#end
|
|
49
|
+
## Macro: addConstraintsAnnotationsImports. Add all constraints annotations imports for aggregate's field
|
|
50
|
+
#macro( addConstraintsAnnotationsImports )
|
|
51
|
+
#set( $addedImportNotBlank = false)
|
|
52
|
+
#set( $addedImportNotNull = false)
|
|
53
|
+
#set( $addedImportSize = false)
|
|
54
|
+
#set( $addedImportPattern = false)
|
|
55
|
+
#foreach( $attribute in $entity.attributes )
|
|
56
|
+
## Check if existe some attribute with Not Blank constraint
|
|
57
|
+
#if( !$addedImportNotBlank )
|
|
58
|
+
#set( $attributePostable = $attribute.tagValueAsBoolean( "postable", true ) )
|
|
59
|
+
#set( $logicalDeletion = $entity.tagValue("AggregateDeletion", "physical") == "logical" )
|
|
60
|
+
#if( $attributePostable && $attribute.isNotBlank())
|
|
61
|
+
import jakarta.validation.constraints.NotBlank;
|
|
62
|
+
#set( $addedImportNotBlank = true)
|
|
63
|
+
#end
|
|
64
|
+
#end
|
|
65
|
+
## Check if existe some attribute with Not Null constraint
|
|
66
|
+
#if( !$addedImportNotNull )
|
|
67
|
+
#set( $attributePostable = $attribute.tagValueAsBoolean( "postable", true ) )
|
|
68
|
+
#if( ($attributePostable && $attribute.isNotNull()) || $logicalDeletion )
|
|
69
|
+
import jakarta.validation.constraints.NotNull;
|
|
70
|
+
#set( $addedImportNotNull = true)
|
|
71
|
+
#end
|
|
72
|
+
#end
|
|
73
|
+
## Check if existe some attribute with Size constraint
|
|
74
|
+
#if( !$addedImportSize )
|
|
75
|
+
#set( $attributePostable = $attribute.tagValueAsBoolean( "postable", true ) )
|
|
76
|
+
#set( $attributeUpdatable = $attribute.tagValueAsBoolean( "updatable", true ) )
|
|
77
|
+
#if( $attribute.isStringType() && ($attributePostable || $attributeUpdatable) && $attribute.maxLength != "")
|
|
78
|
+
import jakarta.validation.constraints.Size;
|
|
79
|
+
#set( $addedImportSize = true)
|
|
80
|
+
#end
|
|
81
|
+
#end
|
|
82
|
+
## Check if existe some attribute with Pattern constraint
|
|
83
|
+
#if( !$addedImportPattern )
|
|
84
|
+
#set( $attributePostable = $attribute.tagValueAsBoolean( "postable", true ) )
|
|
85
|
+
#set( $attributeUpdatable = $attribute.tagValueAsBoolean( "updatable", true ) )
|
|
86
|
+
#if( ($attributePostable || $attributeUpdatable) && $attribute.pattern != "")
|
|
87
|
+
import jakarta.validation.constraints.Pattern;
|
|
88
|
+
#set( $addedImportPattern = true)
|
|
89
|
+
#end
|
|
90
|
+
#end
|
|
91
|
+
## Check if all imports was added to finish foreach
|
|
92
|
+
#if( $addedImportNotBlank && $addedImportNotNull && $addedImportSize && $addedImportPattern)
|
|
93
|
+
#break
|
|
94
|
+
#end
|
|
95
|
+
## End foreach $entity.attributes
|
|
96
|
+
#end
|
|
97
|
+
## End macro addConstraintsAnnotationsImports
|
|
98
|
+
#end
|
|
99
|
+
## Macro: addConstraintsAnnotations. Add all constraints annotations for aggregate's field
|
|
100
|
+
#macro( addConstraintsAnnotations $attribute )
|
|
101
|
+
#set( $attributePostable = $attribute.tagValueAsBoolean( "postable", true ) )
|
|
102
|
+
#set( $attributeUpdatable = $attribute.tagValueAsBoolean( "updatable", true ) )
|
|
103
|
+
#set( $attributeReadable = $attribute.tagValueAsBoolean( "readable", true ) )
|
|
104
|
+
#set( $attributeFilterable = $attribute.tagValueAsBoolean( "filterable", true ) )
|
|
105
|
+
#set( $validators = [] )
|
|
106
|
+
#if ( $attributePostable )
|
|
107
|
+
#set( $z = $validators.add("CreateValidator.class") )
|
|
108
|
+
#end
|
|
109
|
+
#if ( $attributeUpdatable )
|
|
110
|
+
#set( $z = $validators.add("UpdateValidator.class") )
|
|
111
|
+
#end
|
|
112
|
+
#if( $attributePostable || $attributeUpdatable )
|
|
113
|
+
#if($attribute.isNotBlank())
|
|
114
|
+
@NotBlank(message = "The field <#snakeLowerCase( ${attribute.name} )> is mandatory", groups = { $fn.join($validators, ", ") })
|
|
115
|
+
#elseif( $attribute.isNotNull() )
|
|
116
|
+
@NotNull(message = "The field <#snakeLowerCase( ${attribute.name} )> is mandatory", groups = { $fn.join($validators, ", ") })
|
|
117
|
+
#end
|
|
118
|
+
#if( $attribute.isStringType() && $attribute.maxLength != "" )
|
|
119
|
+
@Size(
|
|
120
|
+
message = "The field <#snakeLowerCase( ${attribute.name} )> has exceeded maximum length (${attribute.maxLength} characters)",
|
|
121
|
+
max = ${attribute.maxLength},
|
|
122
|
+
groups = { $fn.join($validators, ", ") }
|
|
123
|
+
)
|
|
124
|
+
#end
|
|
125
|
+
#if( $attribute.pattern != "" )
|
|
126
|
+
@Pattern(
|
|
127
|
+
message = "The field <#snakeLowerCase( ${attribute.name} )> does not match the pattern: ${attribute.pattern})",
|
|
128
|
+
regexp = "${attribute.pattern}",
|
|
129
|
+
groups = { $fn.join($validators, ", ") }
|
|
130
|
+
)
|
|
131
|
+
#end
|
|
132
|
+
#end
|
|
133
|
+
#end
|
|
134
|
+
## Macro: addResourceFieldAnnotations. Add all resource's field annotations
|
|
135
|
+
#macro( addResourceFieldAnnotations $attribute )
|
|
136
|
+
#set( $attributePostable = $attribute.tagValueAsBoolean( "postable", true ) )
|
|
137
|
+
#set( $attributeUpdatable = $attribute.tagValueAsBoolean( "updatable", true ) )
|
|
138
|
+
#set( $attributeReadable = $attribute.tagValueAsBoolean( "readable", true ) )
|
|
139
|
+
#set( $attributeFilterable = $attribute.tagValueAsBoolean( "filterable", true ) )
|
|
140
|
+
#if( $attributePostable || $attributeUpdatable )
|
|
141
|
+
#if( $attributeReadable )
|
|
142
|
+
@JsonProperty(access = Access.READ_WRITE)
|
|
143
|
+
#else
|
|
144
|
+
@JsonProperty(access = Access.WRITE_ONLY)
|
|
145
|
+
#end
|
|
146
|
+
@JsonApiField(filterable = $attributeFilterable)
|
|
147
|
+
#elseif( $attributeReadable )
|
|
148
|
+
@JsonProperty(access = Access.READ_ONLY)
|
|
149
|
+
@JsonApiField(filterable = $attributeFilterable)
|
|
150
|
+
#else
|
|
151
|
+
@JsonIgnore
|
|
152
|
+
#end
|
|
153
|
+
#end
|
|
154
|
+
## Macro: javaTypeToTsType. Convierte un tipo de Java a su equivalente en TypeScript
|
|
155
|
+
#macro( javaTypeToTsType $javaType )
|
|
156
|
+
#if( $javaType == "String" )
|
|
157
|
+
string#elseif( $javaType == "Long" || $javaType == "Integer" || $javaType == "Double" || $javaType == "Float" || $javaType == "BigDecimal" )
|
|
158
|
+
number#elseif( $javaType == "Boolean" || $javaType == "boolean" )
|
|
159
|
+
boolean#elseif( $javaType == "LocalDate" || $javaType == "LocalDateTime" || $javaType == "Date" )
|
|
160
|
+
string#elseif( $javaType == "byte[]" )
|
|
161
|
+
Uint8Array#else
|
|
162
|
+
any#end#end
|
|
163
|
+
## Macro: extractGenericType. Extrae el tipo entre < > de un tipo genérico
|
|
164
|
+
#macro( extractGenericType $type )
|
|
165
|
+
#set( $match = $type.replaceAll(".*<([a-zA-Z0-9_]+)>.*", "$1") )
|
|
166
|
+
$match#end
|
|
167
|
+
## Macro: tsDefaultValue. Devuelve un valor de inicialización según el tipo Java
|
|
168
|
+
#macro( tsDefaultValue $javaType )
|
|
169
|
+
#if( $javaType == "String" )
|
|
170
|
+
= ''#elseif( $javaType == "Long" || $javaType == "Integer" || $javaType == "Double" || $javaType == "Float" || $javaType == "BigDecimal" )
|
|
171
|
+
= 0#elseif( $javaType == "Boolean" || $javaType == "boolean" )
|
|
172
|
+
= false#elseif( $javaType == "LocalDate" || $javaType == "LocalDateTime" || $javaType == "Date" )
|
|
173
|
+
= ''#elseif( $javaType == "byte[]" )
|
|
174
|
+
= new Uint8Array()#else
|
|
175
|
+
= undefined#end#end
|
|
176
|
+
## Macro: Devuelve el tipo de columna de un campo del modelo
|
|
177
|
+
#macro( columnType $input )
|
|
178
|
+
#set($type = "")
|
|
179
|
+
#if($input == "string" || $input == "String")
|
|
180
|
+
#set($type = "ColumnType.TEXT")
|
|
181
|
+
#elseif($input == "integer" || $input == "Integer" || $input == "int" || $input == "long" || $input == "Long" || $input == "double" || $input == "Double" || $input == "float" || $input == "Float" || $input == "BigDecimal")
|
|
182
|
+
#set($type = "ColumnType.NUMBER")
|
|
183
|
+
#elseif($input == "boolean" || $input == "Boolean")
|
|
184
|
+
#set($type = "ColumnType.BOOLEAN")
|
|
185
|
+
#elseif($input == "LocalDate" || $input == "localdate" || $input == "Date" || $input == "date")
|
|
186
|
+
#set($type = "ColumnType.DATE")
|
|
187
|
+
#elseif($input == "byte[]")
|
|
188
|
+
#set($type = "ColumnType.FILE")
|
|
189
|
+
#else
|
|
190
|
+
#set($type = "ColumnType.TEXT")
|
|
191
|
+
#end
|
|
192
|
+
$type
|
|
193
|
+
#end
|
|
194
|
+
## Extract and convert string in to list
|
|
195
|
+
#macro(printTagValueAsList $element $tagName)
|
|
196
|
+
#set($rawValue = $element.tagValue($tagName))
|
|
197
|
+
#if($rawValue && $rawValue.trim() != "")
|
|
198
|
+
#set($parts = $rawValue.split(","))
|
|
199
|
+
, #foreach($p in $parts)
|
|
200
|
+
'$p.trim()'#if($foreach.hasNext), #end
|
|
201
|
+
#end
|
|
202
|
+
#end
|
|
203
|
+
#end
|
|
204
|
+
## Extract and convert string in to object column
|
|
205
|
+
#macro(printTagAsColumnObjects $element $tagName)
|
|
206
|
+
#set($rawValue = $element.tagValue($tagName))
|
|
207
|
+
#if($rawValue && $rawValue.trim() != "")
|
|
208
|
+
#set($parts = $rawValue.split(","))
|
|
209
|
+
, #foreach($p in $parts)
|
|
210
|
+
{
|
|
211
|
+
field: '$p.trim()',
|
|
212
|
+
header: '$p.trim()',
|
|
213
|
+
type: ColumnType.TEXT
|
|
214
|
+
}#if($foreach.hasNext),#end
|
|
215
|
+
#end
|
|
216
|
+
#end
|
|
217
|
+
#end
|
|
218
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
import { provideHttpClient, withFetch, withInterceptors } from '@angular/common/http';
|
|
3
|
+
import { ApplicationConfig, importProvidersFrom, InjectionToken } from '@angular/core';
|
|
4
|
+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
5
|
+
import { provideRouter, withEnabledBlockingInitialNavigation, withInMemoryScrolling } from '@angular/router';
|
|
6
|
+
import { providePrimeNG } from 'primeng/config';
|
|
7
|
+
import { ToastModule } from 'primeng/toast';
|
|
8
|
+
import { MessageService } from 'primeng/api';
|
|
9
|
+
import { appRoutes } from './app.routes';
|
|
10
|
+
import { DibaPreset } from '@root/themes/diba.preset';
|
|
11
|
+
import { authInterceptor } from '@core/interceptors/auth.interceptor';
|
|
12
|
+
import { httpResponseInterceptor } from '@core/interceptors/http-response.interceptor';
|
|
13
|
+
|
|
14
|
+
import { UserInfoRepositoryInterface } from '@core/user-info/domain/user-info.repository.interface';
|
|
15
|
+
export const USER_INFO_REPOSITORY_TOKEN = new InjectionToken<UserInfoRepositoryInterface>('UserInfoRepositoryToken');
|
|
16
|
+
import { UserInfoRepositoryImpl } from '@core/user-info/infrastructure/outbound/user-info.repository.impl';
|
|
17
|
+
|
|
18
|
+
import { SystemInfoRepositoryInterface } from '@core/system-info/domain/system-info.repository.interface';
|
|
19
|
+
export const SYSTEM_INFO_REPOSITORY_TOKEN = new InjectionToken<SystemInfoRepositoryInterface>('SystemInfoRepositoryToken');
|
|
20
|
+
import { SystemInfoRepositoryImpl } from '@core/system-info/infrastructure/outbound/system-info.repository.impl';
|
|
21
|
+
|
|
22
|
+
#foreach( $entityM in $model.allEntities )
|
|
23
|
+
import { ${entityM}RepositoryInterface } from '@modules/#kebabCase("${entityM}")/domain/#kebabCase("${entityM}").repository.interface';
|
|
24
|
+
import { ${entityM}RepositoryImpl } from '@modules/#kebabCase("${entityM}")/infrastructure/outbound/#kebabCase("${entityM}").repository.impl';
|
|
25
|
+
#end
|
|
26
|
+
|
|
27
|
+
#foreach( $entityM in $model.allEntities )
|
|
28
|
+
export const #snakeUpperCase("${entityM}")_REPOSITORY_TOKEN = new InjectionToken<${entityM}RepositoryInterface>('${entityM}RepositoryToken');
|
|
29
|
+
#end
|
|
30
|
+
|
|
31
|
+
export const appConfig: ApplicationConfig = {
|
|
32
|
+
providers: [
|
|
33
|
+
provideRouter(appRoutes, withInMemoryScrolling({ anchorScrolling: 'enabled', scrollPositionRestoration: 'enabled' }), withEnabledBlockingInitialNavigation()),
|
|
34
|
+
provideHttpClient(
|
|
35
|
+
withFetch(),
|
|
36
|
+
withInterceptors([
|
|
37
|
+
authInterceptor,
|
|
38
|
+
httpResponseInterceptor
|
|
39
|
+
])),
|
|
40
|
+
provideAnimationsAsync(),
|
|
41
|
+
providePrimeNG({
|
|
42
|
+
theme: {
|
|
43
|
+
preset: DibaPreset
|
|
44
|
+
},
|
|
45
|
+
translation: {}
|
|
46
|
+
}),
|
|
47
|
+
importProvidersFrom(ToastModule),
|
|
48
|
+
MessageService,
|
|
49
|
+
|
|
50
|
+
{ provide: USER_INFO_REPOSITORY_TOKEN, useClass: UserInfoRepositoryImpl } ,// Binding token to class
|
|
51
|
+
{ provide: SYSTEM_INFO_REPOSITORY_TOKEN, useClass: SystemInfoRepositoryImpl } ,// Binding token to class
|
|
52
|
+
#foreach( $entityM in $model.allEntities )
|
|
53
|
+
{ provide: #snakeUpperCase("${entityM}")_REPOSITORY_TOKEN, useClass: ${entityM}RepositoryImpl } #comma( $foreach.hasNext )// Binding token to class
|
|
54
|
+
#end
|
|
55
|
+
]
|
|
56
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
import { Routes } from '@angular/router';
|
|
3
|
+
import { authCanMatch } from '@core/guards/auth.guard';
|
|
4
|
+
import { LayoutComponent } from '@core/layout/component/layout/layout.component';
|
|
5
|
+
import { NotFoundComponent } from '@core/layout/component/not-found/not-found.component';
|
|
6
|
+
|
|
7
|
+
export const appRoutes: Routes = [
|
|
8
|
+
{
|
|
9
|
+
path: '',
|
|
10
|
+
canMatch: [authCanMatch],
|
|
11
|
+
component: LayoutComponent,
|
|
12
|
+
children: [
|
|
13
|
+
#foreach( $entityM in $model.allEntities )
|
|
14
|
+
{ path: '#kebabCase("${entityM}")', loadChildren: () => import('@modules/#kebabCase("${entityM}")/infrastructure/inbound/pages/#kebabCase("${entityM}").routes') } #comma( $foreach.hasNext )
|
|
15
|
+
|
|
16
|
+
#end
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{ path: 'pagina-no-trobada', component: NotFoundComponent },
|
|
20
|
+
{ path: '**', redirectTo: '/pagina-no-trobada' }
|
|
21
|
+
];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import { NgForOf } from '@angular/common';
|
|
4
|
+
import { MenuItem } from 'primeng/api';
|
|
5
|
+
import { MenuitemComponent } from '../menuitem/menuitem.component';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-menu',
|
|
9
|
+
imports: [MenuitemComponent, NgForOf],
|
|
10
|
+
templateUrl: './menu.component.html',
|
|
11
|
+
styleUrl: './menu.component.scss'
|
|
12
|
+
})
|
|
13
|
+
export class MenuComponent {
|
|
14
|
+
protected model: MenuItem[] = [
|
|
15
|
+
{
|
|
16
|
+
label: 'FAM-APP',
|
|
17
|
+
items: [
|
|
18
|
+
{
|
|
19
|
+
label: 'Inici',
|
|
20
|
+
icon: 'pi pi-fw pi-home',
|
|
21
|
+
routerLink: ['/']
|
|
22
|
+
},
|
|
23
|
+
#foreach( $entityM in $model.allEntities )
|
|
24
|
+
{ label: '$entityM', icon: 'pi pi-fw pi-list', routerLink: ['/#kebabCase("${entityM}")'] } #comma( $foreach.hasNext )
|
|
25
|
+
|
|
26
|
+
#end
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
];
|
|
30
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import { NgForOf } from '@angular/common';
|
|
4
|
+
import { MenuItem } from 'primeng/api';
|
|
5
|
+
import { MenuitemComponent } from '../menuitem/menuitem.component';
|
|
6
|
+
import { MenubarModule } from 'primeng/menubar';
|
|
7
|
+
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
8
|
+
import { faSquareCaretLeft } from '@fortawesome/free-regular-svg-icons';
|
|
9
|
+
import { TopMenuService } from '@core/layout/service/top-menu/top-menu.service';
|
|
10
|
+
import { LayoutService } from '@core/layout/service/layout.service';
|
|
11
|
+
import { MenuModelService } from '@core/layout/service/menu.model.service';
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'app-top-menu',
|
|
15
|
+
imports: [MenuitemComponent, NgForOf, MenubarModule, FontAwesomeModule],
|
|
16
|
+
templateUrl: './top-menu.component.html',
|
|
17
|
+
styleUrl: './top-menu.component.scss'
|
|
18
|
+
})
|
|
19
|
+
export class TopMenuComponent {
|
|
20
|
+
|
|
21
|
+
faSquareCaretLeft = faSquareCaretLeft;
|
|
22
|
+
protected model: MenuItem[];
|
|
23
|
+
|
|
24
|
+
constructor(
|
|
25
|
+
public layoutService: LayoutService,
|
|
26
|
+
private topMenuService: TopMenuService,
|
|
27
|
+
private menuModelService: MenuModelService
|
|
28
|
+
) {
|
|
29
|
+
this.model = this.menuModelService.model;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
toggleMenu() {
|
|
33
|
+
this.topMenuService.toggle();
|
|
34
|
+
this.layoutService.layoutState.update((prev) => ({ ...prev, overlayMenuActive: true }));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { MenuItem } from 'primeng/api';
|
|
4
|
+
import { PrimeNG } from 'primeng/config';
|
|
5
|
+
|
|
6
|
+
@Injectable({ providedIn: 'root' })
|
|
7
|
+
export class MenuModelService {
|
|
8
|
+
primengConfig = inject(PrimeNG);
|
|
9
|
+
translate = (key: string) => (this.primengConfig.translation as Record<string, string>)?.[key] ?? key;
|
|
10
|
+
readonly model: MenuItem[] = [
|
|
11
|
+
{
|
|
12
|
+
label: this.translate('INICI'),
|
|
13
|
+
icon: 'pi pi-fw pi-home',
|
|
14
|
+
routerLink: ['/']
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
#set($DEFAULT_MENU = "MANTENIMENTS")
|
|
18
|
+
#set($menus = [])
|
|
19
|
+
#foreach($e in $model.allEntities)
|
|
20
|
+
#set($menuName = $e.tagValue("Menu", $DEFAULT_MENU))
|
|
21
|
+
#if(!$menus.contains($menuName))
|
|
22
|
+
#set($void = $menus.add($menuName))
|
|
23
|
+
#end
|
|
24
|
+
#end
|
|
25
|
+
|
|
26
|
+
#foreach($menu in $menus)
|
|
27
|
+
{
|
|
28
|
+
label: this.translate('$menu'),
|
|
29
|
+
items: [
|
|
30
|
+
#set($first = true)
|
|
31
|
+
#foreach($e in $model.allEntities)
|
|
32
|
+
#set($menuName = $e.tagValue("Menu", $DEFAULT_MENU))
|
|
33
|
+
#if($menuName == $menu)
|
|
34
|
+
#if(!$first),#end
|
|
35
|
+
#set($route = "/#kebabCase('${e.name}')")
|
|
36
|
+
{
|
|
37
|
+
label: this.translate('${e.name}'),
|
|
38
|
+
icon: 'pi pi-fw pi-list',
|
|
39
|
+
routerLink: ['/#kebabCase("${e.name}")']
|
|
40
|
+
}
|
|
41
|
+
#set($first = false)
|
|
42
|
+
#end
|
|
43
|
+
#end
|
|
44
|
+
]
|
|
45
|
+
} #comma($foreach.hasNext)
|
|
46
|
+
|
|
47
|
+
#end
|
|
48
|
+
];
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
import { Inject, Injectable } from '@angular/core';
|
|
7
|
+
import { ${entityName}RepositoryInterface } from '../domain/#kebabCase("${entityName}").repository.interface';
|
|
8
|
+
import { ${entityName} } from '../domain/#kebabCase("${entityName}").entity';
|
|
9
|
+
import { #snakeUpperCase("${entityName}")_REPOSITORY_TOKEN } from '@root/app.config';
|
|
10
|
+
|
|
11
|
+
@Injectable({ providedIn: 'root' })
|
|
12
|
+
export class Create${entityName}UseCase {
|
|
13
|
+
constructor(@Inject(#snakeUpperCase("${entityName}")_REPOSITORY_TOKEN) private repo: ${entityName}RepositoryInterface) {}
|
|
14
|
+
|
|
15
|
+
async execute(#camelCase("${entityName}"): ${entityName}): Promise<${entityName}> {
|
|
16
|
+
return await this.repo.create(#camelCase("${entityName}"));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
import { Inject, Injectable } from '@angular/core';
|
|
7
|
+
import { ${entityName}RepositoryInterface } from '../domain/#kebabCase("${entityName}").repository.interface';
|
|
8
|
+
import { #snakeUpperCase("${entityName}")_REPOSITORY_TOKEN } from '@root/app.config';
|
|
9
|
+
|
|
10
|
+
@Injectable({ providedIn: 'root' })
|
|
11
|
+
export class CreateFile${entityName}UseCase {
|
|
12
|
+
constructor(@Inject(#snakeUpperCase("${entityName}")_REPOSITORY_TOKEN) private repo: ${entityName}RepositoryInterface) {}
|
|
13
|
+
|
|
14
|
+
async execute(id: string, file: File, field: string): Promise<void> {
|
|
15
|
+
return await this.repo.uploadFile(id, file, field);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
import { Inject, Injectable } from '@angular/core';
|
|
7
|
+
import { ${entityName}RepositoryInterface } from '../domain/#kebabCase("${entityName}").repository.interface';
|
|
8
|
+
import { #snakeUpperCase("${entityName}")_REPOSITORY_TOKEN } from '@root/app.config';
|
|
9
|
+
|
|
10
|
+
@Injectable({ providedIn: 'root' })
|
|
11
|
+
export class Delete${entityName}UseCase {
|
|
12
|
+
constructor(@Inject(#snakeUpperCase("${entityName}")_REPOSITORY_TOKEN) private repo: ${entityName}RepositoryInterface) {}
|
|
13
|
+
|
|
14
|
+
async execute(id: string): Promise<void> {
|
|
15
|
+
await this.repo.delete(id);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
#if(!$hasFileType)
|
|
7
|
+
#cancel("No File field found in entity")
|
|
8
|
+
#end
|
|
9
|
+
#if(!$hasFileTypeinNAS)
|
|
10
|
+
#cancel("No NAS File field found in entity")
|
|
11
|
+
#end
|
|
12
|
+
##---------------------------------------------------
|
|
13
|
+
import { Inject, Injectable } from '@angular/core';
|
|
14
|
+
import { ${entityName}RepositoryInterface } from '../domain/#kebabCase("${entityName}").repository.interface';
|
|
15
|
+
import { #snakeUpperCase("${entityName}")_REPOSITORY_TOKEN } from '@root/app.config';
|
|
16
|
+
|
|
17
|
+
@Injectable({ providedIn: 'root' })
|
|
18
|
+
export class Download${entityName}UseCase {
|
|
19
|
+
constructor(@Inject(#snakeUpperCase("${entityName}")_REPOSITORY_TOKEN) private repo: ${entityName}RepositoryInterface) {}
|
|
20
|
+
|
|
21
|
+
async execute(id: number): Promise<Blob> {
|
|
22
|
+
return this.repo.downloadFile(id);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
import { Inject, Injectable } from '@angular/core';
|
|
7
|
+
import { ${entityName}RepositoryInterface } from '../domain/#kebabCase("${entityName}").repository.interface';
|
|
8
|
+
import { ${entityName} } from '../domain/#kebabCase("${entityName}").entity';
|
|
9
|
+
import { #snakeUpperCase("${entityName}")_REPOSITORY_TOKEN } from '@root/app.config';
|
|
10
|
+
|
|
11
|
+
@Injectable({ providedIn: 'root' })
|
|
12
|
+
export class Find${entityName}UseCase {
|
|
13
|
+
constructor(@Inject(#snakeUpperCase("${entityName}")_REPOSITORY_TOKEN) private repo: ${entityName}RepositoryInterface) {}
|
|
14
|
+
|
|
15
|
+
async execute(id: string): Promise<${entityName} | null> {
|
|
16
|
+
return this.repo.find(id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
import { Inject, Injectable } from '@angular/core';
|
|
7
|
+
import { ${entityName}RepositoryInterface } from '../domain/#kebabCase("${entityName}").repository.interface';
|
|
8
|
+
import { ${entityName} } from '../domain/#kebabCase("${entityName}").entity';
|
|
9
|
+
import { #snakeUpperCase("${entityName}")_REPOSITORY_TOKEN } from '@root/app.config';
|
|
10
|
+
import { JsonApiMeta } from '@shared/models/json-api-meta.entity';
|
|
11
|
+
import { Filter } from '@shared/filters/domain/filter.entity';
|
|
12
|
+
|
|
13
|
+
@Injectable({ providedIn: 'root' })
|
|
14
|
+
export class Search${entityName}UseCase {
|
|
15
|
+
constructor(@Inject(#snakeUpperCase("${entityName}")_REPOSITORY_TOKEN) private repo: ${entityName}RepositoryInterface) {}
|
|
16
|
+
|
|
17
|
+
async execute(
|
|
18
|
+
filters?: Filter[],
|
|
19
|
+
include?: string[],
|
|
20
|
+
pagination?: { page: number; limit: number },
|
|
21
|
+
sort?: string
|
|
22
|
+
): Promise<{data: ${entityName}[], meta: JsonApiMeta}> {
|
|
23
|
+
return this.repo.search(filters, include, pagination, sort);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
import { Inject, Injectable } from '@angular/core';
|
|
7
|
+
import { ${entityName}RepositoryInterface } from '../domain/#kebabCase("${entityName}").repository.interface';
|
|
8
|
+
import { ${entityName} } from '../domain/#kebabCase("${entityName}").entity';
|
|
9
|
+
import { #snakeUpperCase("${entityName}")_REPOSITORY_TOKEN } from '@root/app.config';
|
|
10
|
+
|
|
11
|
+
@Injectable({ providedIn: 'root' })
|
|
12
|
+
export class Update${entityName}UseCase {
|
|
13
|
+
constructor(@Inject(#snakeUpperCase("${entityName}")_REPOSITORY_TOKEN) private repo: ${entityName}RepositoryInterface) {}
|
|
14
|
+
|
|
15
|
+
async execute(#camelCase("${entityName}"): ${entityName}): Promise<void> {
|
|
16
|
+
await this.repo.update(#camelCase("${entityName}"));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
#parse("include/macros.vm")
|
|
6
|
+
##---------------------------------------------------
|
|
7
|
+
#foreach( $link in $toOneLinks )
|
|
8
|
+
#if(${link.fieldType}!=${entityName})
|
|
9
|
+
import { ${link.fieldType} } from '../../#kebabCase("$link.fieldType")/domain/#kebabCase("$link.fieldType").entity';
|
|
10
|
+
#end
|
|
11
|
+
#end
|
|
12
|
+
#foreach( $link in $toManyLinks )
|
|
13
|
+
#set( $genericType = "#extractGenericType($link.fieldType)" )
|
|
14
|
+
#if(${link.fieldType}!=$genericType)
|
|
15
|
+
import { $genericType } from '../../#kebabCase("$genericType")/domain/#kebabCase("$genericType").entity';
|
|
16
|
+
#end
|
|
17
|
+
#end
|
|
18
|
+
export interface ${entityName} {
|
|
19
|
+
id?: string;
|
|
20
|
+
#foreach( $attribute in $entity.nonKeyAttributes )
|
|
21
|
+
#set( $attributeType = $attribute.wrapperType )
|
|
22
|
+
#snakeLowerCase("$attribute.name")#if($attribute.isNotNull())?#end: #javaTypeToTsType("$attributeType");
|
|
23
|
+
#end
|
|
24
|
+
#foreach( $link in $toOneLinks )
|
|
25
|
+
#if( $velocityCount == 1 )
|
|
26
|
+
// toOne
|
|
27
|
+
#end
|
|
28
|
+
#snakeLowerCase("${link.fieldName}"): $link.fieldType;
|
|
29
|
+
#end
|
|
30
|
+
#foreach( $link in $toManyLinks )
|
|
31
|
+
#if( $velocityCount == 1 )
|
|
32
|
+
// toMany
|
|
33
|
+
#end
|
|
34
|
+
#snakeLowerCase("${link.fieldName}")?: #extractGenericType("$link.fieldType")[];
|
|
35
|
+
#end
|
|
36
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#parse("include/macros.vm")
|
|
2
|
+
## --------------------------------------------------
|
|
3
|
+
#checkId($entity)
|
|
4
|
+
#parse("include/init_var_entity.vm")
|
|
5
|
+
##---------------------------------------------------
|
|
6
|
+
import { ${entityName} } from './#kebabCase("${entityName}").entity';
|
|
7
|
+
import { JsonApiMeta } from '@shared/models/json-api-meta.entity';
|
|
8
|
+
import { Filter } from '@shared/filters/domain/filter.entity';
|
|
9
|
+
|
|
10
|
+
export interface ${entityName}RepositoryInterface {
|
|
11
|
+
#if($hasFileType)
|
|
12
|
+
create(#camelCase("${entityName}"): ${entityName}, opts?: { file?: File; field?: string }): Promise<${entityName}>;
|
|
13
|
+
#else
|
|
14
|
+
create(#camelCase("${entityName}"): ${entityName}): Promise<${entityName}>;
|
|
15
|
+
#end
|
|
16
|
+
delete(id: string): Promise<void>;
|
|
17
|
+
#if($hasFileType)
|
|
18
|
+
update(#camelCase("${entityName}"): ${entityName}, opts?: { file?: File; field?: string }): Promise<void>;
|
|
19
|
+
#else
|
|
20
|
+
update(#camelCase("${entityName}"): ${entityName}): Promise<void>;
|
|
21
|
+
#end
|
|
22
|
+
find(id: string): Promise<${entityName} | null>;
|
|
23
|
+
search(filter?: Filter[], include?: string[], pagination?: { page: number; limit: number }, sort?: string): Promise<{data: ${entityName}[], meta: JsonApiMeta}>;
|
|
24
|
+
#if($hasFileTypeinNAS)
|
|
25
|
+
downloadFile(id: number): Promise<Blob>;
|
|
26
|
+
#end
|
|
27
|
+
}
|