@grapadigital/shared-schemas 1.0.215 → 1.0.217

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.
@@ -27,6 +27,12 @@ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
27
  import { Party } from './party.schema';
28
28
  import { Profile } from './profile.schema';
29
29
  export type ClientDocument = HydratedDocument<Client>;
30
+ /**
31
+ * Personalizações de cliente: ligam telas e regras que valem só para ele.
32
+ * Ver GD-683.
33
+ */
34
+ export declare const CLIENT_CUSTOMIZATION_VALUES: readonly ["samsung"];
35
+ export type ClientCustomization = (typeof CLIENT_CUSTOMIZATION_VALUES)[number];
30
36
  export declare class Cluster {
31
37
  key: string;
32
38
  label: string;
@@ -132,6 +138,13 @@ export declare class Client extends Party {
132
138
  * (Antigo `hasReport`.)
133
139
  */
134
140
  hasGenIAAnalysis: boolean;
141
+ /**
142
+ * Personalização do cliente (ex.: `samsung`): liga as telas e regras
143
+ * específicas dele no Flow e no Hub. Ausente ou `null` = comportamento
144
+ * padrão. Nunca comparar id de cliente no código, sempre este campo.
145
+ * Ver GD-683.
146
+ */
147
+ customization?: ClientCustomization | null;
135
148
  /**
136
149
  * Client de organização (ex.: "Oma Creators"): representa a organização
137
150
  * inteira, não uma marca. No hub, mostra todas as actions dessa organização
@@ -9,11 +9,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ClientModel = exports.ClientSchema = exports.Client = exports.ClientResponsibleSchema = exports.ClientResponsible = exports.NicheItemSchema = exports.NicheItem = exports.AgencyCommissionPeriodSchema = exports.AgencyCommissionPeriod = exports.CommissionRangeSchema = exports.CommissionRange = exports.CompanySchema = exports.Company = exports.ClusterSchema = exports.Cluster = void 0;
12
+ exports.ClientModel = exports.ClientSchema = exports.Client = exports.ClientResponsibleSchema = exports.ClientResponsible = exports.NicheItemSchema = exports.NicheItem = exports.AgencyCommissionPeriodSchema = exports.AgencyCommissionPeriod = exports.CommissionRangeSchema = exports.CommissionRange = exports.CompanySchema = exports.Company = exports.ClusterSchema = exports.Cluster = exports.CLIENT_CUSTOMIZATION_VALUES = void 0;
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const swagger_1 = require("@nestjs/swagger");
15
15
  const mongoose_2 = require("mongoose");
16
16
  const party_schema_1 = require("./party.schema");
17
+ /**
18
+ * Personalizações de cliente: ligam telas e regras que valem só para ele.
19
+ * Ver GD-683.
20
+ */
21
+ exports.CLIENT_CUSTOMIZATION_VALUES = ['samsung'];
17
22
  let Cluster = class Cluster {
18
23
  };
19
24
  __decorate([
@@ -169,6 +174,10 @@ __decorate([
169
174
  (0, mongoose_1.Prop)({ type: Boolean, default: false }),
170
175
  __metadata("design:type", Boolean)
171
176
  ], Client.prototype, "hasGenIAAnalysis", void 0);
177
+ __decorate([
178
+ (0, mongoose_1.Prop)({ type: String, enum: exports.CLIENT_CUSTOMIZATION_VALUES, required: false, default: null }),
179
+ __metadata("design:type", Object)
180
+ ], Client.prototype, "customization", void 0);
172
181
  __decorate([
173
182
  (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: 'Organization', required: false }),
174
183
  __metadata("design:type", mongoose_2.Types.ObjectId)
@@ -34,12 +34,13 @@ export declare class Commission {
34
34
  role: 'origination' | 'commercial' | 'planning' | 'curation';
35
35
  value: number;
36
36
  percentage: number;
37
- status: 'pending' | 'approved' | 'ready' | 'paid' | 'cancelled' | 'disputed' | 'reproved';
37
+ status: 'pending' | 'approved' | 'ready' | 'received' | 'paid' | 'cancelled' | 'disputed' | 'reproved';
38
38
  type: 'collaborator' | 'agency' | 'bonus';
39
39
  sale: Types.ObjectId | Sale;
40
40
  paidAt?: Date;
41
41
  approvedAt?: Date;
42
42
  readyAt?: Date;
43
+ receivedAt?: Date;
43
44
  paymentDate?: Date;
44
45
  approvedBy?: {
45
46
  _id: string;
@@ -50,7 +50,7 @@ __decorate([
50
50
  __decorate([
51
51
  (0, mongoose_1.Prop)({
52
52
  type: String,
53
- enum: ['pending', 'approved', 'ready', 'paid', 'cancelled', 'disputed', 'reproved'],
53
+ enum: ['pending', 'approved', 'ready', 'received', 'paid', 'cancelled', 'disputed', 'reproved'],
54
54
  default: 'pending',
55
55
  required: true,
56
56
  }),
@@ -80,6 +80,10 @@ __decorate([
80
80
  (0, mongoose_1.Prop)({ type: Date, required: false }),
81
81
  __metadata("design:type", Date)
82
82
  ], Commission.prototype, "readyAt", void 0);
83
+ __decorate([
84
+ (0, mongoose_1.Prop)({ type: Date, required: false }),
85
+ __metadata("design:type", Date)
86
+ ], Commission.prototype, "receivedAt", void 0);
83
87
  __decorate([
84
88
  (0, mongoose_1.Prop)({ type: Date, required: false }),
85
89
  __metadata("design:type", Date)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.215",
3
+ "version": "1.0.217",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,6 +11,13 @@ import { Profile } from './profile.schema';
11
11
 
12
12
  export type ClientDocument = HydratedDocument<Client>;
13
13
 
14
+ /**
15
+ * Personalizações de cliente: ligam telas e regras que valem só para ele.
16
+ * Ver GD-683.
17
+ */
18
+ export const CLIENT_CUSTOMIZATION_VALUES = ['samsung'] as const;
19
+ export type ClientCustomization = (typeof CLIENT_CUSTOMIZATION_VALUES)[number];
20
+
14
21
  @Schema({ _id: false })
15
22
  export class Cluster {
16
23
  @Prop({ required: true })
@@ -140,6 +147,15 @@ export class Client extends Party {
140
147
  @Prop({ type: Boolean, default: false })
141
148
  hasGenIAAnalysis: boolean;
142
149
 
150
+ /**
151
+ * Personalização do cliente (ex.: `samsung`): liga as telas e regras
152
+ * específicas dele no Flow e no Hub. Ausente ou `null` = comportamento
153
+ * padrão. Nunca comparar id de cliente no código, sempre este campo.
154
+ * Ver GD-683.
155
+ */
156
+ @Prop({ type: String, enum: CLIENT_CUSTOMIZATION_VALUES, required: false, default: null })
157
+ customization?: ClientCustomization | null;
158
+
143
159
  /**
144
160
  * Client de organização (ex.: "Oma Creators"): representa a organização
145
161
  * inteira, não uma marca. No hub, mostra todas as actions dessa organização
@@ -41,11 +41,11 @@ export class Commission {
41
41
 
42
42
  @Prop({
43
43
  type: String,
44
- enum: ['pending', 'approved', 'ready', 'paid', 'cancelled', 'disputed', 'reproved'],
44
+ enum: ['pending', 'approved', 'ready', 'received', 'paid', 'cancelled', 'disputed', 'reproved'],
45
45
  default: 'pending',
46
46
  required: true,
47
47
  })
48
- status: 'pending' | 'approved' | 'ready' | 'paid' | 'cancelled' | 'disputed' | 'reproved';
48
+ status: 'pending' | 'approved' | 'ready' | 'received' | 'paid' | 'cancelled' | 'disputed' | 'reproved';
49
49
 
50
50
  @Prop({
51
51
  type: String,
@@ -66,6 +66,9 @@ export class Commission {
66
66
  @Prop({ type: Date, required: false })
67
67
  readyAt?: Date;
68
68
 
69
+ @Prop({ type: Date, required: false })
70
+ receivedAt?: Date;
71
+
69
72
  @Prop({ type: Date, required: false })
70
73
  paymentDate?: Date;
71
74