@managesome/eposmatic-toolkit 0.4.59 → 0.4.61
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/esm/constants/MATERIALIZED_REPORTS.js +177 -8
- package/esm/helpers/materialized-reports/index.js +7 -0
- package/esm/helpers/materialized-reports/materialized-day-readiness.js +2 -2
- package/esm/helpers/materialized-reports/materialized-dinein-accumulator-helpers.js +557 -0
- package/esm/helpers/materialized-reports/materialized-dinein-classification-helpers.js +447 -0
- package/esm/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +372 -0
- package/esm/helpers/materialized-reports/materialized-dinein-compile-helpers.js +500 -0
- package/esm/helpers/materialized-reports/materialized-dinein-entry-pages.js +218 -0
- package/esm/helpers/materialized-reports/materialized-dinein-key-helpers.js +87 -0
- package/esm/helpers/materialized-reports/materialized-index-bootstrap.js +4 -0
- package/esm/helpers/materialized-reports/materialized-report-drilldown-rows.js +8 -0
- package/esm/helpers/materialized-reports/report-platform/definition.js +93 -1
- package/esm/helpers/materialized-reports/tenant-dinein-formatter.js +240 -0
- package/esm/helpers/reporting-contract/report-contract.js +3 -0
- package/esm/schemas/models/index.js +2 -0
- package/esm/schemas/models/materialized_tenant_dinein_entries.js +57 -0
- package/esm/schemas/models/materialized_tenant_dinein_reports.js +73 -0
- package/esm/schemas/types/index.js +2 -0
- package/esm/schemas/types/materialized_report_drilldown_rows.js +1 -0
- package/esm/schemas/types/materialized_tenant_dinein_entries.js +1 -0
- package/esm/schemas/types/materialized_tenant_dinein_reports.js +6 -0
- package/lib/constants/MATERIALIZED_REPORTS.d.ts +160 -8
- package/lib/constants/MATERIALIZED_REPORTS.js +178 -9
- package/lib/helpers/materialized-reports/index.d.ts +7 -0
- package/lib/helpers/materialized-reports/index.js +7 -0
- package/lib/helpers/materialized-reports/materialized-day-readiness.d.ts +1 -1
- package/lib/helpers/materialized-reports/materialized-day-readiness.js +2 -2
- package/lib/helpers/materialized-reports/materialized-dinein-accumulator-helpers.d.ts +67 -0
- package/lib/helpers/materialized-reports/materialized-dinein-accumulator-helpers.js +582 -0
- package/lib/helpers/materialized-reports/materialized-dinein-classification-helpers.d.ts +245 -0
- package/lib/helpers/materialized-reports/materialized-dinein-classification-helpers.js +469 -0
- package/lib/helpers/materialized-reports/materialized-dinein-close-day-helpers.d.ts +110 -0
- package/lib/helpers/materialized-reports/materialized-dinein-close-day-helpers.js +384 -0
- package/lib/helpers/materialized-reports/materialized-dinein-compile-helpers.d.ts +73 -0
- package/lib/helpers/materialized-reports/materialized-dinein-compile-helpers.js +504 -0
- package/lib/helpers/materialized-reports/materialized-dinein-entry-pages.d.ts +69 -0
- package/lib/helpers/materialized-reports/materialized-dinein-entry-pages.js +231 -0
- package/lib/helpers/materialized-reports/materialized-dinein-key-helpers.d.ts +44 -0
- package/lib/helpers/materialized-reports/materialized-dinein-key-helpers.js +96 -0
- package/lib/helpers/materialized-reports/materialized-index-bootstrap.js +4 -0
- package/lib/helpers/materialized-reports/materialized-report-drilldown-rows.js +8 -0
- package/lib/helpers/materialized-reports/report-platform/definition.js +92 -0
- package/lib/helpers/materialized-reports/tenant-dinein-formatter.d.ts +225 -0
- package/lib/helpers/materialized-reports/tenant-dinein-formatter.js +243 -0
- package/lib/helpers/reporting-contract/report-contract.d.ts +1 -0
- package/lib/helpers/reporting-contract/report-contract.js +3 -0
- package/lib/schemas/models/index.d.ts +2 -0
- package/lib/schemas/models/index.js +2 -0
- package/lib/schemas/models/materialized_tenant_day_readiness.d.ts +3 -3
- package/lib/schemas/models/materialized_tenant_dinein_entries.d.ts +100 -0
- package/lib/schemas/models/materialized_tenant_dinein_entries.js +60 -0
- package/lib/schemas/models/materialized_tenant_dinein_reports.d.ts +111 -0
- package/lib/schemas/models/materialized_tenant_dinein_reports.js +76 -0
- package/lib/schemas/types/index.d.ts +2 -0
- package/lib/schemas/types/index.js +2 -0
- package/lib/schemas/types/materialized_report_drilldown_rows.d.ts +1 -1
- package/lib/schemas/types/materialized_report_drilldown_rows.js +1 -0
- package/lib/schemas/types/materialized_tenant_dinein_entries.d.ts +127 -0
- package/lib/schemas/types/materialized_tenant_dinein_entries.js +2 -0
- package/lib/schemas/types/materialized_tenant_dinein_reports.d.ts +326 -0
- package/lib/schemas/types/materialized_tenant_dinein_reports.js +9 -0
- package/lib/tests/materialized-reports/dinein-fixtures.d.ts +29 -0
- package/lib/tests/materialized-reports/dinein-fixtures.js +130 -0
- package/lib/tests/materialized-reports/materialized-day-readiness.test.js +3 -2
- package/lib/tests/materialized-reports/materialized-dinein-compile.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-dinein-compile.test.js +807 -0
- package/lib/tests/materialized-reports/materialized-dinein-plan.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-dinein-plan.test.js +419 -0
- package/lib/tests/materialized-reports/materialized-tenant-dinein-schema.test.d.ts +1 -0
- package/lib/tests/materialized-reports/materialized-tenant-dinein-schema.test.js +185 -0
- package/lib/tests/materialized-reports/report-platform/registry-conformance.test.js +15 -2
- package/lib/tests/materialized-reports/tenant-dinein-formatter.test.d.ts +1 -0
- package/lib/tests/materialized-reports/tenant-dinein-formatter.test.js +299 -0
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_INDEX_OPTIONS = exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_COLLECTION_INDEXES = exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_COLLECTION_NAME = exports.MaterializedTenantDineinEntriesSchema = exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_SCHEMA_VERSION = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const ENUMS_1 = require("../../constants/ENUMS");
|
|
6
|
+
const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
7
|
+
/**
|
|
8
|
+
* Mongoose schema for `materialized_tenant_dinein_entries`.
|
|
9
|
+
*
|
|
10
|
+
* `dinein_entries` is `Mixed`: it is a key-addressed map of row sections
|
|
11
|
+
* (`<ORDER_STATUS>:<PLATFORM>` → rows), and the keys ARE the data.
|
|
12
|
+
*
|
|
13
|
+
* The UNIQUE identity includes `page`, exactly like the discount / delivery /
|
|
14
|
+
* dialer page collections: a page-per-source-day design cannot coexist with a
|
|
15
|
+
* unique index that omits `page`, because every period page of a month shares
|
|
16
|
+
* `day_index: null`.
|
|
17
|
+
*/
|
|
18
|
+
/** Document shape version. Bump on a row-shape change + backfill. */
|
|
19
|
+
exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_SCHEMA_VERSION = 1;
|
|
20
|
+
exports.MaterializedTenantDineinEntriesSchema = new mongoose_1.Schema({
|
|
21
|
+
tenant_id: { type: String, required: true },
|
|
22
|
+
brand_id: { type: String, required: true },
|
|
23
|
+
scope_context: { type: String, required: true, enum: MATERIALIZED_REPORTS_1.MATERIALIZED_DINEIN_ENTRY_SCOPES },
|
|
24
|
+
scope_field: { type: String, required: true },
|
|
25
|
+
page: { type: String, required: true },
|
|
26
|
+
day_index: { type: String, default: null, enum: [...ENUMS_1.ALL_DAY_INDEX, null] },
|
|
27
|
+
dinein_entries: { type: mongoose_1.Schema.Types.Mixed, required: true, default: null },
|
|
28
|
+
iteration: { type: Number, required: true, min: 1, default: 1 },
|
|
29
|
+
schema_version: {
|
|
30
|
+
type: Number,
|
|
31
|
+
required: true,
|
|
32
|
+
immutable: true,
|
|
33
|
+
default: exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_SCHEMA_VERSION,
|
|
34
|
+
},
|
|
35
|
+
source_watermark: { type: mongoose_1.Schema.Types.Date, required: true },
|
|
36
|
+
computed_at: { type: mongoose_1.Schema.Types.Date, required: true },
|
|
37
|
+
createdAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date(), immutable: true },
|
|
38
|
+
updatedAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date() },
|
|
39
|
+
}, { timestamps: true, versionKey: false, minimize: false });
|
|
40
|
+
exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_COLLECTION_NAME = 'materialized_tenant_dinein_entries';
|
|
41
|
+
/**
|
|
42
|
+
* The single UNIQUE compound identity index (tenant + scope + value + page).
|
|
43
|
+
* Declared ONLY — never applied by this package or the services.
|
|
44
|
+
*/
|
|
45
|
+
exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_COLLECTION_INDEXES = {
|
|
46
|
+
_id: { _id: 1 },
|
|
47
|
+
tenant_id__scope_context__scope_field__page: {
|
|
48
|
+
tenant_id: 1,
|
|
49
|
+
scope_context: 1,
|
|
50
|
+
scope_field: 1,
|
|
51
|
+
page: 1,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
exports.MATERIALIZED_TENANT_DINEIN_ENTRIES_INDEX_OPTIONS = [
|
|
55
|
+
{
|
|
56
|
+
key: { tenant_id: 1, scope_context: 1, scope_field: 1, page: 1 },
|
|
57
|
+
name: 'tenant_id__scope_context__scope_field__page',
|
|
58
|
+
unique: true,
|
|
59
|
+
},
|
|
60
|
+
];
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
/**
|
|
3
|
+
* Mongoose schema for `materialized_tenant_dinein_reports`.
|
|
4
|
+
*
|
|
5
|
+
* `dinein_counters` is `Mixed` on purpose: it is a key-addressed map of bounded
|
|
6
|
+
* counter blocks (`<ORDER_STATUS>:<PLATFORM>` → counters + bounded dimension
|
|
7
|
+
* maps), and the keys ARE the data — Mongoose cannot type them without a fixed
|
|
8
|
+
* key set. `reservation_counters` is a DOCUMENT-level block because a
|
|
9
|
+
* reservation has no order and must survive any order-status/platform filter.
|
|
10
|
+
*
|
|
11
|
+
* The collection holds COUNTERS only. Itemized check rows live in the sibling
|
|
12
|
+
* `materialized_tenant_dinein_entries` collection (one page per source day).
|
|
13
|
+
*/
|
|
14
|
+
/** Document shape version. Bump on a key-grammar/metric change + backfill. */
|
|
15
|
+
export declare const MATERIALIZED_TENANT_DINEIN_REPORTS_SCHEMA_VERSION = 1;
|
|
16
|
+
export declare const MaterializedTenantDineinReportSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
17
|
+
timestamps: true;
|
|
18
|
+
versionKey: false;
|
|
19
|
+
minimize: false;
|
|
20
|
+
}, {
|
|
21
|
+
createdAt: NativeDate;
|
|
22
|
+
updatedAt: NativeDate;
|
|
23
|
+
} & {
|
|
24
|
+
createdAt: NativeDate;
|
|
25
|
+
updatedAt: NativeDate;
|
|
26
|
+
brand_id: string;
|
|
27
|
+
tenant_id: string;
|
|
28
|
+
day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
|
|
29
|
+
iteration: number;
|
|
30
|
+
scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
31
|
+
scope_field: string;
|
|
32
|
+
sale_type_key_filters: string[];
|
|
33
|
+
schema_version: number;
|
|
34
|
+
source_watermark: NativeDate;
|
|
35
|
+
computed_at: NativeDate;
|
|
36
|
+
dinein_counters: any;
|
|
37
|
+
reservation_counters: any;
|
|
38
|
+
upcoming_reservations: any;
|
|
39
|
+
top_edited_checks: any;
|
|
40
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
41
|
+
createdAt: NativeDate;
|
|
42
|
+
updatedAt: NativeDate;
|
|
43
|
+
} & {
|
|
44
|
+
createdAt: NativeDate;
|
|
45
|
+
updatedAt: NativeDate;
|
|
46
|
+
brand_id: string;
|
|
47
|
+
tenant_id: string;
|
|
48
|
+
day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
|
|
49
|
+
iteration: number;
|
|
50
|
+
scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
51
|
+
scope_field: string;
|
|
52
|
+
sale_type_key_filters: string[];
|
|
53
|
+
schema_version: number;
|
|
54
|
+
source_watermark: NativeDate;
|
|
55
|
+
computed_at: NativeDate;
|
|
56
|
+
dinein_counters: any;
|
|
57
|
+
reservation_counters: any;
|
|
58
|
+
upcoming_reservations: any;
|
|
59
|
+
top_edited_checks: any;
|
|
60
|
+
}>> & import("mongoose").FlatRecord<{
|
|
61
|
+
createdAt: NativeDate;
|
|
62
|
+
updatedAt: NativeDate;
|
|
63
|
+
} & {
|
|
64
|
+
createdAt: NativeDate;
|
|
65
|
+
updatedAt: NativeDate;
|
|
66
|
+
brand_id: string;
|
|
67
|
+
tenant_id: string;
|
|
68
|
+
day_index: import("../../constants/ENUMS").DAY_INDEX_ENUM | null;
|
|
69
|
+
iteration: number;
|
|
70
|
+
scope_context: import("../../constants/MATERIALIZED_REPORTS").MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
71
|
+
scope_field: string;
|
|
72
|
+
sale_type_key_filters: string[];
|
|
73
|
+
schema_version: number;
|
|
74
|
+
source_watermark: NativeDate;
|
|
75
|
+
computed_at: NativeDate;
|
|
76
|
+
dinein_counters: any;
|
|
77
|
+
reservation_counters: any;
|
|
78
|
+
upcoming_reservations: any;
|
|
79
|
+
top_edited_checks: any;
|
|
80
|
+
}> & {
|
|
81
|
+
_id: import("mongoose").Types.ObjectId;
|
|
82
|
+
} & {
|
|
83
|
+
__v: number;
|
|
84
|
+
}>;
|
|
85
|
+
export declare const MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_NAME = "materialized_tenant_dinein_reports";
|
|
86
|
+
/**
|
|
87
|
+
* The single UNIQUE compound identity index, like every materialized report
|
|
88
|
+
* collection. Declared ONLY — no service calls `index()` or `ensureIndexes`, and
|
|
89
|
+
* the services run with `autoIndex: false`. Applying it is an owner deploy step.
|
|
90
|
+
*/
|
|
91
|
+
export declare const MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_INDEXES: {
|
|
92
|
+
_id: {
|
|
93
|
+
_id: number;
|
|
94
|
+
};
|
|
95
|
+
tenant_id__scope_context__scope_field__day_index: {
|
|
96
|
+
tenant_id: number;
|
|
97
|
+
scope_context: number;
|
|
98
|
+
scope_field: number;
|
|
99
|
+
day_index: number;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export declare const MATERIALIZED_TENANT_DINEIN_REPORTS_INDEX_OPTIONS: {
|
|
103
|
+
key: {
|
|
104
|
+
tenant_id: number;
|
|
105
|
+
scope_context: number;
|
|
106
|
+
scope_field: number;
|
|
107
|
+
day_index: number;
|
|
108
|
+
};
|
|
109
|
+
name: string;
|
|
110
|
+
unique: boolean;
|
|
111
|
+
}[];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MATERIALIZED_TENANT_DINEIN_REPORTS_INDEX_OPTIONS = exports.MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_INDEXES = exports.MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_NAME = exports.MaterializedTenantDineinReportSchema = exports.MATERIALIZED_TENANT_DINEIN_REPORTS_SCHEMA_VERSION = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const ENUMS_1 = require("../../constants/ENUMS");
|
|
6
|
+
const MATERIALIZED_REPORTS_1 = require("../../constants/MATERIALIZED_REPORTS");
|
|
7
|
+
/**
|
|
8
|
+
* Mongoose schema for `materialized_tenant_dinein_reports`.
|
|
9
|
+
*
|
|
10
|
+
* `dinein_counters` is `Mixed` on purpose: it is a key-addressed map of bounded
|
|
11
|
+
* counter blocks (`<ORDER_STATUS>:<PLATFORM>` → counters + bounded dimension
|
|
12
|
+
* maps), and the keys ARE the data — Mongoose cannot type them without a fixed
|
|
13
|
+
* key set. `reservation_counters` is a DOCUMENT-level block because a
|
|
14
|
+
* reservation has no order and must survive any order-status/platform filter.
|
|
15
|
+
*
|
|
16
|
+
* The collection holds COUNTERS only. Itemized check rows live in the sibling
|
|
17
|
+
* `materialized_tenant_dinein_entries` collection (one page per source day).
|
|
18
|
+
*/
|
|
19
|
+
/** Document shape version. Bump on a key-grammar/metric change + backfill. */
|
|
20
|
+
exports.MATERIALIZED_TENANT_DINEIN_REPORTS_SCHEMA_VERSION = 1;
|
|
21
|
+
exports.MaterializedTenantDineinReportSchema = new mongoose_1.Schema({
|
|
22
|
+
tenant_id: { type: String, required: true },
|
|
23
|
+
brand_id: { type: String, required: true },
|
|
24
|
+
scope_context: { type: String, required: true, enum: MATERIALIZED_REPORTS_1.MATERIALIZED_DINEIN_REPORT_SCOPES },
|
|
25
|
+
scope_field: { type: String, required: true },
|
|
26
|
+
day_index: { type: String, default: null, enum: [...ENUMS_1.ALL_DAY_INDEX, null] },
|
|
27
|
+
sale_type_key_filters: {
|
|
28
|
+
type: [String],
|
|
29
|
+
required: true,
|
|
30
|
+
default: () => [...MATERIALIZED_REPORTS_1.DINEIN_KEY_FILTERS],
|
|
31
|
+
validate: {
|
|
32
|
+
validator: (value) => value.length > 0 &&
|
|
33
|
+
value.every((entry) => MATERIALIZED_REPORTS_1.ALL_MATERIALIZED_REPORT_KEY_FILTERS.includes(entry)),
|
|
34
|
+
message: 'sale_type_key_filters must be a non-empty subset of the known key filters',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
dinein_counters: { type: mongoose_1.Schema.Types.Mixed, required: true, default: null },
|
|
38
|
+
reservation_counters: { type: mongoose_1.Schema.Types.Mixed, required: true, default: null },
|
|
39
|
+
// Bounded, masked display snapshots. `Mixed` for the same reason as the
|
|
40
|
+
// counters: the arrays are written whole and never queried element-wise.
|
|
41
|
+
upcoming_reservations: { type: mongoose_1.Schema.Types.Mixed, default: null },
|
|
42
|
+
top_edited_checks: { type: mongoose_1.Schema.Types.Mixed, default: null },
|
|
43
|
+
iteration: { type: Number, required: true, min: 1, default: 1 },
|
|
44
|
+
schema_version: {
|
|
45
|
+
type: Number,
|
|
46
|
+
required: true,
|
|
47
|
+
immutable: true,
|
|
48
|
+
default: exports.MATERIALIZED_TENANT_DINEIN_REPORTS_SCHEMA_VERSION,
|
|
49
|
+
},
|
|
50
|
+
source_watermark: { type: mongoose_1.Schema.Types.Date, required: true },
|
|
51
|
+
computed_at: { type: mongoose_1.Schema.Types.Date, required: true },
|
|
52
|
+
createdAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date(), immutable: true },
|
|
53
|
+
updatedAt: { type: mongoose_1.Schema.Types.Date, required: true, default: () => new Date() },
|
|
54
|
+
}, { timestamps: true, versionKey: false, minimize: false });
|
|
55
|
+
exports.MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_NAME = 'materialized_tenant_dinein_reports';
|
|
56
|
+
/**
|
|
57
|
+
* The single UNIQUE compound identity index, like every materialized report
|
|
58
|
+
* collection. Declared ONLY — no service calls `index()` or `ensureIndexes`, and
|
|
59
|
+
* the services run with `autoIndex: false`. Applying it is an owner deploy step.
|
|
60
|
+
*/
|
|
61
|
+
exports.MATERIALIZED_TENANT_DINEIN_REPORTS_COLLECTION_INDEXES = {
|
|
62
|
+
_id: { _id: 1 },
|
|
63
|
+
tenant_id__scope_context__scope_field__day_index: {
|
|
64
|
+
tenant_id: 1,
|
|
65
|
+
scope_context: 1,
|
|
66
|
+
scope_field: 1,
|
|
67
|
+
day_index: 1,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
exports.MATERIALIZED_TENANT_DINEIN_REPORTS_INDEX_OPTIONS = [
|
|
71
|
+
{
|
|
72
|
+
key: { tenant_id: 1, scope_context: 1, scope_field: 1, day_index: 1 },
|
|
73
|
+
name: 'tenant_id__scope_context__scope_field__day_index',
|
|
74
|
+
unique: true,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
@@ -44,6 +44,8 @@ export * from './materialized_tenant_discount_entries';
|
|
|
44
44
|
export * from './materialized_tenant_discount_reports';
|
|
45
45
|
export * from './materialized_tenant_dialer_entries';
|
|
46
46
|
export * from './materialized_tenant_dialer_reports';
|
|
47
|
+
export * from './materialized_tenant_dinein_entries';
|
|
48
|
+
export * from './materialized_tenant_dinein_reports';
|
|
47
49
|
export * from './materialized_tenant_discount_sources';
|
|
48
50
|
export * from './materialized_tenant_hourly_comparison_entries';
|
|
49
51
|
export * from './materialized_tenant_hourly_comparison_reports';
|
|
@@ -60,6 +60,8 @@ __exportStar(require("./materialized_tenant_discount_entries"), exports);
|
|
|
60
60
|
__exportStar(require("./materialized_tenant_discount_reports"), exports);
|
|
61
61
|
__exportStar(require("./materialized_tenant_dialer_entries"), exports);
|
|
62
62
|
__exportStar(require("./materialized_tenant_dialer_reports"), exports);
|
|
63
|
+
__exportStar(require("./materialized_tenant_dinein_entries"), exports);
|
|
64
|
+
__exportStar(require("./materialized_tenant_dinein_reports"), exports);
|
|
63
65
|
__exportStar(require("./materialized_tenant_discount_sources"), exports);
|
|
64
66
|
__exportStar(require("./materialized_tenant_hourly_comparison_entries"), exports);
|
|
65
67
|
__exportStar(require("./materialized_tenant_hourly_comparison_reports"), exports);
|
|
@@ -13,7 +13,7 @@ import { MATERIALIZED_REPORT_SCOPE_ENUM, MATERIALIZED_REPORT_TYPE_ENUM } from '.
|
|
|
13
13
|
* fields a page query needs: selection identity, sort anchor, and cursor
|
|
14
14
|
* tie-break.
|
|
15
15
|
*/
|
|
16
|
-
export type TDrilldownReportType = MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PREP_TIME_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_CASH_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DELIVERY_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_SALES_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_HOURLY_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PAYMENTS_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DIALER_ENTRIES;
|
|
16
|
+
export type TDrilldownReportType = MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DISCOUNT_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PREP_TIME_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_CASH_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DELIVERY_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_SALES_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_HOURLY_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PAYMENTS_COMPARISON_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DIALER_ENTRIES | MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DINEIN_ENTRIES;
|
|
17
17
|
export declare const ALL_DRILLDOWN_REPORT_TYPES: TDrilldownReportType[];
|
|
18
18
|
/** One flattened itemized row. */
|
|
19
19
|
export interface IMaterializedReportDrilldownRow {
|
|
@@ -11,4 +11,5 @@ exports.ALL_DRILLDOWN_REPORT_TYPES = [
|
|
|
11
11
|
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_HOURLY_COMPARISON_ENTRIES,
|
|
12
12
|
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_PAYMENTS_COMPARISON_ENTRIES,
|
|
13
13
|
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DIALER_ENTRIES,
|
|
14
|
+
MATERIALIZED_REPORTS_1.MATERIALIZED_REPORT_TYPE_ENUM.TENANT_DINEIN_ENTRIES,
|
|
14
15
|
];
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { DAY_INDEX_ENUM } from '../../constants/ENUMS';
|
|
2
|
+
import { MATERIALIZED_REPORT_SCOPE_ENUM } from '../../constants/MATERIALIZED_REPORTS';
|
|
3
|
+
/**
|
|
4
|
+
* Types for `materialized_tenant_dinein_entries`.
|
|
5
|
+
*
|
|
6
|
+
* ## One page per source day
|
|
7
|
+
*
|
|
8
|
+
* | scope | page |
|
|
9
|
+
* | --- | --- |
|
|
10
|
+
* | `localDate` | `'all'` (the scope is already one day) |
|
|
11
|
+
* | `localWeek` | `<source localDate>` |
|
|
12
|
+
* | `localWeekOfYear` | `<source localDate>` |
|
|
13
|
+
* | `localMonth` | `<source localDate>` |
|
|
14
|
+
*
|
|
15
|
+
* An oversized page splits into deterministic `page#0`, `page#1`, … sub-pages;
|
|
16
|
+
* the unsuffixed identity is used while the page fits.
|
|
17
|
+
*
|
|
18
|
+
* ## One row per collectable check
|
|
19
|
+
*
|
|
20
|
+
* A split CHILD is its own row and the deleted split PARENT is never a row
|
|
21
|
+
* ("split children are rows; the parent is hidden"). The per-row `covers` is the
|
|
22
|
+
* check's settled fingerprint covers, never the child's `num_of_guests`.
|
|
23
|
+
*
|
|
24
|
+
* ## Privacy
|
|
25
|
+
*
|
|
26
|
+
* A row carries NO customer name, phone or email and NO review text. Only the
|
|
27
|
+
* numeric `rating` is stored, and the review itself is reduced to the
|
|
28
|
+
* document-level `review_count`.
|
|
29
|
+
*/
|
|
30
|
+
export interface IDineinEntryRow {
|
|
31
|
+
/** Source order `_id` — the row identity and the keyset cursor tie-break. */
|
|
32
|
+
order_id: string;
|
|
33
|
+
order_number: number | null;
|
|
34
|
+
/** The order's own tenant-local business day. */
|
|
35
|
+
localDate: string;
|
|
36
|
+
/** ISO-8601 instant of the check (`order.createdAt`) — newest-first cursor. */
|
|
37
|
+
time: string;
|
|
38
|
+
table_id: string | null;
|
|
39
|
+
table_name: string | null;
|
|
40
|
+
floor_id: string | null;
|
|
41
|
+
/** Fingerprint covers of the check's settled session; 0 when it had no session. */
|
|
42
|
+
covers: number;
|
|
43
|
+
status: string;
|
|
44
|
+
platform: string;
|
|
45
|
+
/** `POS_DIRECT` | `STAFF_TABLET` | `QR_SELF_ORDER` | `UNKNOWN_ORIGIN`. */
|
|
46
|
+
origin: string;
|
|
47
|
+
/** `split_type` of the split group, or null for a non-split check. */
|
|
48
|
+
split_type: string | null;
|
|
49
|
+
/** `NONE` | `CHILD` — a parent is never a row. */
|
|
50
|
+
split_role: string;
|
|
51
|
+
offline: boolean;
|
|
52
|
+
rating: number | null;
|
|
53
|
+
/** `amount_earned` (cents) — already includes the service charge. */
|
|
54
|
+
sales: number;
|
|
55
|
+
/** `service_fee_amount` (cents) — a COMPONENT of `sales`. */
|
|
56
|
+
service_charge: number;
|
|
57
|
+
items: number;
|
|
58
|
+
/** `iterations.length` — the current order is not an edit. */
|
|
59
|
+
edits: number;
|
|
60
|
+
}
|
|
61
|
+
/** Per-key row section of one entry page. */
|
|
62
|
+
export interface IDineinEntrySection {
|
|
63
|
+
rows: IDineinEntryRow[];
|
|
64
|
+
}
|
|
65
|
+
/** One `materialized_tenant_dinein_entries` PAGE. */
|
|
66
|
+
export interface IMaterializedTenantDineinEntry {
|
|
67
|
+
_id: string;
|
|
68
|
+
tenant_id: string;
|
|
69
|
+
brand_id: string;
|
|
70
|
+
/** One of `MATERIALIZED_DINEIN_ENTRY_SCOPES`. */
|
|
71
|
+
scope_context: MATERIALIZED_REPORT_SCOPE_ENUM;
|
|
72
|
+
scope_field: string;
|
|
73
|
+
/** `'all'` for the day scope; the source `YYYY-MM-DD` for a period scope. */
|
|
74
|
+
page: string;
|
|
75
|
+
/** Denormalized weekday — set ONLY on the `localDate` page. */
|
|
76
|
+
day_index: DAY_INDEX_ENUM | null;
|
|
77
|
+
/** One row section per observed `<ORDER_STATUS>:<PLATFORM>` key. */
|
|
78
|
+
dinein_entries: Record<string, IDineinEntrySection> | null;
|
|
79
|
+
/** Shared materialized-envelope field (structural version of THIS document). */
|
|
80
|
+
iteration?: number;
|
|
81
|
+
schema_version: number;
|
|
82
|
+
source_watermark: Date;
|
|
83
|
+
computed_at: Date;
|
|
84
|
+
createdAt: Date;
|
|
85
|
+
updatedAt: Date;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The explicit COVERAGE GAP counters of one closing day.
|
|
89
|
+
*
|
|
90
|
+
* A missing fingerprint never becomes a fabricated session: the gap is counted
|
|
91
|
+
* here and surfaced by the writer, so "no table sessions" can never be confused
|
|
92
|
+
* with "no dine-in orders".
|
|
93
|
+
*/
|
|
94
|
+
export interface IDineinSourceDayCounts {
|
|
95
|
+
/** Dine-in checks folded into this day (children + non-split orders). */
|
|
96
|
+
orders_counted: number;
|
|
97
|
+
/** Dine-in checks that carry ANOTHER business day — never moved into this one. */
|
|
98
|
+
orders_out_of_day: number;
|
|
99
|
+
/** Deleted split parents excluded from sales/order counts. */
|
|
100
|
+
deleted_split_parents_excluded: number;
|
|
101
|
+
/** Ratings inherited from a deleted split parent (counted at most once per group). */
|
|
102
|
+
ratings_from_deleted_parents: number;
|
|
103
|
+
/** Counted checks with NO joined fingerprint: their covers/occupancy are unknown. */
|
|
104
|
+
orders_without_fingerprint: number;
|
|
105
|
+
/** Fingerprint rows supplied for the day. */
|
|
106
|
+
fingerprints_total: number;
|
|
107
|
+
/** Distinct fingerprints joined to a counted check (one = one table session). */
|
|
108
|
+
fingerprints_joined: number;
|
|
109
|
+
/** Duplicate `fingerprint._id` rows dropped (dedupe). */
|
|
110
|
+
fingerprints_duplicate: number;
|
|
111
|
+
/** Fingerprints whose `order_id` is not a counted check of this day. */
|
|
112
|
+
fingerprints_unattached: number;
|
|
113
|
+
/** Fingerprints with no seated start AND no `order.createdAt` fallback. */
|
|
114
|
+
fingerprints_missing_start: number;
|
|
115
|
+
/** Fingerprints with no usable `createdAt` (session end) — session skipped. */
|
|
116
|
+
fingerprints_missing_end: number;
|
|
117
|
+
/** Fingerprints whose seated time is AFTER the close, or otherwise negative. */
|
|
118
|
+
fingerprints_negative_duration: number;
|
|
119
|
+
/** Sessions whose start fell back to `order.createdAt` (missing `start_time`). */
|
|
120
|
+
fingerprints_fallback_start: number;
|
|
121
|
+
/** Reservations folded into this day. */
|
|
122
|
+
reservations_counted: number;
|
|
123
|
+
/** Reservations whose resolved tenant-local day is another day. */
|
|
124
|
+
reservations_out_of_day: number;
|
|
125
|
+
/** Reservations with no usable `reservation_time`. */
|
|
126
|
+
reservations_missing_time: number;
|
|
127
|
+
}
|