@tabletennisshop/common 1.0.37 → 1.0.39

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/build/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './middlewares/current-user-middleware';
9
9
  export * from './models/user.model';
10
10
  export * from './models/product.model';
11
11
  export * from './models/racket.model';
12
+ export * from './models/rating.model';
12
13
  export * from './models/shirt.model';
13
14
  export * from './models/sponge.model';
14
15
  export * from './models/address.schema';
package/build/index.js CHANGED
@@ -25,6 +25,7 @@ __exportStar(require("./middlewares/current-user-middleware"), exports);
25
25
  __exportStar(require("./models/user.model"), exports);
26
26
  __exportStar(require("./models/product.model"), exports);
27
27
  __exportStar(require("./models/racket.model"), exports);
28
+ __exportStar(require("./models/rating.model"), exports);
28
29
  __exportStar(require("./models/shirt.model"), exports);
29
30
  __exportStar(require("./models/sponge.model"), exports);
30
31
  __exportStar(require("./models/address.schema"), exports);
@@ -0,0 +1,16 @@
1
+ import { Document, Model, Types } from "mongoose";
2
+ export interface IRatingAttrs {
3
+ user_id: Types.ObjectId;
4
+ product_id: Types.ObjectId;
5
+ comment?: string;
6
+ rate_score: number;
7
+ }
8
+ interface RatingDoc extends IRatingAttrs, Document {
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ }
12
+ export interface RatingModel extends Model<RatingDoc> {
13
+ build(attrs: IRatingAttrs): RatingDoc;
14
+ }
15
+ export declare const RatingModel: RatingModel;
16
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.RatingModel = void 0;
37
+ const mongoose_1 = __importStar(require("mongoose"));
38
+ const RatingSchema = new mongoose_1.Schema({
39
+ user_id: { type: mongoose_1.Schema.Types.ObjectId, required: true, ref: 'User' },
40
+ product_id: { type: mongoose_1.Schema.Types.ObjectId, required: true, ref: 'Product' },
41
+ comment: { type: String, required: false },
42
+ rate_score: { type: Number, required: true }
43
+ }, {
44
+ timestamps: true,
45
+ collection: 'rating'
46
+ });
47
+ RatingSchema.statics.build = (attrs) => {
48
+ return new exports.RatingModel(attrs);
49
+ };
50
+ exports.RatingModel = mongoose_1.default.model('Rating', RatingSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tabletennisshop/common",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "build/index.d.ts",