@likewatt/models 1.78.1 → 1.79.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.
- package/dist/core/Consent.js +8 -0
- package/package.json +1 -1
package/dist/core/Consent.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.ConsentSchema = exports.Consent = void 0;
|
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
15
15
|
const class_validator_1 = require("class-validator");
|
|
16
|
+
const uuid_1 = require("uuid");
|
|
16
17
|
/**
|
|
17
18
|
* Représente un utilisateur dans le système.
|
|
18
19
|
* - @Schema/timestamps : gère createdAt et updatedAt automatiques
|
|
@@ -164,3 +165,10 @@ exports.Consent = Consent = __decorate([
|
|
|
164
165
|
})
|
|
165
166
|
], Consent);
|
|
166
167
|
exports.ConsentSchema = mongoose_1.SchemaFactory.createForClass(Consent);
|
|
168
|
+
// Hook pre-save pour générer automatiquement un UUID si _id n'est pas fourni
|
|
169
|
+
exports.ConsentSchema.pre('save', function (next) {
|
|
170
|
+
if (!this._id) {
|
|
171
|
+
this._id = (0, uuid_1.v4)();
|
|
172
|
+
}
|
|
173
|
+
next();
|
|
174
|
+
});
|