Compare commits
2 Commits
395f90b463
...
359777f856
| Author | SHA1 | Date | |
|---|---|---|---|
| 359777f856 | |||
| 7c6989f871 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@teacinema/contracts",
|
"name": "@teacinema/contracts",
|
||||||
"version": "1.1.8",
|
"version": "1.2.0",
|
||||||
"description": "Protocol Buffers contracts for microservices",
|
"description": "Protocol Buffers contracts for microservices",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -p tsconfig.build.json",
|
"build": "tsc -p tsconfig.build.json",
|
||||||
|
|||||||
19
proto/category.proto
Normal file
19
proto/category.proto
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
import "google/protobuf/empty.proto"
|
||||||
|
|
||||||
|
package category.v1;
|
||||||
|
|
||||||
|
service CategoryService {
|
||||||
|
rpc GetAllCategories (google.protobuf.Empty) returns GetAllCategoriesResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetAllCategoriesResponse {
|
||||||
|
repeated Category categories = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Category {
|
||||||
|
string id = 1;
|
||||||
|
string title = 2;
|
||||||
|
string slug = 3;
|
||||||
|
}
|
||||||
53
proto/movie.proto
Normal file
53
proto/movie.proto
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package movie.v1;
|
||||||
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
service MovieService {
|
||||||
|
rpc ListMovies (ListMovieRequest) returns (ListMovieResponse);
|
||||||
|
rpc GetMovie (GetMovieRequest) returns (GetMovieResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListMovieRequest {
|
||||||
|
string category = 1;
|
||||||
|
bool random = 2;
|
||||||
|
int32 limit = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListMovieResponse {
|
||||||
|
repeated Movie movies = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetMovieRequest {
|
||||||
|
oneof key {
|
||||||
|
string id = 1;
|
||||||
|
string slug = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetMovieResponse {
|
||||||
|
MovieDetails movie = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message Movie {
|
||||||
|
string id = 1;
|
||||||
|
string title = 2;
|
||||||
|
string slug = 3;
|
||||||
|
string poster = 4;
|
||||||
|
string rating_age = 5;
|
||||||
|
google.protobuf.Timestamp timestamp = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MovieDetails {
|
||||||
|
string id = 1;
|
||||||
|
string title = 2;
|
||||||
|
string slug = 3;
|
||||||
|
string description = 4;
|
||||||
|
string poster = 5;
|
||||||
|
string banner = 6;
|
||||||
|
int32 duration = 7;
|
||||||
|
string rating_age = 8;
|
||||||
|
string country = 9;
|
||||||
|
google.protobuf.Timestamp timestamp = 10;
|
||||||
|
}
|
||||||
@ -30,4 +30,8 @@ export const PROTO_PATHS = {
|
|||||||
USERS: join(__dirname, '../../proto/users.proto'),
|
USERS: join(__dirname, '../../proto/users.proto'),
|
||||||
/** Путь к `media.proto` (пакет `media.v1`) */
|
/** Путь к `media.proto` (пакет `media.v1`) */
|
||||||
MEDIA: join(__dirname, '../../proto/media.proto'),
|
MEDIA: join(__dirname, '../../proto/media.proto'),
|
||||||
|
/** Путь к `movie.proto` (пакет `movie.v1`) */
|
||||||
|
MOVIE: join(__dirname, '../../proto/movie.proto'),
|
||||||
|
/** Путь к `category.proto` (пакет `category.v1`) */
|
||||||
|
CATEGORY: join(__dirname, '../../proto/category.proto'),
|
||||||
} as const
|
} as const
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user