@prodoctors/contracts 1.0.0 → 1.0.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/dist/proto/paths.d.ts +2 -0
- package/dist/proto/paths.js +2 -0
- package/gen/account.ts +57 -0
- package/gen/auth.ts +15 -2
- package/gen/branch.ts +122 -0
- package/package.json +28 -28
- package/proto/account.proto +23 -0
- package/proto/auth.proto +81 -67
- package/proto/branch.proto +64 -0
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -4,4 +4,6 @@ exports.PROTO_PATHS = void 0;
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
6
|
AUTH: (0, path_1.join)(__dirname, "../../proto/auth.proto"),
|
|
7
|
+
ACCOUNT: (0, path_1.join)(__dirname, "../../proto/account.proto"),
|
|
8
|
+
BRANCH: (0, path_1.join)(__dirname, "../../proto/branch.proto"),
|
|
7
9
|
};
|
package/gen/account.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
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: account.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { Role } from "./auth";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "account.v1";
|
|
13
|
+
|
|
14
|
+
export interface GetAccountRequest {
|
|
15
|
+
id: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface GetAccountResponse {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
username: string;
|
|
22
|
+
role: Role;
|
|
23
|
+
branchId: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
27
|
+
|
|
28
|
+
export interface AccountServiceClient {
|
|
29
|
+
/** Get user profile information */
|
|
30
|
+
|
|
31
|
+
getProfile(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface AccountServiceController {
|
|
35
|
+
/** Get user profile information */
|
|
36
|
+
|
|
37
|
+
getProfile(
|
|
38
|
+
request: GetAccountRequest,
|
|
39
|
+
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function AccountServiceControllerMethods() {
|
|
43
|
+
return function (constructor: Function) {
|
|
44
|
+
const grpcMethods: string[] = ["getProfile"];
|
|
45
|
+
for (const method of grpcMethods) {
|
|
46
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
47
|
+
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
48
|
+
}
|
|
49
|
+
const grpcStreamMethods: string[] = [];
|
|
50
|
+
for (const method of grpcStreamMethods) {
|
|
51
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
52
|
+
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
package/gen/auth.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.11.
|
|
3
|
+
// protoc-gen-ts_proto v2.11.5
|
|
4
4
|
// protoc v7.34.0
|
|
5
5
|
// source: auth.proto
|
|
6
6
|
|
|
@@ -10,8 +10,19 @@ 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
|
+
|
|
13
24
|
export interface LoginRequest {
|
|
14
|
-
|
|
25
|
+
username: string;
|
|
15
26
|
password: string;
|
|
16
27
|
}
|
|
17
28
|
|
|
@@ -24,6 +35,8 @@ export interface RegisterRequest {
|
|
|
24
35
|
name: string;
|
|
25
36
|
username: string;
|
|
26
37
|
password: string;
|
|
38
|
+
role: Role;
|
|
39
|
+
branchId: string;
|
|
27
40
|
}
|
|
28
41
|
|
|
29
42
|
export interface RegisterResponse {
|
package/gen/branch.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
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: branch.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "branch.v1";
|
|
12
|
+
|
|
13
|
+
export interface CreateBranchRequest {
|
|
14
|
+
name: string;
|
|
15
|
+
phone: string;
|
|
16
|
+
address: string;
|
|
17
|
+
lat: string;
|
|
18
|
+
lng: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface CreateBranchResponse {
|
|
22
|
+
id: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GetBranchRequest {
|
|
26
|
+
id: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface GetBranchResponse {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
phone: string;
|
|
33
|
+
address: string;
|
|
34
|
+
lat: string;
|
|
35
|
+
lng: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface UpdateBranchRequest {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
phone: string;
|
|
42
|
+
address: string;
|
|
43
|
+
lat: string;
|
|
44
|
+
lng: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface UpdateBranchResponse {
|
|
48
|
+
ok: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface DeleteBranchRequest {
|
|
52
|
+
id: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface DeleteBranchResponse {
|
|
56
|
+
ok: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const BRANCH_V1_PACKAGE_NAME = "branch.v1";
|
|
60
|
+
|
|
61
|
+
/** Branch service for managing branches */
|
|
62
|
+
|
|
63
|
+
export interface BranchServiceClient {
|
|
64
|
+
/** Create a new branch */
|
|
65
|
+
|
|
66
|
+
createBranch(request: CreateBranchRequest): Observable<CreateBranchResponse>;
|
|
67
|
+
|
|
68
|
+
/** Get branch details by ID */
|
|
69
|
+
|
|
70
|
+
getBranch(request: GetBranchRequest): Observable<GetBranchResponse>;
|
|
71
|
+
|
|
72
|
+
/** Update branch details */
|
|
73
|
+
|
|
74
|
+
updateBranch(request: UpdateBranchRequest): Observable<UpdateBranchResponse>;
|
|
75
|
+
|
|
76
|
+
/** Delete a branch by ID */
|
|
77
|
+
|
|
78
|
+
deleteBranch(request: DeleteBranchRequest): Observable<DeleteBranchResponse>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Branch service for managing branches */
|
|
82
|
+
|
|
83
|
+
export interface BranchServiceController {
|
|
84
|
+
/** Create a new branch */
|
|
85
|
+
|
|
86
|
+
createBranch(
|
|
87
|
+
request: CreateBranchRequest,
|
|
88
|
+
): Promise<CreateBranchResponse> | Observable<CreateBranchResponse> | CreateBranchResponse;
|
|
89
|
+
|
|
90
|
+
/** Get branch details by ID */
|
|
91
|
+
|
|
92
|
+
getBranch(request: GetBranchRequest): Promise<GetBranchResponse> | Observable<GetBranchResponse> | GetBranchResponse;
|
|
93
|
+
|
|
94
|
+
/** Update branch details */
|
|
95
|
+
|
|
96
|
+
updateBranch(
|
|
97
|
+
request: UpdateBranchRequest,
|
|
98
|
+
): Promise<UpdateBranchResponse> | Observable<UpdateBranchResponse> | UpdateBranchResponse;
|
|
99
|
+
|
|
100
|
+
/** Delete a branch by ID */
|
|
101
|
+
|
|
102
|
+
deleteBranch(
|
|
103
|
+
request: DeleteBranchRequest,
|
|
104
|
+
): Promise<DeleteBranchResponse> | Observable<DeleteBranchResponse> | DeleteBranchResponse;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function BranchServiceControllerMethods() {
|
|
108
|
+
return function (constructor: Function) {
|
|
109
|
+
const grpcMethods: string[] = ["createBranch", "getBranch", "updateBranch", "deleteBranch"];
|
|
110
|
+
for (const method of grpcMethods) {
|
|
111
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
112
|
+
GrpcMethod("BranchService", method)(constructor.prototype[method], method, descriptor);
|
|
113
|
+
}
|
|
114
|
+
const grpcStreamMethods: string[] = [];
|
|
115
|
+
for (const method of grpcStreamMethods) {
|
|
116
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
117
|
+
GrpcStreamMethod("BranchService", method)(constructor.prototype[method], method, descriptor);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const BRANCH_SERVICE_NAME = "BranchService";
|
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
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@prodoctors/contracts",
|
|
3
|
+
"version": "1.0.1",
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
syntax = "proto3";
|
|
3
|
+
|
|
4
|
+
package account.v1;
|
|
5
|
+
|
|
6
|
+
import "auth.proto";
|
|
7
|
+
|
|
8
|
+
service AccountService {
|
|
9
|
+
// Get user profile information
|
|
10
|
+
rpc GetProfile (GetAccountRequest) returns (GetAccountResponse);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
message GetAccountRequest {
|
|
14
|
+
string id = 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
message GetAccountResponse {
|
|
18
|
+
string id = 1;
|
|
19
|
+
string name = 2;
|
|
20
|
+
string username = 3;
|
|
21
|
+
auth.v1.Role role = 4;
|
|
22
|
+
string branch_id = 5;
|
|
23
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -1,68 +1,82 @@
|
|
|
1
|
-
syntax = "proto3";
|
|
2
|
-
|
|
3
|
-
package auth.v1;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
message LoginRequest {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
message
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
message
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
message
|
|
66
|
-
|
|
67
|
-
|
|
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
|
+
Role role = 4;
|
|
38
|
+
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;
|
|
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;
|
|
68
82
|
}
|
|
@@ -0,0 +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
|
+
}
|