@polymorphism-tech/morph-spec 4.6.0 → 4.7.0
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 +394 -700
- package/docs/ARCHITECTURE.md +331 -0
- package/docs/CHEATSHEET.md +221 -0
- package/docs/COMMAND-FLOWS.md +368 -0
- package/docs/QUICKSTART.md +212 -0
- package/docs/examples/order-management/contracts.cs +84 -0
- package/docs/examples/order-management/proposal.md +24 -0
- package/docs/examples/order-management/spec.md +162 -0
- package/docs/plans/2026-02-23-ddd-architecture-refactor.md +1153 -0
- package/docs/plans/2026-02-23-ddd-nextsteps.md +682 -0
- package/docs/plans/2026-02-23-infra-architect-refactor.md +437 -0
- package/docs/plans/2026-02-23-nextjs-code-review-design.md +156 -0
- package/docs/plans/2026-02-23-nextjs-code-review-impl.md +1254 -0
- package/docs/plans/2026-02-23-nextjs-standards-design.md +149 -0
- package/docs/plans/2026-02-23-nextjs-standards-impl.md +1846 -0
- package/framework/agents/README.md +14 -14
- package/framework/agents/architecture/standards-architect.md +159 -159
- package/framework/agents/frontend/nextjs-expert.md +87 -127
- package/framework/agents/infrastructure/azure-architect.md +147 -147
- package/framework/agents/infrastructure/infra-architect.md +45 -0
- package/framework/agents.json +1145 -278
- package/framework/rules/frontend-standards.md +0 -3
- package/framework/rules/nextjs-standards.md +17 -0
- package/framework/skills/level-0-meta/code-review-nextjs/SKILL.md +147 -0
- package/framework/skills/level-0-meta/code-review-nextjs/references/review-example-nextjs.md +254 -0
- package/framework/skills/level-0-meta/tool-usage-guide/SKILL.md +3 -3
- package/framework/skills/level-1-workflows/phase-design/SKILL.md +45 -9
- package/framework/skills/level-1-workflows/phase-tasks/SKILL.md +38 -0
- package/framework/standards/STANDARDS.json +121 -0
- package/framework/standards/architecture/ddd/bounded-contexts.md +105 -0
- package/framework/standards/architecture/ddd/complexity-levels.md +108 -0
- package/framework/standards/architecture/ddd/ubiquitous-language.md +58 -0
- package/framework/standards/frontend/nextjs/app-router.md +123 -0
- package/framework/standards/frontend/nextjs/components.md +132 -0
- package/framework/standards/frontend/nextjs/data-fetching.md +126 -0
- package/framework/standards/frontend/nextjs/forms.md +128 -0
- package/framework/standards/frontend/nextjs/naming-conventions.md +67 -0
- package/framework/standards/frontend/nextjs/project-structure.md +102 -0
- package/framework/standards/frontend/nextjs/state-management.md +72 -0
- package/framework/standards/frontend/nextjs/testing.md +111 -0
- package/framework/templates/REGISTRY.json +538 -142
- package/framework/templates/code/dotnet/contracts/contracts-level1.cs +69 -0
- package/framework/templates/code/dotnet/contracts/contracts-level2.cs +86 -0
- package/framework/templates/code/dotnet/contracts/contracts-level3.cs +41 -0
- package/framework/templates/docs/spec.md +49 -0
- package/framework/templates/frontend/nextjs/Dockerfile.nextjs.hbs +43 -0
- package/framework/templates/frontend/nextjs/client-component.tsx.hbs +26 -0
- package/framework/templates/frontend/nextjs/env.mjs.hbs +32 -0
- package/framework/templates/frontend/nextjs/feature-form.tsx.hbs +56 -0
- package/framework/templates/frontend/nextjs/page.tsx.hbs +22 -0
- package/framework/templates/frontend/nextjs/tsconfig.json.hbs +26 -0
- package/framework/templates/frontend/nextjs/use-feature.ts.hbs +54 -0
- package/framework/templates/project-structure/dotnet-ddd.md +70 -0
- package/framework/workflows/docs/enforcement-pipeline.md +2 -1
- package/package.json +1 -1
- package/scripts/scan-nextjs.mjs +169 -0
- package/src/commands/project/doctor.js +52 -1
- package/src/commands/project/init.js +15 -1
- package/src/commands/project/update.js +6 -1
- package/src/lib/standards/standards-context-injector.js +5 -0
- package/src/lib/validators/nextjs/index.js +6 -0
- package/src/lib/validators/nextjs/next-component-validator.js +181 -0
- package/src/lib/validators/validation-runner.js +5 -0
- package/src/utils/agents-installer.js +14 -2
- package/.morph/.morphversion +0 -5
- package/.morph/analytics/threads-log.jsonl +0 -6
- package/.morph/config/config.json +0 -8
- package/.morph/framework/agents.json +0 -948
- package/.morph/framework/standards/STANDARDS.json +0 -812
- package/.morph/framework/standards/ai-agents/blazor-ui.md +0 -364
- package/.morph/framework/standards/ai-agents/production.md +0 -415
- package/.morph/framework/standards/ai-agents/setup.md +0 -418
- package/.morph/framework/standards/ai-agents/team-orchestration.md +0 -479
- package/.morph/framework/standards/ai-agents/workflows.md +0 -354
- package/.morph/framework/standards/architecture/ddd/aggregates.md +0 -120
- package/.morph/framework/standards/architecture/ddd/entities.md +0 -99
- package/.morph/framework/standards/architecture/ddd/value-objects.md +0 -124
- package/.morph/framework/standards/backend/api/minimal-api.md +0 -494
- package/.morph/framework/standards/backend/api/rest.md +0 -492
- package/.morph/framework/standards/backend/api/validation.md +0 -88
- package/.morph/framework/standards/backend/authentication/passkeys.md +0 -428
- package/.morph/framework/standards/backend/database/ef-core.md +0 -199
- package/.morph/framework/standards/backend/database/migrations.md +0 -393
- package/.morph/framework/standards/backend/database/postgresql/database.md +0 -352
- package/.morph/framework/standards/backend/database/repository-patterns.md +0 -528
- package/.morph/framework/standards/backend/database/vector-search-rag.md +0 -541
- package/.morph/framework/standards/backend/dotnet/async.md +0 -366
- package/.morph/framework/standards/backend/dotnet/core.md +0 -117
- package/.morph/framework/standards/backend/dotnet/di.md +0 -439
- package/.morph/framework/standards/backend/dotnet/program-cs-checklist.md +0 -92
- package/.morph/framework/standards/backend/integrations/asaas/asaas-api.md +0 -216
- package/.morph/framework/standards/backend/integrations/clerk/clerk-auth.md +0 -290
- package/.morph/framework/standards/backend/integrations/hangfire/hangfire-jobs.md +0 -350
- package/.morph/framework/standards/backend/integrations/resend/resend-email.md +0 -385
- package/.morph/framework/standards/context/analytics.md +0 -96
- package/.morph/framework/standards/context/bundles.md +0 -110
- package/.morph/framework/standards/context/priming.md +0 -78
- package/.morph/framework/standards/core/architecture.md +0 -185
- package/.morph/framework/standards/core/coding.md +0 -214
- package/.morph/framework/standards/core/git-branching-strategy.md +0 -403
- package/.morph/framework/standards/core/git.md +0 -185
- package/.morph/framework/standards/core/testing.md +0 -295
- package/.morph/framework/standards/data/nosql/blob-storage.md +0 -102
- package/.morph/framework/standards/data/nosql/cache/redis.md +0 -97
- package/.morph/framework/standards/data/nosql/cosmos-db.md +0 -118
- package/.morph/framework/standards/data/vector-search/azure-ai-search.md +0 -121
- package/.morph/framework/standards/data/vector-search/rag-chunking.md +0 -104
- package/.morph/framework/standards/frontend/blazor/design-checklist.md +0 -222
- package/.morph/framework/standards/frontend/blazor/fluent-ui-setup.md +0 -595
- package/.morph/framework/standards/frontend/blazor/fluent-ui.md +0 -137
- package/.morph/framework/standards/frontend/blazor/html-conversion.md +0 -184
- package/.morph/framework/standards/frontend/blazor/lifecycle.md +0 -195
- package/.morph/framework/standards/frontend/blazor/pitfalls.md +0 -198
- package/.morph/framework/standards/frontend/blazor/state.md +0 -191
- package/.morph/framework/standards/frontend/design-system/animations.md +0 -151
- package/.morph/framework/standards/frontend/design-system/naming.md +0 -64
- package/.morph/framework/standards/frontend/nextjs/nextjs-patterns.md +0 -215
- package/.morph/framework/standards/infrastructure/azure/azure.md +0 -624
- package/.morph/framework/standards/infrastructure/azure/bicep/bicep-patterns.md +0 -422
- package/.morph/framework/standards/infrastructure/azure/devops/azure-devops-setup.md +0 -516
- package/.morph/framework/standards/infrastructure/azure/devops/local-development.md +0 -520
- package/.morph/framework/standards/infrastructure/azure/services/functions.md +0 -486
- package/.morph/framework/standards/infrastructure/azure/services/service-bus.md +0 -459
- package/.morph/framework/standards/infrastructure/azure/services/storage.md +0 -407
- package/.morph/framework/standards/infrastructure/docker/easypanel-deploy.md +0 -196
- package/.morph/framework/standards/infrastructure/supabase/mcp-setup.md +0 -252
- package/.morph/framework/standards/infrastructure/supabase/supabase-auth.md +0 -176
- package/.morph/framework/standards/infrastructure/supabase/supabase-pgvector.md +0 -169
- package/.morph/framework/standards/infrastructure/supabase/supabase-rls.md +0 -184
- package/.morph/framework/standards/infrastructure/supabase/supabase-storage.md +0 -153
- package/.morph/framework/standards/integration/api/graphql.md +0 -91
- package/.morph/framework/standards/integration/api/grpc.md +0 -114
- package/.morph/framework/standards/integration/api/rest-design.md +0 -95
- package/.morph/framework/standards/integration/event-driven/cqrs.md +0 -101
- package/.morph/framework/standards/integration/event-driven/event-sourcing.md +0 -124
- package/.morph/framework/standards/integration/event-driven/service-bus.md +0 -95
- package/.morph/framework/standards/integration/mcp/mcp-tools.md +0 -384
- package/.morph/framework/standards/observability/logging.md +0 -131
- package/.morph/framework/standards/observability/metrics.md +0 -121
- package/.morph/framework/standards/observability/monitoring.md +0 -114
- package/.morph/framework/standards/observability/tracing.md +0 -132
- package/.morph/framework/standards/workflows/parallel-execution.md +0 -112
- package/.morph/framework/standards/workflows/thread-management.md +0 -113
- package/.morph/framework/templates/.idea/morph-templates.xml +0 -92
- package/.morph/framework/templates/.vscode/morph-templates.code-snippets +0 -186
- package/.morph/framework/templates/IDE-SNIPPETS.md +0 -266
- package/.morph/framework/templates/README.md +0 -814
- package/.morph/framework/templates/REGISTRY.json +0 -1492
- package/.morph/framework/templates/code/dotnet/backend/repository.cs +0 -141
- package/.morph/framework/templates/code/dotnet/backend/service.cs +0 -139
- package/.morph/framework/templates/code/dotnet/contracts/Commands.cs +0 -74
- package/.morph/framework/templates/code/dotnet/contracts/Entities.cs +0 -25
- package/.morph/framework/templates/code/dotnet/contracts/Queries.cs +0 -74
- package/.morph/framework/templates/code/dotnet/contracts/README.md +0 -74
- package/.morph/framework/templates/code/dotnet/contracts/api-contracts.cs +0 -173
- package/.morph/framework/templates/code/dotnet/contracts/contracts.cs +0 -217
- package/.morph/framework/templates/code/dotnet/contracts/contracts.cs.hbs +0 -172
- package/.morph/framework/templates/code/dotnet/database/migration.cs +0 -83
- package/.morph/framework/templates/code/dotnet/frontend/component.razor +0 -239
- package/.morph/framework/templates/code/dotnet/jobs/agent.cs +0 -163
- package/.morph/framework/templates/code/dotnet/jobs/job.cs +0 -171
- package/.morph/framework/templates/code/dotnet/test.cs +0 -239
- package/.morph/framework/templates/code/sql/rls-policy.sql +0 -57
- package/.morph/framework/templates/code/sql/supabase-migration.sql +0 -100
- package/.morph/framework/templates/code/sql/supabase-migration.template.sql +0 -113
- package/.morph/framework/templates/code/typescript/contracts.ts +0 -168
- package/.morph/framework/templates/context/CONTEXT-FEATURE.md +0 -276
- package/.morph/framework/templates/context/CONTEXT.md +0 -181
- package/.morph/framework/templates/docs/clarifications.md +0 -253
- package/.morph/framework/templates/docs/onboarding.md +0 -123
- package/.morph/framework/templates/docs/proposal.md +0 -182
- package/.morph/framework/templates/docs/schema-analysis.md +0 -119
- package/.morph/framework/templates/docs/spec.md +0 -149
- package/.morph/framework/templates/docs/ui-components.md +0 -124
- package/.morph/framework/templates/docs/ui-design-system.md +0 -76
- package/.morph/framework/templates/docs/ui-flows.md +0 -167
- package/.morph/framework/templates/docs/ui-mockups.md +0 -98
- package/.morph/framework/templates/docs/user-stories.md +0 -34
- package/.morph/framework/templates/examples/design-system-examples.md +0 -357
- package/.morph/framework/templates/examples/spec-examples.md +0 -90
- package/.morph/framework/templates/feature/decisions.md +0 -187
- package/.morph/framework/templates/feature/recap.md +0 -146
- package/.morph/framework/templates/feature/tasks.md +0 -199
- package/.morph/framework/templates/infrastructure/azure/Dockerfile.example +0 -82
- package/.morph/framework/templates/infrastructure/azure/README.md +0 -286
- package/.morph/framework/templates/infrastructure/azure/app-insights.bicep +0 -63
- package/.morph/framework/templates/infrastructure/azure/app-service.bicep +0 -164
- package/.morph/framework/templates/infrastructure/azure/container-app-env.bicep +0 -49
- package/.morph/framework/templates/infrastructure/azure/container-app.bicep +0 -156
- package/.morph/framework/templates/infrastructure/azure/deploy-checklist.md +0 -426
- package/.morph/framework/templates/infrastructure/azure/deploy.ps1 +0 -229
- package/.morph/framework/templates/infrastructure/azure/deploy.sh +0 -208
- package/.morph/framework/templates/infrastructure/azure/key-vault.bicep +0 -91
- package/.morph/framework/templates/infrastructure/azure/main.bicep +0 -189
- package/.morph/framework/templates/infrastructure/azure/parameters.dev.json +0 -29
- package/.morph/framework/templates/infrastructure/azure/parameters.prod.json +0 -29
- package/.morph/framework/templates/infrastructure/azure/parameters.staging.json +0 -29
- package/.morph/framework/templates/infrastructure/azure/sql-database.bicep +0 -103
- package/.morph/framework/templates/infrastructure/azure/storage.bicep +0 -106
- package/.morph/framework/templates/infrastructure/docker/Dockerfile.template +0 -58
- package/.morph/framework/templates/infrastructure/docker/docker-compose.template.yml +0 -67
- package/.morph/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +0 -38
- package/.morph/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +0 -48
- package/.morph/framework/templates/infrastructure/docker/easypanel.template.json +0 -54
- package/.morph/framework/templates/infrastructure/github/README.md +0 -593
- package/.morph/framework/templates/infrastructure/github/actions/azure-auth/action.yml.hbs +0 -22
- package/.morph/framework/templates/infrastructure/github/actions/docker-build-push/action.yml.hbs +0 -45
- package/.morph/framework/templates/infrastructure/github/actions/health-check/action.yml.hbs +0 -27
- package/.morph/framework/templates/infrastructure/github/workflows/deploy-azure-app-service.yml.hbs +0 -61
- package/.morph/framework/templates/infrastructure/github/workflows/deploy-easypanel.yml.hbs +0 -31
- package/.morph/framework/templates/infrastructure/github/workflows/docker-build-push.yml.hbs +0 -59
- package/.morph/framework/templates/infrastructure/github/workflows/dotnet-build.yml.hbs +0 -39
- package/.morph/framework/templates/integrations/asaas-client.cs +0 -387
- package/.morph/framework/templates/integrations/asaas-webhook.cs +0 -351
- package/.morph/framework/templates/integrations/azure-identity-config.cs +0 -288
- package/.morph/framework/templates/integrations/clerk-config.cs +0 -258
- package/.morph/framework/templates/meta-prompts/fusion/fusion-agent.md +0 -76
- package/.morph/framework/templates/meta-prompts/fusion/fusion-aggregator.md +0 -100
- package/.morph/framework/templates/meta-prompts/hops/hop-retry.md +0 -78
- package/.morph/framework/templates/meta-prompts/hops/hop-validation.md +0 -97
- package/.morph/framework/templates/meta-prompts/hops/hop-wrapper.md +0 -36
- package/.morph/framework/templates/meta-prompts/parallel-workers/parallel-coordinator.md +0 -113
- package/.morph/framework/templates/meta-prompts/parallel-workers/parallel-worker.md +0 -80
- package/.morph/framework/templates/meta-prompts/squad-leaders/backend-squad.md +0 -90
- package/.morph/framework/templates/meta-prompts/squad-leaders/frontend-squad.md +0 -126
- package/.morph/framework/templates/meta-prompts/squad-leaders/squad-leader.md +0 -43
- package/.morph/framework/templates/meta-prompts/validators/checkpoint-validator.md +0 -107
- package/.morph/framework/templates/meta-prompts/validators/pre-commit-validator.md +0 -95
- package/.morph/framework/templates/saas/subscription.cs +0 -347
- package/.morph/framework/templates/saas/tenant.cs +0 -338
- package/.morph/framework/templates/state.template.json +0 -17
- package/.morph/framework/templates/ui/FluentDesignTheme.cs +0 -149
- package/.morph/framework/templates/ui/MudTheme.cs +0 -281
- package/.morph/framework/templates/ui/design-system.css +0 -226
- package/.morph/logs/tool-failures.log +0 -7
- package/.morph/memory/pre-compact-2026-02-23T15-43-03-521Z.json +0 -16
- package/.morph/state.json +0 -48
- package/framework/templates/code/dotnet/contracts/contracts.cs +0 -217
- package/framework/templates/code/dotnet/contracts/contracts.cs.hbs +0 -172
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// REPOSITORY TEMPLATE
|
|
3
|
-
// Generated by MORPH Framework
|
|
4
|
-
// ============================================================
|
|
5
|
-
|
|
6
|
-
using Microsoft.EntityFrameworkCore;
|
|
7
|
-
using {{NAMESPACE}}.Domain.Entities;
|
|
8
|
-
|
|
9
|
-
namespace {{NAMESPACE}}.Infrastructure.Data.Repositories;
|
|
10
|
-
|
|
11
|
-
/// <summary>
|
|
12
|
-
/// Repository for {{pascalCase FEATURE_NAME}} data access.
|
|
13
|
-
/// </summary>
|
|
14
|
-
public class {{pascalCase FEATURE_NAME}}Repository(AppDbContext context) : I{{pascalCase FEATURE_NAME}}Repository
|
|
15
|
-
{
|
|
16
|
-
private readonly DbSet<{{pascalCase FEATURE_NAME}}> _dbSet = context.Set<{{pascalCase FEATURE_NAME}}>();
|
|
17
|
-
|
|
18
|
-
/// <inheritdoc />
|
|
19
|
-
public async Task<{{pascalCase FEATURE_NAME}}?> GetByIdAsync(int id, CancellationToken cancellationToken = default)
|
|
20
|
-
{
|
|
21
|
-
return await _dbSet
|
|
22
|
-
.AsNoTracking()
|
|
23
|
-
.FirstOrDefaultAsync(x => x.Id == id, cancellationToken);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/// <inheritdoc />
|
|
27
|
-
public async Task<List<{{pascalCase FEATURE_NAME}}>> GetAllAsync(CancellationToken cancellationToken = default)
|
|
28
|
-
{
|
|
29
|
-
return await _dbSet
|
|
30
|
-
.AsNoTracking()
|
|
31
|
-
.OrderByDescending(x => x.CreatedAt)
|
|
32
|
-
.ToListAsync(cancellationToken);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/// <inheritdoc />
|
|
36
|
-
public async Task AddAsync({{pascalCase FEATURE_NAME}} entity, CancellationToken cancellationToken = default)
|
|
37
|
-
{
|
|
38
|
-
await _dbSet.AddAsync(entity, cancellationToken);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/// <inheritdoc />
|
|
42
|
-
public void Update({{pascalCase FEATURE_NAME}} entity)
|
|
43
|
-
{
|
|
44
|
-
_dbSet.Update(entity);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/// <inheritdoc />
|
|
48
|
-
public void Remove({{pascalCase FEATURE_NAME}} entity)
|
|
49
|
-
{
|
|
50
|
-
_dbSet.Remove(entity);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/// <inheritdoc />
|
|
54
|
-
public async Task SaveChangesAsync(CancellationToken cancellationToken = default)
|
|
55
|
-
{
|
|
56
|
-
await context.SaveChangesAsync(cancellationToken);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
#region Additional Query Methods
|
|
60
|
-
|
|
61
|
-
/// <summary>
|
|
62
|
-
/// Gets {{pascalCase FEATURE_NAME}}s by status.
|
|
63
|
-
/// </summary>
|
|
64
|
-
public async Task<List<{{pascalCase FEATURE_NAME}}>> GetByStatusAsync(
|
|
65
|
-
{{pascalCase FEATURE_NAME}}Status status,
|
|
66
|
-
CancellationToken cancellationToken = default)
|
|
67
|
-
{
|
|
68
|
-
return await _dbSet
|
|
69
|
-
.AsNoTracking()
|
|
70
|
-
.Where(x => x.Status == status)
|
|
71
|
-
.OrderByDescending(x => x.CreatedAt)
|
|
72
|
-
.ToListAsync(cancellationToken);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/// <summary>
|
|
76
|
-
/// Checks if a {{pascalCase FEATURE_NAME}} with the given name exists.
|
|
77
|
-
/// </summary>
|
|
78
|
-
public async Task<bool> ExistsByNameAsync(
|
|
79
|
-
string name,
|
|
80
|
-
CancellationToken cancellationToken = default)
|
|
81
|
-
{
|
|
82
|
-
return await _dbSet
|
|
83
|
-
.AsNoTracking()
|
|
84
|
-
.AnyAsync(x => x.Name == name, cancellationToken);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/// <summary>
|
|
88
|
-
/// Gets {{pascalCase FEATURE_NAME}}s with pagination.
|
|
89
|
-
/// </summary>
|
|
90
|
-
public async Task<(List<{{pascalCase FEATURE_NAME}}> Items, int TotalCount)> GetPagedAsync(
|
|
91
|
-
int page,
|
|
92
|
-
int pageSize,
|
|
93
|
-
CancellationToken cancellationToken = default)
|
|
94
|
-
{
|
|
95
|
-
var query = _dbSet.AsNoTracking();
|
|
96
|
-
|
|
97
|
-
var totalCount = await query.CountAsync(cancellationToken);
|
|
98
|
-
|
|
99
|
-
var items = await query
|
|
100
|
-
.OrderByDescending(x => x.CreatedAt)
|
|
101
|
-
.Skip((page - 1) * pageSize)
|
|
102
|
-
.Take(pageSize)
|
|
103
|
-
.ToListAsync(cancellationToken);
|
|
104
|
-
|
|
105
|
-
return (items, totalCount);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
#endregion
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// ============================================================
|
|
112
|
-
// EF CORE CONFIGURATION
|
|
113
|
-
// ============================================================
|
|
114
|
-
|
|
115
|
-
public class {{pascalCase FEATURE_NAME}}Configuration : IEntityTypeConfiguration<{{pascalCase FEATURE_NAME}}>
|
|
116
|
-
{
|
|
117
|
-
public void Configure(EntityTypeBuilder<{{pascalCase FEATURE_NAME}}> builder)
|
|
118
|
-
{
|
|
119
|
-
builder.ToTable("{{pascalCase FEATURE_NAME}}s");
|
|
120
|
-
|
|
121
|
-
builder.HasKey(x => x.Id);
|
|
122
|
-
|
|
123
|
-
builder.Property(x => x.Name)
|
|
124
|
-
.IsRequired()
|
|
125
|
-
.HasMaxLength(200);
|
|
126
|
-
|
|
127
|
-
builder.Property(x => x.Status)
|
|
128
|
-
.IsRequired()
|
|
129
|
-
.HasConversion<string>();
|
|
130
|
-
|
|
131
|
-
builder.Property(x => x.CreatedAt)
|
|
132
|
-
.IsRequired();
|
|
133
|
-
|
|
134
|
-
builder.Property(x => x.UpdatedAt);
|
|
135
|
-
|
|
136
|
-
// Indexes
|
|
137
|
-
builder.HasIndex(x => x.Name);
|
|
138
|
-
builder.HasIndex(x => x.Status);
|
|
139
|
-
builder.HasIndex(x => x.CreatedAt);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// SERVICE TEMPLATE
|
|
3
|
-
// Generated by MORPH Framework
|
|
4
|
-
// ============================================================
|
|
5
|
-
|
|
6
|
-
using Microsoft.Extensions.Logging;
|
|
7
|
-
|
|
8
|
-
namespace {{NAMESPACE}}.Application.Features.{{pascalCase FEATURE_NAME}}.Services;
|
|
9
|
-
|
|
10
|
-
/// <summary>
|
|
11
|
-
/// Service for managing {{pascalCase FEATURE_NAME}} operations.
|
|
12
|
-
/// </summary>
|
|
13
|
-
public class {{pascalCase FEATURE_NAME}}Service(
|
|
14
|
-
I{{pascalCase FEATURE_NAME}}Repository repository,
|
|
15
|
-
ILogger<{{pascalCase FEATURE_NAME}}Service> logger) : I{{pascalCase FEATURE_NAME}}Service
|
|
16
|
-
{
|
|
17
|
-
/// <inheritdoc />
|
|
18
|
-
public async Task<{{pascalCase FEATURE_NAME}}Dto?> GetByIdAsync(int id, CancellationToken cancellationToken = default)
|
|
19
|
-
{
|
|
20
|
-
logger.LogDebug("Getting {{pascalCase FEATURE_NAME}} with ID {Id}", id);
|
|
21
|
-
|
|
22
|
-
var entity = await repository.GetByIdAsync(id, cancellationToken);
|
|
23
|
-
if (entity is null)
|
|
24
|
-
{
|
|
25
|
-
logger.LogWarning("{{pascalCase FEATURE_NAME}} with ID {Id} not found", id);
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return MapToDto(entity);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/// <inheritdoc />
|
|
33
|
-
public async Task<List<{{pascalCase FEATURE_NAME}}Dto>> GetAllAsync(CancellationToken cancellationToken = default)
|
|
34
|
-
{
|
|
35
|
-
logger.LogDebug("Getting all {{pascalCase FEATURE_NAME}}s");
|
|
36
|
-
|
|
37
|
-
var entities = await repository.GetAllAsync(cancellationToken);
|
|
38
|
-
return entities.Select(MapToDto).ToList();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/// <inheritdoc />
|
|
42
|
-
public async Task<{{pascalCase FEATURE_NAME}}Dto> CreateAsync(
|
|
43
|
-
Create{{pascalCase FEATURE_NAME}}Request request,
|
|
44
|
-
CancellationToken cancellationToken = default)
|
|
45
|
-
{
|
|
46
|
-
logger.LogInformation("Creating new {{pascalCase FEATURE_NAME}}: {Name}", request.Name);
|
|
47
|
-
|
|
48
|
-
// Validate
|
|
49
|
-
await ValidateCreateAsync(request, cancellationToken);
|
|
50
|
-
|
|
51
|
-
// Create entity
|
|
52
|
-
var entity = Domain.Entities.{{pascalCase FEATURE_NAME}}.Create(request.Name);
|
|
53
|
-
|
|
54
|
-
// Save
|
|
55
|
-
await repository.AddAsync(entity, cancellationToken);
|
|
56
|
-
await repository.SaveChangesAsync(cancellationToken);
|
|
57
|
-
|
|
58
|
-
logger.LogInformation("Created {{pascalCase FEATURE_NAME}} with ID {Id}", entity.Id);
|
|
59
|
-
|
|
60
|
-
return MapToDto(entity);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/// <inheritdoc />
|
|
64
|
-
public async Task UpdateAsync(
|
|
65
|
-
int id,
|
|
66
|
-
Update{{pascalCase FEATURE_NAME}}Request request,
|
|
67
|
-
CancellationToken cancellationToken = default)
|
|
68
|
-
{
|
|
69
|
-
logger.LogInformation("Updating {{pascalCase FEATURE_NAME}} {Id}", id);
|
|
70
|
-
|
|
71
|
-
var entity = await repository.GetByIdAsync(id, cancellationToken)
|
|
72
|
-
?? throw new {{pascalCase FEATURE_NAME}}NotFoundException(id);
|
|
73
|
-
|
|
74
|
-
// Validate
|
|
75
|
-
await ValidateUpdateAsync(entity, request, cancellationToken);
|
|
76
|
-
|
|
77
|
-
// Update entity
|
|
78
|
-
entity.UpdateName(request.Name);
|
|
79
|
-
|
|
80
|
-
// Save
|
|
81
|
-
repository.Update(entity);
|
|
82
|
-
await repository.SaveChangesAsync(cancellationToken);
|
|
83
|
-
|
|
84
|
-
logger.LogInformation("Updated {{pascalCase FEATURE_NAME}} {Id}", id);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/// <inheritdoc />
|
|
88
|
-
public async Task DeleteAsync(int id, CancellationToken cancellationToken = default)
|
|
89
|
-
{
|
|
90
|
-
logger.LogInformation("Deleting {{pascalCase FEATURE_NAME}} {Id}", id);
|
|
91
|
-
|
|
92
|
-
var entity = await repository.GetByIdAsync(id, cancellationToken)
|
|
93
|
-
?? throw new {{pascalCase FEATURE_NAME}}NotFoundException(id);
|
|
94
|
-
|
|
95
|
-
// Soft delete or remove
|
|
96
|
-
repository.Remove(entity);
|
|
97
|
-
await repository.SaveChangesAsync(cancellationToken);
|
|
98
|
-
|
|
99
|
-
logger.LogInformation("Deleted {{pascalCase FEATURE_NAME}} {Id}", id);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
#region Private Methods
|
|
103
|
-
|
|
104
|
-
private static {{pascalCase FEATURE_NAME}}Dto MapToDto(Domain.Entities.{{pascalCase FEATURE_NAME}} entity)
|
|
105
|
-
{
|
|
106
|
-
return new {{pascalCase FEATURE_NAME}}Dto(
|
|
107
|
-
entity.Id,
|
|
108
|
-
entity.Name,
|
|
109
|
-
entity.Status,
|
|
110
|
-
entity.CreatedAt,
|
|
111
|
-
entity.UpdatedAt
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
private async Task ValidateCreateAsync(
|
|
116
|
-
Create{{pascalCase FEATURE_NAME}}Request request,
|
|
117
|
-
CancellationToken cancellationToken)
|
|
118
|
-
{
|
|
119
|
-
// Add validation logic here
|
|
120
|
-
// Example: Check for duplicates
|
|
121
|
-
// var existing = await repository.FindByNameAsync(request.Name, cancellationToken);
|
|
122
|
-
// if (existing is not null)
|
|
123
|
-
// throw new ValidationException("Name already exists");
|
|
124
|
-
|
|
125
|
-
await Task.CompletedTask;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
private async Task ValidateUpdateAsync(
|
|
129
|
-
Domain.Entities.{{pascalCase FEATURE_NAME}} entity,
|
|
130
|
-
Update{{pascalCase FEATURE_NAME}}Request request,
|
|
131
|
-
CancellationToken cancellationToken)
|
|
132
|
-
{
|
|
133
|
-
// Add validation logic here
|
|
134
|
-
|
|
135
|
-
await Task.CompletedTask;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
#endregion
|
|
139
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// {{titleCase FEATURE_NAME}} - Commands (CQRS)
|
|
3
|
-
// Generated by MORPH-SPEC Framework
|
|
4
|
-
// ============================================================================
|
|
5
|
-
|
|
6
|
-
using MediatR;
|
|
7
|
-
|
|
8
|
-
namespace {{NAMESPACE}}.Application.Features.{{pascalCase FEATURE_NAME}}.Commands;
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// Create Command
|
|
12
|
-
// ============================================================================
|
|
13
|
-
|
|
14
|
-
/// <summary>
|
|
15
|
-
/// Command to create a new {{titleCase FEATURE_NAME}}
|
|
16
|
-
/// </summary>
|
|
17
|
-
public record Create{{pascalCase FEATURE_NAME}}Command : IRequest<Create{{pascalCase FEATURE_NAME}}Result>
|
|
18
|
-
{
|
|
19
|
-
// TODO: Add required properties
|
|
20
|
-
// public required string Name { get; init; }
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public record Create{{pascalCase FEATURE_NAME}}Result
|
|
24
|
-
{
|
|
25
|
-
public bool IsSuccess { get; init; }
|
|
26
|
-
public int? Id { get; init; }
|
|
27
|
-
public string? Error { get; init; }
|
|
28
|
-
|
|
29
|
-
public static Create{{pascalCase FEATURE_NAME}}Result Success(int id) => new() { IsSuccess = true, Id = id };
|
|
30
|
-
public static Create{{pascalCase FEATURE_NAME}}Result Failure(string error) => new() { IsSuccess = false, Error = error };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// Update Command
|
|
35
|
-
// ============================================================================
|
|
36
|
-
|
|
37
|
-
/// <summary>
|
|
38
|
-
/// Command to update an existing {{titleCase FEATURE_NAME}}
|
|
39
|
-
/// </summary>
|
|
40
|
-
public record Update{{pascalCase FEATURE_NAME}}Command : IRequest<Update{{pascalCase FEATURE_NAME}}Result>
|
|
41
|
-
{
|
|
42
|
-
public required int Id { get; init; }
|
|
43
|
-
// TODO: Add updatable properties
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public record Update{{pascalCase FEATURE_NAME}}Result
|
|
47
|
-
{
|
|
48
|
-
public bool IsSuccess { get; init; }
|
|
49
|
-
public string? Error { get; init; }
|
|
50
|
-
|
|
51
|
-
public static Update{{pascalCase FEATURE_NAME}}Result Success() => new() { IsSuccess = true };
|
|
52
|
-
public static Update{{pascalCase FEATURE_NAME}}Result Failure(string error) => new() { IsSuccess = false, Error = error };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ============================================================================
|
|
56
|
-
// Delete Command
|
|
57
|
-
// ============================================================================
|
|
58
|
-
|
|
59
|
-
/// <summary>
|
|
60
|
-
/// Command to delete a {{titleCase FEATURE_NAME}}
|
|
61
|
-
/// </summary>
|
|
62
|
-
public record Delete{{pascalCase FEATURE_NAME}}Command : IRequest<Delete{{pascalCase FEATURE_NAME}}Result>
|
|
63
|
-
{
|
|
64
|
-
public required int Id { get; init; }
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public record Delete{{pascalCase FEATURE_NAME}}Result
|
|
68
|
-
{
|
|
69
|
-
public bool IsSuccess { get; init; }
|
|
70
|
-
public string? Error { get; init; }
|
|
71
|
-
|
|
72
|
-
public static Delete{{pascalCase FEATURE_NAME}}Result Success() => new() { IsSuccess = true };
|
|
73
|
-
public static Delete{{pascalCase FEATURE_NAME}}Result Failure(string error) => new() { IsSuccess = false, Error = error };
|
|
74
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// {{titleCase FEATURE_NAME}} - Entity Interfaces
|
|
3
|
-
// Generated by MORPH-SPEC Framework
|
|
4
|
-
// ============================================================================
|
|
5
|
-
|
|
6
|
-
namespace {{NAMESPACE}}.Domain.Entities;
|
|
7
|
-
|
|
8
|
-
/// <summary>
|
|
9
|
-
/// Base interface for {{titleCase FEATURE_NAME}} entity
|
|
10
|
-
/// </summary>
|
|
11
|
-
public interface I{{pascalCase FEATURE_NAME}}Entity
|
|
12
|
-
{
|
|
13
|
-
int Id { get; }
|
|
14
|
-
DateTime CreatedAt { get; }
|
|
15
|
-
DateTime? UpdatedAt { get; }
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// TODO: Add specific entity interfaces below
|
|
19
|
-
// Example:
|
|
20
|
-
// public interface IScheduledReport : I{{pascalCase FEATURE_NAME}}Entity
|
|
21
|
-
// {
|
|
22
|
-
// string Name { get; }
|
|
23
|
-
// ReportType Type { get; }
|
|
24
|
-
// string CronExpression { get; }
|
|
25
|
-
// }
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// {{titleCase FEATURE_NAME}} - Queries (CQRS)
|
|
3
|
-
// Generated by MORPH-SPEC Framework
|
|
4
|
-
// ============================================================================
|
|
5
|
-
|
|
6
|
-
using MediatR;
|
|
7
|
-
|
|
8
|
-
namespace {{NAMESPACE}}.Application.Features.{{pascalCase FEATURE_NAME}}.Queries;
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// Get By Id Query
|
|
12
|
-
// ============================================================================
|
|
13
|
-
|
|
14
|
-
/// <summary>
|
|
15
|
-
/// Query to get a {{titleCase FEATURE_NAME}} by ID
|
|
16
|
-
/// </summary>
|
|
17
|
-
public record Get{{pascalCase FEATURE_NAME}}ByIdQuery : IRequest<{{pascalCase FEATURE_NAME}}Dto?>
|
|
18
|
-
{
|
|
19
|
-
public required int Id { get; init; }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// Get All Query (with pagination)
|
|
24
|
-
// ============================================================================
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
/// Query to get all {{titleCase FEATURE_NAME}} with pagination
|
|
28
|
-
/// </summary>
|
|
29
|
-
public record Get{{pascalCase FEATURE_NAME}}ListQuery : IRequest<{{pascalCase FEATURE_NAME}}ListResult>
|
|
30
|
-
{
|
|
31
|
-
public int Page { get; init; } = 1;
|
|
32
|
-
public int PageSize { get; init; } = 10;
|
|
33
|
-
public string? SearchTerm { get; init; }
|
|
34
|
-
public string? SortBy { get; init; }
|
|
35
|
-
public bool SortDescending { get; init; }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public record {{pascalCase FEATURE_NAME}}ListResult
|
|
39
|
-
{
|
|
40
|
-
public required IReadOnlyList<{{pascalCase FEATURE_NAME}}Dto> Items { get; init; }
|
|
41
|
-
public int TotalCount { get; init; }
|
|
42
|
-
public int Page { get; init; }
|
|
43
|
-
public int PageSize { get; init; }
|
|
44
|
-
public int TotalPages => (int)Math.Ceiling(TotalCount / (double)PageSize);
|
|
45
|
-
public bool HasNextPage => Page < TotalPages;
|
|
46
|
-
public bool HasPreviousPage => Page > 1;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ============================================================================
|
|
50
|
-
// DTOs
|
|
51
|
-
// ============================================================================
|
|
52
|
-
|
|
53
|
-
/// <summary>
|
|
54
|
-
/// DTO for {{titleCase FEATURE_NAME}}
|
|
55
|
-
/// </summary>
|
|
56
|
-
public record {{pascalCase FEATURE_NAME}}Dto
|
|
57
|
-
{
|
|
58
|
-
public int Id { get; init; }
|
|
59
|
-
public DateTime CreatedAt { get; init; }
|
|
60
|
-
public DateTime? UpdatedAt { get; init; }
|
|
61
|
-
|
|
62
|
-
// TODO: Add mapped properties from entity
|
|
63
|
-
// public string Name { get; init; } = string.Empty;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/// <summary>
|
|
67
|
-
/// Summary DTO for lists (less data)
|
|
68
|
-
/// </summary>
|
|
69
|
-
public record {{pascalCase FEATURE_NAME}}SummaryDto
|
|
70
|
-
{
|
|
71
|
-
public int Id { get; init; }
|
|
72
|
-
// TODO: Add only essential properties for list display
|
|
73
|
-
// public string Name { get; init; } = string.Empty;
|
|
74
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Contracts - {{titleCase FEATURE_NAME}}
|
|
2
|
-
|
|
3
|
-
> Estrutura de contracts para features complexas
|
|
4
|
-
|
|
5
|
-
## Estrutura
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
contracts/
|
|
9
|
-
├── README.md # Este arquivo (índice)
|
|
10
|
-
├── Entities/ # Entidades de domínio
|
|
11
|
-
│ └── I{{pascalCase FEATURE_NAME}}Entity.cs
|
|
12
|
-
├── Commands/ # Commands (CQRS)
|
|
13
|
-
│ └── I{{pascalCase FEATURE_NAME}}Commands.cs
|
|
14
|
-
├── Queries/ # Queries (CQRS)
|
|
15
|
-
│ └── I{{pascalCase FEATURE_NAME}}Queries.cs
|
|
16
|
-
├── DTOs/ # Data Transfer Objects
|
|
17
|
-
│ └── {{pascalCase FEATURE_NAME}}Dto.cs
|
|
18
|
-
├── Events/ # Domain Events
|
|
19
|
-
│ └── {{pascalCase FEATURE_NAME}}Events.cs
|
|
20
|
-
└── Services/ # Service Interfaces
|
|
21
|
-
└── I{{pascalCase FEATURE_NAME}}Service.cs
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Quando usar pasta vs arquivo único
|
|
25
|
-
|
|
26
|
-
| Cenário | Usar |
|
|
27
|
-
|---------|------|
|
|
28
|
-
| < 5 interfaces/DTOs | `contracts.cs` (arquivo único) |
|
|
29
|
-
| 5-15 interfaces/DTOs | `contracts/` (pasta organizada) |
|
|
30
|
-
| > 15 interfaces/DTOs | `contracts/` + subpastas por domínio |
|
|
31
|
-
|
|
32
|
-
## Convenções
|
|
33
|
-
|
|
34
|
-
1. **Prefixo `I`** para interfaces: `IOrderService`, `IPaymentGateway`
|
|
35
|
-
2. **Sufixo `Dto`** para DTOs: `OrderDto`, `OrderCreateDto`
|
|
36
|
-
3. **Sufixo `Command`** para commands: `CreateOrderCommand`
|
|
37
|
-
4. **Sufixo `Query`** para queries: `GetOrderByIdQuery`
|
|
38
|
-
5. **Sufixo `Event`** para eventos: `OrderCreatedEvent`
|
|
39
|
-
|
|
40
|
-
## Índice de Contracts
|
|
41
|
-
|
|
42
|
-
### Entidades
|
|
43
|
-
|
|
44
|
-
| Interface | Descrição | Arquivo |
|
|
45
|
-
|-----------|-----------|---------|
|
|
46
|
-
| _A ser preenchido_ | | |
|
|
47
|
-
|
|
48
|
-
### Commands
|
|
49
|
-
|
|
50
|
-
| Command | Handler | Descrição |
|
|
51
|
-
|---------|---------|-----------|
|
|
52
|
-
| _A ser preenchido_ | | |
|
|
53
|
-
|
|
54
|
-
### Queries
|
|
55
|
-
|
|
56
|
-
| Query | Handler | Descrição |
|
|
57
|
-
|-------|---------|-----------|
|
|
58
|
-
| _A ser preenchido_ | | |
|
|
59
|
-
|
|
60
|
-
### DTOs
|
|
61
|
-
|
|
62
|
-
| DTO | Usado em | Descrição |
|
|
63
|
-
|-----|----------|-----------|
|
|
64
|
-
| _A ser preenchido_ | | |
|
|
65
|
-
|
|
66
|
-
### Services
|
|
67
|
-
|
|
68
|
-
| Interface | Implementação | Descrição |
|
|
69
|
-
|-----------|---------------|-----------|
|
|
70
|
-
| _A ser preenchido_ | | |
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
_Gerado por MORPH-SPEC Framework_
|