@likewatt/models 1.147.1 → 1.149.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.
@@ -2,6 +2,7 @@ import { Document } from 'mongoose';
2
2
  import { SiteType } from './internal/enums';
3
3
  import { BuildingData } from './internal/building-data';
4
4
  import { BuildingDataStatus } from './enums/BuildingDataStatus';
5
+ import { GroupedConsentDraft } from './GroupedConsentDraft';
5
6
  export type CollectiveSiteDocument = CollectiveSite & Document;
6
7
  export declare class CollectiveSite {
7
8
  readonly _id: string;
@@ -39,6 +40,7 @@ export declare class CollectiveSite {
39
40
  consentUploadEnabled?: boolean;
40
41
  consentFraudConsentId?: string | null;
41
42
  consentResentAfterFraudAt?: Date | null;
43
+ groupedConsentDraft?: GroupedConsentDraft | null;
42
44
  deletedAt?: Date | null;
43
45
  createdAt?: Date | string;
44
46
  updatedAt?: Date | string;
@@ -18,6 +18,7 @@ const class_transformer_1 = require("class-transformer");
18
18
  const enums_1 = require("./internal/enums");
19
19
  const building_data_1 = require("./internal/building-data");
20
20
  const BuildingDataStatus_1 = require("./enums/BuildingDataStatus");
21
+ const GroupedConsentDraft_1 = require("./GroupedConsentDraft");
21
22
  let CollectiveSite = class CollectiveSite {
22
23
  };
23
24
  exports.CollectiveSite = CollectiveSite;
@@ -273,6 +274,22 @@ __decorate([
273
274
  (0, class_transformer_1.Type)(() => Date),
274
275
  __metadata("design:type", Object)
275
276
  ], CollectiveSite.prototype, "consentResentAfterFraudAt", void 0);
277
+ __decorate([
278
+ (0, swagger_1.ApiPropertyOptional)({
279
+ description: 'Brouillon de demande de consentement groupée (un par collectif), photo du formulaire aux champs possiblement vides. Écrit par la gateway seule ; effacé à l’envoi réussi depuis le brouillon.',
280
+ type: GroupedConsentDraft_1.GroupedConsentDraft,
281
+ nullable: true,
282
+ }),
283
+ (0, mongoose_1.Prop)({
284
+ type: GroupedConsentDraft_1.GroupedConsentDraftSchema,
285
+ required: false,
286
+ default: undefined,
287
+ }),
288
+ (0, class_validator_1.IsOptional)(),
289
+ (0, class_validator_1.ValidateNested)(),
290
+ (0, class_transformer_1.Type)(() => GroupedConsentDraft_1.GroupedConsentDraft),
291
+ __metadata("design:type", Object)
292
+ ], CollectiveSite.prototype, "groupedConsentDraft", void 0);
276
293
  __decorate([
277
294
  (0, swagger_1.ApiPropertyOptional)({
278
295
  description: 'Date de suppression (passage au compte support) ; absente ou null = projet actif. Posée et effacée par la gateway.',
@@ -0,0 +1,36 @@
1
+ /** Ligne d'un brouillon de demande groupée : nom et PDL tels que saisis, possiblement vides. */
2
+ export declare class GroupedConsentDraftMeter {
3
+ name: string;
4
+ pdl: string;
5
+ }
6
+ export declare const GroupedConsentDraftMeterSchema: import("mongoose").Schema<GroupedConsentDraftMeter, import("mongoose").Model<GroupedConsentDraftMeter, any, any, any, import("mongoose").Document<unknown, any, GroupedConsentDraftMeter, any, {}> & GroupedConsentDraftMeter & {
7
+ _id: import("mongoose").Types.ObjectId;
8
+ } & {
9
+ __v: number;
10
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, GroupedConsentDraftMeter, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<GroupedConsentDraftMeter>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<GroupedConsentDraftMeter> & {
11
+ _id: import("mongoose").Types.ObjectId;
12
+ } & {
13
+ __v: number;
14
+ }>;
15
+ /**
16
+ * Brouillon d'une demande de consentement ACC groupée : photo du formulaire,
17
+ * champs possiblement vides. Un seul par collectif. N'a aucun effet (ni fiche
18
+ * de consentement, ni mail, ni compteur) : les règles s'appliquent à l'envoi.
19
+ */
20
+ export declare class GroupedConsentDraft {
21
+ companyName: string;
22
+ firstname: string;
23
+ lastname: string;
24
+ email: string;
25
+ meters: GroupedConsentDraftMeter[];
26
+ updatedAt: Date;
27
+ }
28
+ export declare const GroupedConsentDraftSchema: import("mongoose").Schema<GroupedConsentDraft, import("mongoose").Model<GroupedConsentDraft, any, any, any, import("mongoose").Document<unknown, any, GroupedConsentDraft, any, {}> & GroupedConsentDraft & {
29
+ _id: import("mongoose").Types.ObjectId;
30
+ } & {
31
+ __v: number;
32
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, GroupedConsentDraft, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<GroupedConsentDraft>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<GroupedConsentDraft> & {
33
+ _id: import("mongoose").Types.ObjectId;
34
+ } & {
35
+ __v: number;
36
+ }>;
@@ -0,0 +1,87 @@
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.GroupedConsentDraftSchema = exports.GroupedConsentDraft = exports.GroupedConsentDraftMeterSchema = exports.GroupedConsentDraftMeter = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const class_transformer_1 = require("class-transformer");
16
+ const class_validator_1 = require("class-validator");
17
+ /** Ligne d'un brouillon de demande groupée : nom et PDL tels que saisis, possiblement vides. */
18
+ let GroupedConsentDraftMeter = class GroupedConsentDraftMeter {
19
+ };
20
+ exports.GroupedConsentDraftMeter = GroupedConsentDraftMeter;
21
+ __decorate([
22
+ (0, swagger_1.ApiProperty)({ description: 'Nom du compteur (peut être vide)' }),
23
+ (0, mongoose_1.Prop)({ type: String, default: '' }),
24
+ (0, class_validator_1.IsString)(),
25
+ __metadata("design:type", String)
26
+ ], GroupedConsentDraftMeter.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, swagger_1.ApiProperty)({ description: 'PDL tel que saisi (peut être vide)' }),
29
+ (0, mongoose_1.Prop)({ type: String, default: '' }),
30
+ (0, class_validator_1.IsString)(),
31
+ __metadata("design:type", String)
32
+ ], GroupedConsentDraftMeter.prototype, "pdl", void 0);
33
+ exports.GroupedConsentDraftMeter = GroupedConsentDraftMeter = __decorate([
34
+ (0, mongoose_1.Schema)({ _id: false })
35
+ ], GroupedConsentDraftMeter);
36
+ exports.GroupedConsentDraftMeterSchema = mongoose_1.SchemaFactory.createForClass(GroupedConsentDraftMeter);
37
+ /**
38
+ * Brouillon d'une demande de consentement ACC groupée : photo du formulaire,
39
+ * champs possiblement vides. Un seul par collectif. N'a aucun effet (ni fiche
40
+ * de consentement, ni mail, ni compteur) : les règles s'appliquent à l'envoi.
41
+ */
42
+ let GroupedConsentDraft = class GroupedConsentDraft {
43
+ };
44
+ exports.GroupedConsentDraft = GroupedConsentDraft;
45
+ __decorate([
46
+ (0, swagger_1.ApiProperty)({ description: 'Nom / raison sociale du titulaire' }),
47
+ (0, mongoose_1.Prop)({ type: String, default: '' }),
48
+ (0, class_validator_1.IsString)(),
49
+ __metadata("design:type", String)
50
+ ], GroupedConsentDraft.prototype, "companyName", void 0);
51
+ __decorate([
52
+ (0, swagger_1.ApiProperty)({ description: 'Prénom du représentant' }),
53
+ (0, mongoose_1.Prop)({ type: String, default: '' }),
54
+ (0, class_validator_1.IsString)(),
55
+ __metadata("design:type", String)
56
+ ], GroupedConsentDraft.prototype, "firstname", void 0);
57
+ __decorate([
58
+ (0, swagger_1.ApiProperty)({ description: 'Nom du représentant' }),
59
+ (0, mongoose_1.Prop)({ type: String, default: '' }),
60
+ (0, class_validator_1.IsString)(),
61
+ __metadata("design:type", String)
62
+ ], GroupedConsentDraft.prototype, "lastname", void 0);
63
+ __decorate([
64
+ (0, swagger_1.ApiProperty)({ description: 'Adresse e-mail du représentant' }),
65
+ (0, mongoose_1.Prop)({ type: String, default: '' }),
66
+ (0, class_validator_1.IsString)(),
67
+ __metadata("design:type", String)
68
+ ], GroupedConsentDraft.prototype, "email", void 0);
69
+ __decorate([
70
+ (0, swagger_1.ApiProperty)({ type: [GroupedConsentDraftMeter] }),
71
+ (0, mongoose_1.Prop)({ type: [exports.GroupedConsentDraftMeterSchema], default: [] }),
72
+ (0, class_validator_1.IsArray)(),
73
+ (0, class_validator_1.ValidateNested)({ each: true }),
74
+ (0, class_transformer_1.Type)(() => GroupedConsentDraftMeter),
75
+ __metadata("design:type", Array)
76
+ ], GroupedConsentDraft.prototype, "meters", void 0);
77
+ __decorate([
78
+ (0, swagger_1.ApiProperty)({ description: 'Date du dernier enregistrement' }),
79
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
80
+ (0, class_validator_1.IsDate)(),
81
+ (0, class_transformer_1.Type)(() => Date),
82
+ __metadata("design:type", Date)
83
+ ], GroupedConsentDraft.prototype, "updatedAt", void 0);
84
+ exports.GroupedConsentDraft = GroupedConsentDraft = __decorate([
85
+ (0, mongoose_1.Schema)({ _id: false })
86
+ ], GroupedConsentDraft);
87
+ exports.GroupedConsentDraftSchema = mongoose_1.SchemaFactory.createForClass(GroupedConsentDraft);
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Événement de cycle de vie d'un compte (user) Aurora, tel que la gateway
3
+ * l'a provoqué ou constaté.
4
+ */
5
+ export declare enum AuroraAccountEvent {
6
+ /** User Aurora invité et rattaché à l'utilisateur Optiwize. */
7
+ CREATED = "CREATED",
8
+ /**
9
+ * Invitation renvoyée. Aurora n'ayant pas de vrai renvoi, l'ancien user est
10
+ * désactivé et un nouveau est invité : `previousAuroraUserId` → `auroraUserId`.
11
+ */
12
+ INVITATION_RESENT = "INVITATION_RESENT",
13
+ /** User Aurora désactivé (droit retiré, compte Optiwize supprimé). */
14
+ REVOKED = "REVOKED",
15
+ /**
16
+ * Identité Aurora oubliée côté Optiwize sans action de notre part : user
17
+ * supprimé chez Aurora (404), ou désactivé par un renvoi d'invitation qui
18
+ * a échoué.
19
+ */
20
+ FORGOTTEN = "FORGOTTEN"
21
+ }
22
+ /**
23
+ * Journal des comptes Aurora des utilisateurs (monitoring admin, KO-919).
24
+ *
25
+ * Une ligne = un événement. L'API Aurora ne fournit aucune date de création de
26
+ * user (et ses ids sont des UUID v4) : ce journal est la seule source datée de
27
+ * l'historique d'un compte. `userEmail`, `principalId` et `workspaceId` sont
28
+ * figés au moment de l'événement et peuvent être nuls (compte Optiwize déjà
29
+ * supprimé).
30
+ */
31
+ export declare class AuroraAccountLog {
32
+ id: number;
33
+ event: AuroraAccountEvent;
34
+ /** Utilisateur Optiwize titulaire du compte Aurora. */
35
+ userId: string;
36
+ userEmail?: string | null;
37
+ /** Compte principal (titulaire) de l'organisation de l'utilisateur. */
38
+ principalId?: string | null;
39
+ workspaceId?: string | null;
40
+ /** User Aurora concerné (le NOUVEAU pour un renvoi d'invitation). */
41
+ auroraUserId?: string | null;
42
+ /** User Aurora désactivé par un renvoi d'invitation. */
43
+ previousAuroraUserId?: string | null;
44
+ /**
45
+ * Précision libre sur l'origine de l'événement (ex. `deleted`,
46
+ * `right_removed`, `aurora_not_found`). VARCHAR et non ENUM : une nouvelle
47
+ * cause ne doit pas faire échouer l'écriture d'une ligne de traçage.
48
+ */
49
+ reason?: string | null;
50
+ /** Date de l'événement (transmise par la gateway). */
51
+ createdAt?: Date;
52
+ }
@@ -0,0 +1,124 @@
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.AuroraAccountLog = exports.AuroraAccountEvent = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ /**
15
+ * Événement de cycle de vie d'un compte (user) Aurora, tel que la gateway
16
+ * l'a provoqué ou constaté.
17
+ */
18
+ var AuroraAccountEvent;
19
+ (function (AuroraAccountEvent) {
20
+ /** User Aurora invité et rattaché à l'utilisateur Optiwize. */
21
+ AuroraAccountEvent["CREATED"] = "CREATED";
22
+ /**
23
+ * Invitation renvoyée. Aurora n'ayant pas de vrai renvoi, l'ancien user est
24
+ * désactivé et un nouveau est invité : `previousAuroraUserId` → `auroraUserId`.
25
+ */
26
+ AuroraAccountEvent["INVITATION_RESENT"] = "INVITATION_RESENT";
27
+ /** User Aurora désactivé (droit retiré, compte Optiwize supprimé). */
28
+ AuroraAccountEvent["REVOKED"] = "REVOKED";
29
+ /**
30
+ * Identité Aurora oubliée côté Optiwize sans action de notre part : user
31
+ * supprimé chez Aurora (404), ou désactivé par un renvoi d'invitation qui
32
+ * a échoué.
33
+ */
34
+ AuroraAccountEvent["FORGOTTEN"] = "FORGOTTEN";
35
+ })(AuroraAccountEvent || (exports.AuroraAccountEvent = AuroraAccountEvent = {}));
36
+ /**
37
+ * Journal des comptes Aurora des utilisateurs (monitoring admin, KO-919).
38
+ *
39
+ * Une ligne = un événement. L'API Aurora ne fournit aucune date de création de
40
+ * user (et ses ids sont des UUID v4) : ce journal est la seule source datée de
41
+ * l'historique d'un compte. `userEmail`, `principalId` et `workspaceId` sont
42
+ * figés au moment de l'événement et peuvent être nuls (compte Optiwize déjà
43
+ * supprimé).
44
+ */
45
+ let AuroraAccountLog = class AuroraAccountLog {
46
+ };
47
+ exports.AuroraAccountLog = AuroraAccountLog;
48
+ __decorate([
49
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: 'bigint' }),
50
+ __metadata("design:type", Number)
51
+ ], AuroraAccountLog.prototype, "id", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({
54
+ name: 'event',
55
+ type: 'enum',
56
+ enum: AuroraAccountEvent,
57
+ nullable: false,
58
+ }),
59
+ __metadata("design:type", String)
60
+ ], AuroraAccountLog.prototype, "event", void 0);
61
+ __decorate([
62
+ (0, typeorm_1.Column)({ name: 'user_id', type: 'varchar', length: 64, nullable: false }),
63
+ __metadata("design:type", String)
64
+ ], AuroraAccountLog.prototype, "userId", void 0);
65
+ __decorate([
66
+ (0, typeorm_1.Column)({
67
+ name: 'user_email',
68
+ type: 'varchar',
69
+ length: 320,
70
+ nullable: true,
71
+ }),
72
+ __metadata("design:type", Object)
73
+ ], AuroraAccountLog.prototype, "userEmail", void 0);
74
+ __decorate([
75
+ (0, typeorm_1.Column)({
76
+ name: 'principal_id',
77
+ type: 'varchar',
78
+ length: 64,
79
+ nullable: true,
80
+ }),
81
+ __metadata("design:type", Object)
82
+ ], AuroraAccountLog.prototype, "principalId", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({
85
+ name: 'workspace_id',
86
+ type: 'varchar',
87
+ length: 64,
88
+ nullable: true,
89
+ }),
90
+ __metadata("design:type", Object)
91
+ ], AuroraAccountLog.prototype, "workspaceId", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)({
94
+ name: 'aurora_user_id',
95
+ type: 'varchar',
96
+ length: 64,
97
+ nullable: true,
98
+ }),
99
+ __metadata("design:type", Object)
100
+ ], AuroraAccountLog.prototype, "auroraUserId", void 0);
101
+ __decorate([
102
+ (0, typeorm_1.Column)({
103
+ name: 'previous_aurora_user_id',
104
+ type: 'varchar',
105
+ length: 64,
106
+ nullable: true,
107
+ }),
108
+ __metadata("design:type", Object)
109
+ ], AuroraAccountLog.prototype, "previousAuroraUserId", void 0);
110
+ __decorate([
111
+ (0, typeorm_1.Column)({ name: 'reason', type: 'varchar', length: 64, nullable: true }),
112
+ __metadata("design:type", Object)
113
+ ], AuroraAccountLog.prototype, "reason", void 0);
114
+ __decorate([
115
+ (0, typeorm_1.CreateDateColumn)({ name: 'created_at' }),
116
+ __metadata("design:type", Date)
117
+ ], AuroraAccountLog.prototype, "createdAt", void 0);
118
+ exports.AuroraAccountLog = AuroraAccountLog = __decorate([
119
+ (0, typeorm_1.Entity)('aurora_account_log'),
120
+ (0, typeorm_1.Index)('idx_aurora_account_log_user_created', ['userId', 'createdAt']),
121
+ (0, typeorm_1.Index)('idx_aurora_account_log_principal_created', ['principalId', 'createdAt']),
122
+ (0, typeorm_1.Index)('idx_aurora_account_log_aurora_user', ['auroraUserId']),
123
+ (0, typeorm_1.Index)('idx_aurora_account_log_created', ['createdAt'])
124
+ ], AuroraAccountLog);
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './core/Scenario';
5
5
  export * from './core/Site';
6
6
  export * from './core/Customer';
7
7
  export * from './core/Consent';
8
+ export * from './core/GroupedConsentDraft';
8
9
  export * from './core/User';
9
10
  export * from './core/License';
10
11
  export * from './core/Subscription';
@@ -41,6 +42,7 @@ export * from './core/TypeORM/KoncileOcrLog';
41
42
  export * from './core/TypeORM/AssistantLlmLog';
42
43
  export * from './core/TypeORM/WebhookOutput';
43
44
  export * from './core/TypeORM/AdminActionLog';
45
+ export * from './core/TypeORM/AuroraAccountLog';
44
46
  export { EnedisReportAcquisitionMethod, EnedisReportOperationType, ExtractionSens, ExtractionType, ExtractionSource, } from './core/TypeORM/EnedisReportHistory';
45
47
  export * from './core/internal/enums';
46
48
  export * from './core/enums/BuildingDataStatus';
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ __exportStar(require("./core/Scenario"), exports);
23
23
  __exportStar(require("./core/Site"), exports);
24
24
  __exportStar(require("./core/Customer"), exports);
25
25
  __exportStar(require("./core/Consent"), exports);
26
+ __exportStar(require("./core/GroupedConsentDraft"), exports);
26
27
  __exportStar(require("./core/User"), exports);
27
28
  __exportStar(require("./core/License"), exports);
28
29
  __exportStar(require("./core/Subscription"), exports);
@@ -60,6 +61,7 @@ __exportStar(require("./core/TypeORM/KoncileOcrLog"), exports);
60
61
  __exportStar(require("./core/TypeORM/AssistantLlmLog"), exports);
61
62
  __exportStar(require("./core/TypeORM/WebhookOutput"), exports);
62
63
  __exportStar(require("./core/TypeORM/AdminActionLog"), exports);
64
+ __exportStar(require("./core/TypeORM/AuroraAccountLog"), exports);
63
65
  // TypeORM enums
64
66
  var EnedisReportHistory_1 = require("./core/TypeORM/EnedisReportHistory");
65
67
  Object.defineProperty(exports, "EnedisReportAcquisitionMethod", { enumerable: true, get: function () { return EnedisReportHistory_1.EnedisReportAcquisitionMethod; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likewatt/models",
3
- "version": "1.147.1",
3
+ "version": "1.149.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {