@likewatt/models 1.1.21 → 1.1.23

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,8 +1,8 @@
1
- import { Document, Types } from 'mongoose';
1
+ import { Document } from 'mongoose';
2
2
  import { SiteType } from './internal/enums';
3
3
  export type CollectiveSiteDocument = CollectiveSite & Document;
4
4
  export declare class CollectiveSite {
5
- readonly _id: Types.ObjectId;
5
+ readonly _id: string;
6
6
  _createdAt: string;
7
7
  _lastModified: string;
8
8
  addressGeocode: number[];
@@ -30,11 +30,11 @@ export declare class CollectiveSite {
30
30
  sites: string[];
31
31
  }
32
32
  export declare const CollectiveSiteSchema: import("mongoose").Schema<CollectiveSite, import("mongoose").Model<CollectiveSite, any, any, any, Document<unknown, any, CollectiveSite, any, {}> & CollectiveSite & Required<{
33
- _id: Types.ObjectId;
33
+ _id: string;
34
34
  }> & {
35
35
  __v: number;
36
36
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CollectiveSite, Document<unknown, {}, import("mongoose").FlatRecord<CollectiveSite>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<CollectiveSite> & Required<{
37
- _id: Types.ObjectId;
37
+ _id: string;
38
38
  }> & {
39
39
  __v: number;
40
40
  }>;
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CollectiveSiteSchema = exports.CollectiveSite = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const swagger_1 = require("@nestjs/swagger");
15
- const mongoose_2 = require("mongoose");
15
+ const uuid_1 = require("uuid");
16
16
  const class_validator_1 = require("class-validator");
17
17
  const enums_1 = require("./internal/enums");
18
18
  let CollectiveSite = class CollectiveSite {
@@ -20,12 +20,13 @@ let CollectiveSite = class CollectiveSite {
20
20
  exports.CollectiveSite = CollectiveSite;
21
21
  __decorate([
22
22
  (0, swagger_1.ApiProperty)({
23
- description: 'Identifiant unique MongoDB',
23
+ description: 'Identifiant unique (UUID ou custom string)',
24
24
  example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
25
- type: mongoose_2.Types.ObjectId,
25
+ type: String,
26
26
  readOnly: true,
27
27
  }),
28
- __metadata("design:type", mongoose_2.Types.ObjectId)
28
+ (0, mongoose_1.Prop)({ type: String }),
29
+ __metadata("design:type", String)
29
30
  ], CollectiveSite.prototype, "_id", void 0);
30
31
  __decorate([
31
32
  (0, swagger_1.ApiProperty)(),
@@ -188,3 +189,10 @@ exports.CollectiveSite = CollectiveSite = __decorate([
188
189
  })
189
190
  ], CollectiveSite);
190
191
  exports.CollectiveSiteSchema = mongoose_1.SchemaFactory.createForClass(CollectiveSite);
192
+ // Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
193
+ exports.CollectiveSiteSchema.pre('save', function (next) {
194
+ if (!this._id) {
195
+ this._id = (0, uuid_1.v4)();
196
+ }
197
+ next();
198
+ });
@@ -1,4 +1,4 @@
1
- import { Document, Types } from 'mongoose';
1
+ import { Document } from 'mongoose';
2
2
  import { RestOfTheYearTarifs } from './internal/rest-of-the-years-tarif';
3
3
  import { Tarif } from './internal/tarif';
4
4
  /**
@@ -9,7 +9,7 @@ import { Tarif } from './internal/tarif';
9
9
  * - class-validator rules : validation runtime
10
10
  */
11
11
  export declare class DefaultRate {
12
- _id: Types.ObjectId;
12
+ _id: string;
13
13
  name?: string;
14
14
  userId: string;
15
15
  tarifs: Tarif[];
@@ -17,11 +17,11 @@ export declare class DefaultRate {
17
17
  }
18
18
  export type DefaultRateDocument = DefaultRate & Document;
19
19
  export declare const DefaultRateSchema: import("mongoose").Schema<DefaultRate, import("mongoose").Model<DefaultRate, any, any, any, Document<unknown, any, DefaultRate, any, {}> & DefaultRate & Required<{
20
- _id: Types.ObjectId;
20
+ _id: string;
21
21
  }> & {
22
22
  __v: number;
23
23
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, DefaultRate, Document<unknown, {}, import("mongoose").FlatRecord<DefaultRate>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<DefaultRate> & Required<{
24
- _id: Types.ObjectId;
24
+ _id: string;
25
25
  }> & {
26
26
  __v: number;
27
27
  }>;
@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DefaultRateSchema = exports.DefaultRate = void 0;
13
- const mongoose_1 = require("mongoose");
14
13
  const swagger_1 = require("@nestjs/swagger");
15
- const mongoose_2 = require("@nestjs/mongoose");
14
+ const mongoose_1 = require("@nestjs/mongoose");
15
+ const uuid_1 = require("uuid");
16
16
  const class_validator_1 = require("class-validator");
17
17
  const rest_of_the_years_tarif_1 = require("./internal/rest-of-the-years-tarif");
18
18
  const tarif_1 = require("./internal/tarif");
@@ -28,12 +28,13 @@ let DefaultRate = class DefaultRate {
28
28
  exports.DefaultRate = DefaultRate;
29
29
  __decorate([
30
30
  (0, swagger_1.ApiProperty)({
31
- description: 'Identifiant unique MongoDB',
31
+ description: 'Identifiant unique (UUID ou custom string)',
32
32
  example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
33
- type: mongoose_1.Types.ObjectId,
33
+ type: String,
34
34
  readOnly: true,
35
35
  }),
36
- __metadata("design:type", mongoose_1.Types.ObjectId)
36
+ (0, mongoose_1.Prop)({ type: String }),
37
+ __metadata("design:type", String)
37
38
  ], DefaultRate.prototype, "_id", void 0);
38
39
  __decorate([
39
40
  (0, swagger_1.ApiProperty)({
@@ -41,7 +42,7 @@ __decorate([
41
42
  example: 'Tarif par défaut 1',
42
43
  type: String,
43
44
  }),
44
- (0, mongoose_2.Prop)(),
45
+ (0, mongoose_1.Prop)(),
45
46
  (0, class_validator_1.IsOptional)(),
46
47
  (0, class_validator_1.IsString)(),
47
48
  __metadata("design:type", String)
@@ -52,25 +53,32 @@ __decorate([
52
53
  example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
53
54
  type: String,
54
55
  }),
55
- (0, mongoose_2.Prop)({ type: mongoose_1.Types.ObjectId, ref: 'User' }),
56
+ (0, mongoose_1.Prop)({ type: String, ref: 'User' }),
56
57
  (0, class_validator_1.IsOptional)(),
57
58
  __metadata("design:type", String)
58
59
  ], DefaultRate.prototype, "userId", void 0);
59
60
  __decorate([
60
61
  (0, swagger_1.ApiProperty)({ type: [tarif_1.Tarif] }),
61
- (0, mongoose_2.Prop)({ required: true }),
62
+ (0, mongoose_1.Prop)({ required: true }),
62
63
  (0, class_validator_1.IsArray)(),
63
64
  __metadata("design:type", Array)
64
65
  ], DefaultRate.prototype, "tarifs", void 0);
65
66
  __decorate([
66
67
  (0, swagger_1.ApiProperty)({ type: rest_of_the_years_tarif_1.RestOfTheYearTarifs }),
67
- (0, mongoose_2.Prop)({ required: false }),
68
+ (0, mongoose_1.Prop)({ required: false }),
68
69
  __metadata("design:type", rest_of_the_years_tarif_1.RestOfTheYearTarifs)
69
70
  ], DefaultRate.prototype, "restOfTheYear", void 0);
70
71
  exports.DefaultRate = DefaultRate = __decorate([
71
- (0, mongoose_2.Schema)({
72
+ (0, mongoose_1.Schema)({
72
73
  id: false,
73
74
  timestamps: true,
74
75
  })
75
76
  ], DefaultRate);
76
- exports.DefaultRateSchema = mongoose_2.SchemaFactory.createForClass(DefaultRate);
77
+ exports.DefaultRateSchema = mongoose_1.SchemaFactory.createForClass(DefaultRate);
78
+ // Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
79
+ exports.DefaultRateSchema.pre('save', function (next) {
80
+ if (!this._id) {
81
+ this._id = (0, uuid_1.v4)();
82
+ }
83
+ next();
84
+ });
@@ -1,4 +1,4 @@
1
- import { Document, Types } from 'mongoose';
1
+ import { Document } from 'mongoose';
2
2
  /**
3
3
  * Représente un utilisateur dans le système.
4
4
  * - @Schema/timestamps : gère createdAt et updatedAt automatiques
@@ -7,18 +7,18 @@ import { Document, Types } from 'mongoose';
7
7
  * - class-validator rules : validation runtime
8
8
  */
9
9
  export declare class Invitation {
10
- _id: Types.ObjectId;
10
+ _id: string;
11
11
  email: string;
12
12
  principal: string;
13
13
  _createdAt?: Date;
14
14
  }
15
15
  export type InvitationDocument = Invitation & Document;
16
16
  export declare const InvitationSchema: import("mongoose").Schema<Invitation, import("mongoose").Model<Invitation, any, any, any, Document<unknown, any, Invitation, any, {}> & Invitation & Required<{
17
- _id: Types.ObjectId;
17
+ _id: string;
18
18
  }> & {
19
19
  __v: number;
20
20
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Invitation, Document<unknown, {}, import("mongoose").FlatRecord<Invitation>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Invitation> & Required<{
21
- _id: Types.ObjectId;
21
+ _id: string;
22
22
  }> & {
23
23
  __v: number;
24
24
  }>;
@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.InvitationSchema = exports.Invitation = void 0;
13
- const mongoose_1 = require("mongoose");
14
13
  const swagger_1 = require("@nestjs/swagger");
15
- const mongoose_2 = require("@nestjs/mongoose");
14
+ const mongoose_1 = require("@nestjs/mongoose");
15
+ const uuid_1 = require("uuid");
16
16
  const class_validator_1 = require("class-validator");
17
17
  /**
18
18
  * Représente un utilisateur dans le système.
@@ -26,12 +26,13 @@ let Invitation = class Invitation {
26
26
  exports.Invitation = Invitation;
27
27
  __decorate([
28
28
  (0, swagger_1.ApiProperty)({
29
- description: 'Identifiant unique MongoDB',
29
+ description: 'Identifiant unique (UUID ou custom string)',
30
30
  example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
31
- type: mongoose_1.Types.ObjectId,
31
+ type: String,
32
32
  readOnly: true,
33
33
  }),
34
- __metadata("design:type", mongoose_1.Types.ObjectId)
34
+ (0, mongoose_1.Prop)({ type: String }),
35
+ __metadata("design:type", String)
35
36
  ], Invitation.prototype, "_id", void 0);
36
37
  __decorate([
37
38
  (0, swagger_1.ApiProperty)({
@@ -39,7 +40,7 @@ __decorate([
39
40
  example: 'firstname.lastname@email.com',
40
41
  format: 'email',
41
42
  }),
42
- (0, mongoose_2.Prop)({ type: String, required: true }),
43
+ (0, mongoose_1.Prop)({ type: String, required: true }),
43
44
  (0, class_validator_1.IsEmail)(),
44
45
  __metadata("design:type", String)
45
46
  ], Invitation.prototype, "email", void 0);
@@ -49,7 +50,7 @@ __decorate([
49
50
  example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
50
51
  type: String,
51
52
  }),
52
- (0, mongoose_2.Prop)({ type: String, required: true }),
53
+ (0, mongoose_1.Prop)({ type: String, required: true }),
53
54
  (0, class_validator_1.IsEmail)(),
54
55
  __metadata("design:type", String)
55
56
  ], Invitation.prototype, "principal", void 0);
@@ -59,15 +60,22 @@ __decorate([
59
60
  example: '30-04-2024',
60
61
  type: String,
61
62
  }),
62
- (0, mongoose_2.Prop)({ type: String, required: false }),
63
+ (0, mongoose_1.Prop)({ type: String, required: false }),
63
64
  (0, class_validator_1.IsOptional)(),
64
65
  (0, class_validator_1.IsString)(),
65
66
  __metadata("design:type", Date)
66
67
  ], Invitation.prototype, "_createdAt", void 0);
67
68
  exports.Invitation = Invitation = __decorate([
68
- (0, mongoose_2.Schema)({
69
+ (0, mongoose_1.Schema)({
69
70
  id: false,
70
71
  timestamps: true,
71
72
  })
72
73
  ], Invitation);
73
- exports.InvitationSchema = mongoose_2.SchemaFactory.createForClass(Invitation);
74
+ exports.InvitationSchema = mongoose_1.SchemaFactory.createForClass(Invitation);
75
+ // Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
76
+ exports.InvitationSchema.pre('save', function (next) {
77
+ if (!this._id) {
78
+ this._id = (0, uuid_1.v4)();
79
+ }
80
+ next();
81
+ });
@@ -1,4 +1,4 @@
1
- import { Document, Types } from 'mongoose';
1
+ import { Document } from 'mongoose';
2
2
  /**
3
3
  * Représente un utilisateur dans le système.
4
4
  * - @Schema/timestamps : gère createdAt et updatedAt automatiques
@@ -7,7 +7,7 @@ import { Document, Types } from 'mongoose';
7
7
  * - class-validator rules : validation runtime
8
8
  */
9
9
  export declare class License {
10
- _id: Types.ObjectId;
10
+ _id: string;
11
11
  license?: string;
12
12
  domain?: boolean;
13
13
  startDate: Date;
@@ -20,11 +20,11 @@ export declare class License {
20
20
  }
21
21
  export type LicenseDocument = License & Document;
22
22
  export declare const LicenseSchema: import("mongoose").Schema<License, import("mongoose").Model<License, any, any, any, Document<unknown, any, License, any, {}> & License & Required<{
23
- _id: Types.ObjectId;
23
+ _id: string;
24
24
  }> & {
25
25
  __v: number;
26
26
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, License, Document<unknown, {}, import("mongoose").FlatRecord<License>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<License> & Required<{
27
- _id: Types.ObjectId;
27
+ _id: string;
28
28
  }> & {
29
29
  __v: number;
30
30
  }>;
@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LicenseSchema = exports.License = void 0;
13
- const mongoose_1 = require("mongoose");
14
13
  const swagger_1 = require("@nestjs/swagger");
15
- const mongoose_2 = require("@nestjs/mongoose");
14
+ const mongoose_1 = require("@nestjs/mongoose");
15
+ const uuid_1 = require("uuid");
16
16
  const class_validator_1 = require("class-validator");
17
17
  /**
18
18
  * Représente un utilisateur dans le système.
@@ -26,19 +26,20 @@ let License = class License {
26
26
  exports.License = License;
27
27
  __decorate([
28
28
  (0, swagger_1.ApiProperty)({
29
- description: 'Identifiant unique MongoDB',
29
+ description: 'Identifiant unique (UUID ou custom string)',
30
30
  example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
31
- type: mongoose_1.Types.ObjectId,
31
+ type: String,
32
32
  readOnly: true,
33
33
  }),
34
- __metadata("design:type", mongoose_1.Types.ObjectId)
34
+ (0, mongoose_1.Prop)({ type: String }),
35
+ __metadata("design:type", String)
35
36
  ], License.prototype, "_id", void 0);
36
37
  __decorate([
37
38
  (0, swagger_1.ApiProperty)({
38
39
  description: 'Licence utilisateur',
39
40
  example: 'Standard',
40
41
  }),
41
- (0, mongoose_2.Prop)({ type: String, required: false }),
42
+ (0, mongoose_1.Prop)({ type: String, required: false }),
42
43
  (0, class_validator_1.IsOptional)(),
43
44
  (0, class_validator_1.IsString)(),
44
45
  __metadata("design:type", String)
@@ -48,7 +49,7 @@ __decorate([
48
49
  description: 'Domaine d’activité',
49
50
  example: true,
50
51
  }),
51
- (0, mongoose_2.Prop)({ type: Boolean, required: true, default: false }),
52
+ (0, mongoose_1.Prop)({ type: Boolean, required: true, default: false }),
52
53
  (0, class_validator_1.IsOptional)(),
53
54
  (0, class_validator_1.IsBoolean)(),
54
55
  __metadata("design:type", Boolean)
@@ -58,7 +59,7 @@ __decorate([
58
59
  description: 'Date de début de la licence',
59
60
  example: '2023-01-01T00:00:00Z',
60
61
  }),
61
- (0, mongoose_2.Prop)({ type: Date, required: true }),
62
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
62
63
  (0, class_validator_1.IsDate)(),
63
64
  __metadata("design:type", Date)
64
65
  ], License.prototype, "startDate", void 0);
@@ -67,7 +68,7 @@ __decorate([
67
68
  description: 'Date de fin de la licence',
68
69
  example: '2023-12-31T23:59:59Z',
69
70
  }),
70
- (0, mongoose_2.Prop)({ type: Date, required: true }),
71
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
71
72
  (0, class_validator_1.IsDate)(),
72
73
  __metadata("design:type", Date)
73
74
  ], License.prototype, "endDate", void 0);
@@ -76,7 +77,7 @@ __decorate([
76
77
  description: 'Nombre maximum d’utilisateurs',
77
78
  example: 1,
78
79
  }),
79
- (0, mongoose_2.Prop)({ type: Number, required: false }),
80
+ (0, mongoose_1.Prop)({ type: Number, required: false }),
80
81
  (0, class_validator_1.IsOptional)(),
81
82
  (0, class_validator_1.IsNumber)(),
82
83
  __metadata("design:type", Number)
@@ -86,7 +87,7 @@ __decorate([
86
87
  description: 'Nombre maximum de sites',
87
88
  example: 1,
88
89
  }),
89
- (0, mongoose_2.Prop)({ type: Number, required: false }),
90
+ (0, mongoose_1.Prop)({ type: Number, required: false }),
90
91
  (0, class_validator_1.IsOptional)(),
91
92
  (0, class_validator_1.IsNumber)(),
92
93
  __metadata("design:type", Number)
@@ -96,7 +97,7 @@ __decorate([
96
97
  description: 'Suivi OKD activé',
97
98
  example: false,
98
99
  }),
99
- (0, mongoose_2.Prop)({ type: Boolean, default: false }),
100
+ (0, mongoose_1.Prop)({ type: Boolean, default: false }),
100
101
  (0, class_validator_1.IsBoolean)(),
101
102
  __metadata("design:type", Boolean)
102
103
  ], License.prototype, "trackerOkd", void 0);
@@ -105,7 +106,7 @@ __decorate([
105
106
  description: 'Type de l’utilisateur',
106
107
  example: true,
107
108
  }),
108
- (0, mongoose_2.Prop)({ type: Boolean, required: false, default: false }),
109
+ (0, mongoose_1.Prop)({ type: Boolean, required: false, default: false }),
109
110
  (0, class_validator_1.IsOptional)(),
110
111
  (0, class_validator_1.IsBoolean)(),
111
112
  __metadata("design:type", Boolean)
@@ -115,15 +116,22 @@ __decorate([
115
116
  description: 'Identifiant de l’utilisateur',
116
117
  example: 'Standard',
117
118
  }),
118
- (0, mongoose_2.Prop)({ type: String, required: false }),
119
+ (0, mongoose_1.Prop)({ type: String, required: false }),
119
120
  (0, class_validator_1.IsOptional)(),
120
121
  (0, class_validator_1.IsString)(),
121
122
  __metadata("design:type", String)
122
123
  ], License.prototype, "userId", void 0);
123
124
  exports.License = License = __decorate([
124
- (0, mongoose_2.Schema)({
125
+ (0, mongoose_1.Schema)({
125
126
  id: false,
126
127
  timestamps: true,
127
128
  })
128
129
  ], License);
129
- exports.LicenseSchema = mongoose_2.SchemaFactory.createForClass(License);
130
+ exports.LicenseSchema = mongoose_1.SchemaFactory.createForClass(License);
131
+ // Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
132
+ exports.LicenseSchema.pre('save', function (next) {
133
+ if (!this._id) {
134
+ this._id = (0, uuid_1.v4)();
135
+ }
136
+ next();
137
+ });
@@ -1,4 +1,4 @@
1
- import { Document, Types, Schema as MSchema } from 'mongoose';
1
+ import { Document, Schema as MSchema } from 'mongoose';
2
2
  export declare class Objective {
3
3
  id: number;
4
4
  name: string;
@@ -8,11 +8,11 @@ export declare class Objective {
8
8
  value2?: number;
9
9
  }
10
10
  export declare const ObjectiveSchema: MSchema<Objective, import("mongoose").Model<Objective, any, any, any, Document<unknown, any, Objective, any, {}> & Objective & {
11
- _id: Types.ObjectId;
11
+ _id: import("mongoose").Types.ObjectId;
12
12
  } & {
13
13
  __v: number;
14
14
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Objective, Document<unknown, {}, import("mongoose").FlatRecord<Objective>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Objective> & {
15
- _id: Types.ObjectId;
15
+ _id: import("mongoose").Types.ObjectId;
16
16
  } & {
17
17
  __v: number;
18
18
  }>;
@@ -21,11 +21,11 @@ export declare class Month {
21
21
  year?: number;
22
22
  }
23
23
  export declare const MonthSchema: MSchema<Month, import("mongoose").Model<Month, any, any, any, Document<unknown, any, Month, any, {}> & Month & {
24
- _id: Types.ObjectId;
24
+ _id: import("mongoose").Types.ObjectId;
25
25
  } & {
26
26
  __v: number;
27
27
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Month, Document<unknown, {}, import("mongoose").FlatRecord<Month>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Month> & {
28
- _id: Types.ObjectId;
28
+ _id: import("mongoose").Types.ObjectId;
29
29
  } & {
30
30
  __v: number;
31
31
  }>;
@@ -38,11 +38,11 @@ export declare class DemandMultiplierSlot {
38
38
  startHour?: number;
39
39
  }
40
40
  export declare const DemandMultiplierSlotSchema: MSchema<DemandMultiplierSlot, import("mongoose").Model<DemandMultiplierSlot, any, any, any, Document<unknown, any, DemandMultiplierSlot, any, {}> & DemandMultiplierSlot & {
41
- _id: Types.ObjectId;
41
+ _id: import("mongoose").Types.ObjectId;
42
42
  } & {
43
43
  __v: number;
44
44
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, DemandMultiplierSlot, Document<unknown, {}, import("mongoose").FlatRecord<DemandMultiplierSlot>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<DemandMultiplierSlot> & {
45
- _id: Types.ObjectId;
45
+ _id: import("mongoose").Types.ObjectId;
46
46
  } & {
47
47
  __v: number;
48
48
  }>;
@@ -51,11 +51,11 @@ export declare class DistributionKey {
51
51
  values: (string | number)[];
52
52
  }
53
53
  export declare const DistributionKeySchema: MSchema<DistributionKey, import("mongoose").Model<DistributionKey, any, any, any, Document<unknown, any, DistributionKey, any, {}> & DistributionKey & {
54
- _id: Types.ObjectId;
54
+ _id: import("mongoose").Types.ObjectId;
55
55
  } & {
56
56
  __v: number;
57
57
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, DistributionKey, Document<unknown, {}, import("mongoose").FlatRecord<DistributionKey>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<DistributionKey> & {
58
- _id: Types.ObjectId;
58
+ _id: import("mongoose").Types.ObjectId;
59
59
  } & {
60
60
  __v: number;
61
61
  }>;
@@ -65,11 +65,11 @@ export declare class RateOfGrowth {
65
65
  year?: number;
66
66
  }
67
67
  export declare const RateOfGrowthSchema: MSchema<RateOfGrowth, import("mongoose").Model<RateOfGrowth, any, any, any, Document<unknown, any, RateOfGrowth, any, {}> & RateOfGrowth & {
68
- _id: Types.ObjectId;
68
+ _id: import("mongoose").Types.ObjectId;
69
69
  } & {
70
70
  __v: number;
71
71
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, RateOfGrowth, Document<unknown, {}, import("mongoose").FlatRecord<RateOfGrowth>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<RateOfGrowth> & {
72
- _id: Types.ObjectId;
72
+ _id: import("mongoose").Types.ObjectId;
73
73
  } & {
74
74
  __v: number;
75
75
  }>;
@@ -80,11 +80,11 @@ export declare class Technology {
80
80
  settings: Record<string, unknown>;
81
81
  }
82
82
  export declare const TechnologySchema: MSchema<Technology, import("mongoose").Model<Technology, any, any, any, Document<unknown, any, Technology, any, {}> & Technology & {
83
- _id: Types.ObjectId;
83
+ _id: import("mongoose").Types.ObjectId;
84
84
  } & {
85
85
  __v: number;
86
86
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Technology, Document<unknown, {}, import("mongoose").FlatRecord<Technology>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Technology> & {
87
- _id: Types.ObjectId;
87
+ _id: import("mongoose").Types.ObjectId;
88
88
  } & {
89
89
  __v: number;
90
90
  }>;
@@ -98,11 +98,11 @@ export declare class ConfigScenario {
98
98
  taxRate?: number;
99
99
  }
100
100
  export declare const ConfigScenarioSchema: MSchema<ConfigScenario, import("mongoose").Model<ConfigScenario, any, any, any, Document<unknown, any, ConfigScenario, any, {}> & ConfigScenario & {
101
- _id: Types.ObjectId;
101
+ _id: import("mongoose").Types.ObjectId;
102
102
  } & {
103
103
  __v: number;
104
104
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ConfigScenario, Document<unknown, {}, import("mongoose").FlatRecord<ConfigScenario>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ConfigScenario> & {
105
- _id: Types.ObjectId;
105
+ _id: import("mongoose").Types.ObjectId;
106
106
  } & {
107
107
  __v: number;
108
108
  }>;
@@ -119,16 +119,16 @@ export declare class ConfigSite {
119
119
  settings: Record<string, unknown>;
120
120
  }
121
121
  export declare const ConfigSiteSchema: MSchema<ConfigSite, import("mongoose").Model<ConfigSite, any, any, any, Document<unknown, any, ConfigSite, any, {}> & ConfigSite & {
122
- _id: Types.ObjectId;
122
+ _id: import("mongoose").Types.ObjectId;
123
123
  } & {
124
124
  __v: number;
125
125
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ConfigSite, Document<unknown, {}, import("mongoose").FlatRecord<ConfigSite>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ConfigSite> & {
126
- _id: Types.ObjectId;
126
+ _id: import("mongoose").Types.ObjectId;
127
127
  } & {
128
128
  __v: number;
129
129
  }>;
130
130
  export declare class Scenario {
131
- readonly _id: Types.ObjectId;
131
+ readonly _id: string;
132
132
  color?: string;
133
133
  configScenario: ConfigScenario;
134
134
  configSite?: Record<string, ConfigSite>;
@@ -151,11 +151,11 @@ export declare class Scenario {
151
151
  }
152
152
  export type ScenarioDocument = Scenario & Document;
153
153
  export declare const ScenarioSchema: MSchema<Scenario, import("mongoose").Model<Scenario, any, any, any, Document<unknown, any, Scenario, any, {}> & Scenario & Required<{
154
- _id: Types.ObjectId;
154
+ _id: string;
155
155
  }> & {
156
156
  __v: number;
157
157
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Scenario, Document<unknown, {}, import("mongoose").FlatRecord<Scenario>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Scenario> & Required<{
158
- _id: Types.ObjectId;
158
+ _id: string;
159
159
  }> & {
160
160
  __v: number;
161
161
  }>;
@@ -167,11 +167,11 @@ export declare class ScenarioType extends Scenario {
167
167
  }
168
168
  export type ScenarioTypeDocument = ScenarioType & Document;
169
169
  export declare const ScenarioTypeSchema: MSchema<ScenarioType, import("mongoose").Model<ScenarioType, any, any, any, Document<unknown, any, ScenarioType, any, {}> & ScenarioType & Required<{
170
- _id: Types.ObjectId;
170
+ _id: string;
171
171
  }> & {
172
172
  __v: number;
173
173
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ScenarioType, Document<unknown, {}, import("mongoose").FlatRecord<ScenarioType>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ScenarioType> & Required<{
174
- _id: Types.ObjectId;
174
+ _id: string;
175
175
  }> & {
176
176
  __v: number;
177
177
  }>;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ScenarioTypeSchema = exports.ScenarioType = exports.ScenarioSchema = exports.Scenario = exports.ConfigSiteSchema = exports.ConfigSite = exports.ConfigScenarioSchema = exports.ConfigScenario = exports.TechnologySchema = exports.Technology = exports.RateOfGrowthSchema = exports.RateOfGrowth = exports.DistributionKeySchema = exports.DistributionKey = exports.DemandMultiplierSlotSchema = exports.DemandMultiplierSlot = exports.MonthSchema = exports.Month = exports.ObjectiveSchema = exports.Objective = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const mongoose_2 = require("mongoose");
15
+ const uuid_1 = require("uuid");
15
16
  const swagger_1 = require("@nestjs/swagger");
16
17
  const class_validator_1 = require("class-validator");
17
18
  let Objective = class Objective {
@@ -358,12 +359,13 @@ let Scenario = class Scenario {
358
359
  exports.Scenario = Scenario;
359
360
  __decorate([
360
361
  (0, swagger_1.ApiProperty)({
361
- description: 'Identifiant unique MongoDB',
362
+ description: 'Identifiant unique (UUID ou custom string)',
362
363
  example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
363
- type: mongoose_2.Types.ObjectId,
364
+ type: String,
364
365
  readOnly: true,
365
366
  }),
366
- __metadata("design:type", mongoose_2.Types.ObjectId)
367
+ (0, mongoose_1.Prop)({ type: String }),
368
+ __metadata("design:type", String)
367
369
  ], Scenario.prototype, "_id", void 0);
368
370
  __decorate([
369
371
  (0, swagger_1.ApiProperty)({ example: '#4c5fcc' }),
@@ -523,6 +525,13 @@ exports.Scenario = Scenario = __decorate([
523
525
  })
524
526
  ], Scenario);
525
527
  exports.ScenarioSchema = mongoose_1.SchemaFactory.createForClass(Scenario);
528
+ // Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
529
+ exports.ScenarioSchema.pre('save', function (next) {
530
+ if (!this._id) {
531
+ this._id = (0, uuid_1.v4)();
532
+ }
533
+ next();
534
+ });
526
535
  let ScenarioType = class ScenarioType extends Scenario {
527
536
  };
528
537
  exports.ScenarioType = ScenarioType;
@@ -557,3 +566,10 @@ exports.ScenarioType = ScenarioType = __decorate([
557
566
  (0, mongoose_1.Schema)()
558
567
  ], ScenarioType);
559
568
  exports.ScenarioTypeSchema = mongoose_1.SchemaFactory.createForClass(ScenarioType);
569
+ // Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
570
+ exports.ScenarioTypeSchema.pre('save', function (next) {
571
+ if (!this._id) {
572
+ this._id = (0, uuid_1.v4)();
573
+ }
574
+ next();
575
+ });
@@ -20,6 +20,7 @@ import { ThermalStorageParams } from './internal/thermal-storage-params';
20
20
  import { OptimizationParams } from './internal/optimization-params';
21
21
  import { FinancingType } from './internal/financing-type';
22
22
  export declare class ScenarioDefaultValue {
23
+ readonly _id: string;
23
24
  defaultPPATarif: DefaultPPATarif;
24
25
  VERSION: number;
25
26
  version: number;
@@ -51,12 +52,12 @@ export declare class ScenarioDefaultValue {
51
52
  updatedAt?: Date;
52
53
  }
53
54
  export type ScenarioDefaultValueDocument = ScenarioDefaultValue & Document;
54
- export declare const ScenarioDefaultValueSchema: import("mongoose").Schema<ScenarioDefaultValue, import("mongoose").Model<ScenarioDefaultValue, any, any, any, Document<unknown, any, ScenarioDefaultValue, any, {}> & ScenarioDefaultValue & {
55
- _id: import("mongoose").Types.ObjectId;
56
- } & {
55
+ export declare const ScenarioDefaultValueSchema: import("mongoose").Schema<ScenarioDefaultValue, import("mongoose").Model<ScenarioDefaultValue, any, any, any, Document<unknown, any, ScenarioDefaultValue, any, {}> & ScenarioDefaultValue & Required<{
56
+ _id: string;
57
+ }> & {
57
58
  __v: number;
58
- }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ScenarioDefaultValue, Document<unknown, {}, import("mongoose").FlatRecord<ScenarioDefaultValue>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ScenarioDefaultValue> & {
59
- _id: import("mongoose").Types.ObjectId;
60
- } & {
59
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ScenarioDefaultValue, Document<unknown, {}, import("mongoose").FlatRecord<ScenarioDefaultValue>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ScenarioDefaultValue> & Required<{
60
+ _id: string;
61
+ }> & {
61
62
  __v: number;
62
63
  }>;