@likewatt/models 1.97.0 → 1.99.1

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 }),
@@ -1,6 +1,5 @@
1
1
  import { Document } from 'mongoose';
2
2
  import { Folder } from './internal/folder.model';
3
- import { ManagerLicenses } from './internal/manager-licenses';
4
3
  import { UsersList } from './internal/users-list';
5
4
  import { ChartTheme } from './internal/chart-theme';
6
5
  /**
@@ -95,8 +94,6 @@ export declare class User {
95
94
  mfa?: Mfa;
96
95
  firstname: string;
97
96
  folders: Folder[];
98
- managerLicenses?: ManagerLicenses;
99
- managerLicensesUsed?: ManagerLicenses;
100
97
  renewLicense?: object;
101
98
  defaultRates: string[];
102
99
  defaultScenarios: string[];
@@ -110,12 +107,12 @@ export declare class User {
110
107
  addressZipCode?: string;
111
108
  isAdmin: boolean;
112
109
  isRenewalEmailSent: boolean;
113
- isManager: boolean;
114
110
  active: boolean;
115
111
  demo: boolean;
116
112
  emailVerified: boolean;
117
113
  principal: boolean;
118
114
  principalUser?: string;
115
+ workspaceId?: string;
119
116
  type?: string;
120
117
  domain?: string;
121
118
  license?: string;
package/dist/core/User.js CHANGED
@@ -15,7 +15,6 @@ const mongoose_1 = require("@nestjs/mongoose");
15
15
  const uuid_1 = require("uuid");
16
16
  const class_validator_1 = require("class-validator");
17
17
  const folder_model_1 = require("./internal/folder.model");
18
- const manager_licenses_1 = require("./internal/manager-licenses");
19
18
  const users_list_1 = require("./internal/users-list");
20
19
  const chart_theme_1 = require("./internal/chart-theme");
21
20
  /**
@@ -273,18 +272,6 @@ __decorate([
273
272
  (0, class_validator_1.IsArray)(),
274
273
  __metadata("design:type", Array)
275
274
  ], User.prototype, "folders", void 0);
276
- __decorate([
277
- (0, swagger_1.ApiProperty)({ type: manager_licenses_1.ManagerLicenses }),
278
- (0, mongoose_1.Prop)({ type: [folder_model_1.FolderSchema] }),
279
- (0, class_validator_1.IsOptional)(),
280
- __metadata("design:type", manager_licenses_1.ManagerLicenses)
281
- ], User.prototype, "managerLicenses", void 0);
282
- __decorate([
283
- (0, swagger_1.ApiProperty)({ type: manager_licenses_1.ManagerLicenses }),
284
- (0, mongoose_1.Prop)({ type: [folder_model_1.FolderSchema] }),
285
- (0, class_validator_1.IsOptional)(),
286
- __metadata("design:type", manager_licenses_1.ManagerLicenses)
287
- ], User.prototype, "managerLicensesUsed", void 0);
288
275
  __decorate([
289
276
  (0, swagger_1.ApiProperty)({ type: Object }),
290
277
  (0, mongoose_1.Prop)({ type: [Object] }),
@@ -401,16 +388,6 @@ __decorate([
401
388
  (0, class_validator_1.IsBoolean)(),
402
389
  __metadata("design:type", Boolean)
403
390
  ], User.prototype, "isRenewalEmailSent", void 0);
404
- __decorate([
405
- (0, swagger_1.ApiProperty)({
406
- description: 'Rôle manager',
407
- example: false,
408
- }),
409
- (0, mongoose_1.Prop)({ type: Boolean, default: false }),
410
- (0, class_validator_1.IsOptional)(),
411
- (0, class_validator_1.IsBoolean)(),
412
- __metadata("design:type", Boolean)
413
- ], User.prototype, "isManager", void 0);
414
391
  __decorate([
415
392
  (0, swagger_1.ApiProperty)({
416
393
  description: 'Compte actif',
@@ -461,6 +438,15 @@ __decorate([
461
438
  (0, class_validator_1.IsString)(),
462
439
  __metadata("design:type", String)
463
440
  ], User.prototype, "principalUser", void 0);
441
+ __decorate([
442
+ (0, swagger_1.ApiPropertyOptional)({
443
+ description: 'Workspace (groupe principal) propriétaire — clé de cloisonnement RBAC',
444
+ }),
445
+ (0, mongoose_1.Prop)({ type: String, index: true }),
446
+ (0, class_validator_1.IsOptional)(),
447
+ (0, class_validator_1.IsString)(),
448
+ __metadata("design:type", String)
449
+ ], User.prototype, "workspaceId", void 0);
464
450
  __decorate([
465
451
  (0, swagger_1.ApiProperty)({
466
452
  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.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {