truflow 0.0.187 → 0.0.188

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.
@@ -1,4 +1,4 @@
1
- export interface IInventoryItem {
1
+ export interface IAllmoxyInventoryItem {
2
2
  item_id: number;
3
3
  line_id: number;
4
4
  name: string | null;
@@ -21,7 +21,7 @@ export interface IInventoryItem {
21
21
  company_exclusive: string | null;
22
22
  status: number;
23
23
  }
24
- export interface IInventoryItemResponse {
24
+ export interface IAllmoxyInventoryItemResponse {
25
25
  item_id: number;
26
26
  line_id: number;
27
27
  name: string;
@@ -1,4 +1,4 @@
1
- export interface ILocationResponse {
1
+ export interface IAllmoxyLocationResponse {
2
2
  location_id: number;
3
3
  name: string;
4
4
  display_order: number;
@@ -11,7 +11,7 @@ export interface ILocationResponse {
11
11
  updatedbyid: number;
12
12
  updateddate: string;
13
13
  }
14
- export interface ILocation {
14
+ export interface IAllmoxyLocation {
15
15
  name: string | null;
16
16
  display_order: number | null;
17
17
  status: number;
@@ -23,58 +23,95 @@
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import mongoose, { Document } from "mongoose";
26
+ import { ILocation } from "./Inventory/ILocation";
26
27
  export interface IField {
27
28
  name: string;
28
- type: string;
29
- autoGenerate?: boolean;
30
- generationPattern?: string;
29
+ key: string;
30
+ type: "number" | "text" | "select" | "calculation" | "tag";
31
31
  required?: boolean;
32
+ options?: string[];
33
+ default?: any;
34
+ unit?: string;
35
+ validation?: {
36
+ min?: number;
37
+ max?: number;
38
+ pattern?: string;
39
+ message?: string;
40
+ };
41
+ calculation?: {
42
+ formula: string;
43
+ dependencies: string[];
44
+ };
45
+ tagPattern?: {
46
+ prefix?: string;
47
+ includeFields?: string[];
48
+ separator?: string;
49
+ };
32
50
  }
33
51
  export interface IInventoryType {
52
+ _id: mongoose.Types.ObjectId;
34
53
  name: string;
54
+ description?: string;
35
55
  fields: IField[];
56
+ defaultLocation?: mongoose.Types.ObjectId;
57
+ tagGenerationEnabled?: boolean;
58
+ enableSupplierField?: boolean;
59
+ enableLocationField?: boolean;
60
+ groupingAttributes?: string[];
36
61
  }
37
- export interface IInventoryEntry {
38
- type: string;
39
- fields: {
40
- [key: string]: any;
41
- };
42
- createdAt?: Date;
62
+ export interface IHistoryEntry {
63
+ date: Date;
64
+ action: "add" | "remove";
65
+ quantity: number;
66
+ user: string;
67
+ notes?: string;
43
68
  }
44
- export type IGenerateFields = (inventoryType: IInventoryType, providedFields?: {
45
- [key: string]: any;
46
- }) => Promise<{
47
- [key: string]: any;
48
- }>;
49
- export type ISupplier = ILeanSupplier & Document;
50
- export interface ILeanSupplier {
51
- _id: mongoose.Types.ObjectId;
52
- name: string;
53
- phone: string;
54
- ermail: string;
55
- website: string;
56
- itemsSupplied: mongoose.Types.ObjectId[];
57
- tagPrefix: string;
58
- allmoxyId?: string;
69
+ export interface IInventoryItem {
70
+ _id: string;
71
+ type: string | IInventoryType;
72
+ location?: string | ILocation;
73
+ fields: Map<string, any>;
74
+ tags: string[];
75
+ history: IHistoryEntry[];
76
+ createdAt: Date;
77
+ updatedAt: Date;
59
78
  }
60
- export type ICategory = ILeanCategory & Document;
61
- export interface ILeanCategory {
79
+ export interface IInventoryItemDocument extends Document, Omit<IInventoryItem, "_id"> {
62
80
  _id: mongoose.Types.ObjectId;
63
- name: string;
64
- tagPrefix: string;
65
- allmoxyId?: string;
66
81
  }
67
- export type IInventoryLocation = ILeanInventoryLocation & Document;
68
- export interface ILeanInventoryLocation {
82
+ export interface IInventoryGroup {
69
83
  _id: mongoose.Types.ObjectId;
70
84
  name: string;
71
- allmoxyId?: string;
72
- shelves: IShelf[];
73
- }
74
- export interface IRack {
75
- name: string;
85
+ type: mongoose.Types.ObjectId;
86
+ attributes: {
87
+ [key: string]: any;
88
+ };
89
+ items: mongoose.Types.ObjectId[];
90
+ totalQuantity: number;
91
+ createdAt: Date;
92
+ updatedAt: Date;
76
93
  }
77
- export interface IShelf {
78
- name: string;
79
- racks: IRack[];
94
+ export type IInventoryTypeDocument = IInventoryType & Document;
95
+ export type IInventoryGroupDocument = IInventoryGroup & Document;
96
+ export interface IInventoryItemResponse {
97
+ _id: mongoose.Types.ObjectId;
98
+ type: IInventoryType;
99
+ location?: {
100
+ _id: mongoose.Types.ObjectId;
101
+ name: string;
102
+ [key: string]: any;
103
+ };
104
+ fields: {
105
+ [key: string]: any;
106
+ };
107
+ tags: string[];
108
+ history: {
109
+ date: Date;
110
+ action: string;
111
+ quantity: number;
112
+ user: mongoose.Types.ObjectId;
113
+ notes?: string;
114
+ }[];
115
+ createdAt: Date;
116
+ updatedAt: Date;
80
117
  }
@@ -0,0 +1,63 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import { Document, Types } from "mongoose";
26
+ export interface IInventoryBase {
27
+ name: string;
28
+ code: string;
29
+ display_order: number;
30
+ status: number;
31
+ createdBy: string;
32
+ createdById: number;
33
+ createdDate: Date;
34
+ updatedBy: string;
35
+ updatedById: number;
36
+ updatedDate: Date;
37
+ }
38
+ export interface IBin extends IInventoryBase {
39
+ _id: Types.ObjectId;
40
+ capacity?: number;
41
+ currentStock?: number;
42
+ }
43
+ export interface IShelf extends IInventoryBase {
44
+ _id: Types.ObjectId;
45
+ bins: IBin[];
46
+ capacity?: number;
47
+ currentStock?: number;
48
+ }
49
+ export interface IRack extends IInventoryBase {
50
+ _id: Types.ObjectId;
51
+ shelves: IShelf[];
52
+ capacity?: number;
53
+ currentStock?: number;
54
+ }
55
+ export interface IInventoryLocation extends Document, IInventoryBase {
56
+ racks: IRack[];
57
+ type: string;
58
+ description?: string;
59
+ capacity?: number;
60
+ currentStock?: number;
61
+ isActive: boolean;
62
+ _id: Types.ObjectId;
63
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,75 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import { Document, Model, Types } from "mongoose";
26
+ /**
27
+ * Base interface for location components with common fields
28
+ */
29
+ export interface ILocationComponentBase {
30
+ _id: Types.ObjectId;
31
+ name: string;
32
+ code: string;
33
+ status: number;
34
+ createdBy: string;
35
+ createdById: number;
36
+ createdDate: Date;
37
+ updatedBy: string;
38
+ updatedById: number;
39
+ updatedDate: Date;
40
+ }
41
+ export interface IBin extends ILocationComponentBase {
42
+ capacity?: number;
43
+ currentStock?: number;
44
+ }
45
+ export interface IShelf extends ILocationComponentBase {
46
+ bins: IBin[];
47
+ capacity?: number;
48
+ currentStock?: number;
49
+ }
50
+ export interface IRack extends ILocationComponentBase {
51
+ shelves: IShelf[];
52
+ capacity?: number;
53
+ currentStock?: number;
54
+ }
55
+ export interface ILocationMethods {
56
+ generateUniqueCode(prefix: string): Promise<string>;
57
+ }
58
+ export interface ILocationModel extends Model<ILocation, {}, ILocationMethods> {
59
+ generateUniqueCode(prefix: string): Promise<string>;
60
+ }
61
+ export interface ILocation extends Omit<Document, '_id'>, ILocationComponentBase {
62
+ type: "warehouse" | "shed" | "other";
63
+ description?: string;
64
+ racks: IRack[];
65
+ capacity?: number;
66
+ currentStock?: number;
67
+ isActive: boolean;
68
+ }
69
+ export interface ILocationPath {
70
+ locationId: Types.ObjectId;
71
+ rackId?: Types.ObjectId;
72
+ shelfId?: Types.ObjectId;
73
+ binId?: Types.ObjectId;
74
+ path: string;
75
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,41 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import mongoose, { Document } from "mongoose";
26
+ export interface ISupplier {
27
+ _id: mongoose.Types.ObjectId;
28
+ name: string;
29
+ code: string;
30
+ contactInfo: {
31
+ email?: string;
32
+ phone?: string;
33
+ address?: string;
34
+ contactPerson?: string;
35
+ };
36
+ notes?: string;
37
+ active: boolean;
38
+ createdAt: Date;
39
+ updatedAt: Date;
40
+ }
41
+ export type ISupplierDocument = ISupplier & Document;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,75 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ import { Document, Model, Types } from "mongoose";
26
+ /**
27
+ * Base interface for location components with common fields
28
+ */
29
+ export interface ILocationComponentBase {
30
+ _id: Types.ObjectId;
31
+ name: string;
32
+ code: string;
33
+ status: number;
34
+ createdBy: string;
35
+ createdById: number;
36
+ createdDate: Date;
37
+ updatedBy: string;
38
+ updatedById: number;
39
+ updatedDate: Date;
40
+ }
41
+ export interface IBin extends ILocationComponentBase {
42
+ capacity?: number;
43
+ currentStock?: number;
44
+ }
45
+ export interface IShelf extends ILocationComponentBase {
46
+ bins: IBin[];
47
+ capacity?: number;
48
+ currentStock?: number;
49
+ }
50
+ export interface IRack extends ILocationComponentBase {
51
+ shelves: IShelf[];
52
+ capacity?: number;
53
+ currentStock?: number;
54
+ }
55
+ export interface ILocationMethods {
56
+ generateUniqueCode(prefix: string): Promise<string>;
57
+ }
58
+ export interface ILocationModel extends Model<ILocation, {}, ILocationMethods> {
59
+ generateUniqueCode(prefix: string): Promise<string>;
60
+ }
61
+ export interface ILocation extends Omit<Document, '_id'>, ILocationComponentBase {
62
+ type: "warehouse" | "shed" | "other";
63
+ description?: string;
64
+ racks: IRack[];
65
+ capacity?: number;
66
+ currentStock?: number;
67
+ isActive: boolean;
68
+ }
69
+ export interface ILocationPath {
70
+ locationId: Types.ObjectId;
71
+ rackId?: Types.ObjectId;
72
+ shelfId?: Types.ObjectId;
73
+ binId?: Types.ObjectId;
74
+ path: string;
75
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -27,6 +27,8 @@ export * from "./IMailCache";
27
27
  export * from "./API/Allmoxy";
28
28
  export * from "./IAllmoxy";
29
29
  export * from "./Classes/IRoute";
30
- export * from "./IInventory";
31
30
  export * from "./IApplication";
32
31
  export * from "./IQualityControl";
32
+ export * from "./Inventory/ILocation";
33
+ export * from "./IInventory";
34
+ export * from "./ISupplier";
package/dist/index.js CHANGED
@@ -43,6 +43,8 @@ __exportStar(require("./IMailCache"), exports);
43
43
  __exportStar(require("./API/Allmoxy"), exports);
44
44
  __exportStar(require("./IAllmoxy"), exports);
45
45
  __exportStar(require("./Classes/IRoute"), exports);
46
- __exportStar(require("./IInventory"), exports);
47
46
  __exportStar(require("./IApplication"), exports);
48
47
  __exportStar(require("./IQualityControl"), exports);
48
+ __exportStar(require("./Inventory/ILocation"), exports);
49
+ __exportStar(require("./IInventory"), exports);
50
+ __exportStar(require("./ISupplier"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "truflow",
3
- "version": "0.0.187",
3
+ "version": "0.0.188",
4
4
  "main": "./dist/index.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- export interface IInventoryItem {
1
+ export interface IAllmoxyInventoryItem {
2
2
  item_id: number;
3
3
  line_id: number;
4
4
  name: string | null;
@@ -22,7 +22,7 @@ export interface IInventoryItem {
22
22
  status: number;
23
23
  }
24
24
 
25
- export interface IInventoryItemResponse {
25
+ export interface IAllmoxyInventoryItemResponse {
26
26
  item_id: number;
27
27
  line_id: number;
28
28
  name: string;
@@ -1,4 +1,4 @@
1
- export interface ILocationResponse {
1
+ export interface IAllmoxyLocationResponse {
2
2
  location_id: number;
3
3
  name: string;
4
4
  display_order: number;
@@ -12,7 +12,7 @@ export interface ILocationResponse {
12
12
  updateddate: string;
13
13
  }
14
14
 
15
- export interface ILocation {
15
+ export interface IAllmoxyLocation {
16
16
  name: string | null;
17
17
  display_order: number | null;
18
18
  status: number;
package/src/IInventory.ts CHANGED
@@ -1,65 +1,113 @@
1
1
  import mongoose, { Document } from "mongoose";
2
+ import { ILocation } from "./Inventory/ILocation";
2
3
 
4
+ // Field Definition - defines a custom field/attribute for an inventory type
3
5
  export interface IField {
4
- name: string;
5
- type: string;
6
- autoGenerate?: boolean;
7
- generationPattern?: string;
8
- required?: boolean;
6
+ name: string; // Display name of the field
7
+ key: string; // Unique key for the field
8
+ type: "number" | "text" | "select" | "calculation" | "tag"; // Field type
9
+ required?: boolean; // Whether this field is required
10
+ options?: string[]; // For select fields, the available options
11
+ default?: any; // Default value
12
+ unit?: string; // Unit of measurement if applicable
13
+ validation?: {
14
+ // Validation rules
15
+ min?: number;
16
+ max?: number;
17
+ pattern?: string;
18
+ message?: string;
19
+ };
20
+ calculation?: {
21
+ // For calculation type fields
22
+ formula: string; // e.g., "length * width * rows / 12"
23
+ dependencies: string[]; // Fields required for this calculation
24
+ };
25
+ tagPattern?: {
26
+ // For tag type fields
27
+ prefix?: string; // e.g., "LFT-"
28
+ includeFields?: string[]; // Fields to include in tag
29
+ separator?: string; // e.g., "-"
30
+ };
9
31
  }
10
32
 
33
+ // Inventory Type - defines a category of inventory with its own set of fields
11
34
  export interface IInventoryType {
12
- name: string;
13
- fields: IField[];
35
+ _id: mongoose.Types.ObjectId;
36
+ name: string; // e.g., "Lumber", "Steel", "Hardware"
37
+ description?: string;
38
+ fields: IField[]; // Custom fields for this type
39
+ defaultLocation?: mongoose.Types.ObjectId;
40
+ tagGenerationEnabled?: boolean;
41
+ enableSupplierField?: boolean; // Whether to show supplier selection
42
+ enableLocationField?: boolean; // Whether to show location selection
43
+ groupingAttributes?: string[]; // Field keys that can be used for grouping
14
44
  }
15
45
 
16
- export interface IInventoryEntry {
17
- type: string;
18
- fields: { [key: string]: any };
19
- createdAt?: Date;
46
+ export interface IHistoryEntry {
47
+ date: Date;
48
+ action: "add" | "remove";
49
+ quantity: number;
50
+ user: string;
51
+ notes?: string;
20
52
  }
21
53
 
22
- export type IGenerateFields = (
23
- inventoryType: IInventoryType,
24
- providedFields?: { [key: string]: any }
25
- ) => Promise<{ [key: string]: any }>;
26
-
27
- export type ISupplier = ILeanSupplier & Document;
28
-
29
- export interface ILeanSupplier {
30
- _id: mongoose.Types.ObjectId;
31
- name: string;
32
- phone: string;
33
- ermail: string;
34
- website: string;
35
- itemsSupplied: mongoose.Types.ObjectId[];
36
- tagPrefix: string;
37
- allmoxyId?: string;
54
+ export interface IInventoryItem {
55
+ _id: string;
56
+ type: string | IInventoryType;
57
+ location?: string | ILocation;
58
+ fields: Map<string, any>;
59
+ tags: string[];
60
+ history: IHistoryEntry[];
61
+ createdAt: Date;
62
+ updatedAt: Date;
38
63
  }
39
64
 
40
- export type ICategory = ILeanCategory & Document;
41
-
42
- export interface ILeanCategory {
65
+ export interface IInventoryItemDocument
66
+ extends Document,
67
+ Omit<IInventoryItem, "_id"> {
43
68
  _id: mongoose.Types.ObjectId;
44
- name: string;
45
- tagPrefix: string;
46
- allmoxyId?: string;
47
69
  }
48
70
 
49
- export type IInventoryLocation = ILeanInventoryLocation & Document;
50
-
51
- export interface ILeanInventoryLocation {
71
+ // Inventory Group - for grouping items by attributes
72
+ export interface IInventoryGroup {
52
73
  _id: mongoose.Types.ObjectId;
53
74
  name: string;
54
- allmoxyId?: string;
55
- shelves: IShelf[];
75
+ type: mongoose.Types.ObjectId; // Reference to IInventoryType
76
+ attributes: {
77
+ // Attributes to group by
78
+ [key: string]: any;
79
+ };
80
+ items: mongoose.Types.ObjectId[]; // References to IInventoryItems
81
+ totalQuantity: number;
82
+ createdAt: Date;
83
+ updatedAt: Date;
56
84
  }
57
85
 
58
- export interface IRack {
59
- name: string;
60
- }
86
+ export type IInventoryTypeDocument = IInventoryType & Document;
61
87
 
62
- export interface IShelf {
63
- name: string;
64
- racks: IRack[];
88
+ export type IInventoryGroupDocument = IInventoryGroup & Document;
89
+
90
+ // API response type for inventory items (after Map has been converted to plain object)
91
+ // API response type for inventory items (after Map has been converted to plain object)
92
+ export interface IInventoryItemResponse {
93
+ _id: mongoose.Types.ObjectId;
94
+ type: IInventoryType; // Populated type reference
95
+ location?: {
96
+ _id: mongoose.Types.ObjectId;
97
+ name: string;
98
+ [key: string]: any;
99
+ }; // Populated location reference
100
+ fields: {
101
+ [key: string]: any;
102
+ }; // Converted from Map to plain object
103
+ tags: string[];
104
+ history: {
105
+ date: Date;
106
+ action: string;
107
+ quantity: number;
108
+ user: mongoose.Types.ObjectId;
109
+ notes?: string;
110
+ }[];
111
+ createdAt: Date;
112
+ updatedAt: Date;
65
113
  }
@@ -0,0 +1,19 @@
1
+ import mongoose, { Document } from "mongoose";
2
+
3
+ export interface ISupplier {
4
+ _id: mongoose.Types.ObjectId;
5
+ name: string;
6
+ code: string;
7
+ contactInfo: {
8
+ email?: string;
9
+ phone?: string;
10
+ address?: string;
11
+ contactPerson?: string;
12
+ };
13
+ notes?: string;
14
+ active: boolean;
15
+ createdAt: Date;
16
+ updatedAt: Date;
17
+ }
18
+
19
+ export type ISupplierDocument = ISupplier & Document;
@@ -0,0 +1,59 @@
1
+ import { Document, Model, Types } from "mongoose";
2
+
3
+ /**
4
+ * Base interface for location components with common fields
5
+ */
6
+ export interface ILocationComponentBase {
7
+ _id: Types.ObjectId;
8
+ name: string;
9
+ code: string;
10
+ status: number;
11
+ createdBy: string;
12
+ createdById: number;
13
+ createdDate: Date;
14
+ updatedBy: string;
15
+ updatedById: number;
16
+ updatedDate: Date;
17
+ }
18
+
19
+ export interface IBin extends ILocationComponentBase {
20
+ capacity?: number;
21
+ currentStock?: number;
22
+ }
23
+
24
+ export interface IShelf extends ILocationComponentBase {
25
+ bins: IBin[];
26
+ capacity?: number;
27
+ currentStock?: number;
28
+ }
29
+
30
+ export interface IRack extends ILocationComponentBase {
31
+ shelves: IShelf[];
32
+ capacity?: number;
33
+ currentStock?: number;
34
+ }
35
+
36
+ export interface ILocationMethods {
37
+ generateUniqueCode(prefix: string): Promise<string>;
38
+ }
39
+
40
+ export interface ILocationModel extends Model<ILocation, {}, ILocationMethods> {
41
+ generateUniqueCode(prefix: string): Promise<string>;
42
+ }
43
+
44
+ export interface ILocation extends Omit<Document, '_id'>, ILocationComponentBase {
45
+ type: "warehouse" | "shed" | "other";
46
+ description?: string;
47
+ racks: IRack[];
48
+ capacity?: number;
49
+ currentStock?: number;
50
+ isActive: boolean;
51
+ }
52
+
53
+ export interface ILocationPath {
54
+ locationId: Types.ObjectId;
55
+ rackId?: Types.ObjectId;
56
+ shelfId?: Types.ObjectId;
57
+ binId?: Types.ObjectId;
58
+ path: string;
59
+ }
package/src/index.ts CHANGED
@@ -27,6 +27,8 @@ export * from "./IMailCache";
27
27
  export * from "./API/Allmoxy";
28
28
  export * from "./IAllmoxy";
29
29
  export * from "./Classes/IRoute";
30
- export * from "./IInventory";
31
30
  export * from "./IApplication";
32
31
  export * from "./IQualityControl";
32
+ export * from "./Inventory/ILocation";
33
+ export * from "./IInventory";
34
+ export * from "./ISupplier";