@likewatt/models 1.48.1 → 1.50.0

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.
@@ -0,0 +1,26 @@
1
+ import { Document } from 'mongoose';
2
+ /**
3
+ * Représente un utilisateur dans le système.
4
+ * - @Schema/timestamps : gère createdAt et updatedAt automatiques
5
+ * - @Prop : schéma Mongoose
6
+ * - @ApiProperty : documentation Swagger
7
+ * - class-validator rules : validation runtime
8
+ */
9
+ export declare class Customer {
10
+ _id: string;
11
+ firstname?: string;
12
+ lastname?: string;
13
+ phone?: string;
14
+ email: string;
15
+ sites: string[];
16
+ }
17
+ export type LicenseDocument = Customer & Document;
18
+ export declare const CustomerSchema: import("mongoose").Schema<Customer, import("mongoose").Model<Customer, any, any, any, Document<unknown, any, Customer, any, {}> & Customer & Required<{
19
+ _id: string;
20
+ }> & {
21
+ __v: number;
22
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Customer, Document<unknown, {}, import("mongoose").FlatRecord<Customer>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Customer> & Required<{
23
+ _id: string;
24
+ }> & {
25
+ __v: number;
26
+ }>;
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CustomerSchema = exports.Customer = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const mongoose_1 = require("@nestjs/mongoose");
15
+ const uuid_1 = require("uuid");
16
+ const class_validator_1 = require("class-validator");
17
+ /**
18
+ * Représente un utilisateur dans le système.
19
+ * - @Schema/timestamps : gère createdAt et updatedAt automatiques
20
+ * - @Prop : schéma Mongoose
21
+ * - @ApiProperty : documentation Swagger
22
+ * - class-validator rules : validation runtime
23
+ */
24
+ let Customer = class Customer {
25
+ };
26
+ exports.Customer = Customer;
27
+ __decorate([
28
+ (0, swagger_1.ApiProperty)({
29
+ description: 'Identifiant unique (UUID ou custom string)',
30
+ example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
31
+ type: String,
32
+ readOnly: true,
33
+ }),
34
+ (0, mongoose_1.Prop)({ type: String }),
35
+ __metadata("design:type", String)
36
+ ], Customer.prototype, "_id", void 0);
37
+ __decorate([
38
+ (0, swagger_1.ApiProperty)({
39
+ description: 'prénom',
40
+ example: 'John',
41
+ }),
42
+ (0, mongoose_1.Prop)({ type: String, required: false }),
43
+ (0, class_validator_1.IsOptional)(),
44
+ (0, class_validator_1.IsString)(),
45
+ __metadata("design:type", String)
46
+ ], Customer.prototype, "firstname", void 0);
47
+ __decorate([
48
+ (0, swagger_1.ApiProperty)({
49
+ description: 'nom',
50
+ example: 'Doe',
51
+ }),
52
+ (0, mongoose_1.Prop)({ type: String, required: false }),
53
+ (0, class_validator_1.IsOptional)(),
54
+ (0, class_validator_1.IsString)(),
55
+ __metadata("design:type", String)
56
+ ], Customer.prototype, "lastname", void 0);
57
+ __decorate([
58
+ (0, swagger_1.ApiProperty)({
59
+ description: 'Numéro de téléphone du client',
60
+ example: '0606060606',
61
+ }),
62
+ (0, mongoose_1.Prop)({ type: String, required: false }),
63
+ (0, class_validator_1.IsOptional)(),
64
+ (0, class_validator_1.IsString)(),
65
+ __metadata("design:type", String)
66
+ ], Customer.prototype, "phone", void 0);
67
+ __decorate([
68
+ (0, swagger_1.ApiProperty)({
69
+ description: 'Adresse e-mail du client',
70
+ example: 'firstname.lastname@email.com',
71
+ format: 'email',
72
+ }),
73
+ (0, mongoose_1.Prop)({ type: String, required: true, unique: true }),
74
+ (0, class_validator_1.IsEmail)(),
75
+ __metadata("design:type", String)
76
+ ], Customer.prototype, "email", void 0);
77
+ __decorate([
78
+ (0, swagger_1.ApiProperty)(),
79
+ (0, mongoose_1.Prop)({ type: [String], required: true }),
80
+ (0, class_validator_1.IsArray)(),
81
+ __metadata("design:type", Array)
82
+ ], Customer.prototype, "sites", void 0);
83
+ exports.Customer = Customer = __decorate([
84
+ (0, mongoose_1.Schema)({
85
+ id: false,
86
+ timestamps: true,
87
+ toJSON: { virtuals: true, versionKey: false },
88
+ toObject: { virtuals: true, versionKey: false },
89
+ })
90
+ ], Customer);
91
+ exports.CustomerSchema = mongoose_1.SchemaFactory.createForClass(Customer);
92
+ // Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
93
+ exports.CustomerSchema.pre('save', function (next) {
94
+ if (!this._id) {
95
+ this._id = (0, uuid_1.v4)();
96
+ }
97
+ next();
98
+ });
@@ -14,6 +14,7 @@ export declare class Comments {
14
14
  TechSummary: string;
15
15
  VanFromPopUp: string;
16
16
  Van: string;
17
+ ConsumerEnergyBalance: string;
17
18
  }
18
19
  export declare const CommentsSchema: import("mongoose").Schema<Comments, import("mongoose").Model<Comments, any, any, any, import("mongoose").Document<unknown, any, Comments, any, {}> & Comments & {
19
20
  _id: import("mongoose").Types.ObjectId;
@@ -85,6 +85,16 @@ __decorate([
85
85
  (0, class_validator_1.IsString)(),
86
86
  __metadata("design:type", String)
87
87
  ], Comments.prototype, "VanFromPopUp", void 0);
88
+ __decorate([
89
+ (0, mongoose_1.Prop)({ required: false }),
90
+ (0, class_validator_1.IsString)(),
91
+ __metadata("design:type", String)
92
+ ], Comments.prototype, "Van", void 0);
93
+ __decorate([
94
+ (0, mongoose_1.Prop)({ required: false }),
95
+ (0, class_validator_1.IsString)(),
96
+ __metadata("design:type", String)
97
+ ], Comments.prototype, "ConsumerEnergyBalance", void 0);
88
98
  exports.Comments = Comments = __decorate([
89
99
  (0, mongoose_1.Schema)({ _id: false })
90
100
  ], Comments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likewatt/models",
3
- "version": "1.48.1",
3
+ "version": "1.50.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {