@usteam/contracts 1.1.3 → 1.1.5
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/.gitkeep +0 -0
- package/gen/go/.gitkeep +0 -0
- package/gen/ts/.gitkeep +0 -0
- package/gen/ts/media.ts +92 -0
- package/gen/{users.ts → ts/users.ts} +26 -9
- package/package.json +2 -2
- package/proto/media.proto +46 -0
- package/proto/users.proto +18 -4
- /package/gen/{account.ts → ts/account.ts} +0 -0
- /package/gen/{auth.ts → ts/auth.ts} +0 -0
- /package/gen/{google → ts/google}/protobuf/empty.ts +0 -0
package/gen/.gitkeep
ADDED
|
File without changes
|
package/gen/go/.gitkeep
ADDED
|
File without changes
|
package/gen/ts/.gitkeep
ADDED
|
File without changes
|
package/gen/ts/media.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
4
|
+
// protoc v7.34.0
|
|
5
|
+
// source: media.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "media.v1";
|
|
12
|
+
|
|
13
|
+
export interface UploadRequest {
|
|
14
|
+
fileName: string;
|
|
15
|
+
folder: string;
|
|
16
|
+
contentType: string;
|
|
17
|
+
data: Uint8Array;
|
|
18
|
+
resizeWidth?: number | undefined;
|
|
19
|
+
resizeHeight?: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface UploadResponse {
|
|
23
|
+
key: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface GetRequest {
|
|
27
|
+
key: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface GetResponse {
|
|
31
|
+
data: Uint8Array;
|
|
32
|
+
contentType: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface DeleteRequest {
|
|
36
|
+
key: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DeleteResponse {
|
|
40
|
+
ok: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
|
44
|
+
|
|
45
|
+
/** Сервис для работы с файлами в S3 */
|
|
46
|
+
|
|
47
|
+
export interface MediaServiceClient {
|
|
48
|
+
/** Загружает файл в S3 */
|
|
49
|
+
|
|
50
|
+
upload(request: UploadRequest): Observable<UploadResponse>;
|
|
51
|
+
|
|
52
|
+
/** Получает файл по ключу в S3 */
|
|
53
|
+
|
|
54
|
+
get(request: GetRequest): Observable<GetResponse>;
|
|
55
|
+
|
|
56
|
+
/** Удаляет файл по ключу в S3 */
|
|
57
|
+
|
|
58
|
+
delete(request: DeleteRequest): Observable<DeleteResponse>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Сервис для работы с файлами в S3 */
|
|
62
|
+
|
|
63
|
+
export interface MediaServiceController {
|
|
64
|
+
/** Загружает файл в S3 */
|
|
65
|
+
|
|
66
|
+
upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
|
|
67
|
+
|
|
68
|
+
/** Получает файл по ключу в S3 */
|
|
69
|
+
|
|
70
|
+
get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
|
|
71
|
+
|
|
72
|
+
/** Удаляет файл по ключу в S3 */
|
|
73
|
+
|
|
74
|
+
delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function MediaServiceControllerMethods() {
|
|
78
|
+
return function (constructor: Function) {
|
|
79
|
+
const grpcMethods: string[] = ["upload", "get", "delete"];
|
|
80
|
+
for (const method of grpcMethods) {
|
|
81
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
82
|
+
GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
83
|
+
}
|
|
84
|
+
const grpcStreamMethods: string[] = [];
|
|
85
|
+
for (const method of grpcStreamMethods) {
|
|
86
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
87
|
+
GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const MEDIA_SERVICE_NAME = "MediaService";
|
|
@@ -26,6 +26,15 @@ export interface CreateUserResponse {
|
|
|
26
26
|
ok: boolean;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export interface PatchUserRequest {
|
|
30
|
+
userId: string;
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PatchUserResponse {
|
|
35
|
+
ok: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
export interface User {
|
|
30
39
|
id: string;
|
|
31
40
|
name?: string | undefined;
|
|
@@ -36,41 +45,49 @@ export interface User {
|
|
|
36
45
|
|
|
37
46
|
export const USERS_V1_PACKAGE_NAME = "users.v1";
|
|
38
47
|
|
|
39
|
-
/** UsersService отвечает за операции связанные с пользователем. */
|
|
48
|
+
/** / UsersService отвечает за операции связанные с пользователем. */
|
|
40
49
|
|
|
41
50
|
export interface UsersServiceClient {
|
|
42
51
|
/**
|
|
43
|
-
* GetMe id текущего пользователя.
|
|
44
|
-
* получает объект с данными текущего пользователя
|
|
52
|
+
* / GetMe id текущего пользователя.
|
|
53
|
+
* / получает объект с данными текущего пользователя
|
|
45
54
|
*/
|
|
46
55
|
|
|
47
56
|
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
|
48
57
|
|
|
49
|
-
/** CreateUser создает нового пользователя */
|
|
58
|
+
/** / CreateUser создает нового пользователя */
|
|
50
59
|
|
|
51
60
|
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
|
61
|
+
|
|
62
|
+
/** / CreateUser создает нового пользователя */
|
|
63
|
+
|
|
64
|
+
patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
|
|
52
65
|
}
|
|
53
66
|
|
|
54
|
-
/** UsersService отвечает за операции связанные с пользователем. */
|
|
67
|
+
/** / UsersService отвечает за операции связанные с пользователем. */
|
|
55
68
|
|
|
56
69
|
export interface UsersServiceController {
|
|
57
70
|
/**
|
|
58
|
-
* GetMe id текущего пользователя.
|
|
59
|
-
* получает объект с данными текущего пользователя
|
|
71
|
+
* / GetMe id текущего пользователя.
|
|
72
|
+
* / получает объект с данными текущего пользователя
|
|
60
73
|
*/
|
|
61
74
|
|
|
62
75
|
getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
|
|
63
76
|
|
|
64
|
-
/** CreateUser создает нового пользователя */
|
|
77
|
+
/** / CreateUser создает нового пользователя */
|
|
65
78
|
|
|
66
79
|
createUser(
|
|
67
80
|
request: CreateUserRequest,
|
|
68
81
|
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
|
82
|
+
|
|
83
|
+
/** / CreateUser создает нового пользователя */
|
|
84
|
+
|
|
85
|
+
patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
|
|
69
86
|
}
|
|
70
87
|
|
|
71
88
|
export function UsersServiceControllerMethods() {
|
|
72
89
|
return function (constructor: Function) {
|
|
73
|
-
const grpcMethods: string[] = ["getMe", "createUser"];
|
|
90
|
+
const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
|
|
74
91
|
for (const method of grpcMethods) {
|
|
75
92
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
76
93
|
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usteam/contracts",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc -p tsconfig.build.json",
|
|
8
|
-
"generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
8
|
+
"generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen/ts --ts_proto_opt=nestJs=true,package=omit"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package media.v1;
|
|
4
|
+
|
|
5
|
+
option go_package = "github.com/ShmatkoBrest/contracts/media:media";
|
|
6
|
+
option java_multiple_files = true;
|
|
7
|
+
|
|
8
|
+
// Сервис для работы с файлами в S3
|
|
9
|
+
service MediaService {
|
|
10
|
+
// Загружает файл в S3
|
|
11
|
+
rpc Upload (UploadRequest) returns (UploadResponse);
|
|
12
|
+
// Получает файл по ключу в S3
|
|
13
|
+
rpc Get (GetRequest) returns (GetResponse);
|
|
14
|
+
// Удаляет файл по ключу в S3
|
|
15
|
+
rpc Delete (DeleteRequest) returns (DeleteResponse);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message UploadRequest {
|
|
19
|
+
string file_name = 1;
|
|
20
|
+
string folder = 2;
|
|
21
|
+
string content_type = 3;
|
|
22
|
+
bytes data = 4;
|
|
23
|
+
optional int32 resize_width = 5;
|
|
24
|
+
optional int32 resize_height = 6;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message UploadResponse {
|
|
28
|
+
string key = 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message GetRequest {
|
|
32
|
+
string key = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message GetResponse {
|
|
36
|
+
bytes data = 1;
|
|
37
|
+
string content_type = 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message DeleteRequest {
|
|
41
|
+
string key = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message DeleteResponse {
|
|
45
|
+
bool ok = 1;
|
|
46
|
+
}
|
package/proto/users.proto
CHANGED
|
@@ -2,14 +2,17 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package users.v1;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/// UsersService отвечает за операции связанные с пользователем.
|
|
6
6
|
service UsersService {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/// GetMe id текущего пользователя.
|
|
8
|
+
/// получает объект с данными текущего пользователя
|
|
9
9
|
rpc GetMe (GetMeRequest) returns (GetMeResponse);
|
|
10
|
-
|
|
10
|
+
/// CreateUser создает нового пользователя
|
|
11
11
|
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
|
|
12
|
+
/// CreateUser создает нового пользователя
|
|
13
|
+
rpc PatchUser (PatchUserRequest) returns (PatchUserResponse);
|
|
12
14
|
|
|
15
|
+
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
message GetMeRequest {
|
|
@@ -28,6 +31,17 @@ message CreateUserResponse {
|
|
|
28
31
|
bool ok = 1;
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
message PatchUserRequest {
|
|
35
|
+
string user_id = 1;
|
|
36
|
+
|
|
37
|
+
optional string name = 2;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message PatchUserResponse {
|
|
41
|
+
bool ok = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
31
45
|
message User {
|
|
32
46
|
string id = 1;
|
|
33
47
|
optional string name = 2;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|