aboutsummaryrefslogtreecommitdiff
path: root/tools/add-feature-template.sh
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-16 07:48:29 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-16 07:48:29 +0300
commit58464468bb18b0bdc2e087ef52664bb5653d3d4e (patch)
tree664954e132a8e1555046888aec7c4622dbb2fa20 /tools/add-feature-template.sh
parent97ef7568ab088396a5fbb11787e309a81cf2e3af (diff)
downloadit-kariera-exam-template-58464468bb18b0bdc2e087ef52664bb5653d3d4e.tar
it-kariera-exam-template-58464468bb18b0bdc2e087ef52664bb5653d3d4e.tar.gz
it-kariera-exam-template-58464468bb18b0bdc2e087ef52664bb5653d3d4e.zip
Fixed add feature and delete feature scripts
Diffstat (limited to 'tools/add-feature-template.sh')
-rwxr-xr-xtools/add-feature-template.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/add-feature-template.sh b/tools/add-feature-template.sh
index 3b11a44..9637384 100755
--- a/tools/add-feature-template.sh
+++ b/tools/add-feature-template.sh
@@ -32,7 +32,7 @@ dir="../$project_name/Data"
# {{{ --------------------------->
# Create the DB model class
-cat > $dir/Models/$feature_name.cs<< EOF
+cat > $dir/${project_name}.Data.Models/$feature_name.cs<< EOF
using System;
namespace $project_name.Data.Models
@@ -55,7 +55,7 @@ EOF
dbset="public DbSet<$feature_name> ${feature_name}s { get; set; }"
-dbcontext_path="$dir/${project_name}Context.cs"
+dbcontext_path="$dir/${project_name}.Data/${project_name}Context.cs"
if ! grep -q "$dbset" "$dbcontext_path"; then
if grep -Fq "DbSet" $dbcontext_path; then
@@ -77,7 +77,7 @@ dir="../$project_name/Services"
# {{{ --------------------------->
# Create Service and Interface
-cat > $dir/Interfaces/I${feature_name}Service.cs<< EOF
+cat > $dir/${project_name}.Services/Interfaces/I${feature_name}Service.cs<< EOF
using $project_name.Data.Models;
using $project_name.Services.Models.$feature_name;
@@ -88,7 +88,7 @@ namespace $project_name.Services.Interfaces
}
EOF
-cat > $dir/Services/${feature_name}Service.cs<< EOF
+cat > $dir/${project_name}.Services/Services/${feature_name}Service.cs<< EOF
using $project_name.Services.Interfaces;
using System;
using AutoMapper;
@@ -112,7 +112,7 @@ EOF
# {{{ --------------------------->
# Create Service Model
-subdir="$dir/Models/$feature_name"
+subdir="$dir/${project_name}.Services.Models/$feature_name"
mkdir -p $subdir
cat > $subdir/$model${feature_name}ServiceModel.cs<< EOF
@@ -137,7 +137,7 @@ EOF
# {{{ --------------------------->
# Create Service Mappings
-subdir="${dir}/Configurations"
+subdir="$dir/${project_name}.Services/Configurations"
mappings=("${feature_name}ServiceModel, $feature_name" "${feature_name}, ${feature_name}ServiceModel")
cat > $subdir/Service${feature_name}Mappings.cs<< EOF
@@ -173,7 +173,7 @@ dir="../$project_name/Web"
# {{{ --------------------------->
# Add the dependency injection of the Service class
-startup_path="$dir/Startup.cs"
+startup_path="$dir/${project_name}.Web/Startup.cs"
service_name="${feature_name}Service"
if ! grep -q "$service_name" "$startup_path"; then
sed -z -i "s/.*AddTransient[^\n]*\n/&\t\t\tservices.AddTransient<I$service_name, $service_name>();\n/" $startup_path
@@ -184,7 +184,7 @@ fi
# {{{ --------------------------->
# Create View Models
-subdir="$dir/Models/$feature_name"
+subdir="$dir/${project_name}.Web.Models/$feature_name"
mkdir -p $subdir
models=("" "Create" "Edit")
@@ -220,7 +220,7 @@ done
# {{{ --------------------------->
# Update View Imports
-viewimports_path="$dir/Views/_ViewImports.cshtml"
+viewimports_path="$dir/${project_name}.Web/Views/_ViewImports.cshtml"
import_name="$project_name.Web.Models.$feature_name"
if ! grep -q "$import_name" "$viewimports_path"; then
sed -z -i "s/.*@using[^\n]*\n/&@using $import_name\n/" $viewimports_path
@@ -231,7 +231,7 @@ fi
# {{{ --------------------------->
# Create Views
-subdir="$dir/Views/$feature_name"
+subdir="$dir/${project_name}.Web/Views/$feature_name"
mkdir -p $subdir
cat > $subdir/Index.cshtml<< EOF
@@ -342,7 +342,7 @@ EOF
# {{{ --------------------------->
# Create Controller
-subdir="$dir/Controllers"
+subdir="$dir/${project_name}.Web/Controllers"
cat > $subdir/${feature_name}Controller.cs<< EOF
using System;
@@ -461,7 +461,7 @@ EOF
# {{{ --------------------------->
# Create Controller Mappings
-subdir="${dir}/Configurations"
+subdir="${dir}/${project_name}.Web/Configurations"
mappings=("${feature_name}ServiceModel, ${feature_name}WebModel" "Create${feature_name}WebModel, ${feature_name}ServiceModel" "${feature_name}ServiceModel, Edit${feature_name}WebModel" "Edit${feature_name}WebModel, ${feature_name}ServiceModel")
cat > $subdir/Controller${feature_name}Mappings.cs<< EOF