@prodoctors/contracts 1.0.1 → 1.0.3
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/gen/account.ts +6 -3
- package/gen/auth.ts +3 -14
- package/gen/branch.ts +10 -10
- package/gen/common.ts +41 -0
- package/gen/google/protobuf/timestamp.ts +118 -0
- package/gen/inventory.ts +297 -0
- package/package.json +27 -27
- package/proto/account.proto +21 -22
- package/proto/auth.proto +71 -81
- package/proto/branch.proto +64 -64
- package/proto/common.proto +34 -0
- package/proto/inventory.proto +170 -0
package/gen/account.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.11.5
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v3.21.12
|
|
5
5
|
// source: account.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
8
8
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
9
|
import { Observable } from "rxjs";
|
|
10
|
-
import { Role } from "./auth";
|
|
11
10
|
|
|
12
11
|
export const protobufPackage = "account.v1";
|
|
13
12
|
|
|
@@ -19,18 +18,22 @@ export interface GetAccountResponse {
|
|
|
19
18
|
id: string;
|
|
20
19
|
name: string;
|
|
21
20
|
username: string;
|
|
22
|
-
role:
|
|
21
|
+
role: string;
|
|
23
22
|
branchId: string;
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
27
26
|
|
|
27
|
+
/** Account service for managing user profiles */
|
|
28
|
+
|
|
28
29
|
export interface AccountServiceClient {
|
|
29
30
|
/** Get user profile information */
|
|
30
31
|
|
|
31
32
|
getProfile(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
/** Account service for managing user profiles */
|
|
36
|
+
|
|
34
37
|
export interface AccountServiceController {
|
|
35
38
|
/** Get user profile information */
|
|
36
39
|
|
package/gen/auth.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.11.5
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v3.21.12
|
|
5
5
|
// source: auth.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
@@ -10,17 +10,6 @@ import { Observable } from "rxjs";
|
|
|
10
10
|
|
|
11
11
|
export const protobufPackage = "auth.v1";
|
|
12
12
|
|
|
13
|
-
export enum Role {
|
|
14
|
-
USER = 0,
|
|
15
|
-
SUPER_ADMIN = 1,
|
|
16
|
-
MANAGER = 2,
|
|
17
|
-
PHARMACIST = 3,
|
|
18
|
-
CASHIER = 4,
|
|
19
|
-
INVENTORY_MANAGER = 5,
|
|
20
|
-
AUDITOR = 6,
|
|
21
|
-
UNRECOGNIZED = -1,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
13
|
export interface LoginRequest {
|
|
25
14
|
username: string;
|
|
26
15
|
password: string;
|
|
@@ -35,8 +24,8 @@ export interface RegisterRequest {
|
|
|
35
24
|
name: string;
|
|
36
25
|
username: string;
|
|
37
26
|
password: string;
|
|
38
|
-
role
|
|
39
|
-
branchId
|
|
27
|
+
role?: string | undefined;
|
|
28
|
+
branchId?: string | undefined;
|
|
40
29
|
}
|
|
41
30
|
|
|
42
31
|
export interface RegisterResponse {
|
package/gen/branch.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
3
|
// protoc-gen-ts_proto v2.11.5
|
|
4
|
-
// protoc
|
|
4
|
+
// protoc v3.21.12
|
|
5
5
|
// source: branch.proto
|
|
6
6
|
|
|
7
7
|
/* eslint-disable */
|
|
@@ -13,9 +13,9 @@ export const protobufPackage = "branch.v1";
|
|
|
13
13
|
export interface CreateBranchRequest {
|
|
14
14
|
name: string;
|
|
15
15
|
phone: string;
|
|
16
|
-
address
|
|
17
|
-
lat
|
|
18
|
-
lng
|
|
16
|
+
address?: string | undefined;
|
|
17
|
+
lat?: string | undefined;
|
|
18
|
+
lng?: string | undefined;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface CreateBranchResponse {
|
|
@@ -30,18 +30,18 @@ export interface GetBranchResponse {
|
|
|
30
30
|
id: string;
|
|
31
31
|
name: string;
|
|
32
32
|
phone: string;
|
|
33
|
-
address
|
|
34
|
-
lat
|
|
35
|
-
lng
|
|
33
|
+
address?: string | undefined;
|
|
34
|
+
lat?: string | undefined;
|
|
35
|
+
lng?: string | undefined;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface UpdateBranchRequest {
|
|
39
39
|
id: string;
|
|
40
40
|
name: string;
|
|
41
41
|
phone: string;
|
|
42
|
-
address
|
|
43
|
-
lat
|
|
44
|
-
lng
|
|
42
|
+
address?: string | undefined;
|
|
43
|
+
lat?: string | undefined;
|
|
44
|
+
lng?: string | undefined;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface UpdateBranchResponse {
|
package/gen/common.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: common.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
9
|
+
|
|
10
|
+
export const protobufPackage = "common.v1";
|
|
11
|
+
|
|
12
|
+
export interface Empty {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface PaginationRequest {
|
|
16
|
+
page: number;
|
|
17
|
+
limit: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PaginationMeta {
|
|
21
|
+
page: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
total: number;
|
|
24
|
+
totalPages: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IdRequest {
|
|
28
|
+
id: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface BoolResponse {
|
|
32
|
+
success: boolean;
|
|
33
|
+
message: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DateRange {
|
|
37
|
+
from: Timestamp | undefined;
|
|
38
|
+
to: Timestamp | undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const COMMON_V1_PACKAGE_NAME = "common.v1";
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: google/protobuf/timestamp.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
|
|
9
|
+
export const protobufPackage = "google.protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A Timestamp represents a point in time independent of any time zone or local
|
|
13
|
+
* calendar, encoded as a count of seconds and fractions of seconds at
|
|
14
|
+
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
|
15
|
+
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
|
16
|
+
* Gregorian calendar backwards to year one.
|
|
17
|
+
*
|
|
18
|
+
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
|
19
|
+
* second table is needed for interpretation, using a [24-hour linear
|
|
20
|
+
* smear](https://developers.google.com/time/smear).
|
|
21
|
+
*
|
|
22
|
+
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
|
23
|
+
* restricting to that range, we ensure that we can convert to and from [RFC
|
|
24
|
+
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
|
25
|
+
*
|
|
26
|
+
* # Examples
|
|
27
|
+
*
|
|
28
|
+
* Example 1: Compute Timestamp from POSIX `time()`.
|
|
29
|
+
*
|
|
30
|
+
* Timestamp timestamp;
|
|
31
|
+
* timestamp.set_seconds(time(NULL));
|
|
32
|
+
* timestamp.set_nanos(0);
|
|
33
|
+
*
|
|
34
|
+
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
|
35
|
+
*
|
|
36
|
+
* struct timeval tv;
|
|
37
|
+
* gettimeofday(&tv, NULL);
|
|
38
|
+
*
|
|
39
|
+
* Timestamp timestamp;
|
|
40
|
+
* timestamp.set_seconds(tv.tv_sec);
|
|
41
|
+
* timestamp.set_nanos(tv.tv_usec * 1000);
|
|
42
|
+
*
|
|
43
|
+
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
|
44
|
+
*
|
|
45
|
+
* FILETIME ft;
|
|
46
|
+
* GetSystemTimeAsFileTime(&ft);
|
|
47
|
+
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
|
48
|
+
*
|
|
49
|
+
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
|
50
|
+
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
|
51
|
+
* Timestamp timestamp;
|
|
52
|
+
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
|
53
|
+
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
|
54
|
+
*
|
|
55
|
+
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
|
56
|
+
*
|
|
57
|
+
* long millis = System.currentTimeMillis();
|
|
58
|
+
*
|
|
59
|
+
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
|
60
|
+
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
|
61
|
+
*
|
|
62
|
+
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
|
63
|
+
*
|
|
64
|
+
* Instant now = Instant.now();
|
|
65
|
+
*
|
|
66
|
+
* Timestamp timestamp =
|
|
67
|
+
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
|
68
|
+
* .setNanos(now.getNano()).build();
|
|
69
|
+
*
|
|
70
|
+
* Example 6: Compute Timestamp from current time in Python.
|
|
71
|
+
*
|
|
72
|
+
* timestamp = Timestamp()
|
|
73
|
+
* timestamp.GetCurrentTime()
|
|
74
|
+
*
|
|
75
|
+
* # JSON Mapping
|
|
76
|
+
*
|
|
77
|
+
* In JSON format, the Timestamp type is encoded as a string in the
|
|
78
|
+
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
|
79
|
+
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
|
80
|
+
* where {year} is always expressed using four digits while {month}, {day},
|
|
81
|
+
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
|
82
|
+
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
|
83
|
+
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
|
84
|
+
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
|
85
|
+
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
|
86
|
+
* able to accept both UTC and other timezones (as indicated by an offset).
|
|
87
|
+
*
|
|
88
|
+
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
|
89
|
+
* 01:30 UTC on January 15, 2017.
|
|
90
|
+
*
|
|
91
|
+
* In JavaScript, one can convert a Date object to this format using the
|
|
92
|
+
* standard
|
|
93
|
+
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
|
94
|
+
* method. In Python, a standard `datetime.datetime` object can be converted
|
|
95
|
+
* to this format using
|
|
96
|
+
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
|
97
|
+
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
|
98
|
+
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
|
99
|
+
* http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
|
|
100
|
+
* ) to obtain a formatter capable of generating timestamps in this format.
|
|
101
|
+
*/
|
|
102
|
+
export interface Timestamp {
|
|
103
|
+
/**
|
|
104
|
+
* Represents seconds of UTC time since Unix epoch
|
|
105
|
+
* 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
|
106
|
+
* 9999-12-31T23:59:59Z inclusive.
|
|
107
|
+
*/
|
|
108
|
+
seconds: number;
|
|
109
|
+
/**
|
|
110
|
+
* Non-negative fractions of a second at nanosecond resolution. Negative
|
|
111
|
+
* second values with fractions must still have non-negative nanos values
|
|
112
|
+
* that count forward in time. Must be from 0 to 999,999,999
|
|
113
|
+
* inclusive.
|
|
114
|
+
*/
|
|
115
|
+
nanos: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
package/gen/inventory.ts
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: inventory.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { BoolResponse, Empty, IdRequest, PaginationMeta, PaginationRequest } from "./common";
|
|
11
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
12
|
+
|
|
13
|
+
export const protobufPackage = "inventory.v1";
|
|
14
|
+
|
|
15
|
+
export interface Branch {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
phone: string;
|
|
19
|
+
address?: string | undefined;
|
|
20
|
+
lat?: string | undefined;
|
|
21
|
+
lng?: string | undefined;
|
|
22
|
+
createdAt: Timestamp | undefined;
|
|
23
|
+
updatedAt: Timestamp | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Product {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
sku: string;
|
|
30
|
+
barcode: string;
|
|
31
|
+
price: string;
|
|
32
|
+
costPrice?: string | undefined;
|
|
33
|
+
createdAt: Timestamp | undefined;
|
|
34
|
+
updatedAt: Timestamp | undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface InventoryItem {
|
|
38
|
+
id: string;
|
|
39
|
+
branchId: string;
|
|
40
|
+
productId: string;
|
|
41
|
+
quantity: number;
|
|
42
|
+
minQuantity: number;
|
|
43
|
+
expireAt?: Timestamp | undefined;
|
|
44
|
+
batchNumber?: string | undefined;
|
|
45
|
+
branch: Branch | undefined;
|
|
46
|
+
product: Product | undefined;
|
|
47
|
+
createdAt: Timestamp | undefined;
|
|
48
|
+
updatedAt: Timestamp | undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CreateBranchRequest {
|
|
52
|
+
name: string;
|
|
53
|
+
address?: string | undefined;
|
|
54
|
+
phone?: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface UpdateBranchRequest {
|
|
58
|
+
id: string;
|
|
59
|
+
name?: string | undefined;
|
|
60
|
+
address?: string | undefined;
|
|
61
|
+
phone?: string | undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ListBranchesResponse {
|
|
65
|
+
items: Branch[];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CreateProductRequest {
|
|
69
|
+
name: string;
|
|
70
|
+
sku: string;
|
|
71
|
+
barcode: string;
|
|
72
|
+
/** / Kirim narxi */
|
|
73
|
+
costPrice: string;
|
|
74
|
+
/** / Sotuv narxi */
|
|
75
|
+
price?: string | undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface UpdateProductRequest {
|
|
79
|
+
id: string;
|
|
80
|
+
name?: string | undefined;
|
|
81
|
+
sku?: string | undefined;
|
|
82
|
+
barcode?: string | undefined;
|
|
83
|
+
price?: string | undefined;
|
|
84
|
+
costPrice?: string | undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface GetProductByIdRequest {
|
|
88
|
+
id: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ListProductsRequest {
|
|
92
|
+
pagination: PaginationRequest | undefined;
|
|
93
|
+
search?: string | undefined;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface ListProductsResponse {
|
|
97
|
+
items: Product[];
|
|
98
|
+
meta: PaginationMeta | undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface CreateInventoryRequest {
|
|
102
|
+
branchId: string;
|
|
103
|
+
productId: string;
|
|
104
|
+
quantity: number;
|
|
105
|
+
minQuantity: number;
|
|
106
|
+
expireAt?: Timestamp | undefined;
|
|
107
|
+
batchNumber?: string | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface UpdateInventoryRequest {
|
|
111
|
+
id: string;
|
|
112
|
+
quantity?: number | undefined;
|
|
113
|
+
minQuantity?: number | undefined;
|
|
114
|
+
expireAt?: Timestamp | undefined;
|
|
115
|
+
batchNumber?: string | undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface AdjustInventoryQuantityRequest {
|
|
119
|
+
inventoryId: string;
|
|
120
|
+
quantityChange: number;
|
|
121
|
+
reason: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface TransferInventoryRequest {
|
|
125
|
+
productId: string;
|
|
126
|
+
fromBranchId: string;
|
|
127
|
+
toBranchId: string;
|
|
128
|
+
quantity: number;
|
|
129
|
+
batchNumber?: string | undefined;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface GetInventoryByIdRequest {
|
|
133
|
+
id: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface ListInventoryRequest {
|
|
137
|
+
pagination: PaginationRequest | undefined;
|
|
138
|
+
branchId?: string | undefined;
|
|
139
|
+
productId?: string | undefined;
|
|
140
|
+
search?: string | undefined;
|
|
141
|
+
lowStockOnly?: boolean | undefined;
|
|
142
|
+
expiringSoonOnly?: boolean | undefined;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface ListInventoryResponse {
|
|
146
|
+
items: InventoryItem[];
|
|
147
|
+
meta: PaginationMeta | undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const INVENTORY_V1_PACKAGE_NAME = "inventory.v1";
|
|
151
|
+
|
|
152
|
+
export interface BranchServiceClient {
|
|
153
|
+
createBranch(request: CreateBranchRequest): Observable<Branch>;
|
|
154
|
+
|
|
155
|
+
updateBranch(request: UpdateBranchRequest): Observable<Branch>;
|
|
156
|
+
|
|
157
|
+
getBranchById(request: IdRequest): Observable<Branch>;
|
|
158
|
+
|
|
159
|
+
listBranches(request: Empty): Observable<ListBranchesResponse>;
|
|
160
|
+
|
|
161
|
+
deleteBranch(request: IdRequest): Observable<BoolResponse>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface BranchServiceController {
|
|
165
|
+
createBranch(request: CreateBranchRequest): Promise<Branch> | Observable<Branch> | Branch;
|
|
166
|
+
|
|
167
|
+
updateBranch(request: UpdateBranchRequest): Promise<Branch> | Observable<Branch> | Branch;
|
|
168
|
+
|
|
169
|
+
getBranchById(request: IdRequest): Promise<Branch> | Observable<Branch> | Branch;
|
|
170
|
+
|
|
171
|
+
listBranches(request: Empty): Promise<ListBranchesResponse> | Observable<ListBranchesResponse> | ListBranchesResponse;
|
|
172
|
+
|
|
173
|
+
deleteBranch(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function BranchServiceControllerMethods() {
|
|
177
|
+
return function (constructor: Function) {
|
|
178
|
+
const grpcMethods: string[] = ["createBranch", "updateBranch", "getBranchById", "listBranches", "deleteBranch"];
|
|
179
|
+
for (const method of grpcMethods) {
|
|
180
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
181
|
+
GrpcMethod("BranchService", method)(constructor.prototype[method], method, descriptor);
|
|
182
|
+
}
|
|
183
|
+
const grpcStreamMethods: string[] = [];
|
|
184
|
+
for (const method of grpcStreamMethods) {
|
|
185
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
186
|
+
GrpcStreamMethod("BranchService", method)(constructor.prototype[method], method, descriptor);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export const BRANCH_SERVICE_NAME = "BranchService";
|
|
192
|
+
|
|
193
|
+
export interface ProductServiceClient {
|
|
194
|
+
createProduct(request: CreateProductRequest): Observable<Product>;
|
|
195
|
+
|
|
196
|
+
updateProduct(request: UpdateProductRequest): Observable<Product>;
|
|
197
|
+
|
|
198
|
+
getProductById(request: GetProductByIdRequest): Observable<Product>;
|
|
199
|
+
|
|
200
|
+
listProducts(request: ListProductsRequest): Observable<ListProductsResponse>;
|
|
201
|
+
|
|
202
|
+
deleteProduct(request: IdRequest): Observable<BoolResponse>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface ProductServiceController {
|
|
206
|
+
createProduct(request: CreateProductRequest): Promise<Product> | Observable<Product> | Product;
|
|
207
|
+
|
|
208
|
+
updateProduct(request: UpdateProductRequest): Promise<Product> | Observable<Product> | Product;
|
|
209
|
+
|
|
210
|
+
getProductById(request: GetProductByIdRequest): Promise<Product> | Observable<Product> | Product;
|
|
211
|
+
|
|
212
|
+
listProducts(
|
|
213
|
+
request: ListProductsRequest,
|
|
214
|
+
): Promise<ListProductsResponse> | Observable<ListProductsResponse> | ListProductsResponse;
|
|
215
|
+
|
|
216
|
+
deleteProduct(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export function ProductServiceControllerMethods() {
|
|
220
|
+
return function (constructor: Function) {
|
|
221
|
+
const grpcMethods: string[] = ["createProduct", "updateProduct", "getProductById", "listProducts", "deleteProduct"];
|
|
222
|
+
for (const method of grpcMethods) {
|
|
223
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
224
|
+
GrpcMethod("ProductService", method)(constructor.prototype[method], method, descriptor);
|
|
225
|
+
}
|
|
226
|
+
const grpcStreamMethods: string[] = [];
|
|
227
|
+
for (const method of grpcStreamMethods) {
|
|
228
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
229
|
+
GrpcStreamMethod("ProductService", method)(constructor.prototype[method], method, descriptor);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export const PRODUCT_SERVICE_NAME = "ProductService";
|
|
235
|
+
|
|
236
|
+
export interface InventoryServiceClient {
|
|
237
|
+
createInventory(request: CreateInventoryRequest): Observable<InventoryItem>;
|
|
238
|
+
|
|
239
|
+
updateInventory(request: UpdateInventoryRequest): Observable<InventoryItem>;
|
|
240
|
+
|
|
241
|
+
adjustQuantity(request: AdjustInventoryQuantityRequest): Observable<InventoryItem>;
|
|
242
|
+
|
|
243
|
+
transferInventory(request: TransferInventoryRequest): Observable<BoolResponse>;
|
|
244
|
+
|
|
245
|
+
getInventoryById(request: GetInventoryByIdRequest): Observable<InventoryItem>;
|
|
246
|
+
|
|
247
|
+
listInventory(request: ListInventoryRequest): Observable<ListInventoryResponse>;
|
|
248
|
+
|
|
249
|
+
deleteInventory(request: IdRequest): Observable<BoolResponse>;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface InventoryServiceController {
|
|
253
|
+
createInventory(request: CreateInventoryRequest): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
|
|
254
|
+
|
|
255
|
+
updateInventory(request: UpdateInventoryRequest): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
|
|
256
|
+
|
|
257
|
+
adjustQuantity(
|
|
258
|
+
request: AdjustInventoryQuantityRequest,
|
|
259
|
+
): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
|
|
260
|
+
|
|
261
|
+
transferInventory(request: TransferInventoryRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
|
|
262
|
+
|
|
263
|
+
getInventoryById(
|
|
264
|
+
request: GetInventoryByIdRequest,
|
|
265
|
+
): Promise<InventoryItem> | Observable<InventoryItem> | InventoryItem;
|
|
266
|
+
|
|
267
|
+
listInventory(
|
|
268
|
+
request: ListInventoryRequest,
|
|
269
|
+
): Promise<ListInventoryResponse> | Observable<ListInventoryResponse> | ListInventoryResponse;
|
|
270
|
+
|
|
271
|
+
deleteInventory(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function InventoryServiceControllerMethods() {
|
|
275
|
+
return function (constructor: Function) {
|
|
276
|
+
const grpcMethods: string[] = [
|
|
277
|
+
"createInventory",
|
|
278
|
+
"updateInventory",
|
|
279
|
+
"adjustQuantity",
|
|
280
|
+
"transferInventory",
|
|
281
|
+
"getInventoryById",
|
|
282
|
+
"listInventory",
|
|
283
|
+
"deleteInventory",
|
|
284
|
+
];
|
|
285
|
+
for (const method of grpcMethods) {
|
|
286
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
287
|
+
GrpcMethod("InventoryService", method)(constructor.prototype[method], method, descriptor);
|
|
288
|
+
}
|
|
289
|
+
const grpcStreamMethods: string[] = [];
|
|
290
|
+
for (const method of grpcStreamMethods) {
|
|
291
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
292
|
+
GrpcStreamMethod("InventoryService", method)(constructor.prototype[method], method, descriptor);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export const INVENTORY_SERVICE_NAME = "InventoryService";
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@prodoctors/contracts",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Protobuf definitions and generated Typescript types for ProDoctors",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc -p tsconfig.build.json",
|
|
9
|
-
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"proto",
|
|
13
|
-
"gen",
|
|
14
|
-
"dist"
|
|
15
|
-
],
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@nestjs/microservices": "^11.1.15",
|
|
21
|
-
"rxjs": "^7.8.2",
|
|
22
|
-
"ts-proto": "^2.11.4"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/node": "^25.3.5",
|
|
26
|
-
"typescript": "^5.9.3"
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@prodoctors/contracts",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Protobuf definitions and generated Typescript types for ProDoctors",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -p tsconfig.build.json",
|
|
9
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"proto",
|
|
13
|
+
"gen",
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@nestjs/microservices": "^11.1.15",
|
|
21
|
+
"rxjs": "^7.8.2",
|
|
22
|
+
"ts-proto": "^2.11.4"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^25.3.5",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
}
|
|
28
28
|
}
|
package/proto/account.proto
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
syntax = "proto3";
|
|
3
|
-
|
|
4
|
-
package account.v1;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
string
|
|
19
|
-
string
|
|
20
|
-
string
|
|
21
|
-
|
|
22
|
-
string branch_id = 5;
|
|
1
|
+
|
|
2
|
+
syntax = "proto3";
|
|
3
|
+
|
|
4
|
+
package account.v1;
|
|
5
|
+
|
|
6
|
+
// Account service for managing user profiles
|
|
7
|
+
service AccountService {
|
|
8
|
+
// Get user profile information
|
|
9
|
+
rpc GetProfile (GetAccountRequest) returns (GetAccountResponse);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message GetAccountRequest {
|
|
13
|
+
string id = 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message GetAccountResponse {
|
|
17
|
+
string id = 1;
|
|
18
|
+
string name = 2;
|
|
19
|
+
string username = 3;
|
|
20
|
+
string role = 4;
|
|
21
|
+
string branch_id = 5;
|
|
23
22
|
}
|
package/proto/auth.proto
CHANGED
|
@@ -1,82 +1,72 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package auth.v1;
|
|
4
|
-
|
|
5
|
-
// Authentication service for sending and verifying OTPs
|
|
6
|
-
service AuthService {
|
|
7
|
-
// Authoriration user
|
|
8
|
-
rpc Login (LoginRequest) returns (LoginResponse);
|
|
9
|
-
|
|
10
|
-
// Registration user
|
|
11
|
-
rpc Register (RegisterRequest) returns (RegisterResponse);
|
|
12
|
-
|
|
13
|
-
// Send OTP to the user
|
|
14
|
-
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
15
|
-
|
|
16
|
-
// Verify the OTP sent to the user
|
|
17
|
-
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
18
|
-
|
|
19
|
-
// Refersh token
|
|
20
|
-
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
message LoginRequest {
|
|
24
|
-
string username = 1;
|
|
25
|
-
string password = 2;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
message LoginResponse {
|
|
29
|
-
string access_token = 1;
|
|
30
|
-
string refresh_token = 2;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
message RegisterRequest {
|
|
34
|
-
string name = 1;
|
|
35
|
-
string username = 2;
|
|
36
|
-
string password = 3;
|
|
37
|
-
|
|
38
|
-
string
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
message RegisterResponse {
|
|
42
|
-
bool ok = 1;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
message SendOtpRequest {
|
|
46
|
-
string identifier = 1;
|
|
47
|
-
string type = 2;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
message SendOtpResponse {
|
|
51
|
-
bool ok = 1;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
message VerifyOtpRequest {
|
|
55
|
-
string identifier = 1;
|
|
56
|
-
string type = 2;
|
|
57
|
-
string code = 3;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
message VerifyOtpResponse {
|
|
61
|
-
string access_token = 1;
|
|
62
|
-
string refresh_token = 2;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
message RefreshRequest {
|
|
66
|
-
string refresh_token = 1;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
message RefreshResponse {
|
|
70
|
-
string access_token = 1;
|
|
71
|
-
string refresh_token = 2;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
enum Role {
|
|
75
|
-
USER = 0;
|
|
76
|
-
SUPER_ADMIN = 1;
|
|
77
|
-
MANAGER = 2;
|
|
78
|
-
PHARMACIST = 3;
|
|
79
|
-
CASHIER = 4;
|
|
80
|
-
INVENTORY_MANAGER = 5;
|
|
81
|
-
AUDITOR = 6;
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package auth.v1;
|
|
4
|
+
|
|
5
|
+
// Authentication service for sending and verifying OTPs
|
|
6
|
+
service AuthService {
|
|
7
|
+
// Authoriration user
|
|
8
|
+
rpc Login (LoginRequest) returns (LoginResponse);
|
|
9
|
+
|
|
10
|
+
// Registration user
|
|
11
|
+
rpc Register (RegisterRequest) returns (RegisterResponse);
|
|
12
|
+
|
|
13
|
+
// Send OTP to the user
|
|
14
|
+
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
15
|
+
|
|
16
|
+
// Verify the OTP sent to the user
|
|
17
|
+
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
18
|
+
|
|
19
|
+
// Refersh token
|
|
20
|
+
rpc Refresh (RefreshRequest) returns (RefreshResponse);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message LoginRequest {
|
|
24
|
+
string username = 1;
|
|
25
|
+
string password = 2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message LoginResponse {
|
|
29
|
+
string access_token = 1;
|
|
30
|
+
string refresh_token = 2;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message RegisterRequest {
|
|
34
|
+
string name = 1;
|
|
35
|
+
string username = 2;
|
|
36
|
+
string password = 3;
|
|
37
|
+
optional string role = 4;
|
|
38
|
+
optional string branch_id = 5;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
message RegisterResponse {
|
|
42
|
+
bool ok = 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message SendOtpRequest {
|
|
46
|
+
string identifier = 1;
|
|
47
|
+
string type = 2;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message SendOtpResponse {
|
|
51
|
+
bool ok = 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message VerifyOtpRequest {
|
|
55
|
+
string identifier = 1;
|
|
56
|
+
string type = 2;
|
|
57
|
+
string code = 3;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
message VerifyOtpResponse {
|
|
61
|
+
string access_token = 1;
|
|
62
|
+
string refresh_token = 2;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
message RefreshRequest {
|
|
66
|
+
string refresh_token = 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
message RefreshResponse {
|
|
70
|
+
string access_token = 1;
|
|
71
|
+
string refresh_token = 2;
|
|
82
72
|
}
|
package/proto/branch.proto
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package branch.v1;
|
|
4
|
-
|
|
5
|
-
// Branch service for managing branches
|
|
6
|
-
service BranchService {
|
|
7
|
-
// Create a new branch
|
|
8
|
-
rpc CreateBranch (CreateBranchRequest) returns (CreateBranchResponse);
|
|
9
|
-
|
|
10
|
-
// Get branch details by ID
|
|
11
|
-
rpc GetBranch (GetBranchRequest) returns (GetBranchResponse);
|
|
12
|
-
|
|
13
|
-
// Update branch details
|
|
14
|
-
rpc UpdateBranch (UpdateBranchRequest) returns (UpdateBranchResponse);
|
|
15
|
-
|
|
16
|
-
// Delete a branch by ID
|
|
17
|
-
rpc DeleteBranch (DeleteBranchRequest) returns (DeleteBranchResponse);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
message CreateBranchRequest {
|
|
21
|
-
string name = 1;
|
|
22
|
-
string phone = 2;
|
|
23
|
-
string address = 3;
|
|
24
|
-
string lat = 4;
|
|
25
|
-
string lng = 5;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
message CreateBranchResponse {
|
|
29
|
-
string id = 1;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
message GetBranchRequest {
|
|
33
|
-
string id = 1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
message GetBranchResponse {
|
|
37
|
-
string id = 1;
|
|
38
|
-
string name = 2;
|
|
39
|
-
string phone = 3;
|
|
40
|
-
string address = 4;
|
|
41
|
-
string lat = 5;
|
|
42
|
-
string lng = 6;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
message UpdateBranchRequest {
|
|
46
|
-
string id = 1;
|
|
47
|
-
string name = 2;
|
|
48
|
-
string phone = 3;
|
|
49
|
-
string address = 4;
|
|
50
|
-
string lat = 5;
|
|
51
|
-
string lng = 6;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
message UpdateBranchResponse {
|
|
55
|
-
bool ok = 1;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
message DeleteBranchRequest {
|
|
59
|
-
string id = 1;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
message DeleteBranchResponse {
|
|
63
|
-
bool ok = 1;
|
|
64
|
-
}
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package branch.v1;
|
|
4
|
+
|
|
5
|
+
// Branch service for managing branches
|
|
6
|
+
service BranchService {
|
|
7
|
+
// Create a new branch
|
|
8
|
+
rpc CreateBranch (CreateBranchRequest) returns (CreateBranchResponse);
|
|
9
|
+
|
|
10
|
+
// Get branch details by ID
|
|
11
|
+
rpc GetBranch (GetBranchRequest) returns (GetBranchResponse);
|
|
12
|
+
|
|
13
|
+
// Update branch details
|
|
14
|
+
rpc UpdateBranch (UpdateBranchRequest) returns (UpdateBranchResponse);
|
|
15
|
+
|
|
16
|
+
// Delete a branch by ID
|
|
17
|
+
rpc DeleteBranch (DeleteBranchRequest) returns (DeleteBranchResponse);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
message CreateBranchRequest {
|
|
21
|
+
string name = 1;
|
|
22
|
+
string phone = 2;
|
|
23
|
+
optional string address = 3;
|
|
24
|
+
optional string lat = 4;
|
|
25
|
+
optional string lng = 5;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message CreateBranchResponse {
|
|
29
|
+
string id = 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
message GetBranchRequest {
|
|
33
|
+
string id = 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message GetBranchResponse {
|
|
37
|
+
string id = 1;
|
|
38
|
+
string name = 2;
|
|
39
|
+
string phone = 3;
|
|
40
|
+
optional string address = 4;
|
|
41
|
+
optional string lat = 5;
|
|
42
|
+
optional string lng = 6;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message UpdateBranchRequest {
|
|
46
|
+
string id = 1;
|
|
47
|
+
string name = 2;
|
|
48
|
+
string phone = 3;
|
|
49
|
+
optional string address = 4;
|
|
50
|
+
optional string lat = 5;
|
|
51
|
+
optional string lng = 6;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message UpdateBranchResponse {
|
|
55
|
+
bool ok = 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
message DeleteBranchRequest {
|
|
59
|
+
string id = 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message DeleteBranchResponse {
|
|
63
|
+
bool ok = 1;
|
|
64
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
package common.v1;
|
|
5
|
+
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
7
|
+
|
|
8
|
+
message Empty {}
|
|
9
|
+
|
|
10
|
+
message PaginationRequest {
|
|
11
|
+
int32 page = 1;
|
|
12
|
+
int32 limit = 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message PaginationMeta {
|
|
16
|
+
int32 page = 1;
|
|
17
|
+
int32 limit = 2;
|
|
18
|
+
int64 total = 3;
|
|
19
|
+
int32 total_pages = 4;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message IdRequest {
|
|
23
|
+
string id = 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message BoolResponse {
|
|
27
|
+
bool success = 1;
|
|
28
|
+
string message = 2;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message DateRange {
|
|
32
|
+
google.protobuf.Timestamp from = 1;
|
|
33
|
+
google.protobuf.Timestamp to = 2;
|
|
34
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package inventory.v1;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/timestamp.proto";
|
|
6
|
+
import "common.proto";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
message Branch {
|
|
10
|
+
string id = 1;
|
|
11
|
+
string name = 2;
|
|
12
|
+
string phone = 3;
|
|
13
|
+
optional string address = 4;
|
|
14
|
+
optional string lat = 5;
|
|
15
|
+
optional string lng = 6;
|
|
16
|
+
google.protobuf.Timestamp created_at = 7;
|
|
17
|
+
google.protobuf.Timestamp updated_at = 8;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
message Product {
|
|
21
|
+
string id = 1;
|
|
22
|
+
string name = 2;
|
|
23
|
+
string sku = 3;
|
|
24
|
+
string barcode = 4;
|
|
25
|
+
string price = 5;
|
|
26
|
+
optional string cost_price = 6;
|
|
27
|
+
google.protobuf.Timestamp created_at = 7;
|
|
28
|
+
google.protobuf.Timestamp updated_at = 8;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message InventoryItem {
|
|
32
|
+
string id = 1;
|
|
33
|
+
string branch_id = 2;
|
|
34
|
+
string product_id = 3;
|
|
35
|
+
int32 quantity = 4;
|
|
36
|
+
int32 min_quantity = 5;
|
|
37
|
+
optional google.protobuf.Timestamp expire_at = 6;
|
|
38
|
+
optional string batch_number = 7;
|
|
39
|
+
Branch branch = 8;
|
|
40
|
+
Product product = 9;
|
|
41
|
+
google.protobuf.Timestamp created_at = 10;
|
|
42
|
+
google.protobuf.Timestamp updated_at = 11;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message CreateBranchRequest {
|
|
46
|
+
string name = 1;
|
|
47
|
+
optional string address = 2;
|
|
48
|
+
optional string phone = 3;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
message UpdateBranchRequest {
|
|
52
|
+
string id = 1;
|
|
53
|
+
optional string name = 2;
|
|
54
|
+
optional string address = 3;
|
|
55
|
+
optional string phone = 4;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
message ListBranchesResponse {
|
|
59
|
+
repeated Branch items = 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message CreateProductRequest {
|
|
63
|
+
string name = 1;
|
|
64
|
+
string sku = 2;
|
|
65
|
+
string barcode = 3;
|
|
66
|
+
|
|
67
|
+
/// Kirim narxi
|
|
68
|
+
string cost_price = 4;
|
|
69
|
+
|
|
70
|
+
/// Sotuv narxi
|
|
71
|
+
optional string price = 5;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message UpdateProductRequest {
|
|
75
|
+
string id = 1;
|
|
76
|
+
optional string name = 2;
|
|
77
|
+
optional string sku = 3;
|
|
78
|
+
optional string barcode = 4;
|
|
79
|
+
optional string price = 5;
|
|
80
|
+
optional string cost_price = 6;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message GetProductByIdRequest {
|
|
84
|
+
string id = 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
message ListProductsRequest {
|
|
88
|
+
common.v1.PaginationRequest pagination = 1;
|
|
89
|
+
optional string search = 2;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message ListProductsResponse {
|
|
93
|
+
repeated Product items = 1;
|
|
94
|
+
common.v1.PaginationMeta meta = 2;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
message CreateInventoryRequest {
|
|
98
|
+
string branch_id = 1;
|
|
99
|
+
string product_id = 2;
|
|
100
|
+
int32 quantity = 3;
|
|
101
|
+
int32 min_quantity = 4;
|
|
102
|
+
optional google.protobuf.Timestamp expire_at = 5;
|
|
103
|
+
optional string batch_number = 6;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
message UpdateInventoryRequest {
|
|
107
|
+
string id = 1;
|
|
108
|
+
optional int32 quantity = 2;
|
|
109
|
+
optional int32 min_quantity = 3;
|
|
110
|
+
optional google.protobuf.Timestamp expire_at = 4;
|
|
111
|
+
optional string batch_number = 5;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
message AdjustInventoryQuantityRequest {
|
|
115
|
+
string inventory_id = 1;
|
|
116
|
+
int32 quantity_change = 2;
|
|
117
|
+
string reason = 3;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
message TransferInventoryRequest {
|
|
121
|
+
string product_id = 1;
|
|
122
|
+
string from_branch_id = 2;
|
|
123
|
+
string to_branch_id = 3;
|
|
124
|
+
int32 quantity = 4;
|
|
125
|
+
optional string batch_number = 5;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
message GetInventoryByIdRequest {
|
|
129
|
+
string id = 1;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
message ListInventoryRequest {
|
|
133
|
+
common.v1.PaginationRequest pagination = 1;
|
|
134
|
+
optional string branch_id = 2;
|
|
135
|
+
optional string product_id = 3;
|
|
136
|
+
optional string search = 4;
|
|
137
|
+
optional bool low_stock_only = 5;
|
|
138
|
+
optional bool expiring_soon_only = 6;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
message ListInventoryResponse {
|
|
142
|
+
repeated InventoryItem items = 1;
|
|
143
|
+
common.v1.PaginationMeta meta = 2;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
service BranchService {
|
|
147
|
+
rpc CreateBranch(CreateBranchRequest) returns (Branch);
|
|
148
|
+
rpc UpdateBranch(UpdateBranchRequest) returns (Branch);
|
|
149
|
+
rpc GetBranchById(common.v1.IdRequest) returns (Branch);
|
|
150
|
+
rpc ListBranches(common.v1.Empty) returns (ListBranchesResponse);
|
|
151
|
+
rpc DeleteBranch(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
service ProductService {
|
|
155
|
+
rpc CreateProduct(CreateProductRequest) returns (Product);
|
|
156
|
+
rpc UpdateProduct(UpdateProductRequest) returns (Product);
|
|
157
|
+
rpc GetProductById(GetProductByIdRequest) returns (Product);
|
|
158
|
+
rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
|
|
159
|
+
rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
service InventoryService {
|
|
163
|
+
rpc CreateInventory(CreateInventoryRequest) returns (InventoryItem);
|
|
164
|
+
rpc UpdateInventory(UpdateInventoryRequest) returns (InventoryItem);
|
|
165
|
+
rpc AdjustQuantity(AdjustInventoryQuantityRequest) returns (InventoryItem);
|
|
166
|
+
rpc TransferInventory(TransferInventoryRequest) returns (common.v1.BoolResponse);
|
|
167
|
+
rpc GetInventoryById(GetInventoryByIdRequest) returns (InventoryItem);
|
|
168
|
+
rpc ListInventory(ListInventoryRequest) returns (ListInventoryResponse);
|
|
169
|
+
rpc DeleteInventory(common.v1.IdRequest) returns (common.v1.BoolResponse);
|
|
170
|
+
}
|