@likewatt/models 1.0.87 → 1.0.89

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.
@@ -30,6 +30,19 @@ export declare const RightsSchema: import("mongoose").Schema<Rights, import("mon
30
30
  } & {
31
31
  __v: number;
32
32
  }>;
33
+ export declare class WebhookParams {
34
+ endpoint?: string;
35
+ token?: string;
36
+ }
37
+ export declare const WebhookParamsSchema: import("mongoose").Schema<WebhookParams, import("mongoose").Model<WebhookParams, any, any, any, Document<unknown, any, WebhookParams, any, {}> & WebhookParams & {
38
+ _id: Types.ObjectId;
39
+ } & {
40
+ __v: number;
41
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, WebhookParams, Document<unknown, {}, import("mongoose").FlatRecord<WebhookParams>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<WebhookParams> & {
42
+ _id: Types.ObjectId;
43
+ } & {
44
+ __v: number;
45
+ }>;
33
46
  /**
34
47
  * Représente un utilisateur dans le système.
35
48
  * - @Schema/timestamps : gère createdAt et updatedAt automatiques
@@ -84,6 +97,7 @@ export declare class User {
84
97
  synthesis_fi: string[];
85
98
  siteTag: SiteTag;
86
99
  rights: Rights;
100
+ webhook?: WebhookParams;
87
101
  _createdAt?: string;
88
102
  _lastConnected?: string;
89
103
  }
package/dist/core/User.js CHANGED
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.UserSchema = exports.User = exports.RightsSchema = exports.Rights = exports.SiteTagSchema = exports.SiteTag = void 0;
12
+ exports.UserSchema = exports.User = exports.WebhookParamsSchema = exports.WebhookParams = exports.RightsSchema = exports.Rights = exports.SiteTagSchema = exports.SiteTag = void 0;
13
13
  const mongoose_1 = require("mongoose");
14
14
  const swagger_1 = require("@nestjs/swagger");
15
15
  const mongoose_2 = require("@nestjs/mongoose");
@@ -52,7 +52,7 @@ __decorate([
52
52
  description: "Indique si l'utilisateur peut supprimer un site",
53
53
  example: true,
54
54
  }),
55
- (0, mongoose_2.Prop)({ type: Boolean, required: true }),
55
+ (0, mongoose_2.Prop)({ type: Boolean, required: true, default: false }),
56
56
  (0, class_validator_1.IsBoolean)(),
57
57
  __metadata("design:type", Boolean)
58
58
  ], Rights.prototype, "deleteSite", void 0);
@@ -61,7 +61,7 @@ __decorate([
61
61
  description: "Indique si l'utilisateur peut supprimer des sites",
62
62
  example: true,
63
63
  }),
64
- (0, mongoose_2.Prop)({ type: Boolean, required: true }),
64
+ (0, mongoose_2.Prop)({ type: Boolean, required: true, default: false }),
65
65
  (0, class_validator_1.IsBoolean)(),
66
66
  __metadata("design:type", Boolean)
67
67
  ], Rights.prototype, "deleteSites", void 0);
@@ -69,6 +69,31 @@ exports.Rights = Rights = __decorate([
69
69
  (0, mongoose_2.Schema)({ _id: false })
70
70
  ], Rights);
71
71
  exports.RightsSchema = mongoose_2.SchemaFactory.createForClass(Rights);
72
+ let WebhookParams = class WebhookParams {
73
+ };
74
+ exports.WebhookParams = WebhookParams;
75
+ __decorate([
76
+ (0, swagger_1.ApiProperty)({
77
+ description: "Endpoint de l'utilisateur pour le webhook",
78
+ example: true,
79
+ }),
80
+ (0, mongoose_2.Prop)({ type: String, required: false, default: "https://example.com/webhook" }),
81
+ (0, class_validator_1.IsString)(),
82
+ __metadata("design:type", String)
83
+ ], WebhookParams.prototype, "endpoint", void 0);
84
+ __decorate([
85
+ (0, swagger_1.ApiProperty)({
86
+ description: "Token de l'utilisateur pour le webhook",
87
+ example: true,
88
+ }),
89
+ (0, mongoose_2.Prop)({ type: String, required: false, default: "myToken_XXXX" }),
90
+ (0, class_validator_1.IsString)(),
91
+ __metadata("design:type", String)
92
+ ], WebhookParams.prototype, "token", void 0);
93
+ exports.WebhookParams = WebhookParams = __decorate([
94
+ (0, mongoose_2.Schema)({ _id: false })
95
+ ], WebhookParams);
96
+ exports.WebhookParamsSchema = mongoose_2.SchemaFactory.createForClass(WebhookParams);
72
97
  /**
73
98
  * Représente un utilisateur dans le système.
74
99
  * - @Schema/timestamps : gère createdAt et updatedAt automatiques
@@ -504,9 +529,25 @@ __decorate([
504
529
  description: 'Droits spécifiques de l’utilisateur',
505
530
  type: () => Rights,
506
531
  }),
507
- (0, mongoose_2.Prop)({ type: exports.RightsSchema, _id: false }),
532
+ (0, mongoose_2.Prop)({
533
+ type: exports.RightsSchema,
534
+ _id: false,
535
+ default: { deleteSite: false, deleteSites: false },
536
+ }),
508
537
  __metadata("design:type", Rights)
509
538
  ], User.prototype, "rights", void 0);
539
+ __decorate([
540
+ (0, swagger_1.ApiProperty)({
541
+ description: 'Configuration du webhook',
542
+ type: () => WebhookParams,
543
+ }),
544
+ (0, mongoose_2.Prop)({
545
+ type: exports.WebhookParamsSchema,
546
+ _id: false,
547
+ default: { endpoint: "https://example.com/webhook", token: "myToken_XXXXX" },
548
+ }),
549
+ __metadata("design:type", WebhookParams)
550
+ ], User.prototype, "webhook", void 0);
510
551
  __decorate([
511
552
  (0, swagger_1.ApiProperty)({
512
553
  description: 'Date interne de création (legacy)',
@@ -39,7 +39,7 @@ export interface User {
39
39
  optim_scenario_consumer: string[];
40
40
  synthesis_fi: string[];
41
41
  siteTag: SiteTag;
42
- rights?: Rights;
42
+ rights: Rights;
43
43
  _createdAt?: string;
44
44
  _lastConnected?: string;
45
45
  createdAt?: Date | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likewatt/models",
3
- "version": "1.0.87",
3
+ "version": "1.0.89",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {