@grapadigital/shared-schemas 1.0.240 → 1.0.241

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/index.d.ts CHANGED
@@ -36,5 +36,7 @@ export * from './schemas/export-comments-job.schema';
36
36
  export * from './schemas/job.schema';
37
37
  export * from './schemas/snapshot.schema';
38
38
  export * from './schemas/lead.schema';
39
+ export * from './schemas/store.schema';
40
+ export * from './schemas/store-visit.schema';
39
41
  export * from './utils/normalize-content-link.util';
40
42
  export * from './utils/merge-metrics-breakdown.util';
package/dist/index.js CHANGED
@@ -57,5 +57,7 @@ __exportStar(require("./schemas/export-comments-job.schema"), exports);
57
57
  __exportStar(require("./schemas/job.schema"), exports);
58
58
  __exportStar(require("./schemas/snapshot.schema"), exports);
59
59
  __exportStar(require("./schemas/lead.schema"), exports);
60
+ __exportStar(require("./schemas/store.schema"), exports);
61
+ __exportStar(require("./schemas/store-visit.schema"), exports);
60
62
  __exportStar(require("./utils/normalize-content-link.util"), exports);
61
63
  __exportStar(require("./utils/merge-metrics-breakdown.util"), exports);
@@ -30,9 +30,9 @@ import { Responsible } from './responsible.schema';
30
30
  export type ClientDocument = HydratedDocument<Client>;
31
31
  /**
32
32
  * Personalizações de cliente: ligam telas e regras que valem só para ele.
33
- * Ver GD-683.
33
+ * Ver GD-683 (samsung) e GD-663 (shoulder).
34
34
  */
35
- export declare const CLIENT_CUSTOMIZATION_VALUES: readonly ["samsung"];
35
+ export declare const CLIENT_CUSTOMIZATION_VALUES: readonly ["samsung", "shoulder"];
36
36
  export type ClientCustomization = (typeof CLIENT_CUSTOMIZATION_VALUES)[number];
37
37
  /**
38
38
  * Catálogo de métricas que podem virar meta no Tier ou na Meta anual do
@@ -52,7 +52,10 @@ export declare class Cluster {
52
52
  export declare const ClusterSchema: MongooseSchema<Cluster, import("mongoose").Model<Cluster, any, any, any, import("mongoose").Document<unknown, any, Cluster, any, {}> & Cluster & {
53
53
  _id: Types.ObjectId;
54
54
  } & {
55
- __v: number;
55
+ __v: number; /**
56
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
57
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
58
+ */
56
59
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Cluster, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Cluster>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Cluster> & {
57
60
  _id: Types.ObjectId;
58
61
  } & {
@@ -70,7 +73,10 @@ export declare class ClientSquad {
70
73
  export declare const ClientSquadSchema: MongooseSchema<ClientSquad, import("mongoose").Model<ClientSquad, any, any, any, import("mongoose").Document<unknown, any, ClientSquad, any, {}> & ClientSquad & {
71
74
  _id: Types.ObjectId;
72
75
  } & {
73
- __v: number;
76
+ __v: number; /**
77
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
78
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
79
+ */
74
80
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ClientSquad, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ClientSquad>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ClientSquad> & {
75
81
  _id: Types.ObjectId;
76
82
  } & {
@@ -83,7 +89,10 @@ export declare class Company {
83
89
  export declare const CompanySchema: MongooseSchema<Company, import("mongoose").Model<Company, any, any, any, import("mongoose").Document<unknown, any, Company, any, {}> & Company & {
84
90
  _id: Types.ObjectId;
85
91
  } & {
86
- __v: number;
92
+ __v: number; /**
93
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
94
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
95
+ */
87
96
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Company, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Company>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Company> & {
88
97
  _id: Types.ObjectId;
89
98
  } & {
@@ -97,7 +106,10 @@ export declare class CommissionRange {
97
106
  export declare const CommissionRangeSchema: MongooseSchema<CommissionRange, import("mongoose").Model<CommissionRange, any, any, any, import("mongoose").Document<unknown, any, CommissionRange, any, {}> & CommissionRange & {
98
107
  _id: Types.ObjectId;
99
108
  } & {
100
- __v: number;
109
+ __v: number; /**
110
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
111
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
112
+ */
101
113
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, CommissionRange, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<CommissionRange>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<CommissionRange> & {
102
114
  _id: Types.ObjectId;
103
115
  } & {
@@ -111,7 +123,10 @@ export declare class ClientMetricGoal {
111
123
  export declare const ClientMetricGoalSchema: MongooseSchema<ClientMetricGoal, import("mongoose").Model<ClientMetricGoal, any, any, any, import("mongoose").Document<unknown, any, ClientMetricGoal, any, {}> & ClientMetricGoal & {
112
124
  _id: Types.ObjectId;
113
125
  } & {
114
- __v: number;
126
+ __v: number; /**
127
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
128
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
129
+ */
115
130
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ClientMetricGoal, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ClientMetricGoal>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ClientMetricGoal> & {
116
131
  _id: Types.ObjectId;
117
132
  } & {
@@ -133,7 +148,10 @@ export declare class ClientTier {
133
148
  export declare const ClientTierSchema: MongooseSchema<ClientTier, import("mongoose").Model<ClientTier, any, any, any, import("mongoose").Document<unknown, any, ClientTier, any, {}> & ClientTier & {
134
149
  _id: Types.ObjectId;
135
150
  } & {
136
- __v: number;
151
+ __v: number; /**
152
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
153
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
154
+ */
137
155
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ClientTier, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ClientTier>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ClientTier> & {
138
156
  _id: Types.ObjectId;
139
157
  } & {
@@ -147,7 +165,10 @@ export declare class ClientAnnualGoal {
147
165
  export declare const ClientAnnualGoalSchema: MongooseSchema<ClientAnnualGoal, import("mongoose").Model<ClientAnnualGoal, any, any, any, import("mongoose").Document<unknown, any, ClientAnnualGoal, any, {}> & ClientAnnualGoal & {
148
166
  _id: Types.ObjectId;
149
167
  } & {
150
- __v: number;
168
+ __v: number; /**
169
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
170
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
171
+ */
151
172
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ClientAnnualGoal, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ClientAnnualGoal>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ClientAnnualGoal> & {
152
173
  _id: Types.ObjectId;
153
174
  } & {
@@ -161,7 +182,10 @@ export declare class AgencyCommissionPeriod {
161
182
  export declare const AgencyCommissionPeriodSchema: MongooseSchema<AgencyCommissionPeriod, import("mongoose").Model<AgencyCommissionPeriod, any, any, any, import("mongoose").Document<unknown, any, AgencyCommissionPeriod, any, {}> & AgencyCommissionPeriod & {
162
183
  _id: Types.ObjectId;
163
184
  } & {
164
- __v: number;
185
+ __v: number; /**
186
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
187
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
188
+ */
165
189
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, AgencyCommissionPeriod, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<AgencyCommissionPeriod>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<AgencyCommissionPeriod> & {
166
190
  _id: Types.ObjectId;
167
191
  } & {
@@ -175,7 +199,10 @@ export declare class NicheItem {
175
199
  export declare const NicheItemSchema: MongooseSchema<NicheItem, import("mongoose").Model<NicheItem, any, any, any, import("mongoose").Document<unknown, any, NicheItem, any, {}> & NicheItem & {
176
200
  _id: Types.ObjectId;
177
201
  } & {
178
- __v: number;
202
+ __v: number; /**
203
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
204
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
205
+ */
179
206
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, NicheItem, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<NicheItem>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<NicheItem> & {
180
207
  _id: Types.ObjectId;
181
208
  } & {
@@ -192,7 +219,10 @@ export declare class ClientResponsible {
192
219
  export declare const ClientResponsibleSchema: MongooseSchema<ClientResponsible, import("mongoose").Model<ClientResponsible, any, any, any, import("mongoose").Document<unknown, any, ClientResponsible, any, {}> & ClientResponsible & {
193
220
  _id: Types.ObjectId;
194
221
  } & {
195
- __v: number;
222
+ __v: number; /**
223
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
224
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
225
+ */
196
226
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ClientResponsible, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<ClientResponsible>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ClientResponsible> & {
197
227
  _id: Types.ObjectId;
198
228
  } & {
@@ -248,7 +278,10 @@ export declare class Client extends Party {
248
278
  export declare const ClientSchema: MongooseSchema<Client, import("mongoose").Model<Client, any, any, any, import("mongoose").Document<unknown, any, Client, any, {}> & Client & Required<{
249
279
  _id: Types.ObjectId;
250
280
  }> & {
251
- __v: number;
281
+ __v: number; /**
282
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
283
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
284
+ */
252
285
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Client, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Client>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Client> & Required<{
253
286
  _id: Types.ObjectId;
254
287
  }> & {
@@ -261,7 +294,10 @@ export declare const ClientModel: import("mongoose").Model<Client, {}, {}, {}, i
261
294
  }, MongooseSchema<Client, import("mongoose").Model<Client, any, any, any, import("mongoose").Document<unknown, any, Client, any, {}> & Client & Required<{
262
295
  _id: Types.ObjectId;
263
296
  }> & {
264
- __v: number;
297
+ __v: number; /**
298
+ * Responsáveis do cliente: `report` são usuários da plataforma que cuidam dos
299
+ * relatórios; `brand` é o contato do lado da marca (texto livre, não é usuário).
300
+ */
265
301
  }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Client, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Client>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Client> & Required<{
266
302
  _id: Types.ObjectId;
267
303
  }> & {
@@ -17,9 +17,9 @@ const party_schema_1 = require("./party.schema");
17
17
  const responsible_schema_1 = require("./responsible.schema");
18
18
  /**
19
19
  * Personalizações de cliente: ligam telas e regras que valem só para ele.
20
- * Ver GD-683.
20
+ * Ver GD-683 (samsung) e GD-663 (shoulder).
21
21
  */
22
- exports.CLIENT_CUSTOMIZATION_VALUES = ['samsung'];
22
+ exports.CLIENT_CUSTOMIZATION_VALUES = ['samsung', 'shoulder'];
23
23
  /**
24
24
  * Catálogo de métricas que podem virar meta no Tier ou na Meta anual do
25
25
  * cliente. Quem cadastra escolhe a métrica e o valor; nada fica fixo.
@@ -0,0 +1,51 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { Schema as MongooseSchema, Types } from 'mongoose';
27
+ import { Store } from './store.schema';
28
+ export declare const STORE_VISIT_STATUS_VALUES: readonly ["awaiting_confirmation", "confirmed", "awaiting_approval", "approved", "done", "finished"];
29
+ export type StoreVisitStatus = (typeof STORE_VISIT_STATUS_VALUES)[number];
30
+ export declare const STORE_VISIT_PERIOD_VALUES: readonly ["morning", "afternoon", "night"];
31
+ export type StoreVisitPeriod = (typeof STORE_VISIT_PERIOD_VALUES)[number];
32
+ export declare class StoreVisitData {
33
+ store: Types.ObjectId | Store;
34
+ scheduledDate: Date;
35
+ scheduledPeriod?: StoreVisitPeriod | null;
36
+ token: string;
37
+ rulesAccepted: boolean;
38
+ acceptedAt?: Date | null;
39
+ tagPhotos: string[];
40
+ lookPhotos: string[];
41
+ reviewNotes?: string | null;
42
+ }
43
+ export declare const StoreVisitDataSchema: MongooseSchema<StoreVisitData, import("mongoose").Model<StoreVisitData, any, any, any, import("mongoose").Document<unknown, any, StoreVisitData, any, {}> & StoreVisitData & {
44
+ _id: Types.ObjectId;
45
+ } & {
46
+ __v: number;
47
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, StoreVisitData, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<StoreVisitData>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<StoreVisitData> & {
48
+ _id: Types.ObjectId;
49
+ } & {
50
+ __v: number;
51
+ }>;
@@ -0,0 +1,85 @@
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.StoreVisitDataSchema = exports.StoreVisitData = exports.STORE_VISIT_PERIOD_VALUES = exports.STORE_VISIT_STATUS_VALUES = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const mongoose_2 = require("mongoose");
16
+ const store_schema_1 = require("./store.schema");
17
+ exports.STORE_VISIT_STATUS_VALUES = [
18
+ 'awaiting_confirmation',
19
+ 'confirmed',
20
+ 'awaiting_approval',
21
+ 'approved',
22
+ 'done',
23
+ 'finished', // Processo encerrado e notificação emitida
24
+ ];
25
+ exports.STORE_VISIT_PERIOD_VALUES = [
26
+ 'morning',
27
+ 'afternoon',
28
+ 'night',
29
+ ];
30
+ let StoreVisitData = class StoreVisitData {
31
+ };
32
+ __decorate([
33
+ (0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345684', description: 'Loja física agendada' }),
34
+ (0, mongoose_1.Prop)({
35
+ type: mongoose_2.Schema.Types.ObjectId,
36
+ ref: store_schema_1.Store.name,
37
+ required: true,
38
+ }),
39
+ __metadata("design:type", Object)
40
+ ], StoreVisitData.prototype, "store", void 0);
41
+ __decorate([
42
+ (0, swagger_1.ApiProperty)({ example: '2026-11-15T00:00:00.000Z', description: 'Data da visita agendada pelo time' }),
43
+ (0, mongoose_1.Prop)({ type: Date, required: true }),
44
+ __metadata("design:type", Date)
45
+ ], StoreVisitData.prototype, "scheduledDate", void 0);
46
+ __decorate([
47
+ (0, swagger_1.ApiProperty)({ example: 'afternoon', enum: exports.STORE_VISIT_PERIOD_VALUES, required: false, nullable: true }),
48
+ (0, mongoose_1.Prop)({ type: String, enum: exports.STORE_VISIT_PERIOD_VALUES, required: false, default: null }),
49
+ __metadata("design:type", Object)
50
+ ], StoreVisitData.prototype, "scheduledPeriod", void 0);
51
+ __decorate([
52
+ (0, swagger_1.ApiProperty)({ example: 'abcdef123456...', description: 'Token de 32 bytes base64url' }),
53
+ (0, mongoose_1.Prop)({ type: String, required: true }),
54
+ __metadata("design:type", String)
55
+ ], StoreVisitData.prototype, "token", void 0);
56
+ __decorate([
57
+ (0, swagger_1.ApiProperty)({ example: false, default: false }),
58
+ (0, mongoose_1.Prop)({ type: Boolean, default: false }),
59
+ __metadata("design:type", Boolean)
60
+ ], StoreVisitData.prototype, "rulesAccepted", void 0);
61
+ __decorate([
62
+ (0, swagger_1.ApiProperty)({ example: null, required: false, nullable: true }),
63
+ (0, mongoose_1.Prop)({ type: Date, required: false, default: null }),
64
+ __metadata("design:type", Object)
65
+ ], StoreVisitData.prototype, "acceptedAt", void 0);
66
+ __decorate([
67
+ (0, swagger_1.ApiProperty)({ type: [String], example: [] }),
68
+ (0, mongoose_1.Prop)({ type: [String], default: [] }),
69
+ __metadata("design:type", Array)
70
+ ], StoreVisitData.prototype, "tagPhotos", void 0);
71
+ __decorate([
72
+ (0, swagger_1.ApiProperty)({ type: [String], example: [] }),
73
+ (0, mongoose_1.Prop)({ type: [String], default: [] }),
74
+ __metadata("design:type", Array)
75
+ ], StoreVisitData.prototype, "lookPhotos", void 0);
76
+ __decorate([
77
+ (0, swagger_1.ApiProperty)({ example: null, required: false, nullable: true }),
78
+ (0, mongoose_1.Prop)({ type: String, required: false, default: null }),
79
+ __metadata("design:type", Object)
80
+ ], StoreVisitData.prototype, "reviewNotes", void 0);
81
+ StoreVisitData = __decorate([
82
+ (0, mongoose_1.Schema)({ _id: false })
83
+ ], StoreVisitData);
84
+ exports.StoreVisitData = StoreVisitData;
85
+ exports.StoreVisitDataSchema = mongoose_1.SchemaFactory.createForClass(StoreVisitData);
@@ -0,0 +1,61 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/session" />
19
+ /// <reference types="mongoose/types/types" />
20
+ /// <reference types="mongoose/types/utility" />
21
+ /// <reference types="mongoose/types/validation" />
22
+ /// <reference types="mongoose/types/virtuals" />
23
+ /// <reference types="mongoose/types/schematypes" />
24
+ /// <reference types="mongoose/types/inferschematype" />
25
+ /// <reference types="mongoose/types/inferrawdoctype" />
26
+ import { HydratedDocument, Schema as MongooseSchema, Types } from 'mongoose';
27
+ import { Address } from './party.schema';
28
+ import { Client } from './client.schema';
29
+ export type StoreDocument = HydratedDocument<Store>;
30
+ export declare class Store {
31
+ _id?: Types.ObjectId;
32
+ client: Types.ObjectId | Client;
33
+ name: string;
34
+ shopping?: string;
35
+ address?: Address;
36
+ active: boolean;
37
+ createdAt?: Date;
38
+ updatedAt?: Date;
39
+ }
40
+ export declare const StoreSchema: MongooseSchema<Store, import("mongoose").Model<Store, any, any, any, import("mongoose").Document<unknown, any, Store, any, {}> & Store & Required<{
41
+ _id: Types.ObjectId;
42
+ }> & {
43
+ __v: number;
44
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Store, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Store>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Store> & Required<{
45
+ _id: Types.ObjectId;
46
+ }> & {
47
+ __v: number;
48
+ }>;
49
+ export declare const StoreModel: import("mongoose").Model<Store, {}, {}, {}, import("mongoose").Document<unknown, {}, Store, {}, import("mongoose").DefaultSchemaOptions> & Store & Required<{
50
+ _id: Types.ObjectId;
51
+ }> & {
52
+ __v: number;
53
+ }, MongooseSchema<Store, import("mongoose").Model<Store, any, any, any, import("mongoose").Document<unknown, any, Store, any, {}> & Store & Required<{
54
+ _id: Types.ObjectId;
55
+ }> & {
56
+ __v: number;
57
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, Store, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<Store>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<Store> & Required<{
58
+ _id: Types.ObjectId;
59
+ }> & {
60
+ __v: number;
61
+ }>>;
@@ -0,0 +1,61 @@
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.StoreModel = exports.StoreSchema = exports.Store = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const swagger_1 = require("@nestjs/swagger");
15
+ const mongoose_2 = require("mongoose");
16
+ const party_schema_1 = require("./party.schema");
17
+ const client_schema_1 = require("./client.schema");
18
+ let Store = class Store {
19
+ };
20
+ __decorate([
21
+ (0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345670', required: false }),
22
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
23
+ __metadata("design:type", mongoose_2.Types.ObjectId)
24
+ ], Store.prototype, "_id", void 0);
25
+ __decorate([
26
+ (0, swagger_1.ApiProperty)({ example: '64bfc3a78d3f1e2a12345682' }),
27
+ (0, mongoose_1.Prop)({
28
+ type: mongoose_2.Schema.Types.ObjectId,
29
+ ref: client_schema_1.Client.name,
30
+ required: true,
31
+ index: true,
32
+ }),
33
+ __metadata("design:type", Object)
34
+ ], Store.prototype, "client", void 0);
35
+ __decorate([
36
+ (0, swagger_1.ApiProperty)({ example: 'Shoulder Shopping Morumbi' }),
37
+ (0, mongoose_1.Prop)({ type: String, required: true, trim: true }),
38
+ __metadata("design:type", String)
39
+ ], Store.prototype, "name", void 0);
40
+ __decorate([
41
+ (0, swagger_1.ApiProperty)({ example: 'Morumbi Shopping', required: false }),
42
+ (0, mongoose_1.Prop)({ type: String, required: false, trim: true }),
43
+ __metadata("design:type", String)
44
+ ], Store.prototype, "shopping", void 0);
45
+ __decorate([
46
+ (0, swagger_1.ApiProperty)({ required: false }),
47
+ (0, mongoose_1.Prop)({ type: party_schema_1.AddressSchema, required: false }),
48
+ __metadata("design:type", party_schema_1.Address)
49
+ ], Store.prototype, "address", void 0);
50
+ __decorate([
51
+ (0, swagger_1.ApiProperty)({ example: true, default: true }),
52
+ (0, mongoose_1.Prop)({ type: Boolean, default: true }),
53
+ __metadata("design:type", Boolean)
54
+ ], Store.prototype, "active", void 0);
55
+ Store = __decorate([
56
+ (0, mongoose_1.Schema)({ timestamps: true, collection: 'stores' })
57
+ ], Store);
58
+ exports.Store = Store;
59
+ exports.StoreSchema = mongoose_1.SchemaFactory.createForClass(Store);
60
+ exports.StoreSchema.index({ client: 1, name: 1 });
61
+ exports.StoreModel = (0, mongoose_2.model)('Store', exports.StoreSchema);
@@ -30,13 +30,14 @@ import { Content } from './content.schema';
30
30
  import { Influencer } from './influencer.schema';
31
31
  import { Profile } from './profile.schema';
32
32
  import { Recruitment } from './recruitment.schema';
33
+ import { StoreVisitData } from './store-visit.schema';
33
34
  export type TaskDocument = HydratedDocument<Task>;
34
35
  export declare const TASK_FORMAT_VALUES: readonly ["reel", "image", "carousel", "story", "tiktok", "youtube", "linkedin", "pinterest"];
35
36
  export type TaskFormat = (typeof TASK_FORMAT_VALUES)[number];
36
- export declare const TASK_TYPE_VALUES: readonly ["briefing", "script", "production", "posting", "analytics", "diagnosis"];
37
+ export declare const TASK_TYPE_VALUES: readonly ["briefing", "script", "production", "posting", "analytics", "diagnosis", "store_visit"];
37
38
  export type TaskType = (typeof TASK_TYPE_VALUES)[number];
38
39
  export declare const TASK_STATUS_BY_TYPE: Record<TaskType, string[]>;
39
- export type TaskStatus = 'awaiting' | 'pending' | 'late' | 'done' | 'cancelled' | 'approval' | 'rework';
40
+ export type TaskStatus = 'awaiting' | 'pending' | 'late' | 'done' | 'cancelled' | 'approval' | 'rework' | 'awaiting_confirmation' | 'confirmed' | 'awaiting_approval' | 'approved' | 'finished';
40
41
  export declare const TASK_STATUS_VALUES: TaskStatus[];
41
42
  export declare class Task {
42
43
  _id?: Types.ObjectId;
@@ -58,6 +59,7 @@ export declare class Task {
58
59
  observation?: string;
59
60
  organization: Types.ObjectId;
60
61
  businessUnit?: ActionBusinessUnit;
62
+ storeVisit?: StoreVisitData;
61
63
  }
62
64
  export declare const TaskSchema: MongooseSchema<Task, import("mongoose").Model<Task, any, any, any, import("mongoose").Document<unknown, any, Task, any, {}> & Task & Required<{
63
65
  _id: Types.ObjectId;
@@ -14,6 +14,7 @@ const mongoose_1 = require("@nestjs/mongoose");
14
14
  const swagger_1 = require("@nestjs/swagger");
15
15
  const mongoose_2 = require("mongoose");
16
16
  const action_schema_1 = require("./action.schema");
17
+ const store_visit_schema_1 = require("./store-visit.schema");
17
18
  exports.TASK_FORMAT_VALUES = [
18
19
  'reel',
19
20
  'image',
@@ -31,6 +32,7 @@ exports.TASK_TYPE_VALUES = [
31
32
  'posting',
32
33
  'analytics',
33
34
  'diagnosis',
35
+ 'store_visit',
34
36
  ];
35
37
  exports.TASK_STATUS_BY_TYPE = {
36
38
  briefing: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
@@ -39,6 +41,14 @@ exports.TASK_STATUS_BY_TYPE = {
39
41
  posting: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
40
42
  analytics: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
41
43
  diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
44
+ store_visit: [
45
+ 'awaiting_confirmation',
46
+ 'confirmed',
47
+ 'awaiting_approval',
48
+ 'approved',
49
+ 'finished',
50
+ 'cancelled',
51
+ ],
42
52
  };
43
53
  exports.TASK_STATUS_VALUES = [
44
54
  'awaiting',
@@ -48,6 +58,11 @@ exports.TASK_STATUS_VALUES = [
48
58
  'rework',
49
59
  'done',
50
60
  'cancelled',
61
+ 'awaiting_confirmation',
62
+ 'confirmed',
63
+ 'awaiting_approval',
64
+ 'approved',
65
+ 'finished',
51
66
  ];
52
67
  let Task = class Task {
53
68
  };
@@ -92,7 +107,7 @@ __decorate([
92
107
  type: String,
93
108
  enum: exports.TASK_FORMAT_VALUES,
94
109
  required: function () {
95
- return this.type !== 'diagnosis';
110
+ return this.type !== 'diagnosis' && this.type !== 'store_visit';
96
111
  },
97
112
  }),
98
113
  __metadata("design:type", String)
@@ -160,6 +175,11 @@ __decorate([
160
175
  (0, mongoose_1.Prop)({ type: String, enum: action_schema_1.ACTION_BUSINESS_UNIT_VALUES, required: false }),
161
176
  __metadata("design:type", String)
162
177
  ], Task.prototype, "businessUnit", void 0);
178
+ __decorate([
179
+ (0, swagger_1.ApiProperty)({ type: () => store_visit_schema_1.StoreVisitData, required: false }),
180
+ (0, mongoose_1.Prop)({ type: store_visit_schema_1.StoreVisitDataSchema, required: false }),
181
+ __metadata("design:type", store_visit_schema_1.StoreVisitData)
182
+ ], Task.prototype, "storeVisit", void 0);
163
183
  Task = __decorate([
164
184
  (0, mongoose_1.Schema)({ timestamps: true })
165
185
  ], Task);
@@ -174,4 +194,6 @@ exports.TaskSchema.index({ client: 1, dueDate: 1 });
174
194
  exports.TaskSchema.index({ influencer: 1, dueDate: 1 });
175
195
  exports.TaskSchema.index({ organization: 1 });
176
196
  exports.TaskSchema.index({ businessUnit: 1 });
197
+ exports.TaskSchema.index({ 'storeVisit.token': 1 }, { unique: true, sparse: true });
198
+ exports.TaskSchema.index({ 'storeVisit.store': 1 }, { sparse: true });
177
199
  exports.TaskModel = (0, mongoose_2.model)('Task', exports.TaskSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grapadigital/shared-schemas",
3
- "version": "1.0.240",
3
+ "version": "1.0.241",
4
4
  "description": "Shared Mongoose Schemas",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -36,5 +36,7 @@ export * from './schemas/export-comments-job.schema';
36
36
  export * from './schemas/job.schema';
37
37
  export * from './schemas/snapshot.schema';
38
38
  export * from './schemas/lead.schema';
39
+ export * from './schemas/store.schema';
40
+ export * from './schemas/store-visit.schema';
39
41
  export * from './utils/normalize-content-link.util';
40
42
  export * from './utils/merge-metrics-breakdown.util';
@@ -14,9 +14,9 @@ export type ClientDocument = HydratedDocument<Client>;
14
14
 
15
15
  /**
16
16
  * Personalizações de cliente: ligam telas e regras que valem só para ele.
17
- * Ver GD-683.
17
+ * Ver GD-683 (samsung) e GD-663 (shoulder).
18
18
  */
19
- export const CLIENT_CUSTOMIZATION_VALUES = ['samsung'] as const;
19
+ export const CLIENT_CUSTOMIZATION_VALUES = ['samsung', 'shoulder'] as const;
20
20
  export type ClientCustomization = (typeof CLIENT_CUSTOMIZATION_VALUES)[number];
21
21
 
22
22
  /**
@@ -0,0 +1,68 @@
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+ import { Schema as MongooseSchema, Types } from 'mongoose';
4
+ import { Store } from './store.schema';
5
+
6
+ export const STORE_VISIT_STATUS_VALUES = [
7
+ 'awaiting_confirmation', // Cadastrada pelo time, aguardando influenciadora confirmar horário e aceitar regras
8
+ 'confirmed', // Influenciadora confirmou horário e aceite registrado
9
+ 'awaiting_approval', // Fotos de looks e etiquetas submetidas para aprovação
10
+ 'approved', // Looks e etiquetas aprovados pelo time
11
+ 'done', // Visita realizada em loja
12
+ 'finished', // Processo encerrado e notificação emitida
13
+ ] as const;
14
+
15
+ export type StoreVisitStatus = (typeof STORE_VISIT_STATUS_VALUES)[number];
16
+
17
+ export const STORE_VISIT_PERIOD_VALUES = [
18
+ 'morning',
19
+ 'afternoon',
20
+ 'night',
21
+ ] as const;
22
+
23
+ export type StoreVisitPeriod = (typeof STORE_VISIT_PERIOD_VALUES)[number];
24
+
25
+ @Schema({ _id: false })
26
+ export class StoreVisitData {
27
+ @ApiProperty({ example: '64bfc3a78d3f1e2a12345684', description: 'Loja física agendada' })
28
+ @Prop({
29
+ type: MongooseSchema.Types.ObjectId,
30
+ ref: Store.name,
31
+ required: true,
32
+ })
33
+ store: Types.ObjectId | Store;
34
+
35
+ @ApiProperty({ example: '2026-11-15T00:00:00.000Z', description: 'Data da visita agendada pelo time' })
36
+ @Prop({ type: Date, required: true })
37
+ scheduledDate: Date;
38
+
39
+ @ApiProperty({ example: 'afternoon', enum: STORE_VISIT_PERIOD_VALUES, required: false, nullable: true })
40
+ @Prop({ type: String, enum: STORE_VISIT_PERIOD_VALUES, required: false, default: null })
41
+ scheduledPeriod?: StoreVisitPeriod | null;
42
+
43
+ @ApiProperty({ example: 'abcdef123456...', description: 'Token de 32 bytes base64url' })
44
+ @Prop({ type: String, required: true })
45
+ token: string;
46
+
47
+ @ApiProperty({ example: false, default: false })
48
+ @Prop({ type: Boolean, default: false })
49
+ rulesAccepted: boolean;
50
+
51
+ @ApiProperty({ example: null, required: false, nullable: true })
52
+ @Prop({ type: Date, required: false, default: null })
53
+ acceptedAt?: Date | null;
54
+
55
+ @ApiProperty({ type: [String], example: [] })
56
+ @Prop({ type: [String], default: [] })
57
+ tagPhotos: string[];
58
+
59
+ @ApiProperty({ type: [String], example: [] })
60
+ @Prop({ type: [String], default: [] })
61
+ lookPhotos: string[];
62
+
63
+ @ApiProperty({ example: null, required: false, nullable: true })
64
+ @Prop({ type: String, required: false, default: null })
65
+ reviewNotes?: string | null;
66
+ }
67
+
68
+ export const StoreVisitDataSchema = SchemaFactory.createForClass(StoreVisitData);
@@ -0,0 +1,52 @@
1
+ import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
2
+ import { ApiProperty } from '@nestjs/swagger';
3
+ import {
4
+ HydratedDocument,
5
+ Schema as MongooseSchema,
6
+ Types,
7
+ model as MongooseModel,
8
+ } from 'mongoose';
9
+ import { Address, AddressSchema } from './party.schema';
10
+ import { Client } from './client.schema';
11
+
12
+ export type StoreDocument = HydratedDocument<Store>;
13
+
14
+ @Schema({ timestamps: true, collection: 'stores' })
15
+ export class Store {
16
+ @ApiProperty({ example: '64bfc3a78d3f1e2a12345670', required: false })
17
+ @Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
18
+ _id?: Types.ObjectId;
19
+
20
+ @ApiProperty({ example: '64bfc3a78d3f1e2a12345682' })
21
+ @Prop({
22
+ type: MongooseSchema.Types.ObjectId,
23
+ ref: Client.name,
24
+ required: true,
25
+ index: true,
26
+ })
27
+ client: Types.ObjectId | Client;
28
+
29
+ @ApiProperty({ example: 'Shoulder Shopping Morumbi' })
30
+ @Prop({ type: String, required: true, trim: true })
31
+ name: string;
32
+
33
+ @ApiProperty({ example: 'Morumbi Shopping', required: false })
34
+ @Prop({ type: String, required: false, trim: true })
35
+ shopping?: string;
36
+
37
+ @ApiProperty({ required: false })
38
+ @Prop({ type: AddressSchema, required: false })
39
+ address?: Address;
40
+
41
+ @ApiProperty({ example: true, default: true })
42
+ @Prop({ type: Boolean, default: true })
43
+ active: boolean;
44
+
45
+ createdAt?: Date;
46
+ updatedAt?: Date;
47
+ }
48
+
49
+ export const StoreSchema = SchemaFactory.createForClass(Store);
50
+ StoreSchema.index({ client: 1, name: 1 });
51
+
52
+ export const StoreModel = MongooseModel('Store', StoreSchema);
@@ -18,6 +18,7 @@ import { Content } from './content.schema';
18
18
  import { Influencer } from './influencer.schema';
19
19
  import { Profile } from './profile.schema';
20
20
  import { Recruitment } from './recruitment.schema';
21
+ import { StoreVisitData, StoreVisitDataSchema } from './store-visit.schema';
21
22
 
22
23
  export type TaskDocument = HydratedDocument<Task>;
23
24
 
@@ -40,6 +41,7 @@ export const TASK_TYPE_VALUES = [
40
41
  'posting',
41
42
  'analytics',
42
43
  'diagnosis',
44
+ 'store_visit',
43
45
  ] as const;
44
46
  export type TaskType = (typeof TASK_TYPE_VALUES)[number];
45
47
 
@@ -50,9 +52,29 @@ export const TASK_STATUS_BY_TYPE: Record<TaskType, string[]> = {
50
52
  posting: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
51
53
  analytics: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
52
54
  diagnosis: ['awaiting', 'pending', 'late', 'done', 'cancelled'],
55
+ store_visit: [
56
+ 'awaiting_confirmation',
57
+ 'confirmed',
58
+ 'awaiting_approval',
59
+ 'approved',
60
+ 'finished',
61
+ 'cancelled',
62
+ ],
53
63
  };
54
64
 
55
- export type TaskStatus = 'awaiting' | 'pending' | 'late' | 'done' | 'cancelled' | 'approval' | 'rework';
65
+ export type TaskStatus =
66
+ | 'awaiting'
67
+ | 'pending'
68
+ | 'late'
69
+ | 'done'
70
+ | 'cancelled'
71
+ | 'approval'
72
+ | 'rework'
73
+ | 'awaiting_confirmation'
74
+ | 'confirmed'
75
+ | 'awaiting_approval'
76
+ | 'approved'
77
+ | 'finished';
56
78
 
57
79
  export const TASK_STATUS_VALUES: TaskStatus[] = [
58
80
  'awaiting',
@@ -62,6 +84,11 @@ export const TASK_STATUS_VALUES: TaskStatus[] = [
62
84
  'rework',
63
85
  'done',
64
86
  'cancelled',
87
+ 'awaiting_confirmation',
88
+ 'confirmed',
89
+ 'awaiting_approval',
90
+ 'approved',
91
+ 'finished',
65
92
  ];
66
93
 
67
94
  @Schema({ timestamps: true })
@@ -99,7 +126,7 @@ export class Task {
99
126
  type: String,
100
127
  enum: TASK_FORMAT_VALUES,
101
128
  required: function (this: Task) {
102
- return this.type !== 'diagnosis';
129
+ return this.type !== 'diagnosis' && this.type !== 'store_visit';
103
130
  },
104
131
  })
105
132
  format?: TaskFormat;
@@ -155,6 +182,10 @@ export class Task {
155
182
  @ApiProperty({ enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
156
183
  @Prop({ type: String, enum: ACTION_BUSINESS_UNIT_VALUES, required: false })
157
184
  businessUnit?: ActionBusinessUnit;
185
+
186
+ @ApiProperty({ type: () => StoreVisitData, required: false })
187
+ @Prop({ type: StoreVisitDataSchema, required: false })
188
+ storeVisit?: StoreVisitData;
158
189
  }
159
190
 
160
191
  export const TaskSchema = SchemaFactory.createForClass(Task);
@@ -168,5 +199,7 @@ TaskSchema.index({ client: 1, dueDate: 1 });
168
199
  TaskSchema.index({ influencer: 1, dueDate: 1 });
169
200
  TaskSchema.index({ organization: 1 });
170
201
  TaskSchema.index({ businessUnit: 1 });
202
+ TaskSchema.index({ 'storeVisit.token': 1 }, { unique: true, sparse: true });
203
+ TaskSchema.index({ 'storeVisit.store': 1 }, { sparse: true });
171
204
 
172
205
  export const TaskModel = MongooseModel('Task', TaskSchema);