Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f7e7c6058 | |||
| 96174b4d5d |
89
gen/ts/hall.ts
Normal file
89
gen/ts/hall.ts
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-ts_proto v2.11.0
|
||||||
|
// protoc v6.33.4
|
||||||
|
// source: hall.proto
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
|
export const protobufPackage = "hall.v1";
|
||||||
|
|
||||||
|
export interface CreateHallRequest {
|
||||||
|
name: string;
|
||||||
|
theaterId: string;
|
||||||
|
layout: RowLayout[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateHallResponse {
|
||||||
|
hall: Hall | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListHallsByTheaterRequest {
|
||||||
|
theaterId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListHallsByTheaterResponse {
|
||||||
|
halls: Hall[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetHallRequest {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetHallResponse {
|
||||||
|
hall: Hall | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Hall {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
theaterId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RowLayout {
|
||||||
|
row: number;
|
||||||
|
columns: number;
|
||||||
|
type: string;
|
||||||
|
price: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const HALL_V1_PACKAGE_NAME = "hall.v1";
|
||||||
|
|
||||||
|
export interface HallServiceClient {
|
||||||
|
createHall(request: CreateHallRequest): Observable<CreateHallResponse>;
|
||||||
|
|
||||||
|
getHall(request: GetHallRequest): Observable<GetHallResponse>;
|
||||||
|
|
||||||
|
listHallsByTheater(request: ListHallsByTheaterRequest): Observable<ListHallsByTheaterResponse>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HallServiceController {
|
||||||
|
createHall(
|
||||||
|
request: CreateHallRequest,
|
||||||
|
): Promise<CreateHallResponse> | Observable<CreateHallResponse> | CreateHallResponse;
|
||||||
|
|
||||||
|
getHall(request: GetHallRequest): Promise<GetHallResponse> | Observable<GetHallResponse> | GetHallResponse;
|
||||||
|
|
||||||
|
listHallsByTheater(
|
||||||
|
request: ListHallsByTheaterRequest,
|
||||||
|
): Promise<ListHallsByTheaterResponse> | Observable<ListHallsByTheaterResponse> | ListHallsByTheaterResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HallServiceControllerMethods() {
|
||||||
|
return function (constructor: Function) {
|
||||||
|
const grpcMethods: string[] = ["createHall", "getHall", "listHallsByTheater"];
|
||||||
|
for (const method of grpcMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcMethod("HallService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
const grpcStreamMethods: string[] = [];
|
||||||
|
for (const method of grpcStreamMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcStreamMethod("HallService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const HALL_SERVICE_NAME = "HallService";
|
||||||
@ -35,8 +35,8 @@ export interface Movie {
|
|||||||
title: string;
|
title: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
poster: string;
|
poster: string;
|
||||||
ratingAge: string;
|
ratingAge: number;
|
||||||
timestamp: Timestamp | undefined;
|
releaseDate: Timestamp | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MovieDetails {
|
export interface MovieDetails {
|
||||||
@ -47,9 +47,9 @@ export interface MovieDetails {
|
|||||||
poster: string;
|
poster: string;
|
||||||
banner: string;
|
banner: string;
|
||||||
duration: number;
|
duration: number;
|
||||||
ratingAge: string;
|
ratingAge: number;
|
||||||
country: string;
|
country: string;
|
||||||
timestamp: Timestamp | undefined;
|
releaseDate: Timestamp | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MOVIE_V1_PACKAGE_NAME = "movie.v1";
|
export const MOVIE_V1_PACKAGE_NAME = "movie.v1";
|
||||||
|
|||||||
129
gen/ts/screening.ts
Normal file
129
gen/ts/screening.ts
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-ts_proto v2.11.0
|
||||||
|
// protoc v6.33.4
|
||||||
|
// source: screening.proto
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
|
export const protobufPackage = "screening.v1";
|
||||||
|
|
||||||
|
export interface CreateScreeningRequest {
|
||||||
|
movieId: string;
|
||||||
|
hallId: string;
|
||||||
|
startAt: string;
|
||||||
|
endAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateScreeningResponse {
|
||||||
|
ok: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetScreeningRequest {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetScreeningResponse {
|
||||||
|
screening: Screening | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetScreeningsRequest {
|
||||||
|
theaterId?: string | undefined;
|
||||||
|
date?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetScreeningsResponse {
|
||||||
|
screenings: Screening[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetScreeningsByMovieRequest {
|
||||||
|
movieId: string;
|
||||||
|
date?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetScreeningsByMovieResponse {
|
||||||
|
screenings: Screening[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Screening {
|
||||||
|
id: string;
|
||||||
|
startAt: string;
|
||||||
|
endAt: string;
|
||||||
|
theater: Theater | undefined;
|
||||||
|
hall: Hall | undefined;
|
||||||
|
movie: Movie | undefined;
|
||||||
|
seatTypes: SeatType[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Movie {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
slug: string;
|
||||||
|
duration: number;
|
||||||
|
banner: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Theater {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
adress: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Hall {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SeatType {
|
||||||
|
type: string;
|
||||||
|
price: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SCREENING_V1_PACKAGE_NAME = "screening.v1";
|
||||||
|
|
||||||
|
export interface ScreeningServiceClient {
|
||||||
|
createScreening(request: CreateScreeningRequest): Observable<CreateScreeningResponse>;
|
||||||
|
|
||||||
|
getScreening(request: GetScreeningRequest): Observable<GetScreeningResponse>;
|
||||||
|
|
||||||
|
getScreenings(request: GetScreeningsRequest): Observable<GetScreeningsResponse>;
|
||||||
|
|
||||||
|
getScreeningsByMovie(request: GetScreeningsByMovieRequest): Observable<GetScreeningsByMovieResponse>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScreeningServiceController {
|
||||||
|
createScreening(
|
||||||
|
request: CreateScreeningRequest,
|
||||||
|
): Promise<CreateScreeningResponse> | Observable<CreateScreeningResponse> | CreateScreeningResponse;
|
||||||
|
|
||||||
|
getScreening(
|
||||||
|
request: GetScreeningRequest,
|
||||||
|
): Promise<GetScreeningResponse> | Observable<GetScreeningResponse> | GetScreeningResponse;
|
||||||
|
|
||||||
|
getScreenings(
|
||||||
|
request: GetScreeningsRequest,
|
||||||
|
): Promise<GetScreeningsResponse> | Observable<GetScreeningsResponse> | GetScreeningsResponse;
|
||||||
|
|
||||||
|
getScreeningsByMovie(
|
||||||
|
request: GetScreeningsByMovieRequest,
|
||||||
|
): Promise<GetScreeningsByMovieResponse> | Observable<GetScreeningsByMovieResponse> | GetScreeningsByMovieResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ScreeningServiceControllerMethods() {
|
||||||
|
return function (constructor: Function) {
|
||||||
|
const grpcMethods: string[] = ["createScreening", "getScreening", "getScreenings", "getScreeningsByMovie"];
|
||||||
|
for (const method of grpcMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcMethod("ScreeningService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
const grpcStreamMethods: string[] = [];
|
||||||
|
for (const method of grpcStreamMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcStreamMethod("ScreeningService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SCREENING_SERVICE_NAME = "ScreeningService";
|
||||||
71
gen/ts/seat.ts
Normal file
71
gen/ts/seat.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-ts_proto v2.11.0
|
||||||
|
// protoc v6.33.4
|
||||||
|
// source: seat.proto
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
|
||||||
|
export const protobufPackage = "seat.v1";
|
||||||
|
|
||||||
|
export interface GetSeatRequest {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetSeatResponse {
|
||||||
|
seat: Seat | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListSeatsByHallRequest {
|
||||||
|
hallId: string;
|
||||||
|
screeningId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ListSeatsByHallResponse {
|
||||||
|
seats: Seat[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Seat {
|
||||||
|
id: string;
|
||||||
|
row: number;
|
||||||
|
number: number;
|
||||||
|
price: number;
|
||||||
|
status: string;
|
||||||
|
type: string;
|
||||||
|
hallId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SEAT_V1_PACKAGE_NAME = "seat.v1";
|
||||||
|
|
||||||
|
export interface SeatServiceClient {
|
||||||
|
getSeat(request: GetSeatRequest): Observable<GetSeatResponse>;
|
||||||
|
|
||||||
|
listSeatsByHall(request: ListSeatsByHallRequest): Observable<ListSeatsByHallResponse>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SeatServiceController {
|
||||||
|
getSeat(request: GetSeatRequest): Promise<GetSeatResponse> | Observable<GetSeatResponse> | GetSeatResponse;
|
||||||
|
|
||||||
|
listSeatsByHall(
|
||||||
|
request: ListSeatsByHallRequest,
|
||||||
|
): Promise<ListSeatsByHallResponse> | Observable<ListSeatsByHallResponse> | ListSeatsByHallResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SeatServiceControllerMethods() {
|
||||||
|
return function (constructor: Function) {
|
||||||
|
const grpcMethods: string[] = ["getSeat", "listSeatsByHall"];
|
||||||
|
for (const method of grpcMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcMethod("SeatService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
const grpcStreamMethods: string[] = [];
|
||||||
|
for (const method of grpcStreamMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcStreamMethod("SeatService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SEAT_SERVICE_NAME = "SeatService";
|
||||||
78
gen/ts/theater.ts
Normal file
78
gen/ts/theater.ts
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-ts_proto v2.11.0
|
||||||
|
// protoc v6.33.4
|
||||||
|
// source: theater.proto
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { Empty } from "./google/protobuf/empty";
|
||||||
|
|
||||||
|
export const protobufPackage = "theater.v1";
|
||||||
|
|
||||||
|
export interface ListTheaterResponse {
|
||||||
|
theaters: Theater[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetTheaterRequest {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetTheaterResponse {
|
||||||
|
theater: Theater | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateTheaterRequest {
|
||||||
|
name: string;
|
||||||
|
address: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateTheaterResponse {
|
||||||
|
theater: Theater | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Theater {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
address: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const THEATER_V1_PACKAGE_NAME = "theater.v1";
|
||||||
|
|
||||||
|
export interface TheaterServiceClient {
|
||||||
|
listTheater(request: Empty): Observable<ListTheaterResponse>;
|
||||||
|
|
||||||
|
getTheater(request: GetTheaterRequest): Observable<GetTheaterResponse>;
|
||||||
|
|
||||||
|
createTheater(request: CreateTheaterRequest): Observable<CreateTheaterResponse>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TheaterServiceController {
|
||||||
|
listTheater(request: Empty): Promise<ListTheaterResponse> | Observable<ListTheaterResponse> | ListTheaterResponse;
|
||||||
|
|
||||||
|
getTheater(
|
||||||
|
request: GetTheaterRequest,
|
||||||
|
): Promise<GetTheaterResponse> | Observable<GetTheaterResponse> | GetTheaterResponse;
|
||||||
|
|
||||||
|
createTheater(
|
||||||
|
request: CreateTheaterRequest,
|
||||||
|
): Promise<CreateTheaterResponse> | Observable<CreateTheaterResponse> | CreateTheaterResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TheaterServiceControllerMethods() {
|
||||||
|
return function (constructor: Function) {
|
||||||
|
const grpcMethods: string[] = ["listTheater", "getTheater", "createTheater"];
|
||||||
|
for (const method of grpcMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcMethod("TheaterService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
const grpcStreamMethods: string[] = [];
|
||||||
|
for (const method of grpcStreamMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcStreamMethod("TheaterService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const THEATER_SERVICE_NAME = "TheaterService";
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@teacinema/contracts",
|
"name": "@teacinema/contracts",
|
||||||
"version": "1.5.0",
|
"version": "1.6.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",
|
||||||
|
|||||||
39
proto/payment.proto
Normal file
39
proto/payment.proto
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package payment.v1;
|
||||||
|
|
||||||
|
service PaymentService {
|
||||||
|
rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse);
|
||||||
|
rpc ProcessPaymentEvent (ProcessPaymentEventRequest) returns (ProcessPaymentEventResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreatePaymentRequest {
|
||||||
|
string user_id = 1;
|
||||||
|
string screening_id = 2;
|
||||||
|
repeated SeatInput seats = 3;
|
||||||
|
optional string payment_method_id = 4;
|
||||||
|
bool save_payment_method = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message CreatePaymentResponse {
|
||||||
|
string url = 1;
|
||||||
|
}
|
||||||
|
message ProcessPaymentEventRequest {
|
||||||
|
string event = 1;
|
||||||
|
string payment_id = 2;
|
||||||
|
string booking_id = 3;
|
||||||
|
string user_id = 4;
|
||||||
|
bool save_payment_method = 5;
|
||||||
|
string provider_payment_id = 6;
|
||||||
|
string card_first6 = 7;
|
||||||
|
string lat4 = 8;
|
||||||
|
}
|
||||||
|
message ProcessPaymentEventResponse {
|
||||||
|
bool ok = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SeatInput {
|
||||||
|
string seat_id = 1;
|
||||||
|
int32 price = 2;
|
||||||
|
}
|
||||||
@ -42,4 +42,6 @@ export const PROTO_PATHS = {
|
|||||||
SEAT: join(__dirname, '../../proto/seat.proto'),
|
SEAT: join(__dirname, '../../proto/seat.proto'),
|
||||||
/** Путь к `screening.proto` (пакет `screening.v1`) */
|
/** Путь к `screening.proto` (пакет `screening.v1`) */
|
||||||
SCREENING: join(__dirname, '../../proto/screening.proto'),
|
SCREENING: join(__dirname, '../../proto/screening.proto'),
|
||||||
|
/** Путь к `payment.proto` (пакет `payment.v1`) */
|
||||||
|
PAYMENT: join(__dirname, '../../proto/payment.proto'),
|
||||||
} as const
|
} as const
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user