@likewatt/models 1.97.0 → 1.99.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.
@@ -3,6 +3,7 @@ export type ApiKeyDocument = ApiKey & Document;
3
3
  export declare class ApiKey {
4
4
  readonly _id: string;
5
5
  userId: string;
6
+ workspaceId?: string;
6
7
  name: string;
7
8
  keyHash: string;
8
9
  keyPrefix: string;
@@ -28,6 +28,15 @@ __decorate([
28
28
  (0, class_validator_1.IsString)(),
29
29
  __metadata("design:type", String)
30
30
  ], ApiKey.prototype, "userId", void 0);
31
+ __decorate([
32
+ (0, swagger_1.ApiPropertyOptional)({
33
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
34
+ }),
35
+ (0, mongoose_1.Prop)({ type: String, index: true }),
36
+ (0, class_validator_1.IsOptional)(),
37
+ (0, class_validator_1.IsString)(),
38
+ __metadata("design:type", String)
39
+ ], ApiKey.prototype, "workspaceId", void 0);
31
40
  __decorate([
32
41
  (0, swagger_1.ApiProperty)({ example: 'Prod CRM' }),
33
42
  (0, mongoose_1.Prop)({ type: String, required: true }),
@@ -7,6 +7,7 @@ export declare class CollectiveSite {
7
7
  type: SiteType;
8
8
  description?: string;
9
9
  creator?: string;
10
+ workspaceId?: string;
10
11
  address: string;
11
12
  initialOwner?: string;
12
13
  name: string;
@@ -54,6 +54,15 @@ __decorate([
54
54
  (0, class_validator_1.IsString)(),
55
55
  __metadata("design:type", String)
56
56
  ], CollectiveSite.prototype, "creator", void 0);
57
+ __decorate([
58
+ (0, swagger_1.ApiPropertyOptional)({
59
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
60
+ }),
61
+ (0, mongoose_1.Prop)({ type: String, index: true }),
62
+ (0, class_validator_1.IsOptional)(),
63
+ (0, class_validator_1.IsString)(),
64
+ __metadata("design:type", String)
65
+ ], CollectiveSite.prototype, "workspaceId", void 0);
57
66
  __decorate([
58
67
  (0, swagger_1.ApiProperty)(),
59
68
  (0, mongoose_1.Prop)({ required: true }),
@@ -12,6 +12,7 @@ export declare class Consent {
12
12
  contractConsent: boolean;
13
13
  courbeConsent: boolean;
14
14
  userId: string;
15
+ workspaceId?: string;
15
16
  date?: Date;
16
17
  email: string;
17
18
  enedisNumber: string;
@@ -72,6 +72,15 @@ __decorate([
72
72
  (0, class_validator_1.IsString)(),
73
73
  __metadata("design:type", String)
74
74
  ], Consent.prototype, "userId", void 0);
75
+ __decorate([
76
+ (0, swagger_1.ApiPropertyOptional)({
77
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
78
+ }),
79
+ (0, mongoose_1.Prop)({ type: String, index: true }),
80
+ (0, class_validator_1.IsOptional)(),
81
+ (0, class_validator_1.IsString)(),
82
+ __metadata("design:type", String)
83
+ ], Consent.prototype, "workspaceId", void 0);
75
84
  __decorate([
76
85
  (0, swagger_1.ApiProperty)({
77
86
  description: 'Date du consentement',
@@ -12,6 +12,7 @@ export declare class DefaultRate {
12
12
  _id: string;
13
13
  name?: string;
14
14
  userId: string;
15
+ workspaceId?: string;
15
16
  rateId?: string;
16
17
  tarifs: Rates[];
17
18
  restOfTheYear?: RestOfTheYearTarifs;
@@ -57,6 +57,15 @@ __decorate([
57
57
  (0, class_validator_1.IsOptional)(),
58
58
  __metadata("design:type", String)
59
59
  ], DefaultRate.prototype, "userId", void 0);
60
+ __decorate([
61
+ (0, swagger_1.ApiPropertyOptional)({
62
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
63
+ }),
64
+ (0, mongoose_1.Prop)({ type: String, index: true }),
65
+ (0, class_validator_1.IsOptional)(),
66
+ (0, class_validator_1.IsString)(),
67
+ __metadata("design:type", String)
68
+ ], DefaultRate.prototype, "workspaceId", void 0);
60
69
  __decorate([
61
70
  (0, swagger_1.ApiProperty)(),
62
71
  (0, mongoose_1.Prop)({ type: String, required: false }),
@@ -47,6 +47,7 @@ export declare const LeadTenantLimitsSchema: import("mongoose").Schema<LeadTenan
47
47
  export declare class LeadTenant {
48
48
  _id: string;
49
49
  userId: string;
50
+ workspaceId?: string;
50
51
  subdomain: string;
51
52
  domain: string;
52
53
  theme?: LeadThemeConfig;
@@ -11,7 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.LeadTenantSchema = exports.LeadTenant = exports.LeadTenantLimitsSchema = exports.LeadTenantLimits = exports.LeadLimitRuleSchema = exports.LeadLimitRule = exports.LeadThemeConfigSchema = exports.LeadThemeConfig = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
+ const swagger_1 = require("@nestjs/swagger");
14
15
  const uuid_1 = require("uuid");
16
+ const class_validator_1 = require("class-validator");
15
17
  const Regex_1 = require("./Regex");
16
18
  const webhook_tenant_options_1 = require("./webhookTypes/webhook-tenant-options");
17
19
  let LeadThemeConfig = class LeadThemeConfig {
@@ -90,6 +92,15 @@ __decorate([
90
92
  (0, mongoose_1.Prop)({ required: true, type: String, ref: 'User' }),
91
93
  __metadata("design:type", String)
92
94
  ], LeadTenant.prototype, "userId", void 0);
95
+ __decorate([
96
+ (0, swagger_1.ApiPropertyOptional)({
97
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
98
+ }),
99
+ (0, mongoose_1.Prop)({ type: String, index: true }),
100
+ (0, class_validator_1.IsOptional)(),
101
+ (0, class_validator_1.IsString)(),
102
+ __metadata("design:type", String)
103
+ ], LeadTenant.prototype, "workspaceId", void 0);
93
104
  __decorate([
94
105
  (0, mongoose_1.Prop)({
95
106
  type: String,
@@ -181,6 +181,7 @@ export declare class Scenario {
181
181
  projectLifespan?: number;
182
182
  sellingPriceInflation?: number;
183
183
  siteId?: string;
184
+ workspaceId?: string;
184
185
  technologies?: Technology[];
185
186
  pvs?: Pv[];
186
187
  version?: number;
@@ -625,6 +625,15 @@ __decorate([
625
625
  (0, class_validator_1.IsString)(),
626
626
  __metadata("design:type", String)
627
627
  ], Scenario.prototype, "siteId", void 0);
628
+ __decorate([
629
+ (0, swagger_1.ApiPropertyOptional)({
630
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
631
+ }),
632
+ (0, mongoose_1.Prop)({ type: String, index: true }),
633
+ (0, class_validator_1.IsOptional)(),
634
+ (0, class_validator_1.IsString)(),
635
+ __metadata("design:type", String)
636
+ ], Scenario.prototype, "workspaceId", void 0);
628
637
  __decorate([
629
638
  (0, swagger_1.ApiProperty)({ type: [Technology] }),
630
639
  (0, mongoose_1.Prop)({ type: [exports.TechnologySchema], required: true }),
@@ -72,6 +72,7 @@ export declare class Site {
72
72
  extractionData?: ExtractionData;
73
73
  scenario?: string;
74
74
  user?: string;
75
+ workspaceId?: string;
75
76
  profile?: Profiles;
76
77
  collectiveSiteId?: string;
77
78
  folder?: string;
package/dist/core/Site.js CHANGED
@@ -271,6 +271,15 @@ __decorate([
271
271
  (0, class_validator_1.IsString)(),
272
272
  __metadata("design:type", String)
273
273
  ], Site.prototype, "user", void 0);
274
+ __decorate([
275
+ (0, swagger_1.ApiPropertyOptional)({
276
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
277
+ }),
278
+ (0, mongoose_1.Prop)({ type: String, index: true }),
279
+ (0, class_validator_1.IsOptional)(),
280
+ (0, class_validator_1.IsString)(),
281
+ __metadata("design:type", String)
282
+ ], Site.prototype, "workspaceId", void 0);
274
283
  __decorate([
275
284
  (0, swagger_1.ApiPropertyOptional)({ enum: enums_1.Profiles }),
276
285
  (0, mongoose_1.Prop)({ type: String, enum: enums_1.Profiles, required: false }),
@@ -116,6 +116,7 @@ export declare class User {
116
116
  emailVerified: boolean;
117
117
  principal: boolean;
118
118
  principalUser?: string;
119
+ workspaceId?: string;
119
120
  type?: string;
120
121
  domain?: string;
121
122
  license?: string;
package/dist/core/User.js CHANGED
@@ -461,6 +461,15 @@ __decorate([
461
461
  (0, class_validator_1.IsString)(),
462
462
  __metadata("design:type", String)
463
463
  ], User.prototype, "principalUser", void 0);
464
+ __decorate([
465
+ (0, swagger_1.ApiPropertyOptional)({
466
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
467
+ }),
468
+ (0, mongoose_1.Prop)({ type: String, index: true }),
469
+ (0, class_validator_1.IsOptional)(),
470
+ (0, class_validator_1.IsString)(),
471
+ __metadata("design:type", String)
472
+ ], User.prototype, "workspaceId", void 0);
464
473
  __decorate([
465
474
  (0, swagger_1.ApiProperty)({
466
475
  description: 'Type de l’utilisateur',
@@ -0,0 +1,20 @@
1
+ import { Document } from 'mongoose';
2
+ export type WorkspaceDocument = Workspace & Document;
3
+ export declare class Workspace {
4
+ readonly _id: string;
5
+ owners: string[];
6
+ name?: string;
7
+ organization?: string;
8
+ settings?: Record<string, unknown>;
9
+ createdAt?: Date;
10
+ updatedAt?: Date;
11
+ }
12
+ export declare const WorkspaceSchema: import("mongoose").Schema<Workspace, import("mongoose").Model<Workspace, any, any, any, Document<unknown, any, Workspace, any, {}> & Workspace & Required<{
13
+ _id: string;
14
+ }> & {
15
+ __v: number;
16
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Workspace, Document<unknown, {}, import("mongoose").FlatRecord<Workspace>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Workspace> & Required<{
17
+ _id: string;
18
+ }> & {
19
+ __v: number;
20
+ }>;
@@ -0,0 +1,82 @@
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.WorkspaceSchema = exports.Workspace = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const class_validator_1 = require("class-validator");
16
+ const uuid_1 = require("uuid");
17
+ let Workspace = class Workspace {
18
+ };
19
+ exports.Workspace = Workspace;
20
+ __decorate([
21
+ (0, swagger_1.ApiProperty)({ type: String, readOnly: true }),
22
+ (0, mongoose_1.Prop)({ type: String }),
23
+ __metadata("design:type", String)
24
+ ], Workspace.prototype, "_id", void 0);
25
+ __decorate([
26
+ (0, swagger_1.ApiProperty)({
27
+ description: 'Comptes principaux (owners) du workspace',
28
+ type: [String],
29
+ }),
30
+ (0, mongoose_1.Prop)({ type: [String], default: [], index: true }),
31
+ (0, class_validator_1.IsArray)(),
32
+ (0, class_validator_1.IsString)({ each: true }),
33
+ __metadata("design:type", Array)
34
+ ], Workspace.prototype, "owners", void 0);
35
+ __decorate([
36
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Nom / raison sociale du workspace' }),
37
+ (0, mongoose_1.Prop)({ type: String }),
38
+ (0, class_validator_1.IsOptional)(),
39
+ (0, class_validator_1.IsString)(),
40
+ __metadata("design:type", String)
41
+ ], Workspace.prototype, "name", void 0);
42
+ __decorate([
43
+ (0, swagger_1.ApiPropertyOptional)(),
44
+ (0, mongoose_1.Prop)({ type: String }),
45
+ (0, class_validator_1.IsOptional)(),
46
+ (0, class_validator_1.IsString)(),
47
+ __metadata("design:type", String)
48
+ ], Workspace.prototype, "organization", void 0);
49
+ __decorate([
50
+ (0, swagger_1.ApiPropertyOptional)({
51
+ description: 'Réglages du workspace (license, limits, leadTenantId, rights). Forme libre — étoffée en Phase 3.',
52
+ type: Object,
53
+ }),
54
+ (0, mongoose_1.Prop)({ type: Object, default: {} }),
55
+ (0, class_validator_1.IsOptional)(),
56
+ (0, class_validator_1.IsObject)(),
57
+ __metadata("design:type", Object)
58
+ ], Workspace.prototype, "settings", void 0);
59
+ __decorate([
60
+ (0, swagger_1.ApiPropertyOptional)({ type: Date, readOnly: true }),
61
+ __metadata("design:type", Date)
62
+ ], Workspace.prototype, "createdAt", void 0);
63
+ __decorate([
64
+ (0, swagger_1.ApiPropertyOptional)({ type: Date, readOnly: true }),
65
+ __metadata("design:type", Date)
66
+ ], Workspace.prototype, "updatedAt", void 0);
67
+ exports.Workspace = Workspace = __decorate([
68
+ (0, mongoose_1.Schema)({
69
+ collection: 'workspaces',
70
+ id: false,
71
+ timestamps: true,
72
+ toJSON: { virtuals: true, versionKey: false },
73
+ toObject: { virtuals: true, versionKey: false },
74
+ })
75
+ ], Workspace);
76
+ exports.WorkspaceSchema = mongoose_1.SchemaFactory.createForClass(Workspace);
77
+ exports.WorkspaceSchema.pre('save', function (next) {
78
+ if (!this._id) {
79
+ this._id = (0, uuid_1.v4)();
80
+ }
81
+ next();
82
+ });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './core/ApiKey';
2
+ export * from './core/Workspace';
2
3
  export * from './core/CollectiveSite';
3
4
  export * from './core/Scenario';
4
5
  export * from './core/Site';
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.ExtractionSource = exports.ExtractionType = exports.ExtractionSens = exports.EnedisReportOperationType = exports.EnedisReportAcquisitionMethod = void 0;
18
18
  // Main entities
19
19
  __exportStar(require("./core/ApiKey"), exports);
20
+ __exportStar(require("./core/Workspace"), exports);
20
21
  __exportStar(require("./core/CollectiveSite"), exports);
21
22
  __exportStar(require("./core/Scenario"), exports);
22
23
  __exportStar(require("./core/Site"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likewatt/models",
3
- "version": "1.97.0",
3
+ "version": "1.99.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {