@infrab4a/connect 4.5.0 → 4.7.0-beta.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/index.cjs.js +74 -0
- package/index.esm.js +73 -1
- package/package.json +1 -1
- package/src/domain/catalog/models/index.d.ts +1 -0
- package/src/domain/catalog/models/product-stock-notification.d.ts +12 -0
- package/src/domain/catalog/repositories/index.d.ts +1 -0
- package/src/domain/catalog/repositories/product-stock-notification.repository.d.ts +5 -0
- package/src/domain/catalog/repositories/product.repository.d.ts +13 -0
- package/src/infra/firebase/firestore/repositories/catalog/product-firestore.repository.d.ts +3 -1
- package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +2 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-notification-hasura-graphql.repository.d.ts +11 -0
package/index.cjs.js
CHANGED
|
@@ -220,6 +220,12 @@ class ProductReviews extends BaseModel {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
class ProductStockNotification extends BaseModel {
|
|
224
|
+
static get identifiersFields() {
|
|
225
|
+
return ['id'];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
223
229
|
class Variant extends BaseModel {
|
|
224
230
|
static get identifiersFields() {
|
|
225
231
|
return ['id', 'productId'];
|
|
@@ -3339,6 +3345,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3339
3345
|
});
|
|
3340
3346
|
this.reviews = {};
|
|
3341
3347
|
}
|
|
3348
|
+
fetchProductReviews(filters) {
|
|
3349
|
+
throw new Error('Method not implemented.');
|
|
3350
|
+
}
|
|
3342
3351
|
async getBySlug(slug) {
|
|
3343
3352
|
var _a;
|
|
3344
3353
|
const result = await this.find({
|
|
@@ -3380,6 +3389,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3380
3389
|
findCatalog(params) {
|
|
3381
3390
|
return this.find(params);
|
|
3382
3391
|
}
|
|
3392
|
+
async fetchPaginatedReviews() {
|
|
3393
|
+
return Promise.resolve([]);
|
|
3394
|
+
}
|
|
3383
3395
|
}
|
|
3384
3396
|
|
|
3385
3397
|
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
@@ -5376,6 +5388,30 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5376
5388
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
5377
5389
|
return product;
|
|
5378
5390
|
}
|
|
5391
|
+
async fetchProductReviews() {
|
|
5392
|
+
let data = [];
|
|
5393
|
+
let count = 0;
|
|
5394
|
+
let offset = 0;
|
|
5395
|
+
const limit = 500;
|
|
5396
|
+
do {
|
|
5397
|
+
const result = await super.find(Object.assign({ fields: ['id', 'name', 'sku', 'reviews'] }, ({
|
|
5398
|
+
limits: {
|
|
5399
|
+
offset,
|
|
5400
|
+
limit,
|
|
5401
|
+
},
|
|
5402
|
+
})));
|
|
5403
|
+
data = data.concat(result.data);
|
|
5404
|
+
count = result.data.length;
|
|
5405
|
+
offset += limit;
|
|
5406
|
+
} while (count === limit);
|
|
5407
|
+
return data.reduce((reviews, product) => [
|
|
5408
|
+
...reviews,
|
|
5409
|
+
...product.reviews.map((review) => (Object.assign(Object.assign({}, review), { reviewStatus: this.getReviewStatus(review), productId: product.id, productName: product.name, productSku: product.sku }))),
|
|
5410
|
+
], []);
|
|
5411
|
+
}
|
|
5412
|
+
getReviewStatus(review) {
|
|
5413
|
+
return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
|
|
5414
|
+
}
|
|
5379
5415
|
async fetchReviews(status) {
|
|
5380
5416
|
const reviewsExpression = {
|
|
5381
5417
|
status: status === 'pending'
|
|
@@ -5614,6 +5650,42 @@ class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
5614
5650
|
}
|
|
5615
5651
|
}
|
|
5616
5652
|
|
|
5653
|
+
class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5654
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5655
|
+
super({
|
|
5656
|
+
tableName: 'product_stock_notification',
|
|
5657
|
+
model: ProductStockNotification,
|
|
5658
|
+
endpoint,
|
|
5659
|
+
authOptions,
|
|
5660
|
+
interceptors,
|
|
5661
|
+
fields: [
|
|
5662
|
+
'id',
|
|
5663
|
+
{ productId: { columnName: 'product_id' } },
|
|
5664
|
+
'name',
|
|
5665
|
+
'email',
|
|
5666
|
+
'shop',
|
|
5667
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
5668
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
5669
|
+
],
|
|
5670
|
+
});
|
|
5671
|
+
}
|
|
5672
|
+
async addCustomerEmail(shop, productId, name, email) {
|
|
5673
|
+
const notification = await this.find({
|
|
5674
|
+
filters: {
|
|
5675
|
+
productId,
|
|
5676
|
+
email,
|
|
5677
|
+
},
|
|
5678
|
+
}).then((data) => data.data.shift());
|
|
5679
|
+
if (!notification)
|
|
5680
|
+
this.create({
|
|
5681
|
+
shop,
|
|
5682
|
+
productId,
|
|
5683
|
+
name,
|
|
5684
|
+
email,
|
|
5685
|
+
});
|
|
5686
|
+
}
|
|
5687
|
+
}
|
|
5688
|
+
|
|
5617
5689
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5618
5690
|
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5619
5691
|
super({
|
|
@@ -6133,6 +6205,8 @@ exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
|
6133
6205
|
exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
|
|
6134
6206
|
exports.ProductReviews = ProductReviews;
|
|
6135
6207
|
exports.ProductReviewsHasuraGraphQLRepository = ProductReviewsHasuraGraphQLRepository;
|
|
6208
|
+
exports.ProductStockNotification = ProductStockNotification;
|
|
6209
|
+
exports.ProductStockNotificationHasuraGraphQLRepository = ProductStockNotificationHasuraGraphQLRepository;
|
|
6136
6210
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
6137
6211
|
exports.ProductsIndex = ProductsIndex;
|
|
6138
6212
|
exports.RecoveryPassword = RecoveryPassword;
|
package/index.esm.js
CHANGED
|
@@ -196,6 +196,12 @@ class ProductReviews extends BaseModel {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
class ProductStockNotification extends BaseModel {
|
|
200
|
+
static get identifiersFields() {
|
|
201
|
+
return ['id'];
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
199
205
|
class Variant extends BaseModel {
|
|
200
206
|
static get identifiersFields() {
|
|
201
207
|
return ['id', 'productId'];
|
|
@@ -3315,6 +3321,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3315
3321
|
});
|
|
3316
3322
|
this.reviews = {};
|
|
3317
3323
|
}
|
|
3324
|
+
fetchProductReviews(filters) {
|
|
3325
|
+
throw new Error('Method not implemented.');
|
|
3326
|
+
}
|
|
3318
3327
|
async getBySlug(slug) {
|
|
3319
3328
|
var _a;
|
|
3320
3329
|
const result = await this.find({
|
|
@@ -3356,6 +3365,9 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3356
3365
|
findCatalog(params) {
|
|
3357
3366
|
return this.find(params);
|
|
3358
3367
|
}
|
|
3368
|
+
async fetchPaginatedReviews() {
|
|
3369
|
+
return Promise.resolve([]);
|
|
3370
|
+
}
|
|
3359
3371
|
}
|
|
3360
3372
|
|
|
3361
3373
|
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
@@ -5352,6 +5364,30 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
5352
5364
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
5353
5365
|
return product;
|
|
5354
5366
|
}
|
|
5367
|
+
async fetchProductReviews() {
|
|
5368
|
+
let data = [];
|
|
5369
|
+
let count = 0;
|
|
5370
|
+
let offset = 0;
|
|
5371
|
+
const limit = 500;
|
|
5372
|
+
do {
|
|
5373
|
+
const result = await super.find(Object.assign({ fields: ['id', 'name', 'sku', 'reviews'] }, ({
|
|
5374
|
+
limits: {
|
|
5375
|
+
offset,
|
|
5376
|
+
limit,
|
|
5377
|
+
},
|
|
5378
|
+
})));
|
|
5379
|
+
data = data.concat(result.data);
|
|
5380
|
+
count = result.data.length;
|
|
5381
|
+
offset += limit;
|
|
5382
|
+
} while (count === limit);
|
|
5383
|
+
return data.reduce((reviews, product) => [
|
|
5384
|
+
...reviews,
|
|
5385
|
+
...product.reviews.map((review) => (Object.assign(Object.assign({}, review), { reviewStatus: this.getReviewStatus(review), productId: product.id, productName: product.name, productSku: product.sku }))),
|
|
5386
|
+
], []);
|
|
5387
|
+
}
|
|
5388
|
+
getReviewStatus(review) {
|
|
5389
|
+
return review.status === true ? 'approved' : review.status === false ? 'rejected' : 'pending';
|
|
5390
|
+
}
|
|
5355
5391
|
async fetchReviews(status) {
|
|
5356
5392
|
const reviewsExpression = {
|
|
5357
5393
|
status: status === 'pending'
|
|
@@ -5590,6 +5626,42 @@ class ProductReviewsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHa
|
|
|
5590
5626
|
}
|
|
5591
5627
|
}
|
|
5592
5628
|
|
|
5629
|
+
class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5630
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5631
|
+
super({
|
|
5632
|
+
tableName: 'product_stock_notification',
|
|
5633
|
+
model: ProductStockNotification,
|
|
5634
|
+
endpoint,
|
|
5635
|
+
authOptions,
|
|
5636
|
+
interceptors,
|
|
5637
|
+
fields: [
|
|
5638
|
+
'id',
|
|
5639
|
+
{ productId: { columnName: 'product_id' } },
|
|
5640
|
+
'name',
|
|
5641
|
+
'email',
|
|
5642
|
+
'shop',
|
|
5643
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
5644
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
5645
|
+
],
|
|
5646
|
+
});
|
|
5647
|
+
}
|
|
5648
|
+
async addCustomerEmail(shop, productId, name, email) {
|
|
5649
|
+
const notification = await this.find({
|
|
5650
|
+
filters: {
|
|
5651
|
+
productId,
|
|
5652
|
+
email,
|
|
5653
|
+
},
|
|
5654
|
+
}).then((data) => data.data.shift());
|
|
5655
|
+
if (!notification)
|
|
5656
|
+
this.create({
|
|
5657
|
+
shop,
|
|
5658
|
+
productId,
|
|
5659
|
+
name,
|
|
5660
|
+
email,
|
|
5661
|
+
});
|
|
5662
|
+
}
|
|
5663
|
+
}
|
|
5664
|
+
|
|
5593
5665
|
class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5594
5666
|
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5595
5667
|
super({
|
|
@@ -5926,4 +5998,4 @@ class WishlistHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
5926
5998
|
}
|
|
5927
5999
|
}
|
|
5928
6000
|
|
|
5929
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
6001
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, Logger, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ export * from './filter-option';
|
|
|
7
7
|
export * from './kit-product';
|
|
8
8
|
export * from './product';
|
|
9
9
|
export * from './product-reviews';
|
|
10
|
+
export * from './product-stock-notification';
|
|
10
11
|
export * from './types';
|
|
11
12
|
export * from './variant';
|
|
12
13
|
export * from './wishlist';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseModel, GenericIdentifier } from '../../generic/model';
|
|
2
|
+
import { Shops } from './enums';
|
|
3
|
+
export declare class ProductStockNotification extends BaseModel<ProductStockNotification> {
|
|
4
|
+
id: number;
|
|
5
|
+
productId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
email: string;
|
|
8
|
+
shop: Shops;
|
|
9
|
+
createdAt?: Date;
|
|
10
|
+
updatedAt?: Date;
|
|
11
|
+
static get identifiersFields(): GenericIdentifier[];
|
|
12
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './category.repository';
|
|
|
4
4
|
export * from './filter-option.repository';
|
|
5
5
|
export * from './filter.repository';
|
|
6
6
|
export * from './product-reviews.repository';
|
|
7
|
+
export * from './product-stock-notification.repository';
|
|
7
8
|
export * from './product.repository';
|
|
8
9
|
export * from './subscription-product.repository';
|
|
9
10
|
export * from './variant.repository';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CrudRepository } from '../../generic/repository/crud.repository';
|
|
2
|
+
import { ProductStockNotification, Shops } from '../models';
|
|
3
|
+
export interface ProductStockNotificationRepository extends CrudRepository<ProductStockNotification> {
|
|
4
|
+
addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
|
|
5
|
+
}
|
|
@@ -6,10 +6,23 @@ export type ReviewWithProductData = ProductReview & {
|
|
|
6
6
|
productId: string;
|
|
7
7
|
productName: string;
|
|
8
8
|
productSku: string;
|
|
9
|
+
reviewStatus?: 'pending' | 'approved' | 'rejected';
|
|
10
|
+
};
|
|
11
|
+
export type PaginatedReviewFilters = {
|
|
12
|
+
sku?: string;
|
|
13
|
+
status: ReviewStatusParams;
|
|
14
|
+
email?: string;
|
|
15
|
+
rate?: number;
|
|
16
|
+
period?: {
|
|
17
|
+
start: Date;
|
|
18
|
+
end: Date;
|
|
19
|
+
};
|
|
20
|
+
limit?: number;
|
|
9
21
|
};
|
|
10
22
|
export interface ProductRepository extends CrudRepository<Product> {
|
|
11
23
|
getBySlug(slug: string): Promise<Product>;
|
|
12
24
|
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
25
|
+
fetchProductReviews(filters: PaginatedReviewFilters): Promise<ReviewWithProductData[]>;
|
|
13
26
|
cleanShoppingCountFromIds(ids: string[]): Promise<any>;
|
|
14
27
|
findCatalog(params: FindRepositoryParams<Product>, mainGender?: Extract<ProductGender, 'female' | 'male' | 'unisex'>): Promise<RepositoryFindResult<Product>>;
|
|
15
28
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { FindRepositoryParams, Product, ProductRepository, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
|
|
1
|
+
import { FindRepositoryParams, PaginatedReviewFilters, Product, ProductRepository, RepositoryFindResult, ReviewStatusParams, ReviewWithProductData } from '../../../../../domain';
|
|
2
2
|
import { FirestoreConstructorParams } from '../../mixins';
|
|
3
3
|
declare const ProductFirestoreRepository_base: import("../../../../../utils").MixinCtor<import("../..").FirestoreRepository<Product> & import("../../../../../domain").CrudRepository<Product, import("../../../../../domain").CrudParams<Product>> & import("../..").FirestoreHelpers, [FirestoreConstructorParams<Product>, ...any[]]>;
|
|
4
4
|
export declare class ProductFirestoreRepository extends ProductFirestoreRepository_base implements ProductRepository {
|
|
5
5
|
private reviews;
|
|
6
6
|
constructor({ firestore, interceptors }: Pick<FirestoreConstructorParams<Product>, 'firestore' | 'interceptors'>);
|
|
7
|
+
fetchProductReviews(filters: PaginatedReviewFilters): Promise<ReviewWithProductData[]>;
|
|
7
8
|
getBySlug(slug: string): Promise<Product>;
|
|
8
9
|
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
9
10
|
cleanShoppingCountFromIds(): Promise<void>;
|
|
10
11
|
findCatalog(params: FindRepositoryParams<Product>): Promise<RepositoryFindResult<Product>>;
|
|
12
|
+
fetchPaginatedReviews(): Promise<ReviewWithProductData[]>;
|
|
11
13
|
}
|
|
12
14
|
export {};
|
|
@@ -5,5 +5,6 @@ export * from './filter-hasura-graphql.repository';
|
|
|
5
5
|
export * from './filter-option-hasura-graphql.repository';
|
|
6
6
|
export * from './product-hasura-graphql.repository';
|
|
7
7
|
export * from './product-review-hasura-graphql.repository';
|
|
8
|
+
export * from './product-stock-notification-hasura-graphql.repository';
|
|
8
9
|
export * from './variant-hasura-graphql.repository';
|
|
9
10
|
export * from './wishlist-hasura-graphql.repository';
|
package/src/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare class ProductHasuraGraphQLRepository extends ProductHasuraGraphQL
|
|
|
12
12
|
find(params?: FindRepositoryParams<ProductHasuraGraphQL>): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;
|
|
13
13
|
getBySlug(slug: string): Promise<ProductHasuraGraphQL>;
|
|
14
14
|
update(params: UpdateRepositoryParams<ProductHasuraGraphQL>): Promise<ProductHasuraGraphQL>;
|
|
15
|
+
fetchProductReviews(): Promise<ReviewWithProductData[]>;
|
|
16
|
+
private getReviewStatus;
|
|
15
17
|
fetchReviews(status: ReviewStatusParams): Promise<ReviewWithProductData[]>;
|
|
16
18
|
findCatalog(params: FindRepositoryParams<ProductHasuraGraphQL>, mainGender?: Extract<ProductGender, 'female' | 'male'>): Promise<RepositoryFindResult<ProductHasuraGraphQL>>;
|
|
17
19
|
private updateCategories;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Filter, ProductStockNotification, Shops } from '../../../../domain';
|
|
2
|
+
import { ProductStockNotificationRepository } from '../../../../domain/catalog/repositories';
|
|
3
|
+
import { HasuraConstructorParams } from '../../mixins';
|
|
4
|
+
declare const ProductStockNotificationHasuraGraphQLRepository_base: import("../../../../utils").MixinCtor<import("../..").GraphQLRepository<ProductStockNotification> & import("../../../../domain").CrudRepository<ProductStockNotification, import("../../../../domain").CrudParams<ProductStockNotification>> & import("../../../../domain").UpdateRepository<ProductStockNotification, import("../../../../domain").RepositoryUpdateParams<ProductStockNotification>> & {
|
|
5
|
+
paramsToPlain(params: import("../../../../domain").RepositoryUpdateParams<ProductStockNotification>): Partial<ProductStockNotification>;
|
|
6
|
+
}, [HasuraConstructorParams<ProductStockNotification> & import("../../mixins").CreateConstructorParams & import("../../mixins").DeleteConstructorParams & import("../../mixins").GetConstructorParams & import("../../mixins").UpdateConstructorParams, ...any[]]>;
|
|
7
|
+
export declare class ProductStockNotificationHasuraGraphQLRepository extends ProductStockNotificationHasuraGraphQLRepository_base implements ProductStockNotificationRepository {
|
|
8
|
+
constructor({ endpoint, authOptions, interceptors, }: Pick<HasuraConstructorParams<Filter>, 'endpoint' | 'authOptions' | 'interceptors'>);
|
|
9
|
+
addCustomerEmail(shop: Shops, productId: string, name: string, email: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export {};
|