@likewatt/models 1.120.0 → 1.121.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/AuroraAccess.d.ts +32 -0
- package/dist/core/AuroraAccess.js +106 -0
- package/dist/core/Workspace.d.ts +3 -0
- package/dist/core/Workspace.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Document } from 'mongoose';
|
|
2
|
+
/**
|
|
3
|
+
* Forfait mensuel de crédits Aurora, un document par compte PRINCIPAL.
|
|
4
|
+
* 1 crédit = 1 nouveau project Aurora (la réouverture d'un project existant est
|
|
5
|
+
* gratuite ; designs/simulations à l'intérieur d'un project payé sont illimités).
|
|
6
|
+
*
|
|
7
|
+
* - config admin (`enabled`, `limit`) : ne touche JAMAIS `count`/`totalCount`
|
|
8
|
+
* - réservation d'un projet (`count`) : ne touche JAMAIS `enabled`/`limit`
|
|
9
|
+
* - reset mensuel : `count → 0`, `totalCount` préservé
|
|
10
|
+
*
|
|
11
|
+
* Le doc est créé PARESSEUSEMENT au 1er projet (upsert atomique côté `reserve`),
|
|
12
|
+
* avec `enabled: true` et `limit = AURORA_DEFAULT_CREDITS`. Le pool est mutualisé
|
|
13
|
+
* au niveau du compte principal (les sous-comptes y puisent).
|
|
14
|
+
*/
|
|
15
|
+
export declare class AuroraAccess {
|
|
16
|
+
_id: string;
|
|
17
|
+
principalId: string;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
limit: number;
|
|
20
|
+
count: number;
|
|
21
|
+
totalCount: number;
|
|
22
|
+
}
|
|
23
|
+
export type AuroraAccessDocument = AuroraAccess & Document;
|
|
24
|
+
export declare const AuroraAccessSchema: import("mongoose").Schema<AuroraAccess, import("mongoose").Model<AuroraAccess, any, any, any, Document<unknown, any, AuroraAccess, any, {}> & AuroraAccess & Required<{
|
|
25
|
+
_id: string;
|
|
26
|
+
}> & {
|
|
27
|
+
__v: number;
|
|
28
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, AuroraAccess, Document<unknown, {}, import("mongoose").FlatRecord<AuroraAccess>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<AuroraAccess> & Required<{
|
|
29
|
+
_id: string;
|
|
30
|
+
}> & {
|
|
31
|
+
__v: number;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,106 @@
|
|
|
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.AuroraAccessSchema = exports.AuroraAccess = void 0;
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
16
|
+
const class_validator_1 = require("class-validator");
|
|
17
|
+
/**
|
|
18
|
+
* Forfait mensuel de crédits Aurora, un document par compte PRINCIPAL.
|
|
19
|
+
* 1 crédit = 1 nouveau project Aurora (la réouverture d'un project existant est
|
|
20
|
+
* gratuite ; designs/simulations à l'intérieur d'un project payé sont illimités).
|
|
21
|
+
*
|
|
22
|
+
* - config admin (`enabled`, `limit`) : ne touche JAMAIS `count`/`totalCount`
|
|
23
|
+
* - réservation d'un projet (`count`) : ne touche JAMAIS `enabled`/`limit`
|
|
24
|
+
* - reset mensuel : `count → 0`, `totalCount` préservé
|
|
25
|
+
*
|
|
26
|
+
* Le doc est créé PARESSEUSEMENT au 1er projet (upsert atomique côté `reserve`),
|
|
27
|
+
* avec `enabled: true` et `limit = AURORA_DEFAULT_CREDITS`. Le pool est mutualisé
|
|
28
|
+
* au niveau du compte principal (les sous-comptes y puisent).
|
|
29
|
+
*/
|
|
30
|
+
let AuroraAccess = class AuroraAccess {
|
|
31
|
+
};
|
|
32
|
+
exports.AuroraAccess = AuroraAccess;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)({
|
|
35
|
+
description: '_id généré automatiquement (UUID v4)',
|
|
36
|
+
example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
|
|
37
|
+
}),
|
|
38
|
+
(0, mongoose_1.Prop)({
|
|
39
|
+
type: String,
|
|
40
|
+
required: true,
|
|
41
|
+
default: () => (0, uuid_1.v4)(),
|
|
42
|
+
}),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], AuroraAccess.prototype, "_id", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiProperty)({
|
|
47
|
+
description: 'Compte PRINCIPAL propriétaire du forfait (unique, indexé)',
|
|
48
|
+
example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
|
|
49
|
+
}),
|
|
50
|
+
(0, mongoose_1.Prop)({ type: String, required: true, unique: true, index: true }),
|
|
51
|
+
(0, class_validator_1.IsString)(),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], AuroraAccess.prototype, "principalId", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, swagger_1.ApiProperty)({
|
|
56
|
+
description: "Module activé (kill-switch ciblé). Créé à true à la 1re réservation.",
|
|
57
|
+
example: true,
|
|
58
|
+
}),
|
|
59
|
+
(0, mongoose_1.Prop)({ type: Boolean, required: true, default: true }),
|
|
60
|
+
(0, class_validator_1.IsOptional)(),
|
|
61
|
+
(0, class_validator_1.IsBoolean)(),
|
|
62
|
+
__metadata("design:type", Boolean)
|
|
63
|
+
], AuroraAccess.prototype, "enabled", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, swagger_1.ApiProperty)({
|
|
66
|
+
description: 'Crédits mensuels (nouveaux projets, surchargeable par client)',
|
|
67
|
+
example: 5,
|
|
68
|
+
}),
|
|
69
|
+
(0, mongoose_1.Prop)({ type: Number, required: true, default: 5 }),
|
|
70
|
+
(0, class_validator_1.IsOptional)(),
|
|
71
|
+
(0, class_validator_1.IsNumber)(),
|
|
72
|
+
(0, class_validator_1.Min)(0),
|
|
73
|
+
__metadata("design:type", Number)
|
|
74
|
+
], AuroraAccess.prototype, "limit", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, swagger_1.ApiProperty)({
|
|
77
|
+
description: 'Projets créés ce mois-ci (remis à 0 au reset mensuel)',
|
|
78
|
+
example: 0,
|
|
79
|
+
}),
|
|
80
|
+
(0, mongoose_1.Prop)({ type: Number, required: true, default: 0 }),
|
|
81
|
+
(0, class_validator_1.IsOptional)(),
|
|
82
|
+
(0, class_validator_1.IsNumber)(),
|
|
83
|
+
(0, class_validator_1.Min)(0),
|
|
84
|
+
__metadata("design:type", Number)
|
|
85
|
+
], AuroraAccess.prototype, "count", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, swagger_1.ApiProperty)({
|
|
88
|
+
description: 'Cumul historique de projets créés (jamais remis à 0, reporting interne)',
|
|
89
|
+
example: 0,
|
|
90
|
+
}),
|
|
91
|
+
(0, mongoose_1.Prop)({ type: Number, required: true, default: 0 }),
|
|
92
|
+
(0, class_validator_1.IsOptional)(),
|
|
93
|
+
(0, class_validator_1.IsNumber)(),
|
|
94
|
+
(0, class_validator_1.Min)(0),
|
|
95
|
+
__metadata("design:type", Number)
|
|
96
|
+
], AuroraAccess.prototype, "totalCount", void 0);
|
|
97
|
+
exports.AuroraAccess = AuroraAccess = __decorate([
|
|
98
|
+
(0, mongoose_1.Schema)({
|
|
99
|
+
id: false,
|
|
100
|
+
timestamps: true,
|
|
101
|
+
collection: 'auroraaccess',
|
|
102
|
+
toJSON: { virtuals: true, versionKey: false },
|
|
103
|
+
toObject: { virtuals: true, versionKey: false },
|
|
104
|
+
})
|
|
105
|
+
], AuroraAccess);
|
|
106
|
+
exports.AuroraAccessSchema = mongoose_1.SchemaFactory.createForClass(AuroraAccess);
|
package/dist/core/Workspace.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export declare class Workspace {
|
|
|
6
6
|
name?: string;
|
|
7
7
|
organization?: string;
|
|
8
8
|
settings?: Record<string, unknown>;
|
|
9
|
+
auroraPartnerId?: string | null;
|
|
10
|
+
auroraUserId?: string | null;
|
|
11
|
+
auroraExternalId?: string | null;
|
|
9
12
|
createdAt?: Date;
|
|
10
13
|
updatedAt?: Date;
|
|
11
14
|
}
|
package/dist/core/Workspace.js
CHANGED
|
@@ -56,6 +56,39 @@ __decorate([
|
|
|
56
56
|
(0, class_validator_1.IsObject)(),
|
|
57
57
|
__metadata("design:type", Object)
|
|
58
58
|
], Workspace.prototype, "settings", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
61
|
+
description: 'Aurora Solar — id du Partner Aurora (1:1 workspace). Provisionné paresseusement, jamais exposé au front.',
|
|
62
|
+
type: String,
|
|
63
|
+
nullable: true,
|
|
64
|
+
}),
|
|
65
|
+
(0, mongoose_1.Prop)({ type: String, default: null }),
|
|
66
|
+
(0, class_validator_1.IsOptional)(),
|
|
67
|
+
(0, class_validator_1.IsString)(),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], Workspace.prototype, "auroraPartnerId", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
72
|
+
description: 'Aurora Solar — id du user Aurora (1:1 workspace, rôle Team Member). Provisionné paresseusement, jamais exposé au front.',
|
|
73
|
+
type: String,
|
|
74
|
+
nullable: true,
|
|
75
|
+
}),
|
|
76
|
+
(0, mongoose_1.Prop)({ type: String, default: null }),
|
|
77
|
+
(0, class_validator_1.IsOptional)(),
|
|
78
|
+
(0, class_validator_1.IsString)(),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], Workspace.prototype, "auroraUserId", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
83
|
+
description: "Aurora Solar — external_provider_id == sub OIDC (source de vérité de l'identité SSO du compte). Format aurora:account:{workspaceId}.",
|
|
84
|
+
type: String,
|
|
85
|
+
nullable: true,
|
|
86
|
+
}),
|
|
87
|
+
(0, mongoose_1.Prop)({ type: String, default: null }),
|
|
88
|
+
(0, class_validator_1.IsOptional)(),
|
|
89
|
+
(0, class_validator_1.IsString)(),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], Workspace.prototype, "auroraExternalId", void 0);
|
|
59
92
|
__decorate([
|
|
60
93
|
(0, swagger_1.ApiPropertyOptional)({ type: Date, readOnly: true }),
|
|
61
94
|
__metadata("design:type", Date)
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './core/Regex';
|
|
|
16
16
|
export * from './core/InfoBanner';
|
|
17
17
|
export * from './core/KoncileOcrAccess';
|
|
18
18
|
export * from './core/ResultShare';
|
|
19
|
+
export * from './core/AuroraAccess';
|
|
19
20
|
export * from './core/TypeORM/analysis';
|
|
20
21
|
export * from './core/TypeORM/AuthAuditLog';
|
|
21
22
|
export * from './core/TypeORM/Co2History';
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __exportStar(require("./core/Regex"), exports);
|
|
|
34
34
|
__exportStar(require("./core/InfoBanner"), exports);
|
|
35
35
|
__exportStar(require("./core/KoncileOcrAccess"), exports);
|
|
36
36
|
__exportStar(require("./core/ResultShare"), exports);
|
|
37
|
+
__exportStar(require("./core/AuroraAccess"), exports);
|
|
37
38
|
// TypeORM entities
|
|
38
39
|
__exportStar(require("./core/TypeORM/analysis"), exports);
|
|
39
40
|
__exportStar(require("./core/TypeORM/AuthAuditLog"), exports);
|