@s-hirano-ist/s-core 1.6.0 → 1.7.1
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/dist/articles/entities/article-entity.d.ts +30 -99
- package/dist/articles/entities/article-entity.d.ts.map +1 -1
- package/dist/articles/entities/article-entity.js +1 -67
- package/dist/articles/entities/article-entity.js.map +1 -1
- package/dist/articles/index.d.ts +1 -0
- package/dist/articles/index.d.ts.map +1 -1
- package/dist/articles/index.js +1 -0
- package/dist/articles/index.js.map +1 -1
- package/dist/articles/repositories/articles-command-repository.interface.d.ts +4 -0
- package/dist/articles/repositories/articles-command-repository.interface.d.ts.map +1 -1
- package/dist/articles/services/articles-batch-domain-service.d.ts +82 -0
- package/dist/articles/services/articles-batch-domain-service.d.ts.map +1 -0
- package/dist/articles/services/articles-batch-domain-service.js +91 -0
- package/dist/articles/services/articles-batch-domain-service.js.map +1 -0
- package/dist/books/entities/books-entity.d.ts +34 -104
- package/dist/books/entities/books-entity.d.ts.map +1 -1
- package/dist/books/entities/books-entity.js +1 -67
- package/dist/books/entities/books-entity.js.map +1 -1
- package/dist/books/index.d.ts +1 -0
- package/dist/books/index.d.ts.map +1 -1
- package/dist/books/index.js +1 -0
- package/dist/books/index.js.map +1 -1
- package/dist/books/repositories/books-command-repository.interface.d.ts +4 -0
- package/dist/books/repositories/books-command-repository.interface.d.ts.map +1 -1
- package/dist/books/services/books-batch-domain-service.d.ts +36 -0
- package/dist/books/services/books-batch-domain-service.d.ts.map +1 -0
- package/dist/books/services/books-batch-domain-service.js +49 -0
- package/dist/books/services/books-batch-domain-service.js.map +1 -0
- package/dist/common/entities/common-entity.d.ts +8 -20
- package/dist/common/entities/common-entity.d.ts.map +1 -1
- package/dist/common/entities/common-entity.js +2 -14
- package/dist/common/entities/common-entity.js.map +1 -1
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +2 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/repositories/batch-command-repository.interface.d.ts +93 -0
- package/dist/common/repositories/batch-command-repository.interface.d.ts.map +1 -0
- package/dist/common/repositories/batch-command-repository.interface.js +2 -0
- package/dist/common/repositories/batch-command-repository.interface.js.map +1 -0
- package/dist/images/entities/image-entity.d.ts +27 -101
- package/dist/images/entities/image-entity.d.ts.map +1 -1
- package/dist/images/entities/image-entity.js +1 -67
- package/dist/images/entities/image-entity.js.map +1 -1
- package/dist/images/index.d.ts +1 -0
- package/dist/images/index.d.ts.map +1 -1
- package/dist/images/index.js +1 -0
- package/dist/images/index.js.map +1 -1
- package/dist/images/repositories/images-command-repository.interface.d.ts +4 -0
- package/dist/images/repositories/images-command-repository.interface.d.ts.map +1 -1
- package/dist/images/services/images-batch-domain-service.d.ts +36 -0
- package/dist/images/services/images-batch-domain-service.d.ts.map +1 -0
- package/dist/images/services/images-batch-domain-service.js +49 -0
- package/dist/images/services/images-batch-domain-service.js.map +1 -0
- package/dist/notes/entities/note-entity.d.ts +13 -76
- package/dist/notes/entities/note-entity.d.ts.map +1 -1
- package/dist/notes/entities/note-entity.js +1 -67
- package/dist/notes/entities/note-entity.js.map +1 -1
- package/dist/notes/index.d.ts +1 -0
- package/dist/notes/index.d.ts.map +1 -1
- package/dist/notes/index.js +1 -0
- package/dist/notes/index.js.map +1 -1
- package/dist/notes/repositories/notes-command-repository.interface.d.ts +4 -0
- package/dist/notes/repositories/notes-command-repository.interface.d.ts.map +1 -1
- package/dist/notes/services/notes-batch-domain-service.d.ts +36 -0
- package/dist/notes/services/notes-batch-domain-service.d.ts.map +1 -0
- package/dist/notes/services/notes-batch-domain-service.js +49 -0
- package/dist/notes/services/notes-batch-domain-service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ import { UserId } from "../../common/entities/common-entity.js";
|
|
|
14
14
|
*
|
|
15
15
|
* @see {@link makeCategoryName} for factory function
|
|
16
16
|
*/
|
|
17
|
-
export declare const CategoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
|
|
17
|
+
export declare const CategoryName: z.core.$ZodBranded<z.ZodString, "CategoryName", "out">;
|
|
18
18
|
/**
|
|
19
19
|
* Branded type for validated category names.
|
|
20
20
|
*/
|
|
@@ -45,7 +45,7 @@ export declare const makeCategoryName: (v: string) => CategoryName;
|
|
|
45
45
|
*
|
|
46
46
|
* @see {@link makeArticleTitle} for factory function
|
|
47
47
|
*/
|
|
48
|
-
export declare const ArticleTitle: z.core.$ZodBranded<z.ZodString, "ArticleTitle">;
|
|
48
|
+
export declare const ArticleTitle: z.core.$ZodBranded<z.ZodString, "ArticleTitle", "out">;
|
|
49
49
|
/**
|
|
50
50
|
* Branded type for validated article titles.
|
|
51
51
|
*/
|
|
@@ -78,7 +78,7 @@ export declare const makeArticleTitle: (v: string) => ArticleTitle;
|
|
|
78
78
|
*
|
|
79
79
|
* @see {@link makeQuote} for factory function
|
|
80
80
|
*/
|
|
81
|
-
export declare const Quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote">;
|
|
81
|
+
export declare const Quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote", "out">;
|
|
82
82
|
/**
|
|
83
83
|
* Branded type for validated quotes.
|
|
84
84
|
*/
|
|
@@ -111,7 +111,7 @@ export declare const makeQuote: (v: string | null | undefined) => Quote;
|
|
|
111
111
|
*
|
|
112
112
|
* @see {@link makeUrl} for factory function
|
|
113
113
|
*/
|
|
114
|
-
export declare const Url: z.core.$ZodBranded<z.ZodURL, "Url">;
|
|
114
|
+
export declare const Url: z.core.$ZodBranded<z.ZodURL, "Url", "out">;
|
|
115
115
|
/**
|
|
116
116
|
* Branded type for validated URLs.
|
|
117
117
|
*/
|
|
@@ -138,7 +138,7 @@ export declare const makeUrl: (v: string) => Url;
|
|
|
138
138
|
*
|
|
139
139
|
* @see {@link makeOgTitle} for factory function
|
|
140
140
|
*/
|
|
141
|
-
export declare const OgTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle">;
|
|
141
|
+
export declare const OgTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle", "out">;
|
|
142
142
|
/**
|
|
143
143
|
* Branded type for validated OG titles.
|
|
144
144
|
*/
|
|
@@ -159,7 +159,7 @@ export declare const makeOgTitle: (v: string | null | undefined) => OgTitle;
|
|
|
159
159
|
*
|
|
160
160
|
* @see {@link makeOgDescription} for factory function
|
|
161
161
|
*/
|
|
162
|
-
export declare const OgDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription">;
|
|
162
|
+
export declare const OgDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription", "out">;
|
|
163
163
|
/**
|
|
164
164
|
* Branded type for validated OG descriptions.
|
|
165
165
|
*/
|
|
@@ -180,7 +180,7 @@ export declare const makeOgDescription: (v: string | null | undefined) => OgDesc
|
|
|
180
180
|
*
|
|
181
181
|
* @see {@link makeOgImageUrl} for factory function
|
|
182
182
|
*/
|
|
183
|
-
export declare const OgImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
|
|
183
|
+
export declare const OgImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl", "out">;
|
|
184
184
|
/**
|
|
185
185
|
* Branded type for validated OG image URLs.
|
|
186
186
|
*/
|
|
@@ -202,17 +202,17 @@ export declare const makeOgImageUrl: (v: string | null | undefined) => OgImageUr
|
|
|
202
202
|
* @see {@link ExportedArticle} for the published state
|
|
203
203
|
*/
|
|
204
204
|
export declare const UnexportedArticle: z.ZodObject<{
|
|
205
|
-
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
206
|
-
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
207
|
-
categoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
|
|
208
|
-
categoryId: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
209
|
-
title: z.core.$ZodBranded<z.ZodString, "ArticleTitle">;
|
|
210
|
-
quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote">;
|
|
211
|
-
url: z.core.$ZodBranded<z.ZodURL, "Url">;
|
|
212
|
-
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
213
|
-
ogTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle">;
|
|
214
|
-
ogDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription">;
|
|
215
|
-
ogImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
|
|
205
|
+
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id", "out">;
|
|
206
|
+
userId: z.core.$ZodBranded<z.ZodString, "UserId", "out">;
|
|
207
|
+
categoryName: z.core.$ZodBranded<z.ZodString, "CategoryName", "out">;
|
|
208
|
+
categoryId: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id", "out">;
|
|
209
|
+
title: z.core.$ZodBranded<z.ZodString, "ArticleTitle", "out">;
|
|
210
|
+
quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote", "out">;
|
|
211
|
+
url: z.core.$ZodBranded<z.ZodURL, "Url", "out">;
|
|
212
|
+
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt", "out">;
|
|
213
|
+
ogTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle", "out">;
|
|
214
|
+
ogDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription", "out">;
|
|
215
|
+
ogImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl", "out">;
|
|
216
216
|
status: z.ZodLiteral<"UNEXPORTED">;
|
|
217
217
|
}, z.core.$strip>;
|
|
218
218
|
/**
|
|
@@ -232,19 +232,19 @@ export type UnexportedArticle = Readonly<z.infer<typeof UnexportedArticle>>;
|
|
|
232
232
|
* @see {@link UnexportedArticle} for the initial state
|
|
233
233
|
*/
|
|
234
234
|
export declare const ExportedArticle: z.ZodObject<{
|
|
235
|
-
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
236
|
-
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
237
|
-
categoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
|
|
238
|
-
categoryId: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
239
|
-
title: z.core.$ZodBranded<z.ZodString, "ArticleTitle">;
|
|
240
|
-
quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote">;
|
|
241
|
-
url: z.core.$ZodBranded<z.ZodURL, "Url">;
|
|
242
|
-
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
243
|
-
ogTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle">;
|
|
244
|
-
ogDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription">;
|
|
245
|
-
ogImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
|
|
235
|
+
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id", "out">;
|
|
236
|
+
userId: z.core.$ZodBranded<z.ZodString, "UserId", "out">;
|
|
237
|
+
categoryName: z.core.$ZodBranded<z.ZodString, "CategoryName", "out">;
|
|
238
|
+
categoryId: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id", "out">;
|
|
239
|
+
title: z.core.$ZodBranded<z.ZodString, "ArticleTitle", "out">;
|
|
240
|
+
quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote", "out">;
|
|
241
|
+
url: z.core.$ZodBranded<z.ZodURL, "Url", "out">;
|
|
242
|
+
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt", "out">;
|
|
243
|
+
ogTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle", "out">;
|
|
244
|
+
ogDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription", "out">;
|
|
245
|
+
ogImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl", "out">;
|
|
246
246
|
status: z.ZodLiteral<"EXPORTED">;
|
|
247
|
-
exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt">;
|
|
247
|
+
exportedAt: z.core.$ZodBranded<z.ZodDate, "ExportedAt", "out">;
|
|
248
248
|
}, z.core.$strip>;
|
|
249
249
|
/**
|
|
250
250
|
* Type for an exported article entity.
|
|
@@ -253,38 +253,6 @@ export declare const ExportedArticle: z.ZodObject<{
|
|
|
253
253
|
* Immutable entity representing a published article.
|
|
254
254
|
*/
|
|
255
255
|
export type ExportedArticle = Readonly<z.infer<typeof ExportedArticle>>;
|
|
256
|
-
/**
|
|
257
|
-
* Zod schema for an article marked for export in the current batch.
|
|
258
|
-
*
|
|
259
|
-
* @remarks
|
|
260
|
-
* Represents an article that has been marked for export but not yet finalized.
|
|
261
|
-
* This intermediate state allows for batch processing with revert capability.
|
|
262
|
-
*
|
|
263
|
-
* @see {@link UnexportedArticle} for the initial state
|
|
264
|
-
* @see {@link ExportedArticle} for the final state
|
|
265
|
-
*/
|
|
266
|
-
export declare const LastUpdatedArticle: z.ZodObject<{
|
|
267
|
-
id: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
268
|
-
userId: z.core.$ZodBranded<z.ZodString, "UserId">;
|
|
269
|
-
categoryName: z.core.$ZodBranded<z.ZodString, "CategoryName">;
|
|
270
|
-
categoryId: z.core.$ZodBranded<z.ZodDefault<z.ZodUUID>, "Id">;
|
|
271
|
-
title: z.core.$ZodBranded<z.ZodString, "ArticleTitle">;
|
|
272
|
-
quote: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "Quote">;
|
|
273
|
-
url: z.core.$ZodBranded<z.ZodURL, "Url">;
|
|
274
|
-
createdAt: z.core.$ZodBranded<z.ZodDate, "CreatedAt">;
|
|
275
|
-
ogTitle: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgTitle">;
|
|
276
|
-
ogDescription: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgDescription">;
|
|
277
|
-
ogImageUrl: z.core.$ZodBranded<z.ZodOptional<z.ZodNullable<z.ZodString>>, "OgImageUrl">;
|
|
278
|
-
status: z.ZodLiteral<"LAST_UPDATED">;
|
|
279
|
-
}, z.core.$strip>;
|
|
280
|
-
/**
|
|
281
|
-
* Type for an article marked for export.
|
|
282
|
-
*
|
|
283
|
-
* @remarks
|
|
284
|
-
* Immutable entity representing an article in the current export batch.
|
|
285
|
-
* Can be reverted back to UnexportedArticle or finalized to ExportedArticle.
|
|
286
|
-
*/
|
|
287
|
-
export type LastUpdatedArticle = Readonly<z.infer<typeof LastUpdatedArticle>>;
|
|
288
256
|
/**
|
|
289
257
|
* Arguments for creating a new article.
|
|
290
258
|
*
|
|
@@ -357,42 +325,5 @@ export declare const articleEntity: {
|
|
|
357
325
|
* @throws {UnexpectedError} For unexpected errors during export
|
|
358
326
|
*/
|
|
359
327
|
export: (article: UnexportedArticle) => ExportedArticle;
|
|
360
|
-
/**
|
|
361
|
-
* Marks an article for export in the current batch.
|
|
362
|
-
*
|
|
363
|
-
* @remarks
|
|
364
|
-
* Transitions from UNEXPORTED to LAST_UPDATED status.
|
|
365
|
-
* This allows for batch processing with revert capability.
|
|
366
|
-
*
|
|
367
|
-
* @param article - The unexported article to mark
|
|
368
|
-
* @returns A frozen LastUpdatedArticle
|
|
369
|
-
* @throws {InvalidFormatError} When the article state is invalid
|
|
370
|
-
* @throws {UnexpectedError} For unexpected errors
|
|
371
|
-
*/
|
|
372
|
-
markAsLastUpdated: (article: UnexportedArticle) => LastUpdatedArticle;
|
|
373
|
-
/**
|
|
374
|
-
* Reverts an article from LAST_UPDATED back to UNEXPORTED.
|
|
375
|
-
*
|
|
376
|
-
* @remarks
|
|
377
|
-
* Use this when batch processing fails and needs to be rolled back.
|
|
378
|
-
*
|
|
379
|
-
* @param article - The last updated article to revert
|
|
380
|
-
* @returns A frozen UnexportedArticle
|
|
381
|
-
* @throws {InvalidFormatError} When the article state is invalid
|
|
382
|
-
* @throws {UnexpectedError} For unexpected errors
|
|
383
|
-
*/
|
|
384
|
-
revert: (article: LastUpdatedArticle) => UnexportedArticle;
|
|
385
|
-
/**
|
|
386
|
-
* Finalizes an article from LAST_UPDATED to EXPORTED.
|
|
387
|
-
*
|
|
388
|
-
* @remarks
|
|
389
|
-
* Use this after batch processing succeeds to confirm the export.
|
|
390
|
-
*
|
|
391
|
-
* @param article - The last updated article to finalize
|
|
392
|
-
* @returns A frozen ExportedArticle with exportedAt timestamp
|
|
393
|
-
* @throws {InvalidFormatError} When the article state is invalid
|
|
394
|
-
* @throws {UnexpectedError} For unexpected errors
|
|
395
|
-
*/
|
|
396
|
-
finalize: (article: LastUpdatedArticle) => ExportedArticle;
|
|
397
328
|
};
|
|
398
329
|
//# sourceMappingURL=article-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article-entity.d.ts","sourceRoot":"","sources":["../../../articles/entities/article-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"article-entity.d.ts","sourceRoot":"","sources":["../../../articles/entities/article-entity.ts"],"names":[],"mappings":"AAAA,OAAO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AAE,KAAK,CAAC;IACd,sBAAsB;IACtB,GAAG,EAAE,GAAG,CAAC;CACT,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa;IACzB;;;;;;;OAOG;mBACY,iBAAiB,KAAG,iBAAiB;IAYpD;;;;;;;OAOG;sBACe,iBAAiB,KAAG,eAAe;CASrD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { CreatedAt, ExportedStatus, Id,
|
|
2
|
+
import { CreatedAt, ExportedStatus, Id, makeCreatedAt, makeExportedStatus, makeId, UnexportedStatus, UserId, } from "../../common/entities/common-entity.js";
|
|
3
3
|
import { createEntityWithErrorHandling } from "../../common/services/entity-factory.js";
|
|
4
4
|
// Value objects
|
|
5
5
|
/**
|
|
@@ -239,17 +239,6 @@ export const UnexportedArticle = Base.extend({ status: UnexportedStatus });
|
|
|
239
239
|
* @see {@link UnexportedArticle} for the initial state
|
|
240
240
|
*/
|
|
241
241
|
export const ExportedArticle = Base.extend(ExportedStatus.shape);
|
|
242
|
-
/**
|
|
243
|
-
* Zod schema for an article marked for export in the current batch.
|
|
244
|
-
*
|
|
245
|
-
* @remarks
|
|
246
|
-
* Represents an article that has been marked for export but not yet finalized.
|
|
247
|
-
* This intermediate state allows for batch processing with revert capability.
|
|
248
|
-
*
|
|
249
|
-
* @see {@link UnexportedArticle} for the initial state
|
|
250
|
-
* @see {@link ExportedArticle} for the final state
|
|
251
|
-
*/
|
|
252
|
-
export const LastUpdatedArticle = Base.extend({ status: LastUpdatedStatus });
|
|
253
242
|
/**
|
|
254
243
|
* Factory object for Article domain entity operations.
|
|
255
244
|
*
|
|
@@ -308,60 +297,5 @@ export const articleEntity = {
|
|
|
308
297
|
});
|
|
309
298
|
});
|
|
310
299
|
},
|
|
311
|
-
/**
|
|
312
|
-
* Marks an article for export in the current batch.
|
|
313
|
-
*
|
|
314
|
-
* @remarks
|
|
315
|
-
* Transitions from UNEXPORTED to LAST_UPDATED status.
|
|
316
|
-
* This allows for batch processing with revert capability.
|
|
317
|
-
*
|
|
318
|
-
* @param article - The unexported article to mark
|
|
319
|
-
* @returns A frozen LastUpdatedArticle
|
|
320
|
-
* @throws {InvalidFormatError} When the article state is invalid
|
|
321
|
-
* @throws {UnexpectedError} For unexpected errors
|
|
322
|
-
*/
|
|
323
|
-
markAsLastUpdated: (article) => {
|
|
324
|
-
return createEntityWithErrorHandling(() => Object.freeze({
|
|
325
|
-
...article,
|
|
326
|
-
status: "LAST_UPDATED",
|
|
327
|
-
}));
|
|
328
|
-
},
|
|
329
|
-
/**
|
|
330
|
-
* Reverts an article from LAST_UPDATED back to UNEXPORTED.
|
|
331
|
-
*
|
|
332
|
-
* @remarks
|
|
333
|
-
* Use this when batch processing fails and needs to be rolled back.
|
|
334
|
-
*
|
|
335
|
-
* @param article - The last updated article to revert
|
|
336
|
-
* @returns A frozen UnexportedArticle
|
|
337
|
-
* @throws {InvalidFormatError} When the article state is invalid
|
|
338
|
-
* @throws {UnexpectedError} For unexpected errors
|
|
339
|
-
*/
|
|
340
|
-
revert: (article) => {
|
|
341
|
-
return createEntityWithErrorHandling(() => Object.freeze({
|
|
342
|
-
...article,
|
|
343
|
-
status: "UNEXPORTED",
|
|
344
|
-
}));
|
|
345
|
-
},
|
|
346
|
-
/**
|
|
347
|
-
* Finalizes an article from LAST_UPDATED to EXPORTED.
|
|
348
|
-
*
|
|
349
|
-
* @remarks
|
|
350
|
-
* Use this after batch processing succeeds to confirm the export.
|
|
351
|
-
*
|
|
352
|
-
* @param article - The last updated article to finalize
|
|
353
|
-
* @returns A frozen ExportedArticle with exportedAt timestamp
|
|
354
|
-
* @throws {InvalidFormatError} When the article state is invalid
|
|
355
|
-
* @throws {UnexpectedError} For unexpected errors
|
|
356
|
-
*/
|
|
357
|
-
finalize: (article) => {
|
|
358
|
-
return createEntityWithErrorHandling(() => {
|
|
359
|
-
const exportedStatus = makeExportedStatus();
|
|
360
|
-
return Object.freeze({
|
|
361
|
-
...article,
|
|
362
|
-
...exportedStatus,
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
},
|
|
366
300
|
};
|
|
367
301
|
//# sourceMappingURL=article-entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article-entity.js","sourceRoot":"","sources":["../../../articles/entities/article-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACN,SAAS,EACT,cAAc,EACd,EAAE,EACF,
|
|
1
|
+
{"version":3,"file":"article-entity.js","sourceRoot":"","sources":["../../../articles/entities/article-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACN,SAAS,EACT,cAAc,EACd,EAAE,EACF,aAAa,EACb,kBAAkB,EAClB,MAAM,EACN,gBAAgB,EAChB,MAAM,GACN,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AAExF,gBAAgB;AAEhB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC3B,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;KAC/B,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;KAC/B,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KAC/B,KAAK,EAAkB,CAAC;AAO1B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAS,EAAgB,EAAE,CAC3D,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEvB;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC3B,MAAM,CAAC,EAAE,OAAO,EAAE,UA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UAAU,EAAE,UAAU;CACtB,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC;AAU3E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAyCjE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC5B;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,IAAuB,EAAqB,EAAE;QACtD,OAAO,6BAA6B,CAAC,GAAG,EAAE,CACzC,MAAM,CAAC,MAAM,CAAC;YACb,EAAE,EAAE,MAAM,EAAE;YACZ,MAAM,EAAE,YAAY;YACpB,UAAU,EAAE,MAAM,EAAE;YACpB,SAAS,EAAE,aAAa,EAAE;YAC1B,GAAG,IAAI;SACP,CAAC,CACF,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC,OAA0B,EAAmB,EAAE;QACvD,OAAO,6BAA6B,CAAC,GAAG,EAAE;YACzC,MAAM,cAAc,GAAG,kBAAkB,EAAE,CAAC;YAC5C,OAAO,MAAM,CAAC,MAAM,CAAC;gBACpB,GAAG,OAAO;gBACV,GAAG,cAAc;aACjB,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAC"}
|
package/dist/articles/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from "./events/article-deleted-event.js";
|
|
|
37
37
|
export * from "./repositories/articles-command-repository.interface.js";
|
|
38
38
|
export * from "./repositories/articles-query-repository.interface.js";
|
|
39
39
|
export * from "./repositories/category-query-repository.interface.js";
|
|
40
|
+
export * from "./services/articles-batch-domain-service.js";
|
|
40
41
|
export * from "./services/articles-domain-service.js";
|
|
41
42
|
export * from "./types/cache-strategy.js";
|
|
42
43
|
export * from "./types/query-params.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../articles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,cAAc,8BAA8B,CAAC;AAG7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAGlD,cAAc,yDAAyD,CAAC;AACxE,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC;AAGtE,cAAc,uCAAuC,CAAC;AAGtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../articles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,cAAc,8BAA8B,CAAC;AAG7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAGlD,cAAc,yDAAyD,CAAC;AACxE,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC;AAGtE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AAGtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
package/dist/articles/index.js
CHANGED
|
@@ -41,6 +41,7 @@ export * from "./repositories/articles-command-repository.interface.js";
|
|
|
41
41
|
export * from "./repositories/articles-query-repository.interface.js";
|
|
42
42
|
export * from "./repositories/category-query-repository.interface.js";
|
|
43
43
|
// Services
|
|
44
|
+
export * from "./services/articles-batch-domain-service.js";
|
|
44
45
|
export * from "./services/articles-domain-service.js";
|
|
45
46
|
// Types
|
|
46
47
|
export * from "./types/cache-strategy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../articles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,WAAW;AACX,cAAc,8BAA8B,CAAC;AAE7C,SAAS;AACT,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAElD,eAAe;AACf,cAAc,yDAAyD,CAAC;AACxE,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC;AAEtE,WAAW;AACX,cAAc,uCAAuC,CAAC;AAEtD,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../articles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,WAAW;AACX,cAAc,8BAA8B,CAAC;AAE7C,SAAS;AACT,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAElD,eAAe;AACf,cAAc,yDAAyD,CAAC;AACxE,cAAc,uDAAuD,CAAC;AACtE,cAAc,uDAAuD,CAAC;AAEtE,WAAW;AACX,cAAc,6CAA6C,CAAC;AAC5D,cAAc,uCAAuC,CAAC;AAEtD,QAAQ;AACR,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC"}
|
|
@@ -7,6 +7,9 @@ import type { UnexportedArticle } from "../entities/article-entity.js";
|
|
|
7
7
|
* Follows the CQRS pattern - this interface handles write operations only.
|
|
8
8
|
* Implementations should be provided by the infrastructure layer (e.g., Prisma).
|
|
9
9
|
*
|
|
10
|
+
* For batch operations (bulkUpdateStatus), use {@link IBatchCommandRepository}
|
|
11
|
+
* from the common module directly.
|
|
12
|
+
*
|
|
10
13
|
* @example
|
|
11
14
|
* ```typescript
|
|
12
15
|
* // Infrastructure implementation
|
|
@@ -24,6 +27,7 @@ import type { UnexportedArticle } from "../entities/article-entity.js";
|
|
|
24
27
|
* ```
|
|
25
28
|
*
|
|
26
29
|
* @see {@link IArticlesQueryRepository} for read operations
|
|
30
|
+
* @see {@link IBatchCommandRepository} for batch operations
|
|
27
31
|
*/
|
|
28
32
|
export type IArticlesCommandRepository = {
|
|
29
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"articles-command-repository.interface.d.ts","sourceRoot":"","sources":["../../../articles/repositories/articles-command-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,EAAE,EACF,MAAM,EACN,MAAM,EACN,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE
|
|
1
|
+
{"version":3,"file":"articles-command-repository.interface.d.ts","sourceRoot":"","sources":["../../../articles/repositories/articles-command-repository.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,EAAE,EACF,MAAM,EACN,MAAM,EACN,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACxC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/C;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type UserId } from "../../common/entities/common-entity.js";
|
|
2
|
+
import type { BulkUpdateResult, IBatchCommandRepository } from "../../common/repositories/batch-command-repository.interface.js";
|
|
3
|
+
/**
|
|
4
|
+
* Result of the reset operation.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Contains the count of articles that were finalized (LAST_UPDATED -> EXPORTED)
|
|
8
|
+
* and marked (UNEXPORTED -> LAST_UPDATED).
|
|
9
|
+
*/
|
|
10
|
+
export type ResetResult = {
|
|
11
|
+
/** Number of articles finalized from LAST_UPDATED to EXPORTED */
|
|
12
|
+
finalized: BulkUpdateResult;
|
|
13
|
+
/** Number of articles marked from UNEXPORTED to LAST_UPDATED */
|
|
14
|
+
marked: BulkUpdateResult;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Domain service for batch operations on Articles.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* Encapsulates the business logic for batch status transitions.
|
|
21
|
+
* Manages the state machine for article lifecycle:
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
* UNEXPORTED --> LAST_UPDATED --> EXPORTED
|
|
25
|
+
* |
|
|
26
|
+
* v
|
|
27
|
+
* UNEXPORTED (revert)
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const commandRepo = createArticlesCommandRepository(prisma);
|
|
33
|
+
* const batchService = new ArticlesBatchDomainService(commandRepo);
|
|
34
|
+
*
|
|
35
|
+
* // Reset: finalize previous batch and mark new items
|
|
36
|
+
* const result = await batchService.resetArticles(userId);
|
|
37
|
+
* console.log(`Finalized: ${result.finalized.count}, Marked: ${result.marked.count}`);
|
|
38
|
+
*
|
|
39
|
+
* // Revert: undo the marking if something went wrong
|
|
40
|
+
* const revertResult = await batchService.revertArticles(userId);
|
|
41
|
+
* console.log(`Reverted: ${revertResult.count}`);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @see {@link IBatchCommandRepository} for repository interface
|
|
45
|
+
* @see {@link ResetResult} for reset operation result
|
|
46
|
+
*/
|
|
47
|
+
export declare class ArticlesBatchDomainService {
|
|
48
|
+
private readonly commandRepository;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new ArticlesBatchDomainService instance.
|
|
51
|
+
*
|
|
52
|
+
* @param commandRepository - The command repository for batch updates
|
|
53
|
+
*/
|
|
54
|
+
constructor(commandRepository: IBatchCommandRepository);
|
|
55
|
+
/**
|
|
56
|
+
* Resets articles for a new batch export.
|
|
57
|
+
*
|
|
58
|
+
* @param userId - The user ID for tenant isolation
|
|
59
|
+
* @returns The result containing finalized and marked counts
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* Performs two operations in sequence:
|
|
63
|
+
* 1. Finalize: LAST_UPDATED -> EXPORTED (complete previous batch)
|
|
64
|
+
* 2. Mark: UNEXPORTED -> LAST_UPDATED (prepare current batch)
|
|
65
|
+
*
|
|
66
|
+
* This operation should be wrapped in a transaction by the caller
|
|
67
|
+
* to ensure atomicity.
|
|
68
|
+
*/
|
|
69
|
+
resetArticles(userId: UserId): Promise<ResetResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Reverts articles from LAST_UPDATED back to UNEXPORTED.
|
|
72
|
+
*
|
|
73
|
+
* @param userId - The user ID for tenant isolation
|
|
74
|
+
* @returns The result containing the count of reverted articles
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* Used to undo a batch marking if something went wrong.
|
|
78
|
+
* Only affects articles in LAST_UPDATED status.
|
|
79
|
+
*/
|
|
80
|
+
revertArticles(userId: UserId): Promise<BulkUpdateResult>;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=articles-batch-domain-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articles-batch-domain-service.d.ts","sourceRoot":"","sources":["../../../articles/services/articles-batch-domain-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,MAAM,EACX,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EACX,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,iEAAiE,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACzB,iEAAiE;IACjE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,gEAAgE;IAChE,MAAM,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,0BAA0B;IAM1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAL9C;;;;OAIG;gBAC0B,iBAAiB,EAAE,uBAAuB;IAEvE;;;;;;;;;;;;;OAaG;IACU,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAmBhE;;;;;;;;;OASG;IACU,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAOtE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { makeExportedAt, } from "../../common/entities/common-entity.js";
|
|
2
|
+
/**
|
|
3
|
+
* Domain service for batch operations on Articles.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Encapsulates the business logic for batch status transitions.
|
|
7
|
+
* Manages the state machine for article lifecycle:
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* UNEXPORTED --> LAST_UPDATED --> EXPORTED
|
|
11
|
+
* |
|
|
12
|
+
* v
|
|
13
|
+
* UNEXPORTED (revert)
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const commandRepo = createArticlesCommandRepository(prisma);
|
|
19
|
+
* const batchService = new ArticlesBatchDomainService(commandRepo);
|
|
20
|
+
*
|
|
21
|
+
* // Reset: finalize previous batch and mark new items
|
|
22
|
+
* const result = await batchService.resetArticles(userId);
|
|
23
|
+
* console.log(`Finalized: ${result.finalized.count}, Marked: ${result.marked.count}`);
|
|
24
|
+
*
|
|
25
|
+
* // Revert: undo the marking if something went wrong
|
|
26
|
+
* const revertResult = await batchService.revertArticles(userId);
|
|
27
|
+
* console.log(`Reverted: ${revertResult.count}`);
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @see {@link IBatchCommandRepository} for repository interface
|
|
31
|
+
* @see {@link ResetResult} for reset operation result
|
|
32
|
+
*/
|
|
33
|
+
export class ArticlesBatchDomainService {
|
|
34
|
+
commandRepository;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new ArticlesBatchDomainService instance.
|
|
37
|
+
*
|
|
38
|
+
* @param commandRepository - The command repository for batch updates
|
|
39
|
+
*/
|
|
40
|
+
constructor(commandRepository) {
|
|
41
|
+
this.commandRepository = commandRepository;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resets articles for a new batch export.
|
|
45
|
+
*
|
|
46
|
+
* @param userId - The user ID for tenant isolation
|
|
47
|
+
* @returns The result containing finalized and marked counts
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* Performs two operations in sequence:
|
|
51
|
+
* 1. Finalize: LAST_UPDATED -> EXPORTED (complete previous batch)
|
|
52
|
+
* 2. Mark: UNEXPORTED -> LAST_UPDATED (prepare current batch)
|
|
53
|
+
*
|
|
54
|
+
* This operation should be wrapped in a transaction by the caller
|
|
55
|
+
* to ensure atomicity.
|
|
56
|
+
*/
|
|
57
|
+
async resetArticles(userId) {
|
|
58
|
+
// Step 1: Finalize previous batch (LAST_UPDATED -> EXPORTED)
|
|
59
|
+
const finalized = await this.commandRepository.bulkUpdateStatus({
|
|
60
|
+
userId,
|
|
61
|
+
fromStatus: "LAST_UPDATED",
|
|
62
|
+
toStatus: "EXPORTED",
|
|
63
|
+
exportedAt: makeExportedAt(),
|
|
64
|
+
});
|
|
65
|
+
// Step 2: Mark current batch (UNEXPORTED -> LAST_UPDATED)
|
|
66
|
+
const marked = await this.commandRepository.bulkUpdateStatus({
|
|
67
|
+
userId,
|
|
68
|
+
fromStatus: "UNEXPORTED",
|
|
69
|
+
toStatus: "LAST_UPDATED",
|
|
70
|
+
});
|
|
71
|
+
return { finalized, marked };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Reverts articles from LAST_UPDATED back to UNEXPORTED.
|
|
75
|
+
*
|
|
76
|
+
* @param userId - The user ID for tenant isolation
|
|
77
|
+
* @returns The result containing the count of reverted articles
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* Used to undo a batch marking if something went wrong.
|
|
81
|
+
* Only affects articles in LAST_UPDATED status.
|
|
82
|
+
*/
|
|
83
|
+
async revertArticles(userId) {
|
|
84
|
+
return this.commandRepository.bulkUpdateStatus({
|
|
85
|
+
userId,
|
|
86
|
+
fromStatus: "LAST_UPDATED",
|
|
87
|
+
toStatus: "UNEXPORTED",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=articles-batch-domain-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"articles-batch-domain-service.js","sourceRoot":"","sources":["../../../articles/services/articles-batch-domain-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,GAEd,MAAM,wCAAwC,CAAC;AAoBhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,0BAA0B;IAMT;IAL7B;;;;OAIG;IACH,YAA6B,iBAA0C;QAA1C,sBAAiB,GAAjB,iBAAiB,CAAyB;IAAG,CAAC;IAE3E;;;;;;;;;;;;;OAaG;IACI,KAAK,CAAC,aAAa,CAAC,MAAc;QACxC,6DAA6D;QAC7D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;YAC/D,MAAM;YACN,UAAU,EAAE,cAAc;YAC1B,QAAQ,EAAE,UAAU;YACpB,UAAU,EAAE,cAAc,EAAE;SAC5B,CAAC,CAAC;QAEH,0DAA0D;QAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;YAC5D,MAAM;YACN,UAAU,EAAE,YAAY;YACxB,QAAQ,EAAE,cAAc;SACxB,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,cAAc,CAAC,MAAc;QACzC,OAAO,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;YAC9C,MAAM;YACN,UAAU,EAAE,cAAc;YAC1B,QAAQ,EAAE,YAAY;SACtB,CAAC,CAAC;IACJ,CAAC;CACD"}
|