@polymorphism-tech/morph-spec 2.3.0 → 3.0.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/CLAUDE.md +446 -1730
- package/README.md +515 -516
- package/bin/morph-spec.js +366 -294
- package/bin/task-manager.js +429 -368
- package/bin/validate.js +369 -268
- package/content/.claude/commands/morph-apply.md +221 -158
- package/content/.claude/commands/morph-deploy.md +529 -0
- package/content/.claude/commands/morph-preflight.md +227 -0
- package/content/.claude/commands/morph-proposal.md +122 -101
- package/content/.claude/commands/morph-status.md +86 -86
- package/content/.claude/commands/morph-troubleshoot.md +122 -0
- package/content/.claude/skills/infra/azure-deploy-specialist.md +699 -0
- package/content/.claude/skills/level-0-meta/README.md +7 -0
- package/content/.claude/skills/level-0-meta/code-review.md +226 -0
- package/content/.claude/skills/level-0-meta/morph-checklist.md +117 -0
- package/content/.claude/skills/level-0-meta/simulation-checklist.md +77 -0
- package/content/.claude/skills/level-1-workflows/README.md +7 -0
- package/content/.claude/skills/level-1-workflows/morph-replicate.md +213 -0
- package/content/.claude/{commands/morph-clarify.md → skills/level-1-workflows/phase-clarify.md} +131 -184
- package/content/.claude/{commands/morph-design.md → skills/level-1-workflows/phase-design.md} +213 -275
- package/content/.claude/skills/level-1-workflows/phase-setup.md +106 -0
- package/content/.claude/skills/level-1-workflows/phase-tasks.md +164 -0
- package/content/.claude/{commands/morph-uiux.md → skills/level-1-workflows/phase-uiux.md} +169 -211
- package/content/.claude/skills/level-2-domains/README.md +14 -0
- package/content/.claude/skills/level-2-domains/ai-agents/ai-system-architect.md +192 -0
- package/content/.claude/skills/{specialists → level-2-domains/architecture}/po-pm-advisor.md +197 -197
- package/content/.claude/skills/level-2-domains/architecture/standards-architect.md +156 -0
- package/content/.claude/skills/level-2-domains/backend/dotnet-senior.md +287 -0
- package/content/.claude/skills/level-2-domains/backend/ef-modeler.md +113 -0
- package/content/.claude/skills/level-2-domains/backend/hangfire-orchestrator.md +126 -0
- package/content/.claude/skills/level-2-domains/backend/ms-agent-expert.md +109 -0
- package/content/.claude/skills/level-2-domains/frontend/blazor-builder.md +210 -0
- package/content/.claude/skills/level-2-domains/frontend/nextjs-expert.md +154 -0
- package/content/.claude/skills/level-2-domains/frontend/ui-ux-designer.md +191 -0
- package/content/.claude/skills/{specialists → level-2-domains/infrastructure}/azure-architect.md +142 -142
- package/content/.claude/skills/level-2-domains/infrastructure/bicep-architect.md +126 -0
- package/content/.claude/skills/level-2-domains/infrastructure/container-specialist.md +131 -0
- package/content/.claude/skills/level-2-domains/infrastructure/devops-engineer.md +119 -0
- package/content/.claude/skills/level-2-domains/integrations/asaas-financial.md +130 -0
- package/content/.claude/skills/level-2-domains/integrations/azure-identity.md +142 -0
- package/content/.claude/skills/level-2-domains/integrations/clerk-auth.md +108 -0
- package/content/.claude/skills/level-2-domains/integrations/resend-email.md +119 -0
- package/content/.claude/skills/level-2-domains/quality/code-analyzer.md +235 -0
- package/content/.claude/skills/level-2-domains/quality/testing-specialist.md +126 -0
- package/content/.claude/skills/level-3-technologies/README.md +7 -0
- package/content/.claude/skills/level-4-patterns/README.md +7 -0
- package/content/.claude/skills/specialists/prompt-engineer.md +189 -0
- package/content/.claude/skills/specialists/seo-growth-hacker.md +320 -0
- package/content/.morph/config/agents.json +762 -242
- package/content/.morph/config/config.template.json +122 -108
- package/content/.morph/docs/workflows/design-impl.md +37 -0
- package/content/.morph/docs/workflows/enforcement-pipeline.md +668 -0
- package/content/.morph/docs/workflows/fast-track.md +29 -0
- package/content/.morph/docs/workflows/full-morph.md +76 -0
- package/content/.morph/docs/workflows/standard.md +44 -0
- package/content/.morph/docs/workflows/ui-refresh.md +39 -0
- package/content/.morph/examples/scheduled-reports/decisions.md +158 -0
- package/content/.morph/examples/scheduled-reports/proposal.md +95 -0
- package/content/.morph/examples/scheduled-reports/spec.md +267 -0
- package/content/.morph/hooks/README.md +348 -239
- package/content/.morph/hooks/pre-commit-agents.sh +24 -24
- package/content/.morph/hooks/task-completed.js +73 -0
- package/content/.morph/hooks/teammate-idle.js +68 -0
- package/content/.morph/schemas/tasks.schema.json +220 -0
- package/content/.morph/standards/agent-framework-blazor-ui.md +359 -0
- package/content/.morph/standards/agent-framework-production.md +410 -0
- package/content/.morph/standards/agent-framework-setup.md +413 -453
- package/content/.morph/standards/agent-framework-workflows.md +349 -0
- package/content/.morph/standards/agent-teams-workflow.md +474 -0
- package/content/.morph/standards/architecture.md +325 -325
- package/content/.morph/standards/azure.md +605 -379
- package/content/.morph/standards/dotnet10-migration.md +520 -494
- package/content/.morph/templates/CONTEXT-FEATURE.md +276 -0
- package/content/.morph/templates/CONTEXT.md +170 -0
- package/content/.morph/templates/agent.cs +163 -172
- package/content/.morph/templates/clarify-questions.md +159 -0
- package/content/.morph/templates/contracts/Commands.cs +74 -0
- package/content/.morph/templates/contracts/Entities.cs +25 -0
- package/content/.morph/templates/contracts/Queries.cs +74 -0
- package/content/.morph/templates/contracts/README.md +74 -0
- package/content/.morph/templates/decisions.md +123 -106
- package/content/.morph/templates/infra/azure-pipelines-deploy.yml +480 -0
- package/content/.morph/templates/infra/deploy-checklist.md +426 -0
- package/content/.morph/templates/proposal.md +141 -155
- package/content/.morph/templates/recap.md +94 -105
- package/content/.morph/templates/simulation.md +353 -0
- package/content/.morph/templates/spec.md +149 -148
- package/content/.morph/templates/state.template.json +222 -222
- package/content/.morph/templates/tasks.md +257 -235
- package/content/.morph/templates/ui-components.md +362 -276
- package/content/CLAUDE.md +150 -442
- package/detectors/structure-detector.js +245 -250
- package/docs/README.md +144 -149
- package/docs/getting-started.md +301 -302
- package/docs/installation.md +361 -361
- package/docs/validation-checklist.md +265 -266
- package/package.json +80 -80
- package/src/commands/advance-phase.js +266 -0
- package/src/commands/analyze-blazor-concurrency.js +193 -0
- package/src/commands/deploy.js +780 -0
- package/src/commands/detect-agents.js +167 -0
- package/src/commands/doctor.js +356 -280
- package/src/commands/generate-context.js +40 -0
- package/src/commands/init.js +258 -245
- package/src/commands/lint-fluent.js +352 -0
- package/src/commands/rollback-phase.js +185 -0
- package/src/commands/session-summary.js +291 -0
- package/src/commands/task.js +78 -75
- package/src/commands/troubleshoot.js +222 -0
- package/src/commands/update.js +192 -159
- package/src/commands/validate-blazor-state.js +210 -0
- package/src/commands/validate-blazor.js +156 -0
- package/src/commands/validate-css.js +84 -0
- package/src/commands/validate-phase.js +221 -0
- package/src/lib/blazor-concurrency-analyzer.js +288 -0
- package/src/lib/blazor-state-validator.js +291 -0
- package/src/lib/blazor-validator.js +374 -0
- package/src/lib/complexity-analyzer.js +441 -292
- package/src/lib/context-generator.js +513 -0
- package/src/lib/continuous-validator.js +421 -440
- package/src/lib/css-validator.js +352 -0
- package/src/lib/decision-constraint-loader.js +109 -0
- package/src/lib/design-system-detector.js +187 -0
- package/src/lib/design-system-scaffolder.js +299 -0
- package/src/lib/hook-executor.js +256 -0
- package/src/lib/recap-generator.js +205 -0
- package/src/lib/spec-validator.js +258 -0
- package/src/lib/standards-context-injector.js +287 -0
- package/src/lib/state-manager.js +397 -340
- package/src/lib/team-orchestrator.js +322 -0
- package/src/lib/troubleshoot-grep.js +194 -0
- package/src/lib/troubleshoot-index.js +144 -0
- package/src/lib/validation-runner.js +283 -0
- package/src/lib/validators/contract-compliance-validator.js +273 -0
- package/src/lib/validators/design-system-validator.js +231 -0
- package/src/utils/file-copier.js +187 -139
- package/content/.claude/commands/morph-costs.md +0 -206
- package/content/.claude/commands/morph-setup.md +0 -100
- package/content/.claude/commands/morph-tasks.md +0 -319
- package/content/.claude/skills/infra/bicep-architect.md +0 -419
- package/content/.claude/skills/infra/container-specialist.md +0 -437
- package/content/.claude/skills/infra/devops-engineer.md +0 -405
- package/content/.claude/skills/integrations/asaas-financial.md +0 -333
- package/content/.claude/skills/integrations/azure-identity.md +0 -309
- package/content/.claude/skills/integrations/clerk-auth.md +0 -290
- package/content/.claude/skills/specialists/ai-system-architect.md +0 -604
- package/content/.claude/skills/specialists/cost-guardian.md +0 -110
- package/content/.claude/skills/specialists/ef-modeler.md +0 -211
- package/content/.claude/skills/specialists/hangfire-orchestrator.md +0 -255
- package/content/.claude/skills/specialists/ms-agent-expert.md +0 -263
- package/content/.claude/skills/specialists/standards-architect.md +0 -78
- package/content/.claude/skills/specialists/ui-ux-designer.md +0 -1100
- package/content/.claude/skills/stacks/dotnet-blazor.md +0 -606
- package/content/.claude/skills/stacks/dotnet-nextjs.md +0 -402
- package/content/.claude/skills/stacks/shopify.md +0 -445
- package/content/.morph/config/azure-pricing.json +0 -70
- package/content/.morph/config/azure-pricing.schema.json +0 -50
- package/content/.morph/hooks/pre-commit-costs.sh +0 -91
- package/docs/api/cost-calculator.js.html +0 -513
- package/docs/api/design-system-generator.js.html +0 -382
- package/docs/api/global.html +0 -5263
- package/docs/api/index.html +0 -96
- package/docs/api/state-manager.js.html +0 -423
- package/src/commands/cost.js +0 -181
- package/src/commands/update-pricing.js +0 -206
- package/src/lib/cost-calculator.js +0 -429
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
# .NET + Next.js Stack
|
|
2
|
-
|
|
3
|
-
Stack full-stack com .NET Web API no backend e Next.js no frontend.
|
|
4
|
-
|
|
5
|
-
## Visão Geral
|
|
6
|
-
|
|
7
|
-
| Aspecto | Tecnologia |
|
|
8
|
-
|---------|------------|
|
|
9
|
-
| **Backend** | .NET 10 Web API / C# 14 |
|
|
10
|
-
| **Frontend** | Next.js 15+ / React 19 |
|
|
11
|
-
| **Database** | Entity Framework Core 10 + Azure SQL |
|
|
12
|
-
| **API** | REST + OpenAPI |
|
|
13
|
-
| **Hosting** | Azure Container Apps |
|
|
14
|
-
|
|
15
|
-
## Triggers
|
|
16
|
-
|
|
17
|
-
Keywords: `nextjs`, `next.js`, `react`, `api`, `frontend`, `spa`, `typescript`
|
|
18
|
-
|
|
19
|
-
## Estrutura de Projeto
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
/
|
|
23
|
-
├── backend/ # .NET Web API
|
|
24
|
-
│ ├── src/
|
|
25
|
-
│ │ ├── Api/
|
|
26
|
-
│ │ │ ├── Program.cs
|
|
27
|
-
│ │ │ ├── Controllers/
|
|
28
|
-
│ │ │ └── Endpoints/ # Minimal APIs
|
|
29
|
-
│ │ ├── Application/
|
|
30
|
-
│ │ │ ├── Services/
|
|
31
|
-
│ │ │ └── DTOs/
|
|
32
|
-
│ │ ├── Domain/
|
|
33
|
-
│ │ │ └── Entities/
|
|
34
|
-
│ │ └── Infrastructure/
|
|
35
|
-
│ │ └── Data/
|
|
36
|
-
│ ├── tests/
|
|
37
|
-
│ └── Backend.sln
|
|
38
|
-
│
|
|
39
|
-
├── frontend/ # Next.js
|
|
40
|
-
│ ├── src/
|
|
41
|
-
│ │ ├── app/ # App Router
|
|
42
|
-
│ │ │ ├── layout.tsx
|
|
43
|
-
│ │ │ ├── page.tsx
|
|
44
|
-
│ │ │ └── (routes)/
|
|
45
|
-
│ │ ├── components/
|
|
46
|
-
│ │ ├── lib/
|
|
47
|
-
│ │ │ ├── api.ts # API client
|
|
48
|
-
│ │ │ └── types.ts # Generated from OpenAPI
|
|
49
|
-
│ │ └── hooks/
|
|
50
|
-
│ ├── package.json
|
|
51
|
-
│ └── next.config.js
|
|
52
|
-
│
|
|
53
|
-
├── docker-compose.yml
|
|
54
|
-
└── infra/
|
|
55
|
-
└── main.bicep
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Backend (.NET API)
|
|
59
|
-
|
|
60
|
-
### Program.cs (Minimal API)
|
|
61
|
-
|
|
62
|
-
```csharp
|
|
63
|
-
var builder = WebApplication.CreateBuilder(args);
|
|
64
|
-
|
|
65
|
-
// OpenAPI
|
|
66
|
-
builder.Services.AddEndpointsApiExplorer();
|
|
67
|
-
builder.Services.AddSwaggerGen(c =>
|
|
68
|
-
{
|
|
69
|
-
c.SwaggerDoc("v1", new() { Title = "My API", Version = "v1" });
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// CORS para Next.js
|
|
73
|
-
builder.Services.AddCors(options =>
|
|
74
|
-
{
|
|
75
|
-
options.AddPolicy("Frontend", policy =>
|
|
76
|
-
{
|
|
77
|
-
policy.WithOrigins(builder.Configuration["Frontend:Url"]!)
|
|
78
|
-
.AllowAnyHeader()
|
|
79
|
-
.AllowAnyMethod()
|
|
80
|
-
.AllowCredentials();
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// Database
|
|
85
|
-
builder.Services.AddDbContext<AppDbContext>(options =>
|
|
86
|
-
options.UseSqlServer(builder.Configuration.GetConnectionString("Default")));
|
|
87
|
-
|
|
88
|
-
// Services
|
|
89
|
-
builder.Services.AddScoped<IOrderService, OrderService>();
|
|
90
|
-
|
|
91
|
-
var app = builder.Build();
|
|
92
|
-
|
|
93
|
-
// Swagger (dev only)
|
|
94
|
-
if (app.Environment.IsDevelopment())
|
|
95
|
-
{
|
|
96
|
-
app.UseSwagger();
|
|
97
|
-
app.UseSwaggerUI();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
app.UseHttpsRedirection();
|
|
101
|
-
app.UseCors("Frontend");
|
|
102
|
-
app.UseAuthentication();
|
|
103
|
-
app.UseAuthorization();
|
|
104
|
-
|
|
105
|
-
// Map endpoints
|
|
106
|
-
app.MapOrderEndpoints();
|
|
107
|
-
|
|
108
|
-
app.Run();
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Minimal API Endpoints
|
|
112
|
-
|
|
113
|
-
```csharp
|
|
114
|
-
// Endpoints/OrderEndpoints.cs
|
|
115
|
-
public static class OrderEndpoints
|
|
116
|
-
{
|
|
117
|
-
public static void MapOrderEndpoints(this WebApplication app)
|
|
118
|
-
{
|
|
119
|
-
var group = app.MapGroup("/api/orders")
|
|
120
|
-
.WithTags("Orders")
|
|
121
|
-
.RequireAuthorization();
|
|
122
|
-
|
|
123
|
-
group.MapGet("/", GetAll);
|
|
124
|
-
group.MapGet("/{id:int}", GetById);
|
|
125
|
-
group.MapPost("/", Create);
|
|
126
|
-
group.MapPut("/{id:int}", Update);
|
|
127
|
-
group.MapDelete("/{id:int}", Delete);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
private static async Task<IResult> GetAll(
|
|
131
|
-
IOrderService service,
|
|
132
|
-
[AsParameters] PaginationQuery query)
|
|
133
|
-
{
|
|
134
|
-
var result = await service.GetAllAsync(query);
|
|
135
|
-
return Results.Ok(result);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private static async Task<IResult> GetById(
|
|
139
|
-
int id,
|
|
140
|
-
IOrderService service)
|
|
141
|
-
{
|
|
142
|
-
var order = await service.GetByIdAsync(id);
|
|
143
|
-
return order is null ? Results.NotFound() : Results.Ok(order);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
private static async Task<IResult> Create(
|
|
147
|
-
CreateOrderRequest request,
|
|
148
|
-
IOrderService service)
|
|
149
|
-
{
|
|
150
|
-
var order = await service.CreateAsync(request);
|
|
151
|
-
return Results.Created($"/api/orders/{order.Id}", order);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private static async Task<IResult> Update(
|
|
155
|
-
int id,
|
|
156
|
-
UpdateOrderRequest request,
|
|
157
|
-
IOrderService service)
|
|
158
|
-
{
|
|
159
|
-
await service.UpdateAsync(id, request);
|
|
160
|
-
return Results.NoContent();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
private static async Task<IResult> Delete(
|
|
164
|
-
int id,
|
|
165
|
-
IOrderService service)
|
|
166
|
-
{
|
|
167
|
-
await service.DeleteAsync(id);
|
|
168
|
-
return Results.NoContent();
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Frontend (Next.js)
|
|
174
|
-
|
|
175
|
-
### API Client
|
|
176
|
-
|
|
177
|
-
```typescript
|
|
178
|
-
// lib/api.ts
|
|
179
|
-
const API_URL = process.env.NEXT_PUBLIC_API_URL!;
|
|
180
|
-
|
|
181
|
-
async function fetchApi<T>(
|
|
182
|
-
endpoint: string,
|
|
183
|
-
options?: RequestInit
|
|
184
|
-
): Promise<T> {
|
|
185
|
-
const res = await fetch(`${API_URL}${endpoint}`, {
|
|
186
|
-
...options,
|
|
187
|
-
headers: {
|
|
188
|
-
'Content-Type': 'application/json',
|
|
189
|
-
...options?.headers,
|
|
190
|
-
},
|
|
191
|
-
credentials: 'include',
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
if (!res.ok) {
|
|
195
|
-
throw new Error(`API error: ${res.status}`);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return res.json();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export const api = {
|
|
202
|
-
orders: {
|
|
203
|
-
getAll: (params?: { page?: number; pageSize?: number }) =>
|
|
204
|
-
fetchApi<PaginatedResult<Order>>(`/api/orders?${new URLSearchParams(params as any)}`),
|
|
205
|
-
|
|
206
|
-
getById: (id: number) =>
|
|
207
|
-
fetchApi<Order>(`/api/orders/${id}`),
|
|
208
|
-
|
|
209
|
-
create: (data: CreateOrderRequest) =>
|
|
210
|
-
fetchApi<Order>('/api/orders', {
|
|
211
|
-
method: 'POST',
|
|
212
|
-
body: JSON.stringify(data),
|
|
213
|
-
}),
|
|
214
|
-
|
|
215
|
-
update: (id: number, data: UpdateOrderRequest) =>
|
|
216
|
-
fetchApi<void>(`/api/orders/${id}`, {
|
|
217
|
-
method: 'PUT',
|
|
218
|
-
body: JSON.stringify(data),
|
|
219
|
-
}),
|
|
220
|
-
|
|
221
|
-
delete: (id: number) =>
|
|
222
|
-
fetchApi<void>(`/api/orders/${id}`, {
|
|
223
|
-
method: 'DELETE',
|
|
224
|
-
}),
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Types (gerado do OpenAPI)
|
|
230
|
-
|
|
231
|
-
```typescript
|
|
232
|
-
// lib/types.ts
|
|
233
|
-
export interface Order {
|
|
234
|
-
id: number;
|
|
235
|
-
orderNumber: string;
|
|
236
|
-
customerId: number;
|
|
237
|
-
customerName: string;
|
|
238
|
-
total: number;
|
|
239
|
-
status: OrderStatus;
|
|
240
|
-
createdAt: string;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export type OrderStatus = 'Pending' | 'Processing' | 'Completed' | 'Cancelled';
|
|
244
|
-
|
|
245
|
-
export interface CreateOrderRequest {
|
|
246
|
-
customerId: number;
|
|
247
|
-
items: OrderItem[];
|
|
248
|
-
notes?: string;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export interface PaginatedResult<T> {
|
|
252
|
-
items: T[];
|
|
253
|
-
totalCount: number;
|
|
254
|
-
page: number;
|
|
255
|
-
pageSize: number;
|
|
256
|
-
totalPages: number;
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Server Component (App Router)
|
|
261
|
-
|
|
262
|
-
```tsx
|
|
263
|
-
// app/orders/page.tsx
|
|
264
|
-
import { api } from '@/lib/api';
|
|
265
|
-
import { OrderList } from '@/components/orders/OrderList';
|
|
266
|
-
|
|
267
|
-
export default async function OrdersPage() {
|
|
268
|
-
const orders = await api.orders.getAll();
|
|
269
|
-
|
|
270
|
-
return (
|
|
271
|
-
<div className="container mx-auto p-4">
|
|
272
|
-
<div className="flex justify-between items-center mb-6">
|
|
273
|
-
<h1 className="text-2xl font-bold">Pedidos</h1>
|
|
274
|
-
<a href="/orders/new" className="btn btn-primary">
|
|
275
|
-
Novo Pedido
|
|
276
|
-
</a>
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
<OrderList initialOrders={orders} />
|
|
280
|
-
</div>
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Client Component
|
|
286
|
-
|
|
287
|
-
```tsx
|
|
288
|
-
'use client';
|
|
289
|
-
|
|
290
|
-
// components/orders/OrderList.tsx
|
|
291
|
-
import { useState } from 'react';
|
|
292
|
-
import { Order, PaginatedResult } from '@/lib/types';
|
|
293
|
-
import { api } from '@/lib/api';
|
|
294
|
-
|
|
295
|
-
interface Props {
|
|
296
|
-
initialOrders: PaginatedResult<Order>;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export function OrderList({ initialOrders }: Props) {
|
|
300
|
-
const [orders, setOrders] = useState(initialOrders);
|
|
301
|
-
const [loading, setLoading] = useState(false);
|
|
302
|
-
|
|
303
|
-
async function loadPage(page: number) {
|
|
304
|
-
setLoading(true);
|
|
305
|
-
try {
|
|
306
|
-
const result = await api.orders.getAll({ page });
|
|
307
|
-
setOrders(result);
|
|
308
|
-
} finally {
|
|
309
|
-
setLoading(false);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
return (
|
|
314
|
-
<div>
|
|
315
|
-
<table className="w-full">
|
|
316
|
-
<thead>
|
|
317
|
-
<tr>
|
|
318
|
-
<th>Número</th>
|
|
319
|
-
<th>Cliente</th>
|
|
320
|
-
<th>Total</th>
|
|
321
|
-
<th>Status</th>
|
|
322
|
-
</tr>
|
|
323
|
-
</thead>
|
|
324
|
-
<tbody>
|
|
325
|
-
{orders.items.map((order) => (
|
|
326
|
-
<tr key={order.id}>
|
|
327
|
-
<td>{order.orderNumber}</td>
|
|
328
|
-
<td>{order.customerName}</td>
|
|
329
|
-
<td>{order.total.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' })}</td>
|
|
330
|
-
<td><StatusBadge status={order.status} /></td>
|
|
331
|
-
</tr>
|
|
332
|
-
))}
|
|
333
|
-
</tbody>
|
|
334
|
-
</table>
|
|
335
|
-
|
|
336
|
-
<Pagination
|
|
337
|
-
currentPage={orders.page}
|
|
338
|
-
totalPages={orders.totalPages}
|
|
339
|
-
onPageChange={loadPage}
|
|
340
|
-
disabled={loading}
|
|
341
|
-
/>
|
|
342
|
-
</div>
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
## Docker Compose
|
|
348
|
-
|
|
349
|
-
```yaml
|
|
350
|
-
# docker-compose.yml
|
|
351
|
-
services:
|
|
352
|
-
backend:
|
|
353
|
-
build:
|
|
354
|
-
context: ./backend
|
|
355
|
-
dockerfile: Dockerfile
|
|
356
|
-
ports:
|
|
357
|
-
- "5000:8080"
|
|
358
|
-
environment:
|
|
359
|
-
- ConnectionStrings__Default=Server=db;Database=App;User=sa;Password=YourStrong!Passw0rd;TrustServerCertificate=true
|
|
360
|
-
- Frontend__Url=http://localhost:3000
|
|
361
|
-
depends_on:
|
|
362
|
-
- db
|
|
363
|
-
|
|
364
|
-
frontend:
|
|
365
|
-
build:
|
|
366
|
-
context: ./frontend
|
|
367
|
-
dockerfile: Dockerfile
|
|
368
|
-
ports:
|
|
369
|
-
- "3000:3000"
|
|
370
|
-
environment:
|
|
371
|
-
- NEXT_PUBLIC_API_URL=http://localhost:5000
|
|
372
|
-
|
|
373
|
-
db:
|
|
374
|
-
image: mcr.microsoft.com/mssql/server:2022-latest
|
|
375
|
-
environment:
|
|
376
|
-
- ACCEPT_EULA=Y
|
|
377
|
-
- SA_PASSWORD=YourStrong!Passw0rd
|
|
378
|
-
ports:
|
|
379
|
-
- "1433:1433"
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
## Documentação de Referência
|
|
383
|
-
|
|
384
|
-
- [Next.js Documentation](https://nextjs.org/docs)
|
|
385
|
-
- [ASP.NET Web API](https://learn.microsoft.com/en-us/aspnet/core/web-api/)
|
|
386
|
-
- [React Documentation](https://react.dev/)
|
|
387
|
-
- [Minimal APIs](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis)
|
|
388
|
-
|
|
389
|
-
## Checklist de Projeto
|
|
390
|
-
|
|
391
|
-
- [ ] Backend com Minimal APIs
|
|
392
|
-
- [ ] OpenAPI/Swagger configurado
|
|
393
|
-
- [ ] CORS configurado para frontend
|
|
394
|
-
- [ ] Frontend com App Router (Next.js 15+)
|
|
395
|
-
- [ ] API client tipado
|
|
396
|
-
- [ ] Types gerados do OpenAPI
|
|
397
|
-
- [ ] Docker Compose para dev
|
|
398
|
-
- [ ] Environment variables configuradas
|
|
399
|
-
|
|
400
|
-
---
|
|
401
|
-
|
|
402
|
-
*MORPH-SPEC by Polymorphism Tech*
|