Skip to content

Commit eaeb290

Browse files
authored
fix(showcase): align fixtures with tightened spec schemas (#1897)
1 parent c9257d5 commit eaeb290

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

examples/app-showcase/src/objects/invoice.object.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
22

33
import { ObjectSchema, Field } from '@objectstack/spec/data';
4+
import { cel, P } from '@objectstack/spec';
45

56
/**
67
* Product — a small price-book / catalog. The invoice line's `product` lookup
@@ -60,7 +61,7 @@ export const Invoice = ObjectSchema.create({
6061
// the same predicate over the merged record — one rule, both ends agree.
6162
issued_on: Field.date({
6263
label: 'Issued On',
63-
requiredWhen: "record.status in ['sent', 'paid']",
64+
requiredWhen: P`record.status in ['sent', 'paid']`,
6465
}),
6566
// Conditional rule (B2): once an invoice is Paid, its tax rate is locked.
6667
// `readonlyWhen` makes the client render the field read-only, and the
@@ -73,16 +74,16 @@ export const Invoice = ObjectSchema.create({
7374
min: 0,
7475
max: 100,
7576
defaultValue: 0,
76-
readonlyWhen: "record.status == 'paid'",
77+
readonlyWhen: P`record.status == 'paid'`,
7778
}),
7879
// Conditional rule (B2): "Paid On" is only meaningful — and only shown —
7980
// once the invoice is Paid, and then it is required. `visibleWhen` is a
8081
// pure client UX concern (the server has no visibility notion); the
8182
// `requiredWhen` half is enforced on both ends.
8283
paid_on: Field.date({
8384
label: 'Paid On',
84-
visibleWhen: "record.status == 'paid'",
85-
requiredWhen: "record.status == 'paid'",
85+
visibleWhen: P`record.status == 'paid'`,
86+
requiredWhen: P`record.status == 'paid'`,
8687
}),
8788
// Roll-up: recomputed server-side as line items are inserted/updated/deleted
8889
// (child FK auto-detected: showcase_invoice_line.invoice). This is the line
@@ -123,7 +124,7 @@ export const InvoiceLine = ObjectSchema.create({
123124
product: Field.lookup('showcase_product', {
124125
label: 'Product',
125126
required: true,
126-
readonlyWhen: "parent.status == 'paid'",
127+
readonlyWhen: P`parent.status == 'paid'`,
127128
}),
128129
// Conditional rule (B2 in grids): a bulk line (large quantity) must carry a
129130
// description note. `requiredWhen` here is ROW-scoped — it references the
@@ -134,20 +135,20 @@ export const InvoiceLine = ObjectSchema.create({
134135
description: Field.text({
135136
label: 'Description',
136137
maxLength: 200,
137-
requiredWhen: 'record.quantity >= 100',
138+
requiredWhen: P`record.quantity >= 100`,
138139
}),
139140
quantity: Field.number({
140141
label: 'Qty',
141142
required: true,
142143
min: 0,
143144
defaultValue: 1,
144-
readonlyWhen: "parent.status == 'paid'",
145+
readonlyWhen: P`parent.status == 'paid'`,
145146
}),
146147
unit_price: Field.currency({
147148
label: 'Unit Price',
148149
scale: 2,
149150
min: 0,
150-
readonlyWhen: "parent.status == 'paid'",
151+
readonlyWhen: P`parent.status == 'paid'`,
151152
}),
152153
// Amount = Qty × Unit Price. Kept as a *stored* currency column (so the
153154
// parent Invoice.total summary can roll it up — summary aggregation reads
@@ -160,7 +161,7 @@ export const InvoiceLine = ObjectSchema.create({
160161
label: 'Amount',
161162
scale: 2,
162163
min: 0,
163-
expression: 'record.quantity * record.unit_price',
164+
expression: cel`record.quantity * record.unit_price`,
164165
}),
165166
},
166167
});

examples/app-showcase/src/pages/project-detail.page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const ProjectDetailPage: Page = {
2020
type: 'record',
2121
object: 'showcase_project',
2222
kind: 'slotted',
23+
template: 'default',
2324
isDefault: true,
2425
regions: [],
2526
slots: {

examples/app-showcase/src/pages/project-workspace.page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const ProjectWorkspacePage: Page = {
1616
type: 'app',
1717
template: 'default',
1818
kind: 'full',
19+
isDefault: false,
1920
regions: [
2021
{
2122
name: 'header',

examples/app-showcase/src/reports/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const HoursByStatusReport: Report = {
1515
label: 'Hours by Status (Summary)',
1616
description: 'Estimated hours grouped by task status.',
1717
type: 'summary',
18+
drilldown: true,
1819
// ADR-0021 Phase 2 — dataset binding (dual-form).
1920
dataset: 'showcase_task_metrics',
2021
rows: ['status'],
@@ -27,6 +28,7 @@ export const StatusPriorityMatrixReport: Report = {
2728
label: 'Status × Priority (Matrix)',
2829
description: 'Task counts cross-tabulated by status and priority.',
2930
type: 'matrix',
31+
drilldown: true,
3032
// ADR-0021 D2 — true pivot: `rows` down × `columns` across, measures in cells.
3133
dataset: 'showcase_task_metrics',
3234
rows: ['status'],
@@ -40,6 +42,7 @@ export const TaskOverviewReport: Report = {
4042
label: 'Task Overview (Joined)',
4143
description: 'Multiple task sub-reports stacked into one joined view.',
4244
type: 'joined',
45+
drilldown: true,
4346
blocks: [
4447
{
4548
// Analytics block → dataset-bound (dual-form); reconciled by the harness.

0 commit comments

Comments
 (0)