@adatechnology/content-module 0.1.0 → 0.2.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.
@@ -0,0 +1,32 @@
1
+ CREATE TABLE "content"."post_former_slugs" (
2
+ "company_id" uuid NOT NULL,
3
+ "slug" varchar(120) NOT NULL,
4
+ "post_id" uuid NOT NULL,
5
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
6
+ CONSTRAINT "post_former_slugs_company_id_slug_pk" PRIMARY KEY("company_id","slug")
7
+ );
8
+ --> statement-breakpoint
9
+ CREATE TABLE "content"."recurrence_rules" (
10
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
11
+ "company_id" uuid NOT NULL,
12
+ "template_id" uuid NOT NULL,
13
+ "frequency" varchar(10) NOT NULL,
14
+ "anchor_day" integer NOT NULL,
15
+ "is_active" boolean DEFAULT true NOT NULL,
16
+ "next_run_at" timestamp with time zone NOT NULL,
17
+ "last_run_at" timestamp with time zone,
18
+ "last_post_id" uuid,
19
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
20
+ );
21
+ --> statement-breakpoint
22
+ ALTER TABLE "content"."posts" ADD COLUMN "short_id" varchar(6);--> statement-breakpoint
23
+ UPDATE "content"."posts" SET "short_id" = substr(md5("id"::text), 1, 6) WHERE "short_id" IS NULL;--> statement-breakpoint
24
+ ALTER TABLE "content"."posts" ALTER COLUMN "short_id" SET NOT NULL;--> statement-breakpoint
25
+ ALTER TABLE "content"."posts" ADD COLUMN "tag_labels" jsonb DEFAULT '{}'::jsonb NOT NULL;--> statement-breakpoint
26
+ ALTER TABLE "content"."posts" ADD COLUMN "is_template" boolean DEFAULT false NOT NULL;--> statement-breakpoint
27
+ ALTER TABLE "content"."post_former_slugs" ADD CONSTRAINT "post_former_slugs_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "content"."posts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
28
+ ALTER TABLE "content"."recurrence_rules" ADD CONSTRAINT "recurrence_rules_template_id_posts_id_fk" FOREIGN KEY ("template_id") REFERENCES "content"."posts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
29
+ CREATE INDEX "idx_recurrence_company" ON "content"."recurrence_rules" USING btree ("company_id");--> statement-breakpoint
30
+ CREATE INDEX "idx_recurrence_due" ON "content"."recurrence_rules" USING btree ("next_run_at") WHERE "is_active";--> statement-breakpoint
31
+ CREATE UNIQUE INDEX "idx_posts_company_short_id" ON "content"."posts" USING btree ("company_id","short_id");--> statement-breakpoint
32
+ CREATE INDEX "idx_posts_due" ON "content"."posts" USING btree ("published_at") WHERE "status" = 'scheduled';
@@ -0,0 +1,454 @@
1
+ {
2
+ "id": "991a2a50-c91b-493f-90ec-d697ef880107",
3
+ "prevId": "63c0d6a1-2bbe-4972-ac46-7a148d6ef377",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "content.post_former_slugs": {
8
+ "name": "post_former_slugs",
9
+ "schema": "content",
10
+ "columns": {
11
+ "company_id": {
12
+ "name": "company_id",
13
+ "type": "uuid",
14
+ "primaryKey": false,
15
+ "notNull": true
16
+ },
17
+ "slug": {
18
+ "name": "slug",
19
+ "type": "varchar(120)",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "post_id": {
24
+ "name": "post_id",
25
+ "type": "uuid",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "created_at": {
30
+ "name": "created_at",
31
+ "type": "timestamp with time zone",
32
+ "primaryKey": false,
33
+ "notNull": true,
34
+ "default": "now()"
35
+ }
36
+ },
37
+ "indexes": {},
38
+ "foreignKeys": {
39
+ "post_former_slugs_post_id_posts_id_fk": {
40
+ "name": "post_former_slugs_post_id_posts_id_fk",
41
+ "tableFrom": "post_former_slugs",
42
+ "tableTo": "posts",
43
+ "schemaTo": "content",
44
+ "columnsFrom": [
45
+ "post_id"
46
+ ],
47
+ "columnsTo": [
48
+ "id"
49
+ ],
50
+ "onDelete": "no action",
51
+ "onUpdate": "no action"
52
+ }
53
+ },
54
+ "compositePrimaryKeys": {
55
+ "post_former_slugs_company_id_slug_pk": {
56
+ "name": "post_former_slugs_company_id_slug_pk",
57
+ "columns": [
58
+ "company_id",
59
+ "slug"
60
+ ]
61
+ }
62
+ },
63
+ "uniqueConstraints": {},
64
+ "policies": {},
65
+ "checkConstraints": {},
66
+ "isRLSEnabled": false
67
+ },
68
+ "content.posts": {
69
+ "name": "posts",
70
+ "schema": "content",
71
+ "columns": {
72
+ "id": {
73
+ "name": "id",
74
+ "type": "uuid",
75
+ "primaryKey": true,
76
+ "notNull": true,
77
+ "default": "gen_random_uuid()"
78
+ },
79
+ "company_id": {
80
+ "name": "company_id",
81
+ "type": "uuid",
82
+ "primaryKey": false,
83
+ "notNull": true
84
+ },
85
+ "slug": {
86
+ "name": "slug",
87
+ "type": "varchar(120)",
88
+ "primaryKey": false,
89
+ "notNull": true
90
+ },
91
+ "short_id": {
92
+ "name": "short_id",
93
+ "type": "varchar(6)",
94
+ "primaryKey": false,
95
+ "notNull": true
96
+ },
97
+ "title": {
98
+ "name": "title",
99
+ "type": "varchar(200)",
100
+ "primaryKey": false,
101
+ "notNull": true
102
+ },
103
+ "excerpt": {
104
+ "name": "excerpt",
105
+ "type": "varchar(500)",
106
+ "primaryKey": false,
107
+ "notNull": false
108
+ },
109
+ "body": {
110
+ "name": "body",
111
+ "type": "text",
112
+ "primaryKey": false,
113
+ "notNull": true,
114
+ "default": "''"
115
+ },
116
+ "cover_image_url": {
117
+ "name": "cover_image_url",
118
+ "type": "varchar(2048)",
119
+ "primaryKey": false,
120
+ "notNull": false
121
+ },
122
+ "cover_image_alt": {
123
+ "name": "cover_image_alt",
124
+ "type": "varchar(300)",
125
+ "primaryKey": false,
126
+ "notNull": false
127
+ },
128
+ "tags": {
129
+ "name": "tags",
130
+ "type": "text[]",
131
+ "primaryKey": false,
132
+ "notNull": true,
133
+ "default": "'{}'"
134
+ },
135
+ "tag_labels": {
136
+ "name": "tag_labels",
137
+ "type": "jsonb",
138
+ "primaryKey": false,
139
+ "notNull": true,
140
+ "default": "'{}'::jsonb"
141
+ },
142
+ "status": {
143
+ "name": "status",
144
+ "type": "varchar(12)",
145
+ "primaryKey": false,
146
+ "notNull": true,
147
+ "default": "'draft'"
148
+ },
149
+ "is_template": {
150
+ "name": "is_template",
151
+ "type": "boolean",
152
+ "primaryKey": false,
153
+ "notNull": true,
154
+ "default": false
155
+ },
156
+ "published_at": {
157
+ "name": "published_at",
158
+ "type": "timestamp with time zone",
159
+ "primaryKey": false,
160
+ "notNull": false
161
+ },
162
+ "author_name": {
163
+ "name": "author_name",
164
+ "type": "varchar(120)",
165
+ "primaryKey": false,
166
+ "notNull": false
167
+ },
168
+ "seo_title": {
169
+ "name": "seo_title",
170
+ "type": "varchar(200)",
171
+ "primaryKey": false,
172
+ "notNull": false
173
+ },
174
+ "seo_description": {
175
+ "name": "seo_description",
176
+ "type": "varchar(320)",
177
+ "primaryKey": false,
178
+ "notNull": false
179
+ },
180
+ "canonical_url": {
181
+ "name": "canonical_url",
182
+ "type": "varchar(2048)",
183
+ "primaryKey": false,
184
+ "notNull": false
185
+ },
186
+ "reading_time_minutes": {
187
+ "name": "reading_time_minutes",
188
+ "type": "integer",
189
+ "primaryKey": false,
190
+ "notNull": true,
191
+ "default": 1
192
+ },
193
+ "created_at": {
194
+ "name": "created_at",
195
+ "type": "timestamp with time zone",
196
+ "primaryKey": false,
197
+ "notNull": true,
198
+ "default": "now()"
199
+ },
200
+ "updated_at": {
201
+ "name": "updated_at",
202
+ "type": "timestamp with time zone",
203
+ "primaryKey": false,
204
+ "notNull": true,
205
+ "default": "now()"
206
+ }
207
+ },
208
+ "indexes": {
209
+ "idx_posts_company_slug": {
210
+ "name": "idx_posts_company_slug",
211
+ "columns": [
212
+ {
213
+ "expression": "company_id",
214
+ "isExpression": false,
215
+ "asc": true,
216
+ "nulls": "last"
217
+ },
218
+ {
219
+ "expression": "slug",
220
+ "isExpression": false,
221
+ "asc": true,
222
+ "nulls": "last"
223
+ }
224
+ ],
225
+ "isUnique": true,
226
+ "concurrently": false,
227
+ "method": "btree",
228
+ "with": {}
229
+ },
230
+ "idx_posts_company_short_id": {
231
+ "name": "idx_posts_company_short_id",
232
+ "columns": [
233
+ {
234
+ "expression": "company_id",
235
+ "isExpression": false,
236
+ "asc": true,
237
+ "nulls": "last"
238
+ },
239
+ {
240
+ "expression": "short_id",
241
+ "isExpression": false,
242
+ "asc": true,
243
+ "nulls": "last"
244
+ }
245
+ ],
246
+ "isUnique": true,
247
+ "concurrently": false,
248
+ "method": "btree",
249
+ "with": {}
250
+ },
251
+ "idx_posts_company_status_published": {
252
+ "name": "idx_posts_company_status_published",
253
+ "columns": [
254
+ {
255
+ "expression": "company_id",
256
+ "isExpression": false,
257
+ "asc": true,
258
+ "nulls": "last"
259
+ },
260
+ {
261
+ "expression": "status",
262
+ "isExpression": false,
263
+ "asc": true,
264
+ "nulls": "last"
265
+ },
266
+ {
267
+ "expression": "published_at",
268
+ "isExpression": false,
269
+ "asc": true,
270
+ "nulls": "last"
271
+ }
272
+ ],
273
+ "isUnique": false,
274
+ "concurrently": false,
275
+ "method": "btree",
276
+ "with": {}
277
+ },
278
+ "idx_posts_tags": {
279
+ "name": "idx_posts_tags",
280
+ "columns": [
281
+ {
282
+ "expression": "tags",
283
+ "isExpression": false,
284
+ "asc": true,
285
+ "nulls": "last"
286
+ }
287
+ ],
288
+ "isUnique": false,
289
+ "concurrently": false,
290
+ "method": "gin",
291
+ "with": {}
292
+ },
293
+ "idx_posts_due": {
294
+ "name": "idx_posts_due",
295
+ "columns": [
296
+ {
297
+ "expression": "published_at",
298
+ "isExpression": false,
299
+ "asc": true,
300
+ "nulls": "last"
301
+ }
302
+ ],
303
+ "isUnique": false,
304
+ "where": "\"status\" = 'scheduled'",
305
+ "concurrently": false,
306
+ "method": "btree",
307
+ "with": {}
308
+ }
309
+ },
310
+ "foreignKeys": {},
311
+ "compositePrimaryKeys": {},
312
+ "uniqueConstraints": {},
313
+ "policies": {},
314
+ "checkConstraints": {},
315
+ "isRLSEnabled": false
316
+ },
317
+ "content.recurrence_rules": {
318
+ "name": "recurrence_rules",
319
+ "schema": "content",
320
+ "columns": {
321
+ "id": {
322
+ "name": "id",
323
+ "type": "uuid",
324
+ "primaryKey": true,
325
+ "notNull": true,
326
+ "default": "gen_random_uuid()"
327
+ },
328
+ "company_id": {
329
+ "name": "company_id",
330
+ "type": "uuid",
331
+ "primaryKey": false,
332
+ "notNull": true
333
+ },
334
+ "template_id": {
335
+ "name": "template_id",
336
+ "type": "uuid",
337
+ "primaryKey": false,
338
+ "notNull": true
339
+ },
340
+ "frequency": {
341
+ "name": "frequency",
342
+ "type": "varchar(10)",
343
+ "primaryKey": false,
344
+ "notNull": true
345
+ },
346
+ "anchor_day": {
347
+ "name": "anchor_day",
348
+ "type": "integer",
349
+ "primaryKey": false,
350
+ "notNull": true
351
+ },
352
+ "is_active": {
353
+ "name": "is_active",
354
+ "type": "boolean",
355
+ "primaryKey": false,
356
+ "notNull": true,
357
+ "default": true
358
+ },
359
+ "next_run_at": {
360
+ "name": "next_run_at",
361
+ "type": "timestamp with time zone",
362
+ "primaryKey": false,
363
+ "notNull": true
364
+ },
365
+ "last_run_at": {
366
+ "name": "last_run_at",
367
+ "type": "timestamp with time zone",
368
+ "primaryKey": false,
369
+ "notNull": false
370
+ },
371
+ "last_post_id": {
372
+ "name": "last_post_id",
373
+ "type": "uuid",
374
+ "primaryKey": false,
375
+ "notNull": false
376
+ },
377
+ "created_at": {
378
+ "name": "created_at",
379
+ "type": "timestamp with time zone",
380
+ "primaryKey": false,
381
+ "notNull": true,
382
+ "default": "now()"
383
+ }
384
+ },
385
+ "indexes": {
386
+ "idx_recurrence_company": {
387
+ "name": "idx_recurrence_company",
388
+ "columns": [
389
+ {
390
+ "expression": "company_id",
391
+ "isExpression": false,
392
+ "asc": true,
393
+ "nulls": "last"
394
+ }
395
+ ],
396
+ "isUnique": false,
397
+ "concurrently": false,
398
+ "method": "btree",
399
+ "with": {}
400
+ },
401
+ "idx_recurrence_due": {
402
+ "name": "idx_recurrence_due",
403
+ "columns": [
404
+ {
405
+ "expression": "next_run_at",
406
+ "isExpression": false,
407
+ "asc": true,
408
+ "nulls": "last"
409
+ }
410
+ ],
411
+ "isUnique": false,
412
+ "where": "\"is_active\"",
413
+ "concurrently": false,
414
+ "method": "btree",
415
+ "with": {}
416
+ }
417
+ },
418
+ "foreignKeys": {
419
+ "recurrence_rules_template_id_posts_id_fk": {
420
+ "name": "recurrence_rules_template_id_posts_id_fk",
421
+ "tableFrom": "recurrence_rules",
422
+ "tableTo": "posts",
423
+ "schemaTo": "content",
424
+ "columnsFrom": [
425
+ "template_id"
426
+ ],
427
+ "columnsTo": [
428
+ "id"
429
+ ],
430
+ "onDelete": "no action",
431
+ "onUpdate": "no action"
432
+ }
433
+ },
434
+ "compositePrimaryKeys": {},
435
+ "uniqueConstraints": {},
436
+ "policies": {},
437
+ "checkConstraints": {},
438
+ "isRLSEnabled": false
439
+ }
440
+ },
441
+ "enums": {},
442
+ "schemas": {
443
+ "content": "content"
444
+ },
445
+ "sequences": {},
446
+ "roles": {},
447
+ "policies": {},
448
+ "views": {},
449
+ "_meta": {
450
+ "columns": {},
451
+ "schemas": {},
452
+ "tables": {}
453
+ }
454
+ }
@@ -8,6 +8,13 @@
8
8
  "when": 1795646336276,
9
9
  "tag": "0000_posts",
10
10
  "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1795729369460,
16
+ "tag": "0001_scheduling",
17
+ "breakpoints": true
11
18
  }
12
19
  ]
13
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adatechnology/content-module",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Stateful content (blog/news posts) module — schema, migrations, repositories, use-cases, admin and public routes, RSS/Atom and sitemap",
6
6
  "publishConfig": {
@@ -36,8 +36,8 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "zod": "^3.24.1",
39
- "@adatechnology/module-http": "0.2.0",
40
- "@adatechnology/content-contracts": "0.1.0"
39
+ "@adatechnology/content-contracts": "0.2.0",
40
+ "@adatechnology/module-http": "0.2.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/bun": "1.3.14",