@prodoctors/contracts 1.0.5 → 1.0.7

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/inventory.ts CHANGED
@@ -96,6 +96,7 @@ export interface Product {
96
96
  manufacturer?: Manufacturer | undefined;
97
97
  createdAt: Timestamp | undefined;
98
98
  updatedAt: Timestamp | undefined;
99
+ imageUrl?: string | undefined;
99
100
  }
100
101
 
101
102
  export interface ProductBarcode {
@@ -159,6 +160,7 @@ export interface CreateProductRequest {
159
160
  manufacturerId?: string | undefined;
160
161
  price: string;
161
162
  costPrice?: string | undefined;
163
+ imageUrl?: string | undefined;
162
164
  }
163
165
 
164
166
  export interface UpdateProductRequest {
@@ -178,6 +180,7 @@ export interface UpdateProductRequest {
178
180
  manufacturerId?: string | undefined;
179
181
  price?: string | undefined;
180
182
  costPrice?: string | undefined;
183
+ imageUrl?: string | undefined;
181
184
  }
182
185
 
183
186
  export interface ListProductsRequest {
package/gen/shift.ts ADDED
@@ -0,0 +1,237 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.5
4
+ // protoc v7.34.0
5
+ // source: shift.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { BoolResponse, IdRequest, PaginationMeta, PaginationRequest } from "./common";
11
+ import { Timestamp } from "./google/protobuf/timestamp";
12
+
13
+ export const protobufPackage = "shift.v1";
14
+
15
+ export enum ShiftStatus {
16
+ SHIFT_STATUS_UNSPECIFIED = 0,
17
+ SHIFT_STATUS_OPEN = 1,
18
+ SHIFT_STATUS_CLOSED = 2,
19
+ SHIFT_STATUS_FAILED = 3,
20
+ UNRECOGNIZED = -1,
21
+ }
22
+
23
+ export enum ExternalTerminalStatus {
24
+ EXTERNAL_TERMINAL_STATUS_UNSPECIFIED = 0,
25
+ EXTERNAL_TERMINAL_STATUS_UNKNOWN = 1,
26
+ EXTERNAL_TERMINAL_STATUS_OPEN = 2,
27
+ EXTERNAL_TERMINAL_STATUS_CLOSED = 3,
28
+ EXTERNAL_TERMINAL_STATUS_ERROR = 4,
29
+ UNRECOGNIZED = -1,
30
+ }
31
+
32
+ export interface PosTerminal {
33
+ id: string;
34
+ branchId: string;
35
+ name: string;
36
+ baseUrl: string;
37
+ token: string;
38
+ port: string;
39
+ isActive: boolean;
40
+ lastKnownStatus: ExternalTerminalStatus;
41
+ lastStatusCheckedAt?: Timestamp | undefined;
42
+ lastStatusMessage?: string | undefined;
43
+ createdAt: Timestamp | undefined;
44
+ updatedAt: Timestamp | undefined;
45
+ }
46
+
47
+ export interface CashierShift {
48
+ id: string;
49
+ branchId: string;
50
+ cashierId: string;
51
+ terminalId: string;
52
+ status: ShiftStatus;
53
+ openedAt: Timestamp | undefined;
54
+ closedAt?: Timestamp | undefined;
55
+ openMessage?: string | undefined;
56
+ closeMessage?: string | undefined;
57
+ leftZreportCountAtOpen?: number | undefined;
58
+ leftZreportCountAtClose?: number | undefined;
59
+ externalErrorMessage?: string | undefined;
60
+ createdAt: Timestamp | undefined;
61
+ updatedAt: Timestamp | undefined;
62
+ terminal?: PosTerminal | undefined;
63
+ }
64
+
65
+ export interface CreateTerminalRequest {
66
+ branchId: string;
67
+ name: string;
68
+ baseUrl: string;
69
+ token: string;
70
+ port: string;
71
+ isActive?: boolean | undefined;
72
+ }
73
+
74
+ export interface UpdateTerminalRequest {
75
+ id: string;
76
+ name?: string | undefined;
77
+ baseUrl?: string | undefined;
78
+ token?: string | undefined;
79
+ port?: string | undefined;
80
+ isActive?: boolean | undefined;
81
+ }
82
+
83
+ export interface ListTerminalsRequest {
84
+ pagination: PaginationRequest | undefined;
85
+ branchId?: string | undefined;
86
+ isActive?: boolean | undefined;
87
+ search?: string | undefined;
88
+ }
89
+
90
+ export interface ListTerminalsResponse {
91
+ items: PosTerminal[];
92
+ meta: PaginationMeta | undefined;
93
+ }
94
+
95
+ export interface TerminalStatusResponse {
96
+ terminalId: string;
97
+ isOpen: boolean;
98
+ status: ExternalTerminalStatus;
99
+ message?: string | undefined;
100
+ leftZreportCount?: number | undefined;
101
+ checkedAt?: Timestamp | undefined;
102
+ }
103
+
104
+ export interface OpenShiftRequest {
105
+ cashierId: string;
106
+ terminalId: string;
107
+ }
108
+
109
+ export interface CloseShiftRequest {
110
+ shiftId: string;
111
+ cashierId: string;
112
+ note?: string | undefined;
113
+ }
114
+
115
+ export interface GetCurrentShiftRequest {
116
+ cashierId: string;
117
+ }
118
+
119
+ export interface GetShiftByIdRequest {
120
+ shiftId: string;
121
+ }
122
+
123
+ export interface ListShiftsRequest {
124
+ pagination: PaginationRequest | undefined;
125
+ branchId?: string | undefined;
126
+ cashierId?: string | undefined;
127
+ terminalId?: string | undefined;
128
+ status?: ShiftStatus | undefined;
129
+ dateFrom?: string | undefined;
130
+ dateTo?: string | undefined;
131
+ }
132
+
133
+ export interface ListShiftsResponse {
134
+ items: CashierShift[];
135
+ meta: PaginationMeta | undefined;
136
+ }
137
+
138
+ export const SHIFT_V1_PACKAGE_NAME = "shift.v1";
139
+
140
+ export interface TerminalServiceClient {
141
+ createTerminal(request: CreateTerminalRequest): Observable<PosTerminal>;
142
+
143
+ updateTerminal(request: UpdateTerminalRequest): Observable<PosTerminal>;
144
+
145
+ getTerminalById(request: IdRequest): Observable<PosTerminal>;
146
+
147
+ listTerminals(request: ListTerminalsRequest): Observable<ListTerminalsResponse>;
148
+
149
+ deleteTerminal(request: IdRequest): Observable<BoolResponse>;
150
+
151
+ getTerminalStatus(request: IdRequest): Observable<TerminalStatusResponse>;
152
+ }
153
+
154
+ export interface TerminalServiceController {
155
+ createTerminal(request: CreateTerminalRequest): Promise<PosTerminal> | Observable<PosTerminal> | PosTerminal;
156
+
157
+ updateTerminal(request: UpdateTerminalRequest): Promise<PosTerminal> | Observable<PosTerminal> | PosTerminal;
158
+
159
+ getTerminalById(request: IdRequest): Promise<PosTerminal> | Observable<PosTerminal> | PosTerminal;
160
+
161
+ listTerminals(
162
+ request: ListTerminalsRequest,
163
+ ): Promise<ListTerminalsResponse> | Observable<ListTerminalsResponse> | ListTerminalsResponse;
164
+
165
+ deleteTerminal(request: IdRequest): Promise<BoolResponse> | Observable<BoolResponse> | BoolResponse;
166
+
167
+ getTerminalStatus(
168
+ request: IdRequest,
169
+ ): Promise<TerminalStatusResponse> | Observable<TerminalStatusResponse> | TerminalStatusResponse;
170
+ }
171
+
172
+ export function TerminalServiceControllerMethods() {
173
+ return function (constructor: Function) {
174
+ const grpcMethods: string[] = [
175
+ "createTerminal",
176
+ "updateTerminal",
177
+ "getTerminalById",
178
+ "listTerminals",
179
+ "deleteTerminal",
180
+ "getTerminalStatus",
181
+ ];
182
+ for (const method of grpcMethods) {
183
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
184
+ GrpcMethod("TerminalService", method)(constructor.prototype[method], method, descriptor);
185
+ }
186
+ const grpcStreamMethods: string[] = [];
187
+ for (const method of grpcStreamMethods) {
188
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
189
+ GrpcStreamMethod("TerminalService", method)(constructor.prototype[method], method, descriptor);
190
+ }
191
+ };
192
+ }
193
+
194
+ export const TERMINAL_SERVICE_NAME = "TerminalService";
195
+
196
+ export interface ShiftServiceClient {
197
+ openShift(request: OpenShiftRequest): Observable<CashierShift>;
198
+
199
+ closeShift(request: CloseShiftRequest): Observable<CashierShift>;
200
+
201
+ getCurrentShift(request: GetCurrentShiftRequest): Observable<CashierShift>;
202
+
203
+ getShiftById(request: GetShiftByIdRequest): Observable<CashierShift>;
204
+
205
+ listShifts(request: ListShiftsRequest): Observable<ListShiftsResponse>;
206
+ }
207
+
208
+ export interface ShiftServiceController {
209
+ openShift(request: OpenShiftRequest): Promise<CashierShift> | Observable<CashierShift> | CashierShift;
210
+
211
+ closeShift(request: CloseShiftRequest): Promise<CashierShift> | Observable<CashierShift> | CashierShift;
212
+
213
+ getCurrentShift(request: GetCurrentShiftRequest): Promise<CashierShift> | Observable<CashierShift> | CashierShift;
214
+
215
+ getShiftById(request: GetShiftByIdRequest): Promise<CashierShift> | Observable<CashierShift> | CashierShift;
216
+
217
+ listShifts(
218
+ request: ListShiftsRequest,
219
+ ): Promise<ListShiftsResponse> | Observable<ListShiftsResponse> | ListShiftsResponse;
220
+ }
221
+
222
+ export function ShiftServiceControllerMethods() {
223
+ return function (constructor: Function) {
224
+ const grpcMethods: string[] = ["openShift", "closeShift", "getCurrentShift", "getShiftById", "listShifts"];
225
+ for (const method of grpcMethods) {
226
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
227
+ GrpcMethod("ShiftService", method)(constructor.prototype[method], method, descriptor);
228
+ }
229
+ const grpcStreamMethods: string[] = [];
230
+ for (const method of grpcStreamMethods) {
231
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
232
+ GrpcStreamMethod("ShiftService", method)(constructor.prototype[method], method, descriptor);
233
+ }
234
+ };
235
+ }
236
+
237
+ export const SHIFT_SERVICE_NAME = "ShiftService";
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@prodoctors/contracts",
3
- "version": "1.0.5",
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.7",
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
  }
@@ -1,305 +1,305 @@
1
- syntax = "proto3";
2
-
3
- package inventory.v1;
4
-
5
- import "google/protobuf/timestamp.proto";
6
- import "common.proto";
7
- import "catalog.proto";
8
-
9
- enum ProductStatus {
10
- PRODUCT_STATUS_UNSPECIFIED = 0;
11
- PRODUCT_STATUS_ACTIVE = 1;
12
- PRODUCT_STATUS_INACTIVE = 2;
13
- }
14
-
15
- enum UnitType {
16
- UNIT_TYPE_UNSPECIFIED = 0;
17
- UNIT_TYPE_PIECE = 1;
18
- UNIT_TYPE_BOX = 2;
19
- UNIT_TYPE_BOTTLE = 3;
20
- UNIT_TYPE_PACK = 4;
21
- UNIT_TYPE_BLISTER = 5;
22
- UNIT_TYPE_TUBE = 6;
23
- UNIT_TYPE_AMPULE = 7;
24
- UNIT_TYPE_VIAL = 8;
25
- }
26
-
27
- enum ProductForm {
28
- PRODUCT_FORM_UNSPECIFIED = 0;
29
- PRODUCT_FORM_TABLET = 1;
30
- PRODUCT_FORM_CAPSULE = 2;
31
- PRODUCT_FORM_SYRUP = 3;
32
- PRODUCT_FORM_INJECTION = 4;
33
- PRODUCT_FORM_OINTMENT = 5;
34
- PRODUCT_FORM_CREAM = 6;
35
- PRODUCT_FORM_GEL = 7;
36
- PRODUCT_FORM_DROPS = 8;
37
- PRODUCT_FORM_SPRAY = 9;
38
- PRODUCT_FORM_POWDER = 10;
39
- PRODUCT_FORM_SOLUTION = 11;
40
- PRODUCT_FORM_SUPPOSITORY = 12;
41
- PRODUCT_FORM_OTHER = 13;
42
- }
43
-
44
- enum BatchStatus {
45
- BATCH_STATUS_UNSPECIFIED = 0;
46
- BATCH_STATUS_ACTIVE = 1;
47
- BATCH_STATUS_EXPIRED = 2;
48
- BATCH_STATUS_DEPLETED = 3;
49
- BATCH_STATUS_BLOCKED = 4;
50
- }
51
-
52
- enum StockMovementType {
53
- STOCK_MOVEMENT_TYPE_UNSPECIFIED = 0;
54
- STOCK_MOVEMENT_TYPE_IN = 1;
55
- STOCK_MOVEMENT_TYPE_OUT = 2;
56
- STOCK_MOVEMENT_TYPE_RETURN_IN = 3;
57
- STOCK_MOVEMENT_TYPE_RETURN_OUT = 4;
58
- STOCK_MOVEMENT_TYPE_WRITE_OFF = 5;
59
- STOCK_MOVEMENT_TYPE_ADJUSTMENT = 6;
60
- STOCK_MOVEMENT_TYPE_TRANSFER_OUT = 7;
61
- STOCK_MOVEMENT_TYPE_TRANSFER_IN = 8;
62
- }
63
-
64
- message Product {
65
- string id = 1;
66
- string name = 2;
67
- string sku = 3;
68
- optional string barcode = 4;
69
- optional string dosage = 5;
70
- optional string description = 6;
71
- ProductForm form = 7;
72
- UnitType unit = 8;
73
- bool requires_prescription = 9;
74
- ProductStatus status = 10;
75
- optional string brand_id = 11;
76
- optional string category_id = 12;
77
- optional string international_name_id = 13;
78
- optional string manufacturer_id = 14;
79
- string price = 15;
80
- optional string cost_price = 16;
81
- optional catalog.v1.Brand brand = 17;
82
- optional catalog.v1.Category category = 18;
83
- optional catalog.v1.InternationalName international_name = 19;
84
- optional catalog.v1.Manufacturer manufacturer = 20;
85
- google.protobuf.Timestamp created_at = 21;
86
- google.protobuf.Timestamp updated_at = 22;
87
- optional string image_url = 23;
88
- }
89
-
90
- message ProductBarcode {
91
- string id = 1;
92
- string product_id = 2;
93
- string barcode = 3;
94
- bool is_primary = 4;
95
- optional string package_type = 5;
96
- optional string note = 6;
97
- google.protobuf.Timestamp created_at = 7;
98
- google.protobuf.Timestamp updated_at = 8;
99
- }
100
-
101
- message ProductBatch {
102
- string id = 1;
103
- string product_id = 2;
104
- string branch_id = 3;
105
- string batch_number = 4;
106
- google.protobuf.Timestamp expiry_date = 5;
107
- optional google.protobuf.Timestamp manufacture_date = 6;
108
- string purchase_price = 7;
109
- string selling_price = 8;
110
- int32 initial_quantity = 9;
111
- int32 remaining_quantity = 10;
112
- BatchStatus status = 11;
113
- optional string purchase_item_id = 12;
114
- optional Product product = 13;
115
- google.protobuf.Timestamp created_at = 14;
116
- google.protobuf.Timestamp updated_at = 15;
117
- }
118
-
119
- message StockMovement {
120
- string id = 1;
121
- string branch_id = 2;
122
- string product_id = 3;
123
- string product_batch_id = 4;
124
- StockMovementType type = 5;
125
- int32 quantity = 6;
126
- int32 balance_before = 7;
127
- int32 balance_after = 8;
128
- optional string reference_type = 9;
129
- optional string reference_id = 10;
130
- optional string performed_by_id = 11;
131
- optional string note = 12;
132
- google.protobuf.Timestamp created_at = 13;
133
- }
134
-
135
- message CreateProductRequest {
136
- string name = 1;
137
- string sku = 2;
138
- optional string barcode = 3;
139
- optional string dosage = 4;
140
- optional string description = 5;
141
- ProductForm form = 6;
142
- UnitType unit = 7;
143
- optional bool requires_prescription = 8;
144
- optional ProductStatus status = 9;
145
- optional string brand_id = 10;
146
- optional string category_id = 11;
147
- optional string international_name_id = 12;
148
- optional string manufacturer_id = 13;
149
- string price = 14;
150
- optional string cost_price = 15;
151
- optional string image_url = 16;
152
- }
153
-
154
- message UpdateProductRequest {
155
- string id = 1;
156
- optional string name = 2;
157
- optional string sku = 3;
158
- optional string barcode = 4;
159
- optional string dosage = 5;
160
- optional string description = 6;
161
- optional ProductForm form = 7;
162
- optional UnitType unit = 8;
163
- optional bool requires_prescription = 9;
164
- optional ProductStatus status = 10;
165
- optional string brand_id = 11;
166
- optional string category_id = 12;
167
- optional string international_name_id = 13;
168
- optional string manufacturer_id = 14;
169
- optional string price = 15;
170
- optional string cost_price = 16;
171
- optional string image_url = 17;
172
- }
173
-
174
- message ListProductsRequest {
175
- common.v1.PaginationRequest pagination = 1;
176
- optional string search = 2;
177
- optional string brand_id = 3;
178
- optional string category_id = 4;
179
- optional string international_name_id = 5;
180
- optional string manufacturer_id = 6;
181
- optional ProductStatus status = 7;
182
- }
183
-
184
- message ListProductsResponse {
185
- repeated Product items = 1;
186
- common.v1.PaginationMeta meta = 2;
187
- }
188
-
189
- message CreateProductBarcodeRequest {
190
- string product_id = 1;
191
- string barcode = 2;
192
- optional bool is_primary = 3;
193
- optional string package_type = 4;
194
- optional string note = 5;
195
- }
196
-
197
- message UpdateProductBarcodeRequest {
198
- string id = 1;
199
- optional string barcode = 2;
200
- optional bool is_primary = 3;
201
- optional string package_type = 4;
202
- optional string note = 5;
203
- }
204
-
205
- message ListProductBarcodesResponse {
206
- repeated ProductBarcode items = 1;
207
- }
208
-
209
- message CreateProductBatchRequest {
210
- string product_id = 1;
211
- string branch_id = 2;
212
- string batch_number = 3;
213
- google.protobuf.Timestamp expiry_date = 4;
214
- optional google.protobuf.Timestamp manufacture_date = 5;
215
- string purchase_price = 6;
216
- string selling_price = 7;
217
- int32 initial_quantity = 8;
218
- optional int32 remaining_quantity = 9;
219
- optional BatchStatus status = 10;
220
- optional string purchase_item_id = 11;
221
- }
222
-
223
- message UpdateProductBatchRequest {
224
- string id = 1;
225
- optional string batch_number = 2;
226
- optional google.protobuf.Timestamp expiry_date = 3;
227
- optional google.protobuf.Timestamp manufacture_date = 4;
228
- optional string purchase_price = 5;
229
- optional string selling_price = 6;
230
- optional int32 initial_quantity = 7;
231
- optional int32 remaining_quantity = 8;
232
- optional BatchStatus status = 9;
233
- }
234
-
235
- message ListProductBatchesRequest {
236
- common.v1.PaginationRequest pagination = 1;
237
- optional string branch_id = 2;
238
- optional string product_id = 3;
239
- optional string batch_number = 4;
240
- optional BatchStatus status = 5;
241
- optional bool low_stock_only = 6;
242
- optional bool expiring_soon_only = 7;
243
- }
244
-
245
- message ListProductBatchesResponse {
246
- repeated ProductBatch items = 1;
247
- common.v1.PaginationMeta meta = 2;
248
- }
249
-
250
- message CreateStockMovementRequest {
251
- string branch_id = 1;
252
- string product_id = 2;
253
- string product_batch_id = 3;
254
- StockMovementType type = 4;
255
- int32 quantity = 5;
256
- int32 balance_before = 6;
257
- int32 balance_after = 7;
258
- optional string reference_type = 8;
259
- optional string reference_id = 9;
260
- optional string performed_by_id = 10;
261
- optional string note = 11;
262
- }
263
-
264
- message ListStockMovementsRequest {
265
- common.v1.PaginationRequest pagination = 1;
266
- optional string branch_id = 2;
267
- optional string product_id = 3;
268
- optional string product_batch_id = 4;
269
- optional StockMovementType type = 5;
270
- }
271
-
272
- message ListStockMovementsResponse {
273
- repeated StockMovement items = 1;
274
- common.v1.PaginationMeta meta = 2;
275
- }
276
-
277
- service ProductService {
278
- rpc CreateProduct(CreateProductRequest) returns (Product);
279
- rpc UpdateProduct(UpdateProductRequest) returns (Product);
280
- rpc GetProductById(common.v1.IdRequest) returns (Product);
281
- rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
282
- rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
283
- }
284
-
285
- service ProductBarcodeService {
286
- rpc CreateProductBarcode(CreateProductBarcodeRequest) returns (ProductBarcode);
287
- rpc UpdateProductBarcode(UpdateProductBarcodeRequest) returns (ProductBarcode);
288
- rpc GetProductBarcodeById(common.v1.IdRequest) returns (ProductBarcode);
289
- rpc ListProductBarcodes(common.v1.IdRequest) returns (ListProductBarcodesResponse);
290
- rpc DeleteProductBarcode(common.v1.IdRequest) returns (common.v1.BoolResponse);
291
- }
292
-
293
- service ProductBatchService {
294
- rpc CreateProductBatch(CreateProductBatchRequest) returns (ProductBatch);
295
- rpc UpdateProductBatch(UpdateProductBatchRequest) returns (ProductBatch);
296
- rpc GetProductBatchById(common.v1.IdRequest) returns (ProductBatch);
297
- rpc ListProductBatches(ListProductBatchesRequest) returns (ListProductBatchesResponse);
298
- rpc DeleteProductBatch(common.v1.IdRequest) returns (common.v1.BoolResponse);
299
- }
300
-
301
- service StockMovementService {
302
- rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
303
- rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
304
- rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
1
+ syntax = "proto3";
2
+
3
+ package inventory.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+ import "catalog.proto";
8
+
9
+ enum ProductStatus {
10
+ PRODUCT_STATUS_UNSPECIFIED = 0;
11
+ PRODUCT_STATUS_ACTIVE = 1;
12
+ PRODUCT_STATUS_INACTIVE = 2;
13
+ }
14
+
15
+ enum UnitType {
16
+ UNIT_TYPE_UNSPECIFIED = 0;
17
+ UNIT_TYPE_PIECE = 1;
18
+ UNIT_TYPE_BOX = 2;
19
+ UNIT_TYPE_BOTTLE = 3;
20
+ UNIT_TYPE_PACK = 4;
21
+ UNIT_TYPE_BLISTER = 5;
22
+ UNIT_TYPE_TUBE = 6;
23
+ UNIT_TYPE_AMPULE = 7;
24
+ UNIT_TYPE_VIAL = 8;
25
+ }
26
+
27
+ enum ProductForm {
28
+ PRODUCT_FORM_UNSPECIFIED = 0;
29
+ PRODUCT_FORM_TABLET = 1;
30
+ PRODUCT_FORM_CAPSULE = 2;
31
+ PRODUCT_FORM_SYRUP = 3;
32
+ PRODUCT_FORM_INJECTION = 4;
33
+ PRODUCT_FORM_OINTMENT = 5;
34
+ PRODUCT_FORM_CREAM = 6;
35
+ PRODUCT_FORM_GEL = 7;
36
+ PRODUCT_FORM_DROPS = 8;
37
+ PRODUCT_FORM_SPRAY = 9;
38
+ PRODUCT_FORM_POWDER = 10;
39
+ PRODUCT_FORM_SOLUTION = 11;
40
+ PRODUCT_FORM_SUPPOSITORY = 12;
41
+ PRODUCT_FORM_OTHER = 13;
42
+ }
43
+
44
+ enum BatchStatus {
45
+ BATCH_STATUS_UNSPECIFIED = 0;
46
+ BATCH_STATUS_ACTIVE = 1;
47
+ BATCH_STATUS_EXPIRED = 2;
48
+ BATCH_STATUS_DEPLETED = 3;
49
+ BATCH_STATUS_BLOCKED = 4;
50
+ }
51
+
52
+ enum StockMovementType {
53
+ STOCK_MOVEMENT_TYPE_UNSPECIFIED = 0;
54
+ STOCK_MOVEMENT_TYPE_IN = 1;
55
+ STOCK_MOVEMENT_TYPE_OUT = 2;
56
+ STOCK_MOVEMENT_TYPE_RETURN_IN = 3;
57
+ STOCK_MOVEMENT_TYPE_RETURN_OUT = 4;
58
+ STOCK_MOVEMENT_TYPE_WRITE_OFF = 5;
59
+ STOCK_MOVEMENT_TYPE_ADJUSTMENT = 6;
60
+ STOCK_MOVEMENT_TYPE_TRANSFER_OUT = 7;
61
+ STOCK_MOVEMENT_TYPE_TRANSFER_IN = 8;
62
+ }
63
+
64
+ message Product {
65
+ string id = 1;
66
+ string name = 2;
67
+ string sku = 3;
68
+ optional string barcode = 4;
69
+ optional string dosage = 5;
70
+ optional string description = 6;
71
+ ProductForm form = 7;
72
+ UnitType unit = 8;
73
+ bool requires_prescription = 9;
74
+ ProductStatus status = 10;
75
+ optional string brand_id = 11;
76
+ optional string category_id = 12;
77
+ optional string international_name_id = 13;
78
+ optional string manufacturer_id = 14;
79
+ string price = 15;
80
+ optional string cost_price = 16;
81
+ optional catalog.v1.Brand brand = 17;
82
+ optional catalog.v1.Category category = 18;
83
+ optional catalog.v1.InternationalName international_name = 19;
84
+ optional catalog.v1.Manufacturer manufacturer = 20;
85
+ google.protobuf.Timestamp created_at = 21;
86
+ google.protobuf.Timestamp updated_at = 22;
87
+ optional string image_url = 23;
88
+ }
89
+
90
+ message ProductBarcode {
91
+ string id = 1;
92
+ string product_id = 2;
93
+ string barcode = 3;
94
+ bool is_primary = 4;
95
+ optional string package_type = 5;
96
+ optional string note = 6;
97
+ google.protobuf.Timestamp created_at = 7;
98
+ google.protobuf.Timestamp updated_at = 8;
99
+ }
100
+
101
+ message ProductBatch {
102
+ string id = 1;
103
+ string product_id = 2;
104
+ string branch_id = 3;
105
+ string batch_number = 4;
106
+ google.protobuf.Timestamp expiry_date = 5;
107
+ optional google.protobuf.Timestamp manufacture_date = 6;
108
+ string purchase_price = 7;
109
+ string selling_price = 8;
110
+ int32 initial_quantity = 9;
111
+ int32 remaining_quantity = 10;
112
+ BatchStatus status = 11;
113
+ optional string purchase_item_id = 12;
114
+ optional Product product = 13;
115
+ google.protobuf.Timestamp created_at = 14;
116
+ google.protobuf.Timestamp updated_at = 15;
117
+ }
118
+
119
+ message StockMovement {
120
+ string id = 1;
121
+ string branch_id = 2;
122
+ string product_id = 3;
123
+ string product_batch_id = 4;
124
+ StockMovementType type = 5;
125
+ int32 quantity = 6;
126
+ int32 balance_before = 7;
127
+ int32 balance_after = 8;
128
+ optional string reference_type = 9;
129
+ optional string reference_id = 10;
130
+ optional string performed_by_id = 11;
131
+ optional string note = 12;
132
+ google.protobuf.Timestamp created_at = 13;
133
+ }
134
+
135
+ message CreateProductRequest {
136
+ string name = 1;
137
+ string sku = 2;
138
+ optional string barcode = 3;
139
+ optional string dosage = 4;
140
+ optional string description = 5;
141
+ ProductForm form = 6;
142
+ UnitType unit = 7;
143
+ optional bool requires_prescription = 8;
144
+ optional ProductStatus status = 9;
145
+ optional string brand_id = 10;
146
+ optional string category_id = 11;
147
+ optional string international_name_id = 12;
148
+ optional string manufacturer_id = 13;
149
+ string price = 14;
150
+ optional string cost_price = 15;
151
+ optional string image_url = 16;
152
+ }
153
+
154
+ message UpdateProductRequest {
155
+ string id = 1;
156
+ optional string name = 2;
157
+ optional string sku = 3;
158
+ optional string barcode = 4;
159
+ optional string dosage = 5;
160
+ optional string description = 6;
161
+ optional ProductForm form = 7;
162
+ optional UnitType unit = 8;
163
+ optional bool requires_prescription = 9;
164
+ optional ProductStatus status = 10;
165
+ optional string brand_id = 11;
166
+ optional string category_id = 12;
167
+ optional string international_name_id = 13;
168
+ optional string manufacturer_id = 14;
169
+ optional string price = 15;
170
+ optional string cost_price = 16;
171
+ optional string image_url = 17;
172
+ }
173
+
174
+ message ListProductsRequest {
175
+ common.v1.PaginationRequest pagination = 1;
176
+ optional string search = 2;
177
+ optional string brand_id = 3;
178
+ optional string category_id = 4;
179
+ optional string international_name_id = 5;
180
+ optional string manufacturer_id = 6;
181
+ optional ProductStatus status = 7;
182
+ }
183
+
184
+ message ListProductsResponse {
185
+ repeated Product items = 1;
186
+ common.v1.PaginationMeta meta = 2;
187
+ }
188
+
189
+ message CreateProductBarcodeRequest {
190
+ string product_id = 1;
191
+ string barcode = 2;
192
+ optional bool is_primary = 3;
193
+ optional string package_type = 4;
194
+ optional string note = 5;
195
+ }
196
+
197
+ message UpdateProductBarcodeRequest {
198
+ string id = 1;
199
+ optional string barcode = 2;
200
+ optional bool is_primary = 3;
201
+ optional string package_type = 4;
202
+ optional string note = 5;
203
+ }
204
+
205
+ message ListProductBarcodesResponse {
206
+ repeated ProductBarcode items = 1;
207
+ }
208
+
209
+ message CreateProductBatchRequest {
210
+ string product_id = 1;
211
+ string branch_id = 2;
212
+ string batch_number = 3;
213
+ google.protobuf.Timestamp expiry_date = 4;
214
+ optional google.protobuf.Timestamp manufacture_date = 5;
215
+ string purchase_price = 6;
216
+ string selling_price = 7;
217
+ int32 initial_quantity = 8;
218
+ optional int32 remaining_quantity = 9;
219
+ optional BatchStatus status = 10;
220
+ optional string purchase_item_id = 11;
221
+ }
222
+
223
+ message UpdateProductBatchRequest {
224
+ string id = 1;
225
+ optional string batch_number = 2;
226
+ optional google.protobuf.Timestamp expiry_date = 3;
227
+ optional google.protobuf.Timestamp manufacture_date = 4;
228
+ optional string purchase_price = 5;
229
+ optional string selling_price = 6;
230
+ optional int32 initial_quantity = 7;
231
+ optional int32 remaining_quantity = 8;
232
+ optional BatchStatus status = 9;
233
+ }
234
+
235
+ message ListProductBatchesRequest {
236
+ common.v1.PaginationRequest pagination = 1;
237
+ optional string branch_id = 2;
238
+ optional string product_id = 3;
239
+ optional string batch_number = 4;
240
+ optional BatchStatus status = 5;
241
+ optional bool low_stock_only = 6;
242
+ optional bool expiring_soon_only = 7;
243
+ }
244
+
245
+ message ListProductBatchesResponse {
246
+ repeated ProductBatch items = 1;
247
+ common.v1.PaginationMeta meta = 2;
248
+ }
249
+
250
+ message CreateStockMovementRequest {
251
+ string branch_id = 1;
252
+ string product_id = 2;
253
+ string product_batch_id = 3;
254
+ StockMovementType type = 4;
255
+ int32 quantity = 5;
256
+ int32 balance_before = 6;
257
+ int32 balance_after = 7;
258
+ optional string reference_type = 8;
259
+ optional string reference_id = 9;
260
+ optional string performed_by_id = 10;
261
+ optional string note = 11;
262
+ }
263
+
264
+ message ListStockMovementsRequest {
265
+ common.v1.PaginationRequest pagination = 1;
266
+ optional string branch_id = 2;
267
+ optional string product_id = 3;
268
+ optional string product_batch_id = 4;
269
+ optional StockMovementType type = 5;
270
+ }
271
+
272
+ message ListStockMovementsResponse {
273
+ repeated StockMovement items = 1;
274
+ common.v1.PaginationMeta meta = 2;
275
+ }
276
+
277
+ service ProductService {
278
+ rpc CreateProduct(CreateProductRequest) returns (Product);
279
+ rpc UpdateProduct(UpdateProductRequest) returns (Product);
280
+ rpc GetProductById(common.v1.IdRequest) returns (Product);
281
+ rpc ListProducts(ListProductsRequest) returns (ListProductsResponse);
282
+ rpc DeleteProduct(common.v1.IdRequest) returns (common.v1.BoolResponse);
283
+ }
284
+
285
+ service ProductBarcodeService {
286
+ rpc CreateProductBarcode(CreateProductBarcodeRequest) returns (ProductBarcode);
287
+ rpc UpdateProductBarcode(UpdateProductBarcodeRequest) returns (ProductBarcode);
288
+ rpc GetProductBarcodeById(common.v1.IdRequest) returns (ProductBarcode);
289
+ rpc ListProductBarcodes(common.v1.IdRequest) returns (ListProductBarcodesResponse);
290
+ rpc DeleteProductBarcode(common.v1.IdRequest) returns (common.v1.BoolResponse);
291
+ }
292
+
293
+ service ProductBatchService {
294
+ rpc CreateProductBatch(CreateProductBatchRequest) returns (ProductBatch);
295
+ rpc UpdateProductBatch(UpdateProductBatchRequest) returns (ProductBatch);
296
+ rpc GetProductBatchById(common.v1.IdRequest) returns (ProductBatch);
297
+ rpc ListProductBatches(ListProductBatchesRequest) returns (ListProductBatchesResponse);
298
+ rpc DeleteProductBatch(common.v1.IdRequest) returns (common.v1.BoolResponse);
299
+ }
300
+
301
+ service StockMovementService {
302
+ rpc CreateStockMovement(CreateStockMovementRequest) returns (StockMovement);
303
+ rpc GetStockMovementById(common.v1.IdRequest) returns (StockMovement);
304
+ rpc ListStockMovements(ListStockMovementsRequest) returns (ListStockMovementsResponse);
305
305
  }
@@ -0,0 +1,144 @@
1
+ syntax = "proto3";
2
+
3
+ package shift.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+
8
+ enum ShiftStatus {
9
+ SHIFT_STATUS_UNSPECIFIED = 0;
10
+ SHIFT_STATUS_OPEN = 1;
11
+ SHIFT_STATUS_CLOSED = 2;
12
+ SHIFT_STATUS_FAILED = 3;
13
+ }
14
+
15
+ enum ExternalTerminalStatus {
16
+ EXTERNAL_TERMINAL_STATUS_UNSPECIFIED = 0;
17
+ EXTERNAL_TERMINAL_STATUS_UNKNOWN = 1;
18
+ EXTERNAL_TERMINAL_STATUS_OPEN = 2;
19
+ EXTERNAL_TERMINAL_STATUS_CLOSED = 3;
20
+ EXTERNAL_TERMINAL_STATUS_ERROR = 4;
21
+ }
22
+
23
+ message PosTerminal {
24
+ string id = 1;
25
+ string branch_id = 2;
26
+ string name = 3;
27
+ string base_url = 4;
28
+ string token = 5;
29
+ string port = 6;
30
+ bool is_active = 7;
31
+ ExternalTerminalStatus last_known_status = 8;
32
+ optional google.protobuf.Timestamp last_status_checked_at = 9;
33
+ optional string last_status_message = 10;
34
+ google.protobuf.Timestamp created_at = 11;
35
+ google.protobuf.Timestamp updated_at = 12;
36
+ }
37
+
38
+ message CashierShift {
39
+ string id = 1;
40
+ string branch_id = 2;
41
+ string cashier_id = 3;
42
+ string terminal_id = 4;
43
+ ShiftStatus status = 5;
44
+ google.protobuf.Timestamp opened_at = 6;
45
+ optional google.protobuf.Timestamp closed_at = 7;
46
+ optional string open_message = 8;
47
+ optional string close_message = 9;
48
+ optional int32 left_zreport_count_at_open = 10;
49
+ optional int32 left_zreport_count_at_close = 11;
50
+ optional string external_error_message = 12;
51
+ google.protobuf.Timestamp created_at = 13;
52
+ google.protobuf.Timestamp updated_at = 14;
53
+ optional PosTerminal terminal = 15;
54
+ }
55
+
56
+ message CreateTerminalRequest {
57
+ string branch_id = 1;
58
+ string name = 2;
59
+ string base_url = 3;
60
+ string token = 4;
61
+ string port = 5;
62
+ optional bool is_active = 6;
63
+ }
64
+
65
+ message UpdateTerminalRequest {
66
+ string id = 1;
67
+ optional string name = 2;
68
+ optional string base_url = 3;
69
+ optional string token = 4;
70
+ optional string port = 5;
71
+ optional bool is_active = 6;
72
+ }
73
+
74
+ message ListTerminalsRequest {
75
+ common.v1.PaginationRequest pagination = 1;
76
+ optional string branch_id = 2;
77
+ optional bool is_active = 3;
78
+ optional string search = 4;
79
+ }
80
+
81
+ message ListTerminalsResponse {
82
+ repeated PosTerminal items = 1;
83
+ common.v1.PaginationMeta meta = 2;
84
+ }
85
+
86
+ message TerminalStatusResponse {
87
+ string terminal_id = 1;
88
+ bool is_open = 2;
89
+ ExternalTerminalStatus status = 3;
90
+ optional string message = 4;
91
+ optional int32 left_zreport_count = 5;
92
+ optional google.protobuf.Timestamp checked_at = 6;
93
+ }
94
+
95
+ message OpenShiftRequest {
96
+ string cashier_id = 1;
97
+ string terminal_id = 2;
98
+ }
99
+
100
+ message CloseShiftRequest {
101
+ string shift_id = 1;
102
+ string cashier_id = 2;
103
+ optional string note = 3;
104
+ }
105
+
106
+ message GetCurrentShiftRequest {
107
+ string cashier_id = 1;
108
+ }
109
+
110
+ message GetShiftByIdRequest {
111
+ string shift_id = 1;
112
+ }
113
+
114
+ message ListShiftsRequest {
115
+ common.v1.PaginationRequest pagination = 1;
116
+ optional string branch_id = 2;
117
+ optional string cashier_id = 3;
118
+ optional string terminal_id = 4;
119
+ optional ShiftStatus status = 5;
120
+ optional string date_from = 6;
121
+ optional string date_to = 7;
122
+ }
123
+
124
+ message ListShiftsResponse {
125
+ repeated CashierShift items = 1;
126
+ common.v1.PaginationMeta meta = 2;
127
+ }
128
+
129
+ service TerminalService {
130
+ rpc CreateTerminal(CreateTerminalRequest) returns (PosTerminal);
131
+ rpc UpdateTerminal(UpdateTerminalRequest) returns (PosTerminal);
132
+ rpc GetTerminalById(common.v1.IdRequest) returns (PosTerminal);
133
+ rpc ListTerminals(ListTerminalsRequest) returns (ListTerminalsResponse);
134
+ rpc DeleteTerminal(common.v1.IdRequest) returns (common.v1.BoolResponse);
135
+ rpc GetTerminalStatus(common.v1.IdRequest) returns (TerminalStatusResponse);
136
+ }
137
+
138
+ service ShiftService {
139
+ rpc OpenShift(OpenShiftRequest) returns (CashierShift);
140
+ rpc CloseShift(CloseShiftRequest) returns (CashierShift);
141
+ rpc GetCurrentShift(GetCurrentShiftRequest) returns (CashierShift);
142
+ rpc GetShiftById(GetShiftByIdRequest) returns (CashierShift);
143
+ rpc ListShifts(ListShiftsRequest) returns (ListShiftsResponse);
144
+ }