agrs-sequelize-sdk 1.4.0 → 1.4.3
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/migrations/add-requested-from-dashboard-to-articles.js +17 -17
- package/migrations/change-adset-name-to-text.js +79 -79
- package/models/AICampaignQueue.js +136 -136
- package/models/AIGenerationLog.js +85 -85
- package/models/AIGenerationRequest.js +212 -212
- package/models/AdAccountValues.js +25 -25
- package/models/AdHistory.js +30 -30
- package/models/AdPerformance.js +94 -94
- package/models/AdSet.js +289 -289
- package/models/AdSetHistory.js +30 -30
- package/models/AdsetPerformance.js +126 -126
- package/models/AiArticleRetryQueue.js +150 -150
- package/models/AiCreationRetryQueue.js +127 -127
- package/models/Article.js +206 -206
- package/models/AutomationRule.js +173 -173
- package/models/BannerTemplate.js +129 -129
- package/models/Buyers.js +25 -25
- package/models/Campaign.js +157 -157
- package/models/CampaignActionHistory.js +86 -86
- package/models/CampaignCreationLog.js +309 -309
- package/models/CampaignCreationLogV2.js +314 -314
- package/models/CampaignHistory.js +33 -33
- package/models/Channel.js +55 -55
- package/models/Domain.js +35 -39
- package/models/DynamicFeed.js +212 -212
- package/models/ExplorAdsChannel.js +61 -61
- package/models/FacebookRetryQueue.js +156 -156
- package/models/Feed.js +33 -33
- package/models/FeedArticleConfiguration.js +80 -80
- package/models/FrontStoryChannel.js +59 -59
- package/models/FrontStoryChannelV2.js +60 -60
- package/models/GenericFlowRequest.js +114 -114
- package/models/MidoWebChannel.js +47 -47
- package/models/MineChannel.js +42 -42
- package/models/Pages.js +99 -99
- package/models/PipelineExecution.js +59 -59
- package/models/PolicyDogsCreativeCache.js +50 -50
- package/models/PolicyDogsImageCache.js +30 -30
- package/models/Presets.js +34 -34
- package/models/RSOCFeedCampaign.js +375 -375
- package/models/RsocKeywordPerformance.js +110 -110
- package/models/RuleAction.js +90 -90
- package/models/RuleCondition.js +137 -137
- package/models/RuleExecution.js +107 -107
- package/models/RulesValues.js +56 -56
- package/models/SupportedLocale.js +23 -23
- package/models/SyncHistory.js +249 -249
- package/models/TTQChannel.js +42 -42
- package/models/TemplateMetadata.js +260 -260
- package/models/Tier2_AdAccounts.js +110 -110
- package/models/Tier2_Assets.js +70 -70
- package/models/Tier2_BusinessManagers.js +105 -105
- package/models/Tier2_CreditLines.js +99 -99
- package/models/Tier2_Pages.js +91 -91
- package/models/Tier2_Pixels.js +82 -82
- package/models/Tier2_Tokens.js +64 -64
- package/models/Tier2_UserAdAccounts.js +83 -83
- package/models/TokenRotationState.js +121 -121
- package/models/TonicRSOCKeywordPerformance.js +122 -122
- package/models/Users.js +148 -148
- package/models/Vertical.js +25 -25
- package/models/newFiles.js +137 -137
- package/models/pixel.js +3 -3
- package/package.json +19 -21
- package/run.sh +214 -214
- package/services/sequelizeService.js +110 -110
|
@@ -1,260 +1,260 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TemplateMetadata Model
|
|
3
|
-
* Stores rich metadata for banner templates with AI-generated insights
|
|
4
|
-
* Used for advanced filtering, sorting, and template library management
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = (sequelize, DataTypes) => {
|
|
8
|
-
const TemplateMetadata = sequelize.define(
|
|
9
|
-
"TemplateMetadata",
|
|
10
|
-
{
|
|
11
|
-
id: {
|
|
12
|
-
type: DataTypes.INTEGER,
|
|
13
|
-
primaryKey: true,
|
|
14
|
-
autoIncrement: true,
|
|
15
|
-
comment: "Auto-incremented primary key",
|
|
16
|
-
},
|
|
17
|
-
name: {
|
|
18
|
-
type: DataTypes.STRING(255),
|
|
19
|
-
allowNull: false,
|
|
20
|
-
comment: "Template name (e.g., 'Template 1')",
|
|
21
|
-
},
|
|
22
|
-
status: {
|
|
23
|
-
type: DataTypes.STRING(20),
|
|
24
|
-
allowNull: false,
|
|
25
|
-
defaultValue: "Active",
|
|
26
|
-
comment: "Template status (e.g., 'Active', 'Inactive')",
|
|
27
|
-
},
|
|
28
|
-
description: {
|
|
29
|
-
type: DataTypes.TEXT,
|
|
30
|
-
allowNull: true,
|
|
31
|
-
comment: "Short description (200 chars)",
|
|
32
|
-
},
|
|
33
|
-
detailedDescription: {
|
|
34
|
-
type: DataTypes.TEXT,
|
|
35
|
-
allowNull: true,
|
|
36
|
-
field: "detailed_description",
|
|
37
|
-
comment: "Full template description from templateDescriptions.js",
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
// ===== Metadata Fields =====
|
|
41
|
-
imageType: {
|
|
42
|
-
type: DataTypes.TEXT,
|
|
43
|
-
allowNull: true,
|
|
44
|
-
field: "image_type",
|
|
45
|
-
comment:
|
|
46
|
-
"Best image type for this template (e.g., 'photo', 'illustration', 'render3d', 'collage', 'solid', 'cartoon', 'mixed')",
|
|
47
|
-
},
|
|
48
|
-
category: {
|
|
49
|
-
type: DataTypes.TEXT,
|
|
50
|
-
allowNull: true,
|
|
51
|
-
comment: "Layout category (e.g., 'asymmetric-split', 'vertical-stack')",
|
|
52
|
-
},
|
|
53
|
-
tags: {
|
|
54
|
-
type: DataTypes.JSON,
|
|
55
|
-
allowNull: true,
|
|
56
|
-
defaultValue: [],
|
|
57
|
-
comment: "Array of descriptive tags for filtering",
|
|
58
|
-
},
|
|
59
|
-
elements: {
|
|
60
|
-
type: DataTypes.JSON,
|
|
61
|
-
allowNull: true,
|
|
62
|
-
defaultValue: [],
|
|
63
|
-
comment:
|
|
64
|
-
"Array of visual elements (e.g., ['Photo', 'Headline', 'CTA'])",
|
|
65
|
-
},
|
|
66
|
-
complexity: {
|
|
67
|
-
type: DataTypes.STRING(20),
|
|
68
|
-
allowNull: true,
|
|
69
|
-
comment: "Template complexity level (e.g., 'low', 'medium', 'high')",
|
|
70
|
-
},
|
|
71
|
-
textDensity: {
|
|
72
|
-
type: DataTypes.STRING(20),
|
|
73
|
-
allowNull: true,
|
|
74
|
-
field: "text_density",
|
|
75
|
-
comment:
|
|
76
|
-
"Amount of text in template (e.g., 'none', 'low', 'medium', 'high')",
|
|
77
|
-
},
|
|
78
|
-
imageCount: {
|
|
79
|
-
type: DataTypes.INTEGER,
|
|
80
|
-
allowNull: true,
|
|
81
|
-
field: "image_count",
|
|
82
|
-
comment: "Number of image slots",
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
// ===== Layout Fields =====
|
|
86
|
-
layoutStructure: {
|
|
87
|
-
type: DataTypes.TEXT,
|
|
88
|
-
allowNull: true,
|
|
89
|
-
field: "layout_structure",
|
|
90
|
-
comment: "Description of layout structure",
|
|
91
|
-
},
|
|
92
|
-
composition: {
|
|
93
|
-
type: DataTypes.TEXT,
|
|
94
|
-
allowNull: true,
|
|
95
|
-
comment: "Description of visual composition",
|
|
96
|
-
},
|
|
97
|
-
textPlacement: {
|
|
98
|
-
type: DataTypes.JSON,
|
|
99
|
-
allowNull: true,
|
|
100
|
-
defaultValue: [],
|
|
101
|
-
field: "text_placement",
|
|
102
|
-
comment: "Array of text placement descriptions",
|
|
103
|
-
},
|
|
104
|
-
imagePlacement: {
|
|
105
|
-
type: DataTypes.JSON,
|
|
106
|
-
allowNull: true,
|
|
107
|
-
defaultValue: [],
|
|
108
|
-
field: "image_placement",
|
|
109
|
-
comment: "Array of image placement descriptions",
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
// ===== Prompt Fields (for AI generation) =====
|
|
113
|
-
imageStyle: {
|
|
114
|
-
type: DataTypes.TEXT,
|
|
115
|
-
allowNull: true,
|
|
116
|
-
field: "image_style",
|
|
117
|
-
comment: "Image style for AI prompt (e.g., 'PHOTO', 'ILLUSTRATION')",
|
|
118
|
-
},
|
|
119
|
-
layoutDescription: {
|
|
120
|
-
type: DataTypes.TEXT,
|
|
121
|
-
allowNull: true,
|
|
122
|
-
field: "layout_description",
|
|
123
|
-
comment: "Detailed layout description for AI prompt",
|
|
124
|
-
},
|
|
125
|
-
textPositions: {
|
|
126
|
-
type: DataTypes.JSON,
|
|
127
|
-
allowNull: true,
|
|
128
|
-
field: "text_positions",
|
|
129
|
-
comment: "Text positioning info for AI prompt (headline, cta, subtext)",
|
|
130
|
-
},
|
|
131
|
-
backgroundType: {
|
|
132
|
-
type: DataTypes.TEXT,
|
|
133
|
-
allowNull: true,
|
|
134
|
-
field: "background_type",
|
|
135
|
-
comment: "Background type description",
|
|
136
|
-
},
|
|
137
|
-
colorPalette: {
|
|
138
|
-
type: DataTypes.JSON,
|
|
139
|
-
allowNull: true,
|
|
140
|
-
defaultValue: [],
|
|
141
|
-
field: "color_palette",
|
|
142
|
-
comment: "Array of color palette hints",
|
|
143
|
-
},
|
|
144
|
-
mood: {
|
|
145
|
-
type: DataTypes.TEXT,
|
|
146
|
-
allowNull: true,
|
|
147
|
-
comment: "Mood/aesthetic description",
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
// ===== Sample Images =====
|
|
151
|
-
sampleImages: {
|
|
152
|
-
type: DataTypes.JSON,
|
|
153
|
-
allowNull: true,
|
|
154
|
-
defaultValue: [],
|
|
155
|
-
field: "sample_images",
|
|
156
|
-
comment: "Array of sample image URLs",
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
// ===== User Uploaded Original Image =====
|
|
160
|
-
userUploadedImageUrl: {
|
|
161
|
-
type: DataTypes.TEXT,
|
|
162
|
-
allowNull: true,
|
|
163
|
-
field: "user_uploaded_image_url",
|
|
164
|
-
comment:
|
|
165
|
-
"URL of the original banner image uploaded by user (stored in GCP)",
|
|
166
|
-
},
|
|
167
|
-
uploadedBy: {
|
|
168
|
-
type: DataTypes.STRING(100),
|
|
169
|
-
allowNull: true,
|
|
170
|
-
field: "uploaded_by",
|
|
171
|
-
comment: "Username of the user who uploaded this template",
|
|
172
|
-
},
|
|
173
|
-
isUserGenerated: {
|
|
174
|
-
type: DataTypes.BOOLEAN,
|
|
175
|
-
allowNull: false,
|
|
176
|
-
defaultValue: true,
|
|
177
|
-
field: "is_user_generated",
|
|
178
|
-
comment:
|
|
179
|
-
"True if template was uploaded/analyzed by user, false if system template",
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
// ===== Preview =====
|
|
183
|
-
layoutPreview: {
|
|
184
|
-
type: DataTypes.TEXT,
|
|
185
|
-
allowNull: true,
|
|
186
|
-
field: "layout_preview",
|
|
187
|
-
comment: "HTML/CSS preview generated by Gemini AI",
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
// ===== Template Specification (JSON) =====
|
|
191
|
-
templateSpec: {
|
|
192
|
-
type: DataTypes.JSON,
|
|
193
|
-
allowNull: true,
|
|
194
|
-
field: "template_spec",
|
|
195
|
-
comment: "Detailed JSON specification for template reproduction (imageStyle, layout, positions)",
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
// ===== Legacy Grid Config (for backward compatibility) =====
|
|
199
|
-
legacyGridConfig: {
|
|
200
|
-
type: DataTypes.JSON,
|
|
201
|
-
allowNull: true,
|
|
202
|
-
field: "legacy_grid_config",
|
|
203
|
-
comment: "Original Grid CSS config from templateConfig.json",
|
|
204
|
-
},
|
|
205
|
-
originalCreatedAt: {
|
|
206
|
-
type: DataTypes.DATE,
|
|
207
|
-
allowNull: true,
|
|
208
|
-
field: "original_created_at",
|
|
209
|
-
comment: "Original creation date from templateConfig.json",
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
// ===== Timestamps =====
|
|
213
|
-
createdAt: {
|
|
214
|
-
type: DataTypes.DATE,
|
|
215
|
-
allowNull: false,
|
|
216
|
-
defaultValue: DataTypes.NOW,
|
|
217
|
-
field: "created_at",
|
|
218
|
-
},
|
|
219
|
-
updatedAt: {
|
|
220
|
-
type: DataTypes.DATE,
|
|
221
|
-
allowNull: false,
|
|
222
|
-
defaultValue: DataTypes.NOW,
|
|
223
|
-
field: "updated_at",
|
|
224
|
-
},
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
tableName: "template_metadata",
|
|
228
|
-
timestamps: true,
|
|
229
|
-
underscored: true,
|
|
230
|
-
indexes: [
|
|
231
|
-
{
|
|
232
|
-
name: "idx_template_metadata_status",
|
|
233
|
-
fields: ["status"],
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: "idx_template_metadata_image_type",
|
|
237
|
-
fields: ["image_type"],
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
name: "idx_template_metadata_complexity",
|
|
241
|
-
fields: ["complexity"],
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
name: "idx_template_metadata_category",
|
|
245
|
-
fields: ["category"],
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: "idx_template_metadata_image_count",
|
|
249
|
-
fields: ["image_count"],
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
name: "idx_template_metadata_is_user_generated",
|
|
253
|
-
fields: ["is_user_generated"],
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
}
|
|
257
|
-
);
|
|
258
|
-
|
|
259
|
-
return TemplateMetadata;
|
|
260
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* TemplateMetadata Model
|
|
3
|
+
* Stores rich metadata for banner templates with AI-generated insights
|
|
4
|
+
* Used for advanced filtering, sorting, and template library management
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
module.exports = (sequelize, DataTypes) => {
|
|
8
|
+
const TemplateMetadata = sequelize.define(
|
|
9
|
+
"TemplateMetadata",
|
|
10
|
+
{
|
|
11
|
+
id: {
|
|
12
|
+
type: DataTypes.INTEGER,
|
|
13
|
+
primaryKey: true,
|
|
14
|
+
autoIncrement: true,
|
|
15
|
+
comment: "Auto-incremented primary key",
|
|
16
|
+
},
|
|
17
|
+
name: {
|
|
18
|
+
type: DataTypes.STRING(255),
|
|
19
|
+
allowNull: false,
|
|
20
|
+
comment: "Template name (e.g., 'Template 1')",
|
|
21
|
+
},
|
|
22
|
+
status: {
|
|
23
|
+
type: DataTypes.STRING(20),
|
|
24
|
+
allowNull: false,
|
|
25
|
+
defaultValue: "Active",
|
|
26
|
+
comment: "Template status (e.g., 'Active', 'Inactive')",
|
|
27
|
+
},
|
|
28
|
+
description: {
|
|
29
|
+
type: DataTypes.TEXT,
|
|
30
|
+
allowNull: true,
|
|
31
|
+
comment: "Short description (200 chars)",
|
|
32
|
+
},
|
|
33
|
+
detailedDescription: {
|
|
34
|
+
type: DataTypes.TEXT,
|
|
35
|
+
allowNull: true,
|
|
36
|
+
field: "detailed_description",
|
|
37
|
+
comment: "Full template description from templateDescriptions.js",
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
// ===== Metadata Fields =====
|
|
41
|
+
imageType: {
|
|
42
|
+
type: DataTypes.TEXT,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
field: "image_type",
|
|
45
|
+
comment:
|
|
46
|
+
"Best image type for this template (e.g., 'photo', 'illustration', 'render3d', 'collage', 'solid', 'cartoon', 'mixed')",
|
|
47
|
+
},
|
|
48
|
+
category: {
|
|
49
|
+
type: DataTypes.TEXT,
|
|
50
|
+
allowNull: true,
|
|
51
|
+
comment: "Layout category (e.g., 'asymmetric-split', 'vertical-stack')",
|
|
52
|
+
},
|
|
53
|
+
tags: {
|
|
54
|
+
type: DataTypes.JSON,
|
|
55
|
+
allowNull: true,
|
|
56
|
+
defaultValue: [],
|
|
57
|
+
comment: "Array of descriptive tags for filtering",
|
|
58
|
+
},
|
|
59
|
+
elements: {
|
|
60
|
+
type: DataTypes.JSON,
|
|
61
|
+
allowNull: true,
|
|
62
|
+
defaultValue: [],
|
|
63
|
+
comment:
|
|
64
|
+
"Array of visual elements (e.g., ['Photo', 'Headline', 'CTA'])",
|
|
65
|
+
},
|
|
66
|
+
complexity: {
|
|
67
|
+
type: DataTypes.STRING(20),
|
|
68
|
+
allowNull: true,
|
|
69
|
+
comment: "Template complexity level (e.g., 'low', 'medium', 'high')",
|
|
70
|
+
},
|
|
71
|
+
textDensity: {
|
|
72
|
+
type: DataTypes.STRING(20),
|
|
73
|
+
allowNull: true,
|
|
74
|
+
field: "text_density",
|
|
75
|
+
comment:
|
|
76
|
+
"Amount of text in template (e.g., 'none', 'low', 'medium', 'high')",
|
|
77
|
+
},
|
|
78
|
+
imageCount: {
|
|
79
|
+
type: DataTypes.INTEGER,
|
|
80
|
+
allowNull: true,
|
|
81
|
+
field: "image_count",
|
|
82
|
+
comment: "Number of image slots",
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
// ===== Layout Fields =====
|
|
86
|
+
layoutStructure: {
|
|
87
|
+
type: DataTypes.TEXT,
|
|
88
|
+
allowNull: true,
|
|
89
|
+
field: "layout_structure",
|
|
90
|
+
comment: "Description of layout structure",
|
|
91
|
+
},
|
|
92
|
+
composition: {
|
|
93
|
+
type: DataTypes.TEXT,
|
|
94
|
+
allowNull: true,
|
|
95
|
+
comment: "Description of visual composition",
|
|
96
|
+
},
|
|
97
|
+
textPlacement: {
|
|
98
|
+
type: DataTypes.JSON,
|
|
99
|
+
allowNull: true,
|
|
100
|
+
defaultValue: [],
|
|
101
|
+
field: "text_placement",
|
|
102
|
+
comment: "Array of text placement descriptions",
|
|
103
|
+
},
|
|
104
|
+
imagePlacement: {
|
|
105
|
+
type: DataTypes.JSON,
|
|
106
|
+
allowNull: true,
|
|
107
|
+
defaultValue: [],
|
|
108
|
+
field: "image_placement",
|
|
109
|
+
comment: "Array of image placement descriptions",
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
// ===== Prompt Fields (for AI generation) =====
|
|
113
|
+
imageStyle: {
|
|
114
|
+
type: DataTypes.TEXT,
|
|
115
|
+
allowNull: true,
|
|
116
|
+
field: "image_style",
|
|
117
|
+
comment: "Image style for AI prompt (e.g., 'PHOTO', 'ILLUSTRATION')",
|
|
118
|
+
},
|
|
119
|
+
layoutDescription: {
|
|
120
|
+
type: DataTypes.TEXT,
|
|
121
|
+
allowNull: true,
|
|
122
|
+
field: "layout_description",
|
|
123
|
+
comment: "Detailed layout description for AI prompt",
|
|
124
|
+
},
|
|
125
|
+
textPositions: {
|
|
126
|
+
type: DataTypes.JSON,
|
|
127
|
+
allowNull: true,
|
|
128
|
+
field: "text_positions",
|
|
129
|
+
comment: "Text positioning info for AI prompt (headline, cta, subtext)",
|
|
130
|
+
},
|
|
131
|
+
backgroundType: {
|
|
132
|
+
type: DataTypes.TEXT,
|
|
133
|
+
allowNull: true,
|
|
134
|
+
field: "background_type",
|
|
135
|
+
comment: "Background type description",
|
|
136
|
+
},
|
|
137
|
+
colorPalette: {
|
|
138
|
+
type: DataTypes.JSON,
|
|
139
|
+
allowNull: true,
|
|
140
|
+
defaultValue: [],
|
|
141
|
+
field: "color_palette",
|
|
142
|
+
comment: "Array of color palette hints",
|
|
143
|
+
},
|
|
144
|
+
mood: {
|
|
145
|
+
type: DataTypes.TEXT,
|
|
146
|
+
allowNull: true,
|
|
147
|
+
comment: "Mood/aesthetic description",
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
// ===== Sample Images =====
|
|
151
|
+
sampleImages: {
|
|
152
|
+
type: DataTypes.JSON,
|
|
153
|
+
allowNull: true,
|
|
154
|
+
defaultValue: [],
|
|
155
|
+
field: "sample_images",
|
|
156
|
+
comment: "Array of sample image URLs",
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
// ===== User Uploaded Original Image =====
|
|
160
|
+
userUploadedImageUrl: {
|
|
161
|
+
type: DataTypes.TEXT,
|
|
162
|
+
allowNull: true,
|
|
163
|
+
field: "user_uploaded_image_url",
|
|
164
|
+
comment:
|
|
165
|
+
"URL of the original banner image uploaded by user (stored in GCP)",
|
|
166
|
+
},
|
|
167
|
+
uploadedBy: {
|
|
168
|
+
type: DataTypes.STRING(100),
|
|
169
|
+
allowNull: true,
|
|
170
|
+
field: "uploaded_by",
|
|
171
|
+
comment: "Username of the user who uploaded this template",
|
|
172
|
+
},
|
|
173
|
+
isUserGenerated: {
|
|
174
|
+
type: DataTypes.BOOLEAN,
|
|
175
|
+
allowNull: false,
|
|
176
|
+
defaultValue: true,
|
|
177
|
+
field: "is_user_generated",
|
|
178
|
+
comment:
|
|
179
|
+
"True if template was uploaded/analyzed by user, false if system template",
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
// ===== Preview =====
|
|
183
|
+
layoutPreview: {
|
|
184
|
+
type: DataTypes.TEXT,
|
|
185
|
+
allowNull: true,
|
|
186
|
+
field: "layout_preview",
|
|
187
|
+
comment: "HTML/CSS preview generated by Gemini AI",
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
// ===== Template Specification (JSON) =====
|
|
191
|
+
templateSpec: {
|
|
192
|
+
type: DataTypes.JSON,
|
|
193
|
+
allowNull: true,
|
|
194
|
+
field: "template_spec",
|
|
195
|
+
comment: "Detailed JSON specification for template reproduction (imageStyle, layout, positions)",
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
// ===== Legacy Grid Config (for backward compatibility) =====
|
|
199
|
+
legacyGridConfig: {
|
|
200
|
+
type: DataTypes.JSON,
|
|
201
|
+
allowNull: true,
|
|
202
|
+
field: "legacy_grid_config",
|
|
203
|
+
comment: "Original Grid CSS config from templateConfig.json",
|
|
204
|
+
},
|
|
205
|
+
originalCreatedAt: {
|
|
206
|
+
type: DataTypes.DATE,
|
|
207
|
+
allowNull: true,
|
|
208
|
+
field: "original_created_at",
|
|
209
|
+
comment: "Original creation date from templateConfig.json",
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
// ===== Timestamps =====
|
|
213
|
+
createdAt: {
|
|
214
|
+
type: DataTypes.DATE,
|
|
215
|
+
allowNull: false,
|
|
216
|
+
defaultValue: DataTypes.NOW,
|
|
217
|
+
field: "created_at",
|
|
218
|
+
},
|
|
219
|
+
updatedAt: {
|
|
220
|
+
type: DataTypes.DATE,
|
|
221
|
+
allowNull: false,
|
|
222
|
+
defaultValue: DataTypes.NOW,
|
|
223
|
+
field: "updated_at",
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
tableName: "template_metadata",
|
|
228
|
+
timestamps: true,
|
|
229
|
+
underscored: true,
|
|
230
|
+
indexes: [
|
|
231
|
+
{
|
|
232
|
+
name: "idx_template_metadata_status",
|
|
233
|
+
fields: ["status"],
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "idx_template_metadata_image_type",
|
|
237
|
+
fields: ["image_type"],
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: "idx_template_metadata_complexity",
|
|
241
|
+
fields: ["complexity"],
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "idx_template_metadata_category",
|
|
245
|
+
fields: ["category"],
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
name: "idx_template_metadata_image_count",
|
|
249
|
+
fields: ["image_count"],
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: "idx_template_metadata_is_user_generated",
|
|
253
|
+
fields: ["is_user_generated"],
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
}
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
return TemplateMetadata;
|
|
260
|
+
};
|