@managesome/eposmatic-toolkit 0.2.721 → 0.2.733

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.
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INVENTORY_ENTRIES_COLLECTION_NAME = exports.InventoryEntrySchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const constants_1 = require("../../constants");
6
+ const InventoryEntryActorSchema = new mongoose_1.Schema({
7
+ _id: {
8
+ type: String,
9
+ required: true,
10
+ },
11
+ name: {
12
+ type: String,
13
+ required: true,
14
+ default: '',
15
+ },
16
+ }, {
17
+ _id: false,
18
+ minimize: false,
19
+ });
20
+ const InventoryEntryItemSchema = new mongoose_1.Schema({
21
+ _id: {
22
+ type: mongoose_1.Schema.Types.ObjectId,
23
+ required: true,
24
+ immutable: true,
25
+ },
26
+ inventory_code: {
27
+ type: String,
28
+ required: true,
29
+ trim: true,
30
+ },
31
+ inventory_name: {
32
+ type: String,
33
+ required: true,
34
+ },
35
+ unit: {
36
+ type: String,
37
+ enum: constants_1.ALL_INVENTORY_UNIT_TYPES,
38
+ required: true,
39
+ },
40
+ transaction_type: {
41
+ type: String,
42
+ enum: constants_1.ALL_INVENTORY_TRANSACTION_TYPES,
43
+ required: true,
44
+ },
45
+ transaction_quantity: {
46
+ type: Number,
47
+ min: 0,
48
+ required: true,
49
+ },
50
+ stock_price: {
51
+ type: Number,
52
+ min: 0,
53
+ required: false,
54
+ },
55
+ preparation: {
56
+ type: mongoose_1.Schema.Types.Mixed,
57
+ required: false,
58
+ default: null,
59
+ },
60
+ }, {
61
+ _id: false,
62
+ minimize: false,
63
+ });
64
+ exports.InventoryEntrySchema = new mongoose_1.Schema({
65
+ _id: {
66
+ type: mongoose_1.Schema.Types.ObjectId,
67
+ required: true,
68
+ immutable: true,
69
+ },
70
+ ref_id: {
71
+ type: String,
72
+ required: true,
73
+ trim: true,
74
+ immutable: true,
75
+ },
76
+ ref_type: {
77
+ type: String,
78
+ enum: constants_1.ALL_WAREHOUSE_REF_TYPE_NAMES,
79
+ required: true,
80
+ immutable: true,
81
+ },
82
+ department_code: {
83
+ type: String,
84
+ required: false,
85
+ default: null,
86
+ immutable: true,
87
+ ref: 'tenant_inventory_departments',
88
+ },
89
+ doc_number: {
90
+ type: String,
91
+ required: true,
92
+ trim: true,
93
+ immutable: true,
94
+ },
95
+ transaction_category: {
96
+ type: String,
97
+ enum: constants_1.ALL_INVENTORY_TRANSACTION_CATEGORIES,
98
+ required: true,
99
+ immutable: true,
100
+ },
101
+ description: {
102
+ type: String,
103
+ required: false,
104
+ },
105
+ items: {
106
+ type: [InventoryEntryItemSchema],
107
+ required: true,
108
+ default: [],
109
+ },
110
+ total_items: {
111
+ type: Number,
112
+ min: 0,
113
+ required: true,
114
+ default: 0,
115
+ },
116
+ total_stock_price: {
117
+ type: Number,
118
+ min: 0,
119
+ required: true,
120
+ default: 0,
121
+ },
122
+ created_by: {
123
+ type: InventoryEntryActorSchema,
124
+ required: true,
125
+ },
126
+ createdAt: {
127
+ type: mongoose_1.Schema.Types.Date,
128
+ required: true,
129
+ default: () => new Date(),
130
+ immutable: true,
131
+ },
132
+ updatedAt: {
133
+ type: mongoose_1.Schema.Types.Date,
134
+ required: true,
135
+ default: () => new Date(),
136
+ },
137
+ }, {
138
+ timestamps: true,
139
+ versionKey: false,
140
+ minimize: false,
141
+ });
142
+ exports.INVENTORY_ENTRIES_COLLECTION_NAME = 'inventory_entries';
@@ -28,6 +28,7 @@ export * from './inventory_categories';
28
28
  export * from './inventory_department_transactions';
29
29
  export * from './inventory_department_utilities';
30
30
  export * from './inventory_departments';
31
+ export * from './inventory_entries';
31
32
  export * from './inventory_transactions';
32
33
  export * from './item_transactions';
33
34
  export * from './items';
@@ -44,6 +44,7 @@ __exportStar(require("./inventory_categories"), exports);
44
44
  __exportStar(require("./inventory_department_transactions"), exports);
45
45
  __exportStar(require("./inventory_department_utilities"), exports);
46
46
  __exportStar(require("./inventory_departments"), exports);
47
+ __exportStar(require("./inventory_entries"), exports);
47
48
  __exportStar(require("./inventory_transactions"), exports);
48
49
  __exportStar(require("./item_transactions"), exports);
49
50
  __exportStar(require("./items"), exports);
@@ -0,0 +1,41 @@
1
+ import { INVENTORY_ITEM_UNIT_ENUM, INVENTORY_TRANSACTION_CATEGORY_ENUM, INVENTORY_TRANSACTION_TYPE_ENUM, WAREHOUSE_REF_TYPE_ENUM } from '../../constants';
2
+ export interface IInventoryEntryActorRef {
3
+ _id: string;
4
+ name: string;
5
+ }
6
+ export interface IInventoryEntryPreparationEntry {
7
+ usage_quantity: number;
8
+ waste_quantity: number;
9
+ unit_cost: number;
10
+ final_cost: number;
11
+ waste_cost: number;
12
+ }
13
+ export interface IInventoryEntryItem {
14
+ _id: string;
15
+ inventory_code: string;
16
+ inventory_name: string;
17
+ unit: INVENTORY_ITEM_UNIT_ENUM;
18
+ transaction_type: INVENTORY_TRANSACTION_TYPE_ENUM;
19
+ transaction_quantity: number;
20
+ stock_price?: number;
21
+ preparation?: Record<string, IInventoryEntryPreparationEntry> | null;
22
+ }
23
+ export interface IInventoryEntry {
24
+ _id: string;
25
+ ref_id: string;
26
+ ref_type: WAREHOUSE_REF_TYPE_ENUM;
27
+ /**
28
+ * Set only for department utility operations — the tenant owns the stock and the
29
+ * department is a sub-location inside it. Null for warehouse + tenant kitchen utilities.
30
+ */
31
+ department_code?: string | null;
32
+ doc_number: string;
33
+ transaction_category: INVENTORY_TRANSACTION_CATEGORY_ENUM;
34
+ description?: string | null;
35
+ items: IInventoryEntryItem[];
36
+ total_items: number;
37
+ total_stock_price: number;
38
+ created_by: IInventoryEntryActorRef;
39
+ createdAt: Date;
40
+ updatedAt: Date;
41
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export {};