@buunguyen3589/collections-module 1.0.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.
Files changed (213) hide show
  1. package/dist/app/index.d.ts +1 -0
  2. package/dist/app/index.js +17 -0
  3. package/dist/app/usecases/command/create-collection.usecase.d.ts +16 -0
  4. package/dist/app/usecases/command/create-collection.usecase.js +66 -0
  5. package/dist/app/usecases/command/delete-collection.usecase.d.ts +13 -0
  6. package/dist/app/usecases/command/delete-collection.usecase.js +57 -0
  7. package/dist/app/usecases/command/index.d.ts +5 -0
  8. package/dist/app/usecases/command/index.js +21 -0
  9. package/dist/app/usecases/command/post-collection/index.d.ts +1 -0
  10. package/dist/app/usecases/command/post-collection/index.js +17 -0
  11. package/dist/app/usecases/command/post-collection/upsert-post-collection.usecase.d.ts +14 -0
  12. package/dist/app/usecases/command/post-collection/upsert-post-collection.usecase.js +63 -0
  13. package/dist/app/usecases/command/product-collection/add-all-products-collection.usecase.d.ts +24 -0
  14. package/dist/app/usecases/command/product-collection/add-all-products-collection.usecase.js +93 -0
  15. package/dist/app/usecases/command/product-collection/create-product-collection.usecase.d.ts +24 -0
  16. package/dist/app/usecases/command/product-collection/create-product-collection.usecase.js +94 -0
  17. package/dist/app/usecases/command/product-collection/delete-product-collection.usecase.d.ts +14 -0
  18. package/dist/app/usecases/command/product-collection/delete-product-collection.usecase.js +56 -0
  19. package/dist/app/usecases/command/product-collection/index.d.ts +3 -0
  20. package/dist/app/usecases/command/product-collection/index.js +19 -0
  21. package/dist/app/usecases/command/update-collection.usecase.d.ts +15 -0
  22. package/dist/app/usecases/command/update-collection.usecase.js +73 -0
  23. package/dist/app/usecases/index.d.ts +2 -0
  24. package/dist/app/usecases/index.js +18 -0
  25. package/dist/app/usecases/query/get-detail-collection.usecase.d.ts +36 -0
  26. package/dist/app/usecases/query/get-detail-collection.usecase.js +216 -0
  27. package/dist/app/usecases/query/get-list-collection.usecase.d.ts +23 -0
  28. package/dist/app/usecases/query/get-list-collection.usecase.js +96 -0
  29. package/dist/app/usecases/query/get-products-by-collections-internal.usecase.d.ts +19 -0
  30. package/dist/app/usecases/query/get-products-by-collections-internal.usecase.js +65 -0
  31. package/dist/app/usecases/query/get-products-by-collections.usecase.d.ts +44 -0
  32. package/dist/app/usecases/query/get-products-by-collections.usecase.js +130 -0
  33. package/dist/app/usecases/query/index.d.ts +4 -0
  34. package/dist/app/usecases/query/index.js +20 -0
  35. package/dist/collection.module.d.ts +2 -0
  36. package/dist/collection.module.js +62 -0
  37. package/dist/domain/aggregates/enums/collection.enum.d.ts +5 -0
  38. package/dist/domain/aggregates/enums/collection.enum.js +9 -0
  39. package/dist/domain/aggregates/enums/index.d.ts +1 -0
  40. package/dist/domain/aggregates/enums/index.js +17 -0
  41. package/dist/domain/aggregates/index.d.ts +2 -0
  42. package/dist/domain/aggregates/index.js +18 -0
  43. package/dist/domain/aggregates/types/collection.type.d.ts +14 -0
  44. package/dist/domain/aggregates/types/collection.type.js +2 -0
  45. package/dist/domain/aggregates/types/index.d.ts +3 -0
  46. package/dist/domain/aggregates/types/index.js +19 -0
  47. package/dist/domain/aggregates/types/post-collection.type.d.ts +12 -0
  48. package/dist/domain/aggregates/types/post-collection.type.js +2 -0
  49. package/dist/domain/aggregates/types/product-collection.type.d.ts +11 -0
  50. package/dist/domain/aggregates/types/product-collection.type.js +2 -0
  51. package/dist/domain/builders/collection.builder.d.ts +8 -0
  52. package/dist/domain/builders/collection.builder.js +38 -0
  53. package/dist/domain/builders/index.d.ts +3 -0
  54. package/dist/domain/builders/index.js +19 -0
  55. package/dist/domain/builders/post-collection.builder.d.ts +8 -0
  56. package/dist/domain/builders/post-collection.builder.js +38 -0
  57. package/dist/domain/builders/product-collection.builder.d.ts +8 -0
  58. package/dist/domain/builders/product-collection.builder.js +38 -0
  59. package/dist/domain/consts/event-collection.name.const.d.ts +5 -0
  60. package/dist/domain/consts/event-collection.name.const.js +8 -0
  61. package/dist/domain/consts/event-post-collection.name.const.d.ts +6 -0
  62. package/dist/domain/consts/event-post-collection.name.const.js +9 -0
  63. package/dist/domain/consts/event-product-collection.name.const.d.ts +5 -0
  64. package/dist/domain/consts/event-product-collection.name.const.js +8 -0
  65. package/dist/domain/consts/index.d.ts +3 -0
  66. package/dist/domain/consts/index.js +19 -0
  67. package/dist/domain/dtos/collection.dto.d.ts +4 -0
  68. package/dist/domain/dtos/collection.dto.js +2 -0
  69. package/dist/domain/dtos/index.d.ts +3 -0
  70. package/dist/domain/dtos/index.js +19 -0
  71. package/dist/domain/dtos/post-collection.dto.d.ts +4 -0
  72. package/dist/domain/dtos/post-collection.dto.js +2 -0
  73. package/dist/domain/dtos/product-collection.dto.d.ts +4 -0
  74. package/dist/domain/dtos/product-collection.dto.js +2 -0
  75. package/dist/domain/entities/collection.entity.d.ts +40 -0
  76. package/dist/domain/entities/collection.entity.js +87 -0
  77. package/dist/domain/entities/index.d.ts +3 -0
  78. package/dist/domain/entities/index.js +19 -0
  79. package/dist/domain/entities/post-collection.entity.d.ts +33 -0
  80. package/dist/domain/entities/post-collection.entity.js +70 -0
  81. package/dist/domain/entities/product-collection.entity.d.ts +30 -0
  82. package/dist/domain/entities/product-collection.entity.js +55 -0
  83. package/dist/domain/index.d.ts +6 -0
  84. package/dist/domain/index.js +22 -0
  85. package/dist/domain/mappers/collection.mapper.d.ts +11 -0
  86. package/dist/domain/mappers/collection.mapper.js +56 -0
  87. package/dist/domain/mappers/index.d.ts +3 -0
  88. package/dist/domain/mappers/index.js +19 -0
  89. package/dist/domain/mappers/post-collection.mapper.d.ts +11 -0
  90. package/dist/domain/mappers/post-collection.mapper.js +50 -0
  91. package/dist/domain/mappers/product-collection.mapper.d.ts +11 -0
  92. package/dist/domain/mappers/product-collection.mapper.js +48 -0
  93. package/dist/domain/repositories/collection.repository.d.ts +21 -0
  94. package/dist/domain/repositories/collection.repository.js +93 -0
  95. package/dist/domain/repositories/index.d.ts +3 -0
  96. package/dist/domain/repositories/index.js +19 -0
  97. package/dist/domain/repositories/post-collection.repository.d.ts +21 -0
  98. package/dist/domain/repositories/post-collection.repository.js +107 -0
  99. package/dist/domain/repositories/product-collection.repository.d.ts +21 -0
  100. package/dist/domain/repositories/product-collection.repository.js +98 -0
  101. package/dist/index.d.ts +5 -0
  102. package/dist/index.js +23 -0
  103. package/dist/infra/daos/collection.dao.d.ts +7 -0
  104. package/dist/infra/daos/collection.dao.js +36 -0
  105. package/dist/infra/daos/index.d.ts +3 -0
  106. package/dist/infra/daos/index.js +19 -0
  107. package/dist/infra/daos/post-collection.dao.d.ts +10 -0
  108. package/dist/infra/daos/post-collection.dao.js +70 -0
  109. package/dist/infra/daos/product-collection.dao.d.ts +9 -0
  110. package/dist/infra/daos/product-collection.dao.js +69 -0
  111. package/dist/infra/event-handlers/collection.event-emitter.d.ts +6 -0
  112. package/dist/infra/event-handlers/collection.event-emitter.js +27 -0
  113. package/dist/infra/event-handlers/index.d.ts +3 -0
  114. package/dist/infra/event-handlers/index.js +19 -0
  115. package/dist/infra/event-handlers/post-collection.event-emitter.d.ts +6 -0
  116. package/dist/infra/event-handlers/post-collection.event-emitter.js +27 -0
  117. package/dist/infra/event-handlers/product-collection.event-emitter.d.ts +6 -0
  118. package/dist/infra/event-handlers/product-collection.event-emitter.js +27 -0
  119. package/dist/infra/filters/collection.filter.d.ts +25 -0
  120. package/dist/infra/filters/collection.filter.js +84 -0
  121. package/dist/infra/filters/index.d.ts +3 -0
  122. package/dist/infra/filters/index.js +19 -0
  123. package/dist/infra/filters/post-collection.filter.d.ts +16 -0
  124. package/dist/infra/filters/post-collection.filter.js +54 -0
  125. package/dist/infra/filters/product-collection.filter.d.ts +13 -0
  126. package/dist/infra/filters/product-collection.filter.js +44 -0
  127. package/dist/infra/index.d.ts +6 -0
  128. package/dist/infra/index.js +22 -0
  129. package/dist/infra/mappers/collection.mapper.d.ts +8 -0
  130. package/dist/infra/mappers/collection.mapper.js +31 -0
  131. package/dist/infra/mappers/index.d.ts +3 -0
  132. package/dist/infra/mappers/index.js +19 -0
  133. package/dist/infra/mappers/post-collection.mapper.d.ts +8 -0
  134. package/dist/infra/mappers/post-collection.mapper.js +25 -0
  135. package/dist/infra/mappers/product-collection.mapper.d.ts +8 -0
  136. package/dist/infra/mappers/product-collection.mapper.js +24 -0
  137. package/dist/infra/query-configs/collection.query-config.d.ts +3 -0
  138. package/dist/infra/query-configs/collection.query-config.js +46 -0
  139. package/dist/infra/query-configs/index.d.ts +3 -0
  140. package/dist/infra/query-configs/index.js +19 -0
  141. package/dist/infra/query-configs/post-collection.query-config.d.ts +3 -0
  142. package/dist/infra/query-configs/post-collection.query-config.js +31 -0
  143. package/dist/infra/query-configs/product-collection.query-config.d.ts +3 -0
  144. package/dist/infra/query-configs/product-collection.query-config.js +26 -0
  145. package/dist/infra/records/collection.record.d.ts +11 -0
  146. package/dist/infra/records/collection.record.js +2 -0
  147. package/dist/infra/records/index.d.ts +3 -0
  148. package/dist/infra/records/index.js +19 -0
  149. package/dist/infra/records/post-collection.record.d.ts +7 -0
  150. package/dist/infra/records/post-collection.record.js +2 -0
  151. package/dist/infra/records/product-collection.record.d.ts +7 -0
  152. package/dist/infra/records/product-collection.record.js +2 -0
  153. package/dist/presentation/controllers/index.d.ts +2 -0
  154. package/dist/presentation/controllers/index.js +18 -0
  155. package/dist/presentation/controllers/internals/index.d.ts +1 -0
  156. package/dist/presentation/controllers/internals/index.js +17 -0
  157. package/dist/presentation/controllers/internals/product-collection.internal.rest.d.ts +8 -0
  158. package/dist/presentation/controllers/internals/product-collection.internal.rest.js +45 -0
  159. package/dist/presentation/controllers/storefront/collection.storefront.rest.d.ts +26 -0
  160. package/dist/presentation/controllers/storefront/collection.storefront.rest.js +155 -0
  161. package/dist/presentation/controllers/storefront/index.d.ts +3 -0
  162. package/dist/presentation/controllers/storefront/index.js +19 -0
  163. package/dist/presentation/controllers/storefront/post-collection.storefront.d.ts +7 -0
  164. package/dist/presentation/controllers/storefront/post-collection.storefront.js +37 -0
  165. package/dist/presentation/controllers/storefront/product-collection.storefront.rest.d.ts +5 -0
  166. package/dist/presentation/controllers/storefront/product-collection.storefront.rest.js +50 -0
  167. package/dist/presentation/index.d.ts +1 -0
  168. package/dist/presentation/index.js +17 -0
  169. package/dist/shared/configs/index.d.ts +1 -0
  170. package/dist/shared/configs/index.js +17 -0
  171. package/dist/shared/configs/pagination.config.d.ts +4 -0
  172. package/dist/shared/configs/pagination.config.js +7 -0
  173. package/dist/shared/constants/collection-inject-tokens.const.d.ts +56 -0
  174. package/dist/shared/constants/collection-inject-tokens.const.js +61 -0
  175. package/dist/shared/constants/collection-table-names.const.d.ts +12 -0
  176. package/dist/shared/constants/collection-table-names.const.js +16 -0
  177. package/dist/shared/constants/component-inject-tokens.const.d.ts +7 -0
  178. package/dist/shared/constants/component-inject-tokens.const.js +11 -0
  179. package/dist/shared/constants/error-codes.const.d.ts +6 -0
  180. package/dist/shared/constants/error-codes.const.js +10 -0
  181. package/dist/shared/constants/index.d.ts +4 -0
  182. package/dist/shared/constants/index.js +21 -0
  183. package/dist/shared/core/filter.d.ts +80 -0
  184. package/dist/shared/core/filter.js +554 -0
  185. package/dist/shared/core/index.d.ts +1 -0
  186. package/dist/shared/core/index.js +17 -0
  187. package/dist/shared/index.d.ts +5 -0
  188. package/dist/shared/index.js +21 -0
  189. package/dist/shared/interfaces/ambassador-dao.interface.d.ts +5 -0
  190. package/dist/shared/interfaces/ambassador-dao.interface.js +2 -0
  191. package/dist/shared/interfaces/ambassador-usecase.interface.d.ts +16 -0
  192. package/dist/shared/interfaces/ambassador-usecase.interface.js +2 -0
  193. package/dist/shared/interfaces/campaign-service.interface.d.ts +3 -0
  194. package/dist/shared/interfaces/campaign-service.interface.js +4 -0
  195. package/dist/shared/interfaces/index.d.ts +6 -0
  196. package/dist/shared/interfaces/index.js +22 -0
  197. package/dist/shared/interfaces/post-product-dao.interface.d.ts +8 -0
  198. package/dist/shared/interfaces/post-product-dao.interface.js +2 -0
  199. package/dist/shared/interfaces/product-service.interface.d.ts +6 -0
  200. package/dist/shared/interfaces/product-service.interface.js +2 -0
  201. package/dist/shared/interfaces/ugc-management-service.interface.d.ts +11 -0
  202. package/dist/shared/interfaces/ugc-management-service.interface.js +2 -0
  203. package/dist/shared/types/common.type.d.ts +4 -0
  204. package/dist/shared/types/common.type.js +2 -0
  205. package/dist/shared/types/discount.enum.d.ts +4 -0
  206. package/dist/shared/types/discount.enum.js +8 -0
  207. package/dist/shared/types/index.d.ts +4 -0
  208. package/dist/shared/types/index.js +20 -0
  209. package/dist/shared/types/shopify.type.d.ts +28 -0
  210. package/dist/shared/types/shopify.type.js +2 -0
  211. package/dist/shared/types/ugc.type.d.ts +41 -0
  212. package/dist/shared/types/ugc.type.js +2 -0
  213. package/package.json +56 -0
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { PaginationInput } from '@cbidigital/aqua-ddd';
2
+ import { ListResponse, ShopifyProduct } from '../types';
3
+ export interface IProductService {
4
+ getProducts(input: PaginationInput<ShopifyProduct>, productIds?: string[]): Promise<ListResponse<ShopifyProduct>>;
5
+ getProductsByShopifyCollectionIds(collectionIds?: string[]): Promise<ListResponse<ShopifyProduct>>;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { PaginationInput } from '@cbidigital/aqua-ddd';
2
+ import { ListResponse, UGCPost } from '../types';
3
+ export type GetPostsParams = {
4
+ absUsernames?: string[];
5
+ ids?: string[];
6
+ paginationInput?: PaginationInput;
7
+ };
8
+ export interface IUgcManagementService {
9
+ getApprovedPosts(input: GetPostsParams): Promise<ListResponse<UGCPost>>;
10
+ getPostById(id: string): Promise<UGCPost>;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type ListResponse<T> = {
2
+ totalCount: number;
3
+ items: T[];
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export declare enum DiscountValueType {
2
+ PERCENTAGE = "percentage",
3
+ FIXED = "fixed"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DiscountValueType = void 0;
4
+ var DiscountValueType;
5
+ (function (DiscountValueType) {
6
+ DiscountValueType["PERCENTAGE"] = "percentage";
7
+ DiscountValueType["FIXED"] = "fixed";
8
+ })(DiscountValueType = exports.DiscountValueType || (exports.DiscountValueType = {}));
@@ -0,0 +1,4 @@
1
+ export * from './shopify.type';
2
+ export * from './ugc.type';
3
+ export * from './common.type';
4
+ export * from './discount.enum';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./shopify.type"), exports);
18
+ __exportStar(require("./ugc.type"), exports);
19
+ __exportStar(require("./common.type"), exports);
20
+ __exportStar(require("./discount.enum"), exports);
@@ -0,0 +1,28 @@
1
+ export type ShopifyProduct = {
2
+ id: string;
3
+ productId?: string;
4
+ productName: string;
5
+ productShopifyId: string;
6
+ productMinPrice: string | number;
7
+ productMaxPrice: string | number;
8
+ productUrl: string;
9
+ productDescription: string;
10
+ productImage: string;
11
+ productMedia: {
12
+ node: {
13
+ url: string;
14
+ };
15
+ }[];
16
+ productStatus: string;
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ collectionId?: string;
20
+ };
21
+ export type ShopifyCollection = {
22
+ id: string;
23
+ collectionName: string;
24
+ collectionShopifyId: string;
25
+ createdAt: string;
26
+ updatedAt: string;
27
+ collectionProducts: ShopifyProduct[];
28
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,41 @@
1
+ export type UGCPost = {
2
+ id: string;
3
+ postId: string;
4
+ postTitle: string;
5
+ postAuthorId: string;
6
+ postContent: string;
7
+ postContentExtra: {
8
+ end: number;
9
+ type: number;
10
+ start: number;
11
+ secUid: string;
12
+ userId: string;
13
+ awemeId: string;
14
+ subType: number;
15
+ hashtagId: string;
16
+ isCommerce: false;
17
+ hashtagName: string;
18
+ userUniqueId: string;
19
+ }[];
20
+ postContentHtml: string;
21
+ postImpression: number;
22
+ postEngRate: number;
23
+ postEMV: number;
24
+ postStatus: string;
25
+ postType: string;
26
+ postUrl: string;
27
+ postSocialType: string;
28
+ postSocialCreatedAt: string;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ postMediaDetails: {
32
+ id: string;
33
+ postId: string;
34
+ mediaUrl: string;
35
+ createdAt: string;
36
+ postAuthorId: string;
37
+ mediaType: string;
38
+ mediaPosition: number;
39
+ }[];
40
+ hidden?: boolean;
41
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@buunguyen3589/collections-module",
3
+ "version": "1.0.0",
4
+ "description": "Collections management module built with HeronJS framework following Clean Architecture principles",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist/**/*.js",
9
+ "dist/**/*.d.ts",
10
+ "README.md",
11
+ "package.json"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "prepublishOnly": "npm run build",
16
+ "test": "echo \"Error: no test specified\" && exit 1"
17
+ },
18
+ "keywords": [
19
+ "heronjs",
20
+ "collections",
21
+ "module",
22
+ "clean-architecture",
23
+ "ddd",
24
+ "typescript"
25
+ ],
26
+ "author": "buunguyen3589",
27
+ "license": "ISC",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/buunguyen3589/test-ai.git",
31
+ "directory": "src/features/collections"
32
+ },
33
+ "engines": {
34
+ "node": ">=20"
35
+ },
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "default": "./dist/index.js"
40
+ }
41
+ },
42
+ "peerDependencies": {
43
+ "@cbidigital/aqua-ddd": "^1.0.0-rc.6",
44
+ "@cbidigital/aqua": "^3.0.10",
45
+ "@heronjs/common": "^3.3.40",
46
+ "zod": "^3.24.1",
47
+ "http-status-codes": "*",
48
+ "knex": "*",
49
+ "axios": "*"
50
+ },
51
+ "devDependencies": {
52
+ "@types/node": "^20.12.13",
53
+ "typescript": "^4.9.5"
54
+ }
55
+ }
56
+