agrs-sequelize-sdk 1.3.7 → 1.3.9

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.
@@ -0,0 +1,98 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const AICampaignQueue = sequelize.define(
3
+ "AICampaignQueue",
4
+ {
5
+ id: {
6
+ type: DataTypes.INTEGER,
7
+ primaryKey: true,
8
+ autoIncrement: true,
9
+ },
10
+ article_id: {
11
+ type: DataTypes.STRING(255),
12
+ allowNull: false,
13
+ field: "article_id",
14
+ },
15
+ feed_provider: {
16
+ type: DataTypes.STRING(100),
17
+ allowNull: false,
18
+ field: "feed_provider",
19
+ },
20
+ payload: {
21
+ type: DataTypes.JSONB,
22
+ allowNull: false,
23
+ },
24
+ status: {
25
+ type: DataTypes.STRING(50),
26
+ allowNull: false,
27
+ defaultValue: "pending",
28
+ validate: {
29
+ isIn: [["pending", "processing", "completed", "failed"]],
30
+ },
31
+ },
32
+ created_at: {
33
+ type: DataTypes.DATE,
34
+ allowNull: false,
35
+ defaultValue: DataTypes.NOW,
36
+ field: "created_at",
37
+ },
38
+ processed_at: {
39
+ type: DataTypes.DATE,
40
+ allowNull: true,
41
+ field: "processed_at",
42
+ },
43
+ retry_count: {
44
+ type: DataTypes.INTEGER,
45
+ allowNull: false,
46
+ defaultValue: 0,
47
+ field: "retry_count",
48
+ },
49
+ error_message: {
50
+ type: DataTypes.TEXT,
51
+ allowNull: true,
52
+ field: "error_message",
53
+ },
54
+ facebook_campaign_id: {
55
+ type: DataTypes.STRING(255),
56
+ allowNull: true,
57
+ field: "facebook_campaign_id",
58
+ },
59
+ process_id: {
60
+ type: DataTypes.STRING(255),
61
+ allowNull: true,
62
+ field: "process_id",
63
+ },
64
+ },
65
+ {
66
+ tableName: "ai_campaign_queue",
67
+ timestamps: false, // We manage created_at manually
68
+ indexes: [
69
+ {
70
+ fields: ["status"],
71
+ },
72
+ {
73
+ fields: ["article_id"],
74
+ },
75
+ {
76
+ fields: ["created_at"],
77
+ },
78
+ {
79
+ fields: ["feed_provider"],
80
+ },
81
+ {
82
+ fields: ["process_id"],
83
+ },
84
+ ],
85
+ }
86
+ );
87
+
88
+ AICampaignQueue.associate = (models) => {
89
+ // Optional: Add association to Article model if needed
90
+ // AICampaignQueue.belongsTo(models.Article, {
91
+ // foreignKey: "article_id",
92
+ // targetKey: "AGRSAID",
93
+ // as: "Article",
94
+ // });
95
+ };
96
+
97
+ return AICampaignQueue;
98
+ };
@@ -0,0 +1,81 @@
1
+ module.exports = (sequelize, DataTypes) => {
2
+ const FeedArticleConfiguration = sequelize.define(
3
+ "FeedArticleConfiguration",
4
+ {
5
+ id: {
6
+ type: DataTypes.INTEGER,
7
+ primaryKey: true,
8
+ autoIncrement: true,
9
+ },
10
+ feedProvider: {
11
+ type: DataTypes.STRING(100),
12
+ allowNull: false,
13
+ unique: true,
14
+ field: "feed_provider",
15
+ },
16
+ requiredFields: {
17
+ type: DataTypes.JSONB,
18
+ allowNull: false,
19
+ defaultValue: [],
20
+ field: "required_fields",
21
+ comment: "Array of field configs: [{ name, description, allowedValues }]"
22
+ },
23
+ model: {
24
+ type: DataTypes.STRING(50),
25
+ allowNull: false,
26
+ defaultValue: "gpt-4o-mini",
27
+ comment: "OpenAI model to use for this feed"
28
+ },
29
+ temperature: {
30
+ type: DataTypes.FLOAT,
31
+ allowNull: false,
32
+ defaultValue: 0.7,
33
+ comment: "Temperature for AI generation (0.0-1.0)"
34
+ },
35
+ baseUrl: {
36
+ type: DataTypes.STRING(500),
37
+ allowNull: true,
38
+ field: "base_url",
39
+ },
40
+ isActive: {
41
+ type: DataTypes.BOOLEAN,
42
+ allowNull: false,
43
+ defaultValue: true,
44
+ field: "is_active",
45
+ },
46
+ createdAt: {
47
+ type: DataTypes.DATE,
48
+ allowNull: false,
49
+ defaultValue: DataTypes.NOW,
50
+ field: "created_at",
51
+ },
52
+ updatedAt: {
53
+ type: DataTypes.DATE,
54
+ allowNull: false,
55
+ defaultValue: DataTypes.NOW,
56
+ field: "updated_at",
57
+ },
58
+ },
59
+ {
60
+ tableName: "feed_article_configurations",
61
+ timestamps: true,
62
+ createdAt: "created_at",
63
+ updatedAt: "updated_at",
64
+ indexes: [
65
+ {
66
+ unique: true,
67
+ fields: ["feed_provider"],
68
+ },
69
+ {
70
+ fields: ["is_active"],
71
+ },
72
+ ],
73
+ }
74
+ );
75
+
76
+ FeedArticleConfiguration.associate = (models) => {
77
+ // Future: Add associations if needed
78
+ };
79
+
80
+ return FeedArticleConfiguration;
81
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",