agrs-sequelize-sdk 1.4.16 → 1.4.18

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.
Files changed (84) hide show
  1. package/migrations/2026-05-17-PIXELS-FOLLOWUP.md +85 -0
  2. package/migrations/2026-05-17-add-platform-to-ad.js +19 -0
  3. package/migrations/2026-05-17-add-platform-to-adaccount.js +19 -0
  4. package/migrations/2026-05-17-add-platform-to-adperformance.js +19 -0
  5. package/migrations/2026-05-17-add-platform-to-adset.js +19 -0
  6. package/migrations/2026-05-17-add-platform-to-adsetperformance.js +19 -0
  7. package/migrations/2026-05-17-add-platform-to-aiarticleretryqueue.js +19 -0
  8. package/migrations/2026-05-17-add-platform-to-aicampaignqueue.js +19 -0
  9. package/migrations/2026-05-17-add-platform-to-article.js +19 -0
  10. package/migrations/2026-05-17-add-platform-to-campaign.js +19 -0
  11. package/migrations/2026-05-17-add-platform-to-codefuelcampaign.js +19 -0
  12. package/migrations/2026-05-17-add-platform-to-dynamicfeed.js +19 -0
  13. package/migrations/2026-05-17-add-platform-to-facebookretryqueue.js +19 -0
  14. package/migrations/2026-05-17-add-platform-to-pages.js +19 -0
  15. package/migrations/2026-05-17-add-platform-to-presets.js +19 -0
  16. package/migrations/RUN_ME_MANUALLY_2026-05-17.sql +99 -0
  17. package/migrations/add-requested-from-dashboard-to-articles.js +17 -17
  18. package/migrations/change-adset-name-to-text.js +79 -79
  19. package/models/AICampaignQueue.js +143 -136
  20. package/models/AIGenerationLog.js +85 -85
  21. package/models/AIGenerationRequest.js +212 -212
  22. package/models/Ad.js +6 -0
  23. package/models/AdAccount.js +6 -0
  24. package/models/AdAccountValues.js +25 -25
  25. package/models/AdHistory.js +30 -30
  26. package/models/AdPerformance.js +100 -94
  27. package/models/AdSet.js +295 -289
  28. package/models/AdSetHistory.js +30 -30
  29. package/models/AdsetPerformance.js +132 -126
  30. package/models/AiArticleRetryQueue.js +157 -150
  31. package/models/AiCreationRetryQueue.js +127 -127
  32. package/models/Article.js +212 -206
  33. package/models/AutomationRule.js +173 -173
  34. package/models/BannerTemplate.js +129 -129
  35. package/models/Buyers.js +25 -25
  36. package/models/Campaign.js +163 -157
  37. package/models/CampaignActionHistory.js +86 -86
  38. package/models/CampaignCreationLog.js +309 -309
  39. package/models/CampaignCreationLogV2.js +314 -314
  40. package/models/CampaignHistory.js +33 -33
  41. package/models/Channel.js +55 -55
  42. package/models/CodefuelCampaign.js +6 -0
  43. package/models/Domain.js +39 -47
  44. package/models/DynamicFeed.js +218 -212
  45. package/models/ExplorAdsChannel.js +61 -61
  46. package/models/FacebookRetryQueue.js +163 -156
  47. package/models/Feed.js +33 -33
  48. package/models/FeedArticleConfiguration.js +80 -80
  49. package/models/FrontStoryChannel.js +59 -59
  50. package/models/FrontStoryChannelV2.js +60 -60
  51. package/models/GenericFlowRequest.js +114 -114
  52. package/models/MidoWebChannel.js +47 -47
  53. package/models/MineChannel.js +42 -42
  54. package/models/Pages.js +105 -99
  55. package/models/PipelineExecution.js +59 -59
  56. package/models/PolicyDogsCreativeCache.js +50 -50
  57. package/models/PolicyDogsImageCache.js +30 -30
  58. package/models/Presets.js +40 -34
  59. package/models/RSOCFeedCampaign.js +375 -375
  60. package/models/RsocKeywordPerformance.js +110 -110
  61. package/models/RuleAction.js +90 -90
  62. package/models/RuleCondition.js +137 -137
  63. package/models/RuleExecution.js +107 -107
  64. package/models/RulesValues.js +56 -56
  65. package/models/SupportedLocale.js +23 -23
  66. package/models/SyncHistory.js +249 -249
  67. package/models/TTQChannel.js +42 -42
  68. package/models/TemplateMetadata.js +260 -260
  69. package/models/Tier2_AdAccounts.js +110 -110
  70. package/models/Tier2_Assets.js +70 -70
  71. package/models/Tier2_BusinessManagers.js +105 -105
  72. package/models/Tier2_CreditLines.js +99 -99
  73. package/models/Tier2_Pages.js +91 -91
  74. package/models/Tier2_Pixels.js +82 -82
  75. package/models/Tier2_Tokens.js +64 -64
  76. package/models/Tier2_UserAdAccounts.js +83 -83
  77. package/models/TokenRotationState.js +121 -121
  78. package/models/TonicRSOCKeywordPerformance.js +122 -122
  79. package/models/Users.js +148 -148
  80. package/models/Vertical.js +25 -25
  81. package/models/newFiles.js +137 -137
  82. package/package.json +19 -21
  83. package/run.sh +214 -214
  84. package/services/sequelizeService.js +110 -110
@@ -1,173 +1,173 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const AutomationRule = sequelize.define(
3
- "AutomationRule",
4
- {
5
- id: {
6
- type: DataTypes.UUID,
7
- defaultValue: DataTypes.UUIDV4,
8
- primaryKey: true,
9
- },
10
- name: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- comment: "Rule name for identification",
14
- },
15
- description: {
16
- type: DataTypes.TEXT,
17
- allowNull: true,
18
- comment: "Optional description of what this rule does",
19
- },
20
- isActive: {
21
- type: DataTypes.BOOLEAN,
22
- defaultValue: true,
23
- allowNull: false,
24
- comment: "Whether the rule is currently active",
25
- },
26
- dryRun: {
27
- type: DataTypes.BOOLEAN,
28
- defaultValue: false,
29
- allowNull: false,
30
- comment:
31
- "If true, rule will evaluate but not execute actions (simulation mode)",
32
- },
33
- ruleType: {
34
- type: DataTypes.ENUM("PAUSE", "BUDGET", "BID", "STATUS", "CUSTOM"),
35
- allowNull: true,
36
- comment: "Type of rule - determines the action category",
37
- },
38
- targetLevel: {
39
- type: DataTypes.ENUM("CAMPAIGN", "ADSET", "AD"),
40
- allowNull: true,
41
- comment: "Level at which the rule operates",
42
- },
43
- scheduleType: {
44
- type: DataTypes.ENUM("INTERVAL", "CRON", "MANUAL"),
45
- allowNull: true,
46
- defaultValue: "MANUAL",
47
- comment: "How the rule is triggered",
48
- },
49
- scheduleConfig: {
50
- type: DataTypes.JSONB,
51
- allowNull: true,
52
- comment:
53
- "Schedule configuration (interval minutes, cron expression, etc.)",
54
- },
55
- gcpJobName: {
56
- type: DataTypes.STRING(255),
57
- allowNull: true,
58
- comment: "GCP Cloud Scheduler job name for this rule",
59
- },
60
- lastExecuted: {
61
- type: DataTypes.DATE,
62
- allowNull: true,
63
- comment: "When the rule was last executed",
64
- },
65
- nextExecution: {
66
- type: DataTypes.DATE,
67
- allowNull: true,
68
- comment: "When the rule is scheduled to run next",
69
- },
70
- executionCount: {
71
- type: DataTypes.INTEGER,
72
- defaultValue: 0,
73
- allowNull: false,
74
- comment: "Number of times this rule has been executed",
75
- },
76
- successCount: {
77
- type: DataTypes.INTEGER,
78
- defaultValue: 0,
79
- allowNull: false,
80
- comment: "Number of successful executions",
81
- },
82
- failureCount: {
83
- type: DataTypes.INTEGER,
84
- defaultValue: 0,
85
- allowNull: false,
86
- comment: "Number of failed executions",
87
- },
88
- createdBy: {
89
- type: DataTypes.STRING(255),
90
- allowNull: true,
91
- comment: "User who created this rule",
92
- },
93
- updatedBy: {
94
- type: DataTypes.STRING(255),
95
- allowNull: true,
96
- comment: "User who last updated this rule",
97
- },
98
- mediaBuyer: {
99
- type: DataTypes.STRING(255),
100
- allowNull: true,
101
- comment: "Media buyer assigned to this rule for permissions",
102
- },
103
- dateRangeType: {
104
- type: DataTypes.ENUM(
105
- "LAST_N_DAYS",
106
- "CUSTOM_RANGE",
107
- "CURRENT_MONTH",
108
- "LAST_MONTH"
109
- ),
110
- allowNull: true,
111
- defaultValue: "LAST_N_DAYS",
112
- comment: "Type of date range for rule evaluation",
113
- },
114
- dateRangeValue: {
115
- type: DataTypes.INTEGER,
116
- allowNull: true,
117
- defaultValue: 7,
118
- comment: "Number of days for LAST_N_DAYS type",
119
- },
120
- customStartDate: {
121
- type: DataTypes.DATEONLY,
122
- allowNull: true,
123
- comment: "Custom start date for CUSTOM_RANGE type",
124
- },
125
- customEndDate: {
126
- type: DataTypes.DATEONLY,
127
- allowNull: true,
128
- comment: "Custom end date for CUSTOM_RANGE type",
129
- },
130
- allowedAccounts: {
131
- type: DataTypes.ARRAY(DataTypes.STRING),
132
- allowNull: true,
133
- defaultValue: [],
134
- comment: "Array of account IDs that this rule can run on",
135
- },
136
- allowedMediaBuyers: {
137
- type: DataTypes.ARRAY(DataTypes.STRING),
138
- allowNull: true,
139
- defaultValue: [],
140
- comment: "Array of media buyer codes that this rule can be assigned to",
141
- },
142
- },
143
- {
144
- tableName: "AutomationRules", // New table name
145
- timestamps: true,
146
- }
147
- );
148
-
149
- AutomationRule.associate = (models) => {
150
- // A rule has many conditions
151
- AutomationRule.hasMany(models.RuleCondition, {
152
- foreignKey: "ruleId",
153
- as: "conditions",
154
- onDelete: "CASCADE",
155
- });
156
-
157
- // A rule has many actions
158
- AutomationRule.hasMany(models.RuleAction, {
159
- foreignKey: "ruleId",
160
- as: "actions",
161
- onDelete: "CASCADE",
162
- });
163
-
164
- // A rule has many execution logs
165
- AutomationRule.hasMany(models.RuleExecution, {
166
- foreignKey: "ruleId",
167
- as: "executions",
168
- onDelete: "CASCADE",
169
- });
170
- };
171
-
172
- return AutomationRule;
173
- };
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const AutomationRule = sequelize.define(
3
+ "AutomationRule",
4
+ {
5
+ id: {
6
+ type: DataTypes.UUID,
7
+ defaultValue: DataTypes.UUIDV4,
8
+ primaryKey: true,
9
+ },
10
+ name: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ comment: "Rule name for identification",
14
+ },
15
+ description: {
16
+ type: DataTypes.TEXT,
17
+ allowNull: true,
18
+ comment: "Optional description of what this rule does",
19
+ },
20
+ isActive: {
21
+ type: DataTypes.BOOLEAN,
22
+ defaultValue: true,
23
+ allowNull: false,
24
+ comment: "Whether the rule is currently active",
25
+ },
26
+ dryRun: {
27
+ type: DataTypes.BOOLEAN,
28
+ defaultValue: false,
29
+ allowNull: false,
30
+ comment:
31
+ "If true, rule will evaluate but not execute actions (simulation mode)",
32
+ },
33
+ ruleType: {
34
+ type: DataTypes.ENUM("PAUSE", "BUDGET", "BID", "STATUS", "CUSTOM"),
35
+ allowNull: true,
36
+ comment: "Type of rule - determines the action category",
37
+ },
38
+ targetLevel: {
39
+ type: DataTypes.ENUM("CAMPAIGN", "ADSET", "AD"),
40
+ allowNull: true,
41
+ comment: "Level at which the rule operates",
42
+ },
43
+ scheduleType: {
44
+ type: DataTypes.ENUM("INTERVAL", "CRON", "MANUAL"),
45
+ allowNull: true,
46
+ defaultValue: "MANUAL",
47
+ comment: "How the rule is triggered",
48
+ },
49
+ scheduleConfig: {
50
+ type: DataTypes.JSONB,
51
+ allowNull: true,
52
+ comment:
53
+ "Schedule configuration (interval minutes, cron expression, etc.)",
54
+ },
55
+ gcpJobName: {
56
+ type: DataTypes.STRING(255),
57
+ allowNull: true,
58
+ comment: "GCP Cloud Scheduler job name for this rule",
59
+ },
60
+ lastExecuted: {
61
+ type: DataTypes.DATE,
62
+ allowNull: true,
63
+ comment: "When the rule was last executed",
64
+ },
65
+ nextExecution: {
66
+ type: DataTypes.DATE,
67
+ allowNull: true,
68
+ comment: "When the rule is scheduled to run next",
69
+ },
70
+ executionCount: {
71
+ type: DataTypes.INTEGER,
72
+ defaultValue: 0,
73
+ allowNull: false,
74
+ comment: "Number of times this rule has been executed",
75
+ },
76
+ successCount: {
77
+ type: DataTypes.INTEGER,
78
+ defaultValue: 0,
79
+ allowNull: false,
80
+ comment: "Number of successful executions",
81
+ },
82
+ failureCount: {
83
+ type: DataTypes.INTEGER,
84
+ defaultValue: 0,
85
+ allowNull: false,
86
+ comment: "Number of failed executions",
87
+ },
88
+ createdBy: {
89
+ type: DataTypes.STRING(255),
90
+ allowNull: true,
91
+ comment: "User who created this rule",
92
+ },
93
+ updatedBy: {
94
+ type: DataTypes.STRING(255),
95
+ allowNull: true,
96
+ comment: "User who last updated this rule",
97
+ },
98
+ mediaBuyer: {
99
+ type: DataTypes.STRING(255),
100
+ allowNull: true,
101
+ comment: "Media buyer assigned to this rule for permissions",
102
+ },
103
+ dateRangeType: {
104
+ type: DataTypes.ENUM(
105
+ "LAST_N_DAYS",
106
+ "CUSTOM_RANGE",
107
+ "CURRENT_MONTH",
108
+ "LAST_MONTH"
109
+ ),
110
+ allowNull: true,
111
+ defaultValue: "LAST_N_DAYS",
112
+ comment: "Type of date range for rule evaluation",
113
+ },
114
+ dateRangeValue: {
115
+ type: DataTypes.INTEGER,
116
+ allowNull: true,
117
+ defaultValue: 7,
118
+ comment: "Number of days for LAST_N_DAYS type",
119
+ },
120
+ customStartDate: {
121
+ type: DataTypes.DATEONLY,
122
+ allowNull: true,
123
+ comment: "Custom start date for CUSTOM_RANGE type",
124
+ },
125
+ customEndDate: {
126
+ type: DataTypes.DATEONLY,
127
+ allowNull: true,
128
+ comment: "Custom end date for CUSTOM_RANGE type",
129
+ },
130
+ allowedAccounts: {
131
+ type: DataTypes.ARRAY(DataTypes.STRING),
132
+ allowNull: true,
133
+ defaultValue: [],
134
+ comment: "Array of account IDs that this rule can run on",
135
+ },
136
+ allowedMediaBuyers: {
137
+ type: DataTypes.ARRAY(DataTypes.STRING),
138
+ allowNull: true,
139
+ defaultValue: [],
140
+ comment: "Array of media buyer codes that this rule can be assigned to",
141
+ },
142
+ },
143
+ {
144
+ tableName: "AutomationRules", // New table name
145
+ timestamps: true,
146
+ }
147
+ );
148
+
149
+ AutomationRule.associate = (models) => {
150
+ // A rule has many conditions
151
+ AutomationRule.hasMany(models.RuleCondition, {
152
+ foreignKey: "ruleId",
153
+ as: "conditions",
154
+ onDelete: "CASCADE",
155
+ });
156
+
157
+ // A rule has many actions
158
+ AutomationRule.hasMany(models.RuleAction, {
159
+ foreignKey: "ruleId",
160
+ as: "actions",
161
+ onDelete: "CASCADE",
162
+ });
163
+
164
+ // A rule has many execution logs
165
+ AutomationRule.hasMany(models.RuleExecution, {
166
+ foreignKey: "ruleId",
167
+ as: "executions",
168
+ onDelete: "CASCADE",
169
+ });
170
+ };
171
+
172
+ return AutomationRule;
173
+ };
@@ -1,129 +1,129 @@
1
- /**
2
- * BannerTemplate Model
3
- * Stores banner template specifications for creative generation
4
- */
5
-
6
- const { DataTypes } = require("sequelize");
7
-
8
- module.exports = (sequelize) => {
9
- const BannerTemplate = sequelize.define(
10
- "BannerTemplate",
11
- {
12
- id: {
13
- type: DataTypes.STRING(50),
14
- primaryKey: true,
15
- allowNull: false,
16
- comment: "Template ID (A-Z for built-in, UUID for custom)",
17
- },
18
- name: {
19
- type: DataTypes.STRING(255),
20
- allowNull: false,
21
- comment: "Template name (e.g., 'Photo Overlay Headline')",
22
- },
23
- imageType: {
24
- type: DataTypes.ENUM(
25
- "photo",
26
- "illustration",
27
- "render3d",
28
- "collage",
29
- "solid",
30
- "cartoon"
31
- ),
32
- allowNull: false,
33
- field: "image_type",
34
- comment: "Visual style category",
35
- },
36
- description: {
37
- type: DataTypes.TEXT,
38
- allowNull: true,
39
- comment: "Short description of template",
40
- },
41
- detailedDescription: {
42
- type: DataTypes.TEXT,
43
- allowNull: true,
44
- field: "detailed_description",
45
- comment: "Full template description with layout details",
46
- },
47
- elements: {
48
- type: DataTypes.JSON,
49
- allowNull: true,
50
- defaultValue: [],
51
- comment: "Array of element names (e.g., ['Photo', 'Intro', 'CTA'])",
52
- },
53
- sampleImageUrl: {
54
- type: DataTypes.STRING(500),
55
- allowNull: true,
56
- field: "sample_image_url",
57
- comment: "URL to sample image in GCP",
58
- },
59
- layoutPreview: {
60
- type: DataTypes.TEXT,
61
- allowNull: true,
62
- field: "layout_preview",
63
- comment: "HTML string for preview rendering",
64
- },
65
- isCustom: {
66
- type: DataTypes.BOOLEAN,
67
- allowNull: false,
68
- defaultValue: true,
69
- field: "is_custom",
70
- comment: "True for user-created, false for built-in templates",
71
- },
72
- prompt: {
73
- type: DataTypes.JSON,
74
- allowNull: true,
75
- comment: "Full template specification object",
76
- },
77
- tags: {
78
- type: DataTypes.JSON,
79
- allowNull: true,
80
- defaultValue: [],
81
- comment: "Array of tags for filtering",
82
- },
83
- userId: {
84
- type: DataTypes.STRING(255),
85
- allowNull: true,
86
- field: "user_id",
87
- comment: "User who created this template",
88
- },
89
- createdAt: {
90
- type: DataTypes.DATE,
91
- allowNull: false,
92
- defaultValue: DataTypes.NOW,
93
- field: "created_at",
94
- },
95
- updatedAt: {
96
- type: DataTypes.DATE,
97
- allowNull: false,
98
- defaultValue: DataTypes.NOW,
99
- field: "updated_at",
100
- },
101
- },
102
- {
103
- tableName: "banner_templates",
104
- timestamps: true,
105
- underscored: true,
106
- indexes: [
107
- {
108
- name: "idx_banner_templates_image_type",
109
- fields: ["image_type"],
110
- },
111
- {
112
- name: "idx_banner_templates_is_custom",
113
- fields: ["is_custom"],
114
- },
115
- {
116
- name: "idx_banner_templates_created_at",
117
- fields: ["created_at"],
118
- },
119
- {
120
- name: "idx_banner_templates_user_id",
121
- fields: ["user_id"],
122
- },
123
- ],
124
- }
125
- );
126
-
127
- return BannerTemplate;
128
- };
129
-
1
+ /**
2
+ * BannerTemplate Model
3
+ * Stores banner template specifications for creative generation
4
+ */
5
+
6
+ const { DataTypes } = require("sequelize");
7
+
8
+ module.exports = (sequelize) => {
9
+ const BannerTemplate = sequelize.define(
10
+ "BannerTemplate",
11
+ {
12
+ id: {
13
+ type: DataTypes.STRING(50),
14
+ primaryKey: true,
15
+ allowNull: false,
16
+ comment: "Template ID (A-Z for built-in, UUID for custom)",
17
+ },
18
+ name: {
19
+ type: DataTypes.STRING(255),
20
+ allowNull: false,
21
+ comment: "Template name (e.g., 'Photo Overlay Headline')",
22
+ },
23
+ imageType: {
24
+ type: DataTypes.ENUM(
25
+ "photo",
26
+ "illustration",
27
+ "render3d",
28
+ "collage",
29
+ "solid",
30
+ "cartoon"
31
+ ),
32
+ allowNull: false,
33
+ field: "image_type",
34
+ comment: "Visual style category",
35
+ },
36
+ description: {
37
+ type: DataTypes.TEXT,
38
+ allowNull: true,
39
+ comment: "Short description of template",
40
+ },
41
+ detailedDescription: {
42
+ type: DataTypes.TEXT,
43
+ allowNull: true,
44
+ field: "detailed_description",
45
+ comment: "Full template description with layout details",
46
+ },
47
+ elements: {
48
+ type: DataTypes.JSON,
49
+ allowNull: true,
50
+ defaultValue: [],
51
+ comment: "Array of element names (e.g., ['Photo', 'Intro', 'CTA'])",
52
+ },
53
+ sampleImageUrl: {
54
+ type: DataTypes.STRING(500),
55
+ allowNull: true,
56
+ field: "sample_image_url",
57
+ comment: "URL to sample image in GCP",
58
+ },
59
+ layoutPreview: {
60
+ type: DataTypes.TEXT,
61
+ allowNull: true,
62
+ field: "layout_preview",
63
+ comment: "HTML string for preview rendering",
64
+ },
65
+ isCustom: {
66
+ type: DataTypes.BOOLEAN,
67
+ allowNull: false,
68
+ defaultValue: true,
69
+ field: "is_custom",
70
+ comment: "True for user-created, false for built-in templates",
71
+ },
72
+ prompt: {
73
+ type: DataTypes.JSON,
74
+ allowNull: true,
75
+ comment: "Full template specification object",
76
+ },
77
+ tags: {
78
+ type: DataTypes.JSON,
79
+ allowNull: true,
80
+ defaultValue: [],
81
+ comment: "Array of tags for filtering",
82
+ },
83
+ userId: {
84
+ type: DataTypes.STRING(255),
85
+ allowNull: true,
86
+ field: "user_id",
87
+ comment: "User who created this template",
88
+ },
89
+ createdAt: {
90
+ type: DataTypes.DATE,
91
+ allowNull: false,
92
+ defaultValue: DataTypes.NOW,
93
+ field: "created_at",
94
+ },
95
+ updatedAt: {
96
+ type: DataTypes.DATE,
97
+ allowNull: false,
98
+ defaultValue: DataTypes.NOW,
99
+ field: "updated_at",
100
+ },
101
+ },
102
+ {
103
+ tableName: "banner_templates",
104
+ timestamps: true,
105
+ underscored: true,
106
+ indexes: [
107
+ {
108
+ name: "idx_banner_templates_image_type",
109
+ fields: ["image_type"],
110
+ },
111
+ {
112
+ name: "idx_banner_templates_is_custom",
113
+ fields: ["is_custom"],
114
+ },
115
+ {
116
+ name: "idx_banner_templates_created_at",
117
+ fields: ["created_at"],
118
+ },
119
+ {
120
+ name: "idx_banner_templates_user_id",
121
+ fields: ["user_id"],
122
+ },
123
+ ],
124
+ }
125
+ );
126
+
127
+ return BannerTemplate;
128
+ };
129
+
package/models/Buyers.js CHANGED
@@ -1,26 +1,26 @@
1
- module.exports = (sequelize, DataTypes) => {
2
- const Buyers = sequelize.define(
3
- "Buyers",
4
- {
5
- id: {
6
- type: DataTypes.UUID,
7
- defaultValue: DataTypes.UUIDV4,
8
- primaryKey: true,
9
- },
10
- name: {
11
- type: DataTypes.STRING,
12
- allowNull: false,
13
- },
14
- code: {
15
- type: DataTypes.STRING,
16
- allowNull: false,
17
- unique: true,
18
- },
19
- },
20
- {
21
- tableName: "Buyers",
22
- }
23
- );
24
-
25
- return Buyers;
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const Buyers = sequelize.define(
3
+ "Buyers",
4
+ {
5
+ id: {
6
+ type: DataTypes.UUID,
7
+ defaultValue: DataTypes.UUIDV4,
8
+ primaryKey: true,
9
+ },
10
+ name: {
11
+ type: DataTypes.STRING,
12
+ allowNull: false,
13
+ },
14
+ code: {
15
+ type: DataTypes.STRING,
16
+ allowNull: false,
17
+ unique: true,
18
+ },
19
+ },
20
+ {
21
+ tableName: "Buyers",
22
+ }
23
+ );
24
+
25
+ return Buyers;
26
26
  };