@tabletennisshop/common 1.0.45 → 1.0.46

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.
@@ -8,9 +8,8 @@ interface InventoryDoc extends IInventory, Document {
8
8
  createdAt: Date;
9
9
  updatedAt: Date;
10
10
  }
11
- export declare const InventoryModel: Model<InventoryDoc, {}, {}, {}, Document<unknown, {}, InventoryDoc, {}> & InventoryDoc & Required<{
12
- _id: unknown;
13
- }> & {
14
- __v: number;
15
- }, any>;
11
+ interface InventoryModelType extends Model<InventoryDoc> {
12
+ build(attrs: IInventory): InventoryDoc;
13
+ }
14
+ export declare const InventoryModel: InventoryModelType;
16
15
  export {};
@@ -2,17 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InventoryModel = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
- // Define the schema for the inventory model
6
5
  const InventorySchema = new mongoose_1.Schema({
7
- product_id: { type: mongoose_1.Schema.Types.ObjectId, required: true, ref: 'Product' }, // Reference to the Product model
8
- total_quantity: { type: Number, required: true, default: 0 }, // Total quantity of the product
9
- serials: { type: [String], required: false }, // Optional array of serial numbers
6
+ product_id: { type: mongoose_1.Schema.Types.ObjectId, required: true, ref: 'Product' },
7
+ total_quantity: { type: Number, required: true, default: 0 },
8
+ serials: { type: [String], required: false },
10
9
  }, {
11
- timestamps: true, // Automatically manage createdAt and updatedAt fields
12
- collection: 'inventory' // Name of the collection in MongoDB
10
+ timestamps: true,
11
+ collection: 'inventory'
13
12
  });
14
13
  InventorySchema.statics.build = (attrs) => {
15
14
  return new exports.InventoryModel(attrs);
16
15
  };
17
- // Create the Inventory model
18
16
  exports.InventoryModel = (0, mongoose_1.model)('Inventory', InventorySchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tabletennisshop/common",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",