aboutsummaryrefslogtreecommitdiff
path: root/tools/add-feature-template.sh
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-11 11:56:44 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-11 11:56:44 +0300
commit3edb4619a64e26883b752427b179d04ec30adef7 (patch)
tree3723596d0bc2085af7af918a2ac4a22e64ae0ffe /tools/add-feature-template.sh
parent3fca091e1643e7a23a40d961fe5bdc72dd711271 (diff)
downloadit-kariera-exam-template-3edb4619a64e26883b752427b179d04ec30adef7.tar
it-kariera-exam-template-3edb4619a64e26883b752427b179d04ec30adef7.tar.gz
it-kariera-exam-template-3edb4619a64e26883b752427b179d04ec30adef7.zip
Made service models structure resemble that of the web models (models for each "feature" are in their own folder)
Diffstat (limited to 'tools/add-feature-template.sh')
-rwxr-xr-xtools/add-feature-template.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/add-feature-template.sh b/tools/add-feature-template.sh
index c1f59d9..9fea26a 100755
--- a/tools/add-feature-template.sh
+++ b/tools/add-feature-template.sh
@@ -71,7 +71,7 @@ using System.Threading.Tasks;
using AutoMapper;
using $project_name.Data;
using $project_name.Data.Models;
-using $project_name.Services.Models;
+using $project_name.Services.Models.$feature_name;
namespace $project_name.Services
{
@@ -136,7 +136,8 @@ EOF
# {{{ --------------------------->
# Create Service Models
-subdir="$dir/Models"
+subdir="$dir/Models/$feature_name"
+mkdir -p $subdir
models=("" "Create" "Edit")
for model in "${models[@]}"
@@ -144,7 +145,7 @@ do
cat > $subdir/$model${feature_name}ServiceModel.cs<< EOF
using System;
-namespace $project_name.Services.Models {
+namespace $project_name.Services.Models.$feature_name {
public class $model${feature_name}ServiceModel {$(
if [ ! -z $model ]; then
echo -e "\n\t\tpublic Guid Id { get; set; }"
@@ -171,7 +172,7 @@ mappings=("Create${feature_name}ServiceModel, $feature_name" "$feature_name, ${f
cat > $subdir/${feature_name}Mappings.cs<< EOF
using AutoMapper;
using $project_name.Data.Models;
-using $project_name.Services.Models;
+using $project_name.Services.Models.$feature_name;
namespace $project_name.Services.Configurations
{
@@ -239,7 +240,6 @@ done
# }}} ---------------------------<
-
# {{{ --------------------------->
# Update View Imports
@@ -338,7 +338,7 @@ using System;
using System.Threading.Tasks;
using AutoMapper;
using $project_name.Services;
-using $project_name.Services.Models;
+using $project_name.Services.Models.$feature_name;
using $project_name.Web.Models.$feature_name;
using Microsoft.AspNetCore.Mvc;
@@ -441,7 +441,7 @@ subdir="${dir}/Configurations"
mappings=("${feature_name}ServiceModel, ${feature_name}ViewModel" "Create${feature_name}ViewModel, Create${feature_name}ServiceModel" "${feature_name}ServiceModel, Edit${feature_name}ViewModel" "Edit${feature_name}ViewModel, Edit${feature_name}ServiceModel")
cat > $subdir/${feature_name}Mappings.cs<< EOF
using AutoMapper;
-using $project_name.Services.Models;
+using $project_name.Services.Models.$feature_name;
using $project_name.Web.Models.$feature_name;
namespace $project_name.Web.Configurations