@grapadigital/shared-schemas 1.0.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/README.md +0 -0
- package/dist/index.js +17 -0
- package/dist/schemas/campaign.schema.js +190 -0
- package/package.json +23 -0
- package/src/index.ts +1 -0
- package/src/schemas/campaign.schema.ts +145 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +27 -0
package/README.md
ADDED
|
File without changes
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./schemas/campaign.schema"), exports);
|
|
@@ -0,0 +1,190 @@
|
|
|
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.CampaignSchema = exports.Campaign = exports.ResponsiblesSchema = exports.Responsibles = exports.ResponsibleSchema = exports.Responsible = exports.ComercialCardSchema = exports.ComercialCard = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const mongoose_2 = require("mongoose");
|
|
15
|
+
let ComercialCard = class ComercialCard {
|
|
16
|
+
};
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, mongoose_1.Prop)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], ComercialCard.prototype, "id", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, mongoose_1.Prop)(),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], ComercialCard.prototype, "title", void 0);
|
|
25
|
+
ComercialCard = __decorate([
|
|
26
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
27
|
+
], ComercialCard);
|
|
28
|
+
exports.ComercialCard = ComercialCard;
|
|
29
|
+
exports.ComercialCardSchema = mongoose_1.SchemaFactory.createForClass(ComercialCard);
|
|
30
|
+
let Responsible = class Responsible {
|
|
31
|
+
};
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, mongoose_1.Prop)(),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], Responsible.prototype, "name", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, mongoose_1.Prop)(),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], Responsible.prototype, "team", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, mongoose_1.Prop)(),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Responsible.prototype, "email", void 0);
|
|
44
|
+
Responsible = __decorate([
|
|
45
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
46
|
+
], Responsible);
|
|
47
|
+
exports.Responsible = Responsible;
|
|
48
|
+
exports.ResponsibleSchema = mongoose_1.SchemaFactory.createForClass(Responsible);
|
|
49
|
+
let Responsibles = class Responsibles {
|
|
50
|
+
};
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, mongoose_1.Prop)({ type: exports.ResponsibleSchema }),
|
|
53
|
+
__metadata("design:type", Responsible)
|
|
54
|
+
], Responsibles.prototype, "service", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, mongoose_1.Prop)({ type: exports.ResponsibleSchema, required: false }),
|
|
57
|
+
__metadata("design:type", Responsible)
|
|
58
|
+
], Responsibles.prototype, "comercial", void 0);
|
|
59
|
+
Responsibles = __decorate([
|
|
60
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
61
|
+
], Responsibles);
|
|
62
|
+
exports.Responsibles = Responsibles;
|
|
63
|
+
exports.ResponsiblesSchema = mongoose_1.SchemaFactory.createForClass(Responsibles);
|
|
64
|
+
let Campaign = class Campaign {
|
|
65
|
+
};
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true, required: false }),
|
|
68
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
69
|
+
], Campaign.prototype, "_id", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, mongoose_1.Prop)(),
|
|
72
|
+
__metadata("design:type", String)
|
|
73
|
+
], Campaign.prototype, "title", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
76
|
+
__metadata("design:type", String)
|
|
77
|
+
], Campaign.prototype, "thumbnail", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, mongoose_1.Prop)(),
|
|
80
|
+
__metadata("design:type", Date)
|
|
81
|
+
], Campaign.prototype, "startDate", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, mongoose_1.Prop)(),
|
|
84
|
+
__metadata("design:type", Date)
|
|
85
|
+
], Campaign.prototype, "endDate", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
88
|
+
__metadata("design:type", Number)
|
|
89
|
+
], Campaign.prototype, "nps", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, mongoose_1.Prop)({
|
|
92
|
+
type: String,
|
|
93
|
+
enum: ["config", "inProgress", "paused", "finished", "archived"],
|
|
94
|
+
default: "config",
|
|
95
|
+
}),
|
|
96
|
+
__metadata("design:type", String)
|
|
97
|
+
], Campaign.prototype, "status", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, mongoose_1.Prop)({ type: String, enum: ["partner", "exclusive"] }),
|
|
100
|
+
__metadata("design:type", String)
|
|
101
|
+
], Campaign.prototype, "type", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
104
|
+
__metadata("design:type", Array)
|
|
105
|
+
], Campaign.prototype, "socialnetworks", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, mongoose_1.Prop)({ default: 0, required: false }),
|
|
108
|
+
__metadata("design:type", Number)
|
|
109
|
+
], Campaign.prototype, "recruitedInfluencers", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, mongoose_1.Prop)({ default: 0, required: false }),
|
|
112
|
+
__metadata("design:type", Number)
|
|
113
|
+
], Campaign.prototype, "hiredInfluencers", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, mongoose_1.Prop)({ default: 0, required: false }),
|
|
116
|
+
__metadata("design:type", Number)
|
|
117
|
+
], Campaign.prototype, "producedContent", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, mongoose_1.Prop)({ default: 0, required: false }),
|
|
120
|
+
__metadata("design:type", Number)
|
|
121
|
+
], Campaign.prototype, "hiredContent", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, ref: "Client" }),
|
|
124
|
+
__metadata("design:type", mongoose_2.Types.ObjectId)
|
|
125
|
+
], Campaign.prototype, "client", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, mongoose_1.Prop)([
|
|
128
|
+
{
|
|
129
|
+
type: mongoose_2.Schema.Types.ObjectId,
|
|
130
|
+
ref: "Recruitment",
|
|
131
|
+
required: false,
|
|
132
|
+
},
|
|
133
|
+
]),
|
|
134
|
+
__metadata("design:type", Array)
|
|
135
|
+
], Campaign.prototype, "recruitments", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, mongoose_1.Prop)([
|
|
138
|
+
{ type: mongoose_2.Schema.Types.ObjectId, ref: "Content", required: false },
|
|
139
|
+
]),
|
|
140
|
+
__metadata("design:type", Array)
|
|
141
|
+
], Campaign.prototype, "contents", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, mongoose_1.Prop)(),
|
|
144
|
+
__metadata("design:type", String)
|
|
145
|
+
], Campaign.prototype, "cluster", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
148
|
+
__metadata("design:type", String)
|
|
149
|
+
], Campaign.prototype, "shopping", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
152
|
+
__metadata("design:type", String)
|
|
153
|
+
], Campaign.prototype, "project", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, mongoose_1.Prop)({ type: exports.ComercialCardSchema, required: false }),
|
|
156
|
+
__metadata("design:type", ComercialCard)
|
|
157
|
+
], Campaign.prototype, "comercialCard", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, mongoose_1.Prop)({ type: exports.ResponsiblesSchema }),
|
|
160
|
+
__metadata("design:type", Responsibles)
|
|
161
|
+
], Campaign.prototype, "responsibles", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
164
|
+
__metadata("design:type", String)
|
|
165
|
+
], Campaign.prototype, "brandUsername", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
168
|
+
__metadata("design:type", String)
|
|
169
|
+
], Campaign.prototype, "hashtag", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
172
|
+
__metadata("design:type", String)
|
|
173
|
+
], Campaign.prototype, "BILink", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, mongoose_1.Prop)({ required: false }),
|
|
176
|
+
__metadata("design:type", String)
|
|
177
|
+
], Campaign.prototype, "BISheets", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, mongoose_1.Prop)({ default: Date.now }),
|
|
180
|
+
__metadata("design:type", Date)
|
|
181
|
+
], Campaign.prototype, "createdAt", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
(0, mongoose_1.Prop)({ default: Date.now }),
|
|
184
|
+
__metadata("design:type", Date)
|
|
185
|
+
], Campaign.prototype, "updatedAt", void 0);
|
|
186
|
+
Campaign = __decorate([
|
|
187
|
+
(0, mongoose_1.Schema)({ timestamps: true })
|
|
188
|
+
], Campaign);
|
|
189
|
+
exports.Campaign = Campaign;
|
|
190
|
+
exports.CampaignSchema = mongoose_1.SchemaFactory.createForClass(Campaign);
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grapadigital/shared-schemas",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared Mongoose schemas for campaigns",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@nestjs/mongoose": "^9.0.0",
|
|
13
|
+
"mongoose": "^7.0.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"typescript": "^4.9.0"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/grapadigital/shared-schemas"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT"
|
|
23
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./schemas/campaign.schema"
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Prop, Schema, SchemaFactory } from "@nestjs/mongoose"
|
|
2
|
+
|
|
3
|
+
import { HydratedDocument, Schema as MongooseSchema, Types } from "mongoose"
|
|
4
|
+
|
|
5
|
+
export type CampaignDocument = HydratedDocument<Campaign>
|
|
6
|
+
|
|
7
|
+
@Schema({ _id: false })
|
|
8
|
+
export class ComercialCard {
|
|
9
|
+
@Prop()
|
|
10
|
+
id: string
|
|
11
|
+
|
|
12
|
+
@Prop()
|
|
13
|
+
title: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ComercialCardSchema = SchemaFactory.createForClass(ComercialCard)
|
|
17
|
+
|
|
18
|
+
@Schema({ _id: false })
|
|
19
|
+
export class Responsible {
|
|
20
|
+
@Prop()
|
|
21
|
+
name: string
|
|
22
|
+
|
|
23
|
+
@Prop()
|
|
24
|
+
team: string
|
|
25
|
+
|
|
26
|
+
@Prop()
|
|
27
|
+
email: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const ResponsibleSchema = SchemaFactory.createForClass(Responsible)
|
|
31
|
+
|
|
32
|
+
@Schema({ _id: false })
|
|
33
|
+
export class Responsibles {
|
|
34
|
+
@Prop({ type: ResponsibleSchema })
|
|
35
|
+
service: Responsible
|
|
36
|
+
|
|
37
|
+
@Prop({ type: ResponsibleSchema, required: false })
|
|
38
|
+
comercial?: Responsible
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const ResponsiblesSchema = SchemaFactory.createForClass(Responsibles)
|
|
42
|
+
|
|
43
|
+
@Schema({ timestamps: true })
|
|
44
|
+
export class Campaign {
|
|
45
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, auto: true, required: false })
|
|
46
|
+
_id?: Types.ObjectId
|
|
47
|
+
|
|
48
|
+
@Prop()
|
|
49
|
+
title: string
|
|
50
|
+
|
|
51
|
+
@Prop({ required: false })
|
|
52
|
+
thumbnail?: string
|
|
53
|
+
|
|
54
|
+
@Prop()
|
|
55
|
+
startDate: Date
|
|
56
|
+
|
|
57
|
+
@Prop()
|
|
58
|
+
endDate: Date
|
|
59
|
+
|
|
60
|
+
@Prop({ required: false })
|
|
61
|
+
nps?: number
|
|
62
|
+
|
|
63
|
+
@Prop({
|
|
64
|
+
type: String,
|
|
65
|
+
enum: ["config", "inProgress", "paused", "finished", "archived"],
|
|
66
|
+
default: "config",
|
|
67
|
+
})
|
|
68
|
+
status:
|
|
69
|
+
| "config"
|
|
70
|
+
| "inProgress"
|
|
71
|
+
| "finished"
|
|
72
|
+
| "paused"
|
|
73
|
+
| "finished"
|
|
74
|
+
| "archived"
|
|
75
|
+
|
|
76
|
+
@Prop({ type: String, enum: ["partner", "exclusive"] })
|
|
77
|
+
type: "partner" | "exclusive"
|
|
78
|
+
|
|
79
|
+
@Prop({ required: false })
|
|
80
|
+
socialnetworks?: string[]
|
|
81
|
+
|
|
82
|
+
@Prop({ default: 0, required: false })
|
|
83
|
+
recruitedInfluencers?: number
|
|
84
|
+
|
|
85
|
+
@Prop({ default: 0, required: false })
|
|
86
|
+
hiredInfluencers?: number
|
|
87
|
+
|
|
88
|
+
@Prop({ default: 0, required: false })
|
|
89
|
+
producedContent?: number
|
|
90
|
+
|
|
91
|
+
@Prop({ default: 0, required: false })
|
|
92
|
+
hiredContent?: number
|
|
93
|
+
|
|
94
|
+
@Prop({ type: MongooseSchema.Types.ObjectId, ref: "Client" })
|
|
95
|
+
client: Types.ObjectId
|
|
96
|
+
|
|
97
|
+
@Prop([
|
|
98
|
+
{
|
|
99
|
+
type: MongooseSchema.Types.ObjectId,
|
|
100
|
+
ref: "Recruitment",
|
|
101
|
+
required: false,
|
|
102
|
+
},
|
|
103
|
+
])
|
|
104
|
+
recruitments?: Types.ObjectId[]
|
|
105
|
+
|
|
106
|
+
@Prop([
|
|
107
|
+
{ type: MongooseSchema.Types.ObjectId, ref: "Content", required: false },
|
|
108
|
+
])
|
|
109
|
+
contents?: Types.ObjectId[]
|
|
110
|
+
|
|
111
|
+
@Prop()
|
|
112
|
+
cluster: string
|
|
113
|
+
|
|
114
|
+
@Prop({ required: false })
|
|
115
|
+
shopping?: string
|
|
116
|
+
|
|
117
|
+
@Prop({ required: false })
|
|
118
|
+
project?: string
|
|
119
|
+
|
|
120
|
+
@Prop({ type: ComercialCardSchema, required: false })
|
|
121
|
+
comercialCard?: ComercialCard
|
|
122
|
+
|
|
123
|
+
@Prop({ type: ResponsiblesSchema })
|
|
124
|
+
responsibles: Responsibles
|
|
125
|
+
|
|
126
|
+
@Prop({ required: false })
|
|
127
|
+
brandUsername?: string
|
|
128
|
+
|
|
129
|
+
@Prop({ required: false })
|
|
130
|
+
hashtag?: string
|
|
131
|
+
|
|
132
|
+
@Prop({ required: false })
|
|
133
|
+
BILink?: string
|
|
134
|
+
|
|
135
|
+
@Prop({ required: false })
|
|
136
|
+
BISheets?: string
|
|
137
|
+
|
|
138
|
+
@Prop({ default: Date.now })
|
|
139
|
+
createdAt?: Date
|
|
140
|
+
|
|
141
|
+
@Prop({ default: Date.now })
|
|
142
|
+
updatedAt?: Date
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const CampaignSchema = SchemaFactory.createForClass(Campaign)
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"target": "ES2021",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"lib": ["ES2021", "DOM"],
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"allowJs": true,
|
|
14
|
+
"checkJs": false,
|
|
15
|
+
"noImplicitAny": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"experimentalDecorators": true,
|
|
20
|
+
"emitDecoratorMetadata": true,
|
|
21
|
+
"strictPropertyInitialization": false,
|
|
22
|
+
"baseUrl": "./",
|
|
23
|
+
"paths": {
|
|
24
|
+
"@/*": ["src/*"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|