@mamindom/contracts 1.0.92 → 1.0.93
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/gen/product_review.d.ts +56 -0
- package/dist/gen/product_review.js +36 -0
- package/dist/proto/product_review.proto +60 -0
- package/dist/src/proto/paths.d.ts +1 -0
- package/dist/src/proto/paths.js +1 -0
- package/gen/product_review.ts +99 -0
- package/package.json +1 -1
- package/proto/product_review.proto +60 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { DeleteResponse, PaginationMeta, PaginationRequest } from "./common";
|
|
3
|
+
export declare const protobufPackage = "catalog.v1";
|
|
4
|
+
export declare enum ReviewStatus {
|
|
5
|
+
REVIEW_STATUS_UNSPECIFIED = 0,
|
|
6
|
+
REVIEW_STATUS_PENDING = 1,
|
|
7
|
+
REVIEW_STATUS_APPROVED = 2,
|
|
8
|
+
REVIEW_STATUS_REJECTED = 3,
|
|
9
|
+
UNRECOGNIZED = -1
|
|
10
|
+
}
|
|
11
|
+
export interface ReviewResponse {
|
|
12
|
+
id: string;
|
|
13
|
+
productId: string;
|
|
14
|
+
authorName: string;
|
|
15
|
+
authorEmail: string;
|
|
16
|
+
body: string;
|
|
17
|
+
rating: number;
|
|
18
|
+
status: ReviewStatus;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface GetReviewsRequest {
|
|
22
|
+
pagination: PaginationRequest | undefined;
|
|
23
|
+
productId?: string | undefined;
|
|
24
|
+
status?: ReviewStatus | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface GetReviewsResponse {
|
|
27
|
+
items: ReviewResponse[];
|
|
28
|
+
meta: PaginationMeta | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateReviewRequest {
|
|
31
|
+
productId: string;
|
|
32
|
+
authorName: string;
|
|
33
|
+
authorEmail: string;
|
|
34
|
+
body: string;
|
|
35
|
+
rating: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ReviewIdRequest {
|
|
38
|
+
id: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const CATALOG_V1_PACKAGE_NAME = "catalog.v1";
|
|
41
|
+
export interface ProductReviewServiceClient {
|
|
42
|
+
getReviews(request: GetReviewsRequest): Observable<GetReviewsResponse>;
|
|
43
|
+
createReview(request: CreateReviewRequest): Observable<ReviewResponse>;
|
|
44
|
+
approveReview(request: ReviewIdRequest): Observable<ReviewResponse>;
|
|
45
|
+
rejectReview(request: ReviewIdRequest): Observable<ReviewResponse>;
|
|
46
|
+
deleteReview(request: ReviewIdRequest): Observable<DeleteResponse>;
|
|
47
|
+
}
|
|
48
|
+
export interface ProductReviewServiceController {
|
|
49
|
+
getReviews(request: GetReviewsRequest): Promise<GetReviewsResponse> | Observable<GetReviewsResponse> | GetReviewsResponse;
|
|
50
|
+
createReview(request: CreateReviewRequest): Promise<ReviewResponse> | Observable<ReviewResponse> | ReviewResponse;
|
|
51
|
+
approveReview(request: ReviewIdRequest): Promise<ReviewResponse> | Observable<ReviewResponse> | ReviewResponse;
|
|
52
|
+
rejectReview(request: ReviewIdRequest): Promise<ReviewResponse> | Observable<ReviewResponse> | ReviewResponse;
|
|
53
|
+
deleteReview(request: ReviewIdRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
|
54
|
+
}
|
|
55
|
+
export declare function ProductReviewServiceControllerMethods(): (constructor: Function) => void;
|
|
56
|
+
export declare const PRODUCT_REVIEW_SERVICE_NAME = "ProductReviewService";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.4
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: product_review.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.PRODUCT_REVIEW_SERVICE_NAME = exports.CATALOG_V1_PACKAGE_NAME = exports.ReviewStatus = exports.protobufPackage = void 0;
|
|
9
|
+
exports.ProductReviewServiceControllerMethods = ProductReviewServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "catalog.v1";
|
|
13
|
+
var ReviewStatus;
|
|
14
|
+
(function (ReviewStatus) {
|
|
15
|
+
ReviewStatus[ReviewStatus["REVIEW_STATUS_UNSPECIFIED"] = 0] = "REVIEW_STATUS_UNSPECIFIED";
|
|
16
|
+
ReviewStatus[ReviewStatus["REVIEW_STATUS_PENDING"] = 1] = "REVIEW_STATUS_PENDING";
|
|
17
|
+
ReviewStatus[ReviewStatus["REVIEW_STATUS_APPROVED"] = 2] = "REVIEW_STATUS_APPROVED";
|
|
18
|
+
ReviewStatus[ReviewStatus["REVIEW_STATUS_REJECTED"] = 3] = "REVIEW_STATUS_REJECTED";
|
|
19
|
+
ReviewStatus[ReviewStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
20
|
+
})(ReviewStatus || (exports.ReviewStatus = ReviewStatus = {}));
|
|
21
|
+
exports.CATALOG_V1_PACKAGE_NAME = "catalog.v1";
|
|
22
|
+
function ProductReviewServiceControllerMethods() {
|
|
23
|
+
return function (constructor) {
|
|
24
|
+
const grpcMethods = ["getReviews", "createReview", "approveReview", "rejectReview", "deleteReview"];
|
|
25
|
+
for (const method of grpcMethods) {
|
|
26
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
27
|
+
(0, microservices_1.GrpcMethod)("ProductReviewService", method)(constructor.prototype[method], method, descriptor);
|
|
28
|
+
}
|
|
29
|
+
const grpcStreamMethods = [];
|
|
30
|
+
for (const method of grpcStreamMethods) {
|
|
31
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
32
|
+
(0, microservices_1.GrpcStreamMethod)("ProductReviewService", method)(constructor.prototype[method], method, descriptor);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.PRODUCT_REVIEW_SERVICE_NAME = "ProductReviewService";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package catalog.v1;
|
|
4
|
+
|
|
5
|
+
import "common.proto";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
service ProductReviewService {
|
|
9
|
+
rpc GetReviews (GetReviewsRequest) returns (GetReviewsResponse);
|
|
10
|
+
rpc CreateReview (CreateReviewRequest) returns (ReviewResponse);
|
|
11
|
+
rpc ApproveReview (ReviewIdRequest) returns (ReviewResponse);
|
|
12
|
+
rpc RejectReview (ReviewIdRequest) returns (ReviewResponse);
|
|
13
|
+
rpc DeleteReview (ReviewIdRequest) returns (DeleteResponse);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
enum ReviewStatus {
|
|
18
|
+
REVIEW_STATUS_UNSPECIFIED = 0;
|
|
19
|
+
REVIEW_STATUS_PENDING = 1;
|
|
20
|
+
REVIEW_STATUS_APPROVED = 2;
|
|
21
|
+
REVIEW_STATUS_REJECTED = 3;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
message ReviewResponse {
|
|
26
|
+
string id = 1;
|
|
27
|
+
string product_id = 2;
|
|
28
|
+
string author_name = 3;
|
|
29
|
+
string author_email = 4;
|
|
30
|
+
string body = 5;
|
|
31
|
+
int32 rating = 6;
|
|
32
|
+
ReviewStatus status = 7;
|
|
33
|
+
string created_at = 8;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
message GetReviewsRequest {
|
|
38
|
+
PaginationRequest pagination = 1;
|
|
39
|
+
optional string product_id = 2;
|
|
40
|
+
optional ReviewStatus status = 3;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message GetReviewsResponse {
|
|
44
|
+
repeated ReviewResponse items = 1;
|
|
45
|
+
PaginationMeta meta = 2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
message CreateReviewRequest {
|
|
50
|
+
string product_id = 1;
|
|
51
|
+
string author_name = 2;
|
|
52
|
+
string author_email = 3;
|
|
53
|
+
string body = 4;
|
|
54
|
+
int32 rating = 5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
message ReviewIdRequest {
|
|
59
|
+
string id = 1;
|
|
60
|
+
}
|
package/dist/src/proto/paths.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.PROTO_PATHS = {
|
|
|
18
18
|
BUNDLE: (0, node_path_1.join)(__dirname, '../../proto/bundle.proto'),
|
|
19
19
|
FILTER: (0, node_path_1.join)(__dirname, '../../proto/shop_filters.proto'),
|
|
20
20
|
PICKUP: (0, node_path_1.join)(__dirname, '../../proto/pickup.proto'),
|
|
21
|
+
PRODUCT_REVIEW: (0, node_path_1.join)(__dirname, '../../proto/product_review.proto'),
|
|
21
22
|
COMMON_PROMO: (0, node_path_1.join)(__dirname, '../../proto/common_promo.proto'),
|
|
22
23
|
CALCULATION: (0, node_path_1.join)(__dirname, '../../proto/calculation.proto'),
|
|
23
24
|
COUPON: (0, node_path_1.join)(__dirname, '../../proto/coupon.proto'),
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: product_review.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { DeleteResponse, PaginationMeta, PaginationRequest } from "./common";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "catalog.v1";
|
|
13
|
+
|
|
14
|
+
export enum ReviewStatus {
|
|
15
|
+
REVIEW_STATUS_UNSPECIFIED = 0,
|
|
16
|
+
REVIEW_STATUS_PENDING = 1,
|
|
17
|
+
REVIEW_STATUS_APPROVED = 2,
|
|
18
|
+
REVIEW_STATUS_REJECTED = 3,
|
|
19
|
+
UNRECOGNIZED = -1,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface ReviewResponse {
|
|
23
|
+
id: string;
|
|
24
|
+
productId: string;
|
|
25
|
+
authorName: string;
|
|
26
|
+
authorEmail: string;
|
|
27
|
+
body: string;
|
|
28
|
+
rating: number;
|
|
29
|
+
status: ReviewStatus;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface GetReviewsRequest {
|
|
34
|
+
pagination: PaginationRequest | undefined;
|
|
35
|
+
productId?: string | undefined;
|
|
36
|
+
status?: ReviewStatus | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface GetReviewsResponse {
|
|
40
|
+
items: ReviewResponse[];
|
|
41
|
+
meta: PaginationMeta | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface CreateReviewRequest {
|
|
45
|
+
productId: string;
|
|
46
|
+
authorName: string;
|
|
47
|
+
authorEmail: string;
|
|
48
|
+
body: string;
|
|
49
|
+
rating: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface ReviewIdRequest {
|
|
53
|
+
id: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const CATALOG_V1_PACKAGE_NAME = "catalog.v1";
|
|
57
|
+
|
|
58
|
+
export interface ProductReviewServiceClient {
|
|
59
|
+
getReviews(request: GetReviewsRequest): Observable<GetReviewsResponse>;
|
|
60
|
+
|
|
61
|
+
createReview(request: CreateReviewRequest): Observable<ReviewResponse>;
|
|
62
|
+
|
|
63
|
+
approveReview(request: ReviewIdRequest): Observable<ReviewResponse>;
|
|
64
|
+
|
|
65
|
+
rejectReview(request: ReviewIdRequest): Observable<ReviewResponse>;
|
|
66
|
+
|
|
67
|
+
deleteReview(request: ReviewIdRequest): Observable<DeleteResponse>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ProductReviewServiceController {
|
|
71
|
+
getReviews(
|
|
72
|
+
request: GetReviewsRequest,
|
|
73
|
+
): Promise<GetReviewsResponse> | Observable<GetReviewsResponse> | GetReviewsResponse;
|
|
74
|
+
|
|
75
|
+
createReview(request: CreateReviewRequest): Promise<ReviewResponse> | Observable<ReviewResponse> | ReviewResponse;
|
|
76
|
+
|
|
77
|
+
approveReview(request: ReviewIdRequest): Promise<ReviewResponse> | Observable<ReviewResponse> | ReviewResponse;
|
|
78
|
+
|
|
79
|
+
rejectReview(request: ReviewIdRequest): Promise<ReviewResponse> | Observable<ReviewResponse> | ReviewResponse;
|
|
80
|
+
|
|
81
|
+
deleteReview(request: ReviewIdRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function ProductReviewServiceControllerMethods() {
|
|
85
|
+
return function (constructor: Function) {
|
|
86
|
+
const grpcMethods: string[] = ["getReviews", "createReview", "approveReview", "rejectReview", "deleteReview"];
|
|
87
|
+
for (const method of grpcMethods) {
|
|
88
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
89
|
+
GrpcMethod("ProductReviewService", method)(constructor.prototype[method], method, descriptor);
|
|
90
|
+
}
|
|
91
|
+
const grpcStreamMethods: string[] = [];
|
|
92
|
+
for (const method of grpcStreamMethods) {
|
|
93
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
94
|
+
GrpcStreamMethod("ProductReviewService", method)(constructor.prototype[method], method, descriptor);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const PRODUCT_REVIEW_SERVICE_NAME = "ProductReviewService";
|
package/package.json
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package catalog.v1;
|
|
4
|
+
|
|
5
|
+
import "common.proto";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
service ProductReviewService {
|
|
9
|
+
rpc GetReviews (GetReviewsRequest) returns (GetReviewsResponse);
|
|
10
|
+
rpc CreateReview (CreateReviewRequest) returns (ReviewResponse);
|
|
11
|
+
rpc ApproveReview (ReviewIdRequest) returns (ReviewResponse);
|
|
12
|
+
rpc RejectReview (ReviewIdRequest) returns (ReviewResponse);
|
|
13
|
+
rpc DeleteReview (ReviewIdRequest) returns (DeleteResponse);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
enum ReviewStatus {
|
|
18
|
+
REVIEW_STATUS_UNSPECIFIED = 0;
|
|
19
|
+
REVIEW_STATUS_PENDING = 1;
|
|
20
|
+
REVIEW_STATUS_APPROVED = 2;
|
|
21
|
+
REVIEW_STATUS_REJECTED = 3;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
message ReviewResponse {
|
|
26
|
+
string id = 1;
|
|
27
|
+
string product_id = 2;
|
|
28
|
+
string author_name = 3;
|
|
29
|
+
string author_email = 4;
|
|
30
|
+
string body = 5;
|
|
31
|
+
int32 rating = 6;
|
|
32
|
+
ReviewStatus status = 7;
|
|
33
|
+
string created_at = 8;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
message GetReviewsRequest {
|
|
38
|
+
PaginationRequest pagination = 1;
|
|
39
|
+
optional string product_id = 2;
|
|
40
|
+
optional ReviewStatus status = 3;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message GetReviewsResponse {
|
|
44
|
+
repeated ReviewResponse items = 1;
|
|
45
|
+
PaginationMeta meta = 2;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
message CreateReviewRequest {
|
|
50
|
+
string product_id = 1;
|
|
51
|
+
string author_name = 2;
|
|
52
|
+
string author_email = 3;
|
|
53
|
+
string body = 4;
|
|
54
|
+
int32 rating = 5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
message ReviewIdRequest {
|
|
59
|
+
string id = 1;
|
|
60
|
+
}
|