@duvdu-v1/duvdu 1.1.215 → 1.1.217

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.
@@ -6,5 +6,11 @@ interface UploadOptions {
6
6
  maxSize?: number;
7
7
  fileFilter?(req: Request, file: Express.Multer.File, callback: multer.FileFilterCallback): void;
8
8
  }
9
- export declare const globalUploadMiddleware: (folder: string, options?: UploadOptions) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
9
+ export declare const globalUploadMiddleware: (folder: string, options?: UploadOptions) => {
10
+ single: (fieldName: string) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
11
+ array: (fieldName: string, maxCount?: number | undefined) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
12
+ fields: (fields: readonly multer.Field[]) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
13
+ none: () => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
14
+ any: () => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
15
+ };
10
16
  export {};
@@ -23,7 +23,7 @@ const globalUploadMiddleware = (folder, options) => {
23
23
  // Call original memory storage handler
24
24
  storage._handleFile(req, file, cb);
25
25
  };
26
- return (0, multer_1.default)({
26
+ const upload = (0, multer_1.default)({
27
27
  storage: customStorage,
28
28
  limits: {
29
29
  fileSize: (options === null || options === void 0 ? void 0 : options.maxSize) || 3 * 1024 * 1024 // 3MB default
@@ -51,6 +51,13 @@ const globalUploadMiddleware = (folder, options) => {
51
51
  }, 'en'));
52
52
  }
53
53
  },
54
- }).any();
54
+ });
55
+ return {
56
+ single: upload.single.bind(upload),
57
+ array: upload.array.bind(upload),
58
+ fields: upload.fields.bind(upload),
59
+ none: upload.none.bind(upload),
60
+ any: upload.any.bind(upload)
61
+ };
55
62
  };
56
63
  exports.globalUploadMiddleware = globalUploadMiddleware;
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Favourites = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const model_names_1 = require("../types/model-names");
6
- exports.Favourites = (0, mongoose_1.model)('favourites', new mongoose_1.Schema({
6
+ exports.Favourites = (0, mongoose_1.model)(model_names_1.MODELS.favourites, new mongoose_1.Schema({
7
7
  project: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.projects },
8
8
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
9
- }, { timestamps: true, collection: 'favourites' })
10
- .index({ createdAt: -1, project: 1, user: 1 })
9
+ }, { timestamps: true, collection: model_names_1.MODELS.favourites })
11
10
  .index({ project: 1, user: 1 }, { unique: true }));
@@ -35,5 +35,6 @@ export declare enum MODELS {
35
35
  copyrightContract = "copyright_contracts",
36
36
  projectContract = "project_contracts",
37
37
  rentalContract = "rental_contracts",
38
- teamContract = "team_contracts"
38
+ teamContract = "team_contracts",
39
+ favourites = "favourites"
39
40
  }
@@ -40,4 +40,5 @@ var MODELS;
40
40
  MODELS["projectContract"] = "project_contracts";
41
41
  MODELS["rentalContract"] = "rental_contracts";
42
42
  MODELS["teamContract"] = "team_contracts";
43
+ MODELS["favourites"] = "favourites";
43
44
  })(MODELS || (exports.MODELS = MODELS = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.215",
3
+ "version": "1.1.217",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [