feat(F-190): completed feature
This commit is contained in:
4
project/apps/admin/next-env.d.ts
vendored
4
project/apps/admin/next-env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/types/root-params.d.ts";
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/dev/types/root-params.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
4
project/apps/pos/next-env.d.ts
vendored
4
project/apps/pos/next-env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/types/root-params.d.ts";
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/dev/types/root-params.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 568 B |
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
@@ -173,7 +173,7 @@ describe('GET /reporting/summary (REPORTING_SALES)', () => {
|
||||
expect(body.dataAvailability.grossSales).toBe('available');
|
||||
expect(body.dataAvailability.netSales).toBe('unavailable');
|
||||
expect(body.dataAvailability.margin).toBe('unavailable');
|
||||
expect(body.dataAvailability.paymentMethod).toBe('unavailable');
|
||||
expect(body.dataAvailability.paymentMethod).toBe('available'); // F-190
|
||||
expect(body.dataAvailability.shipping).toBe('available');
|
||||
expect(body.dataAvailability.discounts).toBe('available');
|
||||
});
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/**
|
||||
* F-146 — ReportingService: summary and sales endpoints.
|
||||
* F-190 — dataAvailability flags corrected: refunds and paymentMethod
|
||||
* are now available via reporting_payment_lines.
|
||||
*
|
||||
* Uses the CTE `filtered_orders` pattern from REPORTING_ARCHITECTURE.md §7.
|
||||
* All SQL is fully parameterized — no user input in the query string.
|
||||
@@ -78,8 +80,8 @@ export interface SummaryResponse {
|
||||
orders: 'available';
|
||||
customers: 'available';
|
||||
margin: 'unavailable';
|
||||
paymentMethod: 'unavailable';
|
||||
refunds: 'unavailable';
|
||||
paymentMethod: 'available'; // F-190: reporting_payment_lines has provider data
|
||||
refunds: 'available'; // F-190: reporting_payment_lines has refund rows
|
||||
shipping: 'available';
|
||||
};
|
||||
totals: Metrics;
|
||||
@@ -106,8 +108,8 @@ export interface SalesResponse {
|
||||
orders: 'available';
|
||||
customers: 'available';
|
||||
margin: 'unavailable';
|
||||
paymentMethod: 'unavailable';
|
||||
refunds: 'unavailable';
|
||||
paymentMethod: 'available'; // F-190: reporting_payment_lines has provider data
|
||||
refunds: 'available'; // F-190: reporting_payment_lines has refund rows
|
||||
shipping: 'available';
|
||||
};
|
||||
items: SalesRow[];
|
||||
@@ -198,8 +200,8 @@ export class ReportingService {
|
||||
* - unitsSold: available (SUM quantity)
|
||||
* - orders/customers: available
|
||||
* - margin: unavailable (cost_at_sale not populated)
|
||||
* - paymentMethod: unavailable (needs JOIN with reporting_payment_lines)
|
||||
* - refunds: unavailable (needs state filter)
|
||||
* - paymentMethod: available (F-190: reporting_payment_lines has provider per payment)
|
||||
* - refunds: available (F-190: reporting_payment_lines has refund rows)
|
||||
* - shipping: available (orders_orders.shipping_cents from F-144)
|
||||
*/
|
||||
async summary(filters: ReportingFilters): Promise<SummaryResponse> {
|
||||
@@ -231,8 +233,8 @@ export class ReportingService {
|
||||
orders: 'available',
|
||||
customers: 'available',
|
||||
margin: 'unavailable',
|
||||
paymentMethod: 'unavailable',
|
||||
refunds: 'unavailable',
|
||||
paymentMethod: 'available', // F-190
|
||||
refunds: 'available', // F-190
|
||||
shipping: 'available',
|
||||
},
|
||||
totals: current,
|
||||
@@ -277,8 +279,8 @@ export class ReportingService {
|
||||
orders: 'available',
|
||||
customers: 'available',
|
||||
margin: 'unavailable',
|
||||
paymentMethod: 'unavailable',
|
||||
refunds: 'unavailable',
|
||||
paymentMethod: 'available', // F-190
|
||||
refunds: 'available', // F-190
|
||||
shipping: 'available',
|
||||
},
|
||||
items: rows,
|
||||
@@ -520,8 +522,8 @@ export class ReportingService {
|
||||
orders: 'available',
|
||||
customers: 'available',
|
||||
margin: 'unavailable',
|
||||
paymentMethod: 'unavailable',
|
||||
refunds: 'unavailable',
|
||||
paymentMethod: 'available', // F-190
|
||||
refunds: 'available', // F-190
|
||||
shipping: 'available',
|
||||
},
|
||||
items: rows,
|
||||
|
||||
@@ -68,8 +68,8 @@ describe('ReportingService', () => {
|
||||
orders: 'available',
|
||||
customers: 'available',
|
||||
margin: 'unavailable',
|
||||
paymentMethod: 'unavailable',
|
||||
refunds: 'unavailable',
|
||||
paymentMethod: 'available', // F-190
|
||||
refunds: 'available', // F-190
|
||||
shipping: 'available',
|
||||
},
|
||||
totals: {
|
||||
@@ -144,8 +144,8 @@ describe('ReportingService', () => {
|
||||
const svc = new ReportingService(pool);
|
||||
const result = await svc.summary(makeFilters());
|
||||
expect(result.dataAvailability.margin).toBe('unavailable');
|
||||
expect(result.dataAvailability.paymentMethod).toBe('unavailable');
|
||||
expect(result.dataAvailability.refunds).toBe('unavailable');
|
||||
expect(result.dataAvailability.paymentMethod).toBe('available'); // F-190
|
||||
expect(result.dataAvailability.refunds).toBe('available'); // F-190
|
||||
expect(result.dataAvailability.netSales).toBe('unavailable');
|
||||
expect(result.dataAvailability.grossSales).toBe('available');
|
||||
expect(result.dataAvailability.shipping).toBe('available');
|
||||
|
||||
9
project/storefront/AGENTS.md
Normal file
9
project/storefront/AGENTS.md
Normal file
@@ -0,0 +1,9 @@
|
||||
<!-- BEGIN:nextjs-agent-rules -->
|
||||
|
||||
# This is NOT the Next.js you know
|
||||
|
||||
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
|
||||
|
||||
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
|
||||
|
||||
<!-- END:nextjs-agent-rules -->
|
||||
1
project/storefront/CLAUDE.md
Normal file
1
project/storefront/CLAUDE.md
Normal file
@@ -0,0 +1 @@
|
||||
@AGENTS.md
|
||||
4
project/storefront/next-env.d.ts
vendored
4
project/storefront/next-env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/types/routes.d.ts";
|
||||
import "./.next/types/root-params.d.ts";
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/dev/types/root-params.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 568 B |
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
Reference in New Issue
Block a user