Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f7e7c6058 | |||
| 96174b4d5d | |||
| b406d316db | |||
| f6e360d58d | |||
| 27d9310118 | |||
| 7eb5a02a2d | |||
| 2a1a909138 | |||
| bb9ff65861 | |||
| a735405b7e | |||
| a517282198 | |||
| eead3d5078 | |||
| 276e1bb7e7 | |||
| 67f2fc6472 | |||
| 8dd77c9969 | |||
| db123f7162 | |||
| 6a9e991782 | |||
| 11c023a530 | |||
| 2ec654e667 | |||
| d6967c9358 | |||
| 1bedcd92a0 | |||
| 359777f856 | |||
| 7c6989f871 | |||
| 395f90b463 | |||
| f908a46d70 | |||
| 09a13b587f | |||
| 8c858038e7 | |||
| 8079b25fef |
@ -103,7 +103,7 @@ export class AppModule {}
|
||||
```ts
|
||||
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { ClientGrpc } from '@nestjs/microservices';
|
||||
import { AuthServiceClient } from '@teacinema/contracts/gen/auth';
|
||||
import { AuthServiceClient } from '@teacinema/contracts/gen/ts/auth';
|
||||
|
||||
@Injectable()
|
||||
export class AuthProxy implements OnModuleInit {
|
||||
@ -126,7 +126,7 @@ export class AuthProxy implements OnModuleInit {
|
||||
```ts
|
||||
import { Controller } from '@nestjs/common';
|
||||
import { GrpcMethod } from '@nestjs/microservices';
|
||||
import { AuthServiceController, AuthServiceControllerMethods } from '@teacinema/contracts/gen/auth';
|
||||
import { AuthServiceController, AuthServiceControllerMethods } from '@teacinema/contracts/gen/ts/auth';
|
||||
|
||||
@Controller()
|
||||
@AuthServiceControllerMethods()
|
||||
@ -196,4 +196,4 @@ yarn generate
|
||||
```bash
|
||||
yarn docs
|
||||
open docs/index.html
|
||||
```
|
||||
```
|
||||
|
||||
51
gen/ts/category.ts
Normal file
51
gen/ts/category.ts
Normal file
@ -0,0 +1,51 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: category.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
import { Empty } from "./google/protobuf/empty";
|
||||
|
||||
export const protobufPackage = "category.v1";
|
||||
|
||||
export interface GetAllCategoriesResponse {
|
||||
categories: Category[];
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
}
|
||||
|
||||
export const CATEGORY_V1_PACKAGE_NAME = "category.v1";
|
||||
|
||||
export interface CategoryServiceClient {
|
||||
getAllCategories(request: Empty): Observable<GetAllCategoriesResponse>;
|
||||
}
|
||||
|
||||
export interface CategoryServiceController {
|
||||
getAllCategories(
|
||||
request: Empty,
|
||||
): Promise<GetAllCategoriesResponse> | Observable<GetAllCategoriesResponse> | GetAllCategoriesResponse;
|
||||
}
|
||||
|
||||
export function CategoryServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["getAllCategories"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("CategoryService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("CategoryService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const CATEGORY_SERVICE_NAME = "CategoryService";
|
||||
119
gen/ts/google/protobuf/timestamp.ts
Normal file
119
gen/ts/google/protobuf/timestamp.ts
Normal file
@ -0,0 +1,119 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: google/protobuf/timestamp.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* A Timestamp represents a point in time independent of any time zone or local
|
||||
* calendar, encoded as a count of seconds and fractions of seconds at
|
||||
* nanosecond resolution. The count is relative to an epoch at UTC midnight on
|
||||
* January 1, 1970, in the proleptic Gregorian calendar which extends the
|
||||
* Gregorian calendar backwards to year one.
|
||||
*
|
||||
* All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
|
||||
* second table is needed for interpretation, using a [24-hour linear
|
||||
* smear](https://developers.google.com/time/smear).
|
||||
*
|
||||
* The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
|
||||
* restricting to that range, we ensure that we can convert to and from [RFC
|
||||
* 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
|
||||
*
|
||||
* # Examples
|
||||
*
|
||||
* Example 1: Compute Timestamp from POSIX `time()`.
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(time(NULL));
|
||||
* timestamp.set_nanos(0);
|
||||
*
|
||||
* Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
*
|
||||
* struct timeval tv;
|
||||
* gettimeofday(&tv, NULL);
|
||||
*
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds(tv.tv_sec);
|
||||
* timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
*
|
||||
* Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
*
|
||||
* FILETIME ft;
|
||||
* GetSystemTimeAsFileTime(&ft);
|
||||
* UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
*
|
||||
* // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
* // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
* Timestamp timestamp;
|
||||
* timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
* timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
*
|
||||
* Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
*
|
||||
* long millis = System.currentTimeMillis();
|
||||
*
|
||||
* Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
* .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
*
|
||||
* Example 5: Compute Timestamp from Java `Instant.now()`.
|
||||
*
|
||||
* Instant now = Instant.now();
|
||||
*
|
||||
* Timestamp timestamp =
|
||||
* Timestamp.newBuilder().setSeconds(now.getEpochSecond())
|
||||
* .setNanos(now.getNano()).build();
|
||||
*
|
||||
* Example 6: Compute Timestamp from current time in Python.
|
||||
*
|
||||
* timestamp = Timestamp()
|
||||
* timestamp.GetCurrentTime()
|
||||
*
|
||||
* # JSON Mapping
|
||||
*
|
||||
* In JSON format, the Timestamp type is encoded as a string in the
|
||||
* [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
|
||||
* format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
|
||||
* where {year} is always expressed using four digits while {month}, {day},
|
||||
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
|
||||
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
|
||||
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
|
||||
* is required. A proto3 JSON serializer should always use UTC (as indicated by
|
||||
* "Z") when printing the Timestamp type and a proto3 JSON parser should be
|
||||
* able to accept both UTC and other timezones (as indicated by an offset).
|
||||
*
|
||||
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
|
||||
* 01:30 UTC on January 15, 2017.
|
||||
*
|
||||
* In JavaScript, one can convert a Date object to this format using the
|
||||
* standard
|
||||
* [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
|
||||
* method. In Python, a standard `datetime.datetime` object can be converted
|
||||
* to this format using
|
||||
* [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
|
||||
* the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
|
||||
* the Joda Time's [`ISODateTimeFormat.dateTime()`](
|
||||
* http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
|
||||
* ) to obtain a formatter capable of generating timestamps in this format.
|
||||
*/
|
||||
export interface Timestamp {
|
||||
/**
|
||||
* Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must
|
||||
* be between -315576000000 and 315576000000 inclusive (which corresponds to
|
||||
* 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).
|
||||
*/
|
||||
seconds: number;
|
||||
/**
|
||||
* Non-negative fractions of a second at nanosecond resolution. This field is
|
||||
* the nanosecond portion of the duration, not an alternative to seconds.
|
||||
* Negative second values with fractions must still have non-negative nanos
|
||||
* values that count forward in time. Must be between 0 and 999,999,999
|
||||
* inclusive.
|
||||
*/
|
||||
nanos: number;
|
||||
}
|
||||
|
||||
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
||||
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";
|
||||
84
gen/ts/movie.ts
Normal file
84
gen/ts/movie.ts
Normal file
@ -0,0 +1,84 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: movie.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
import { Timestamp } from "./google/protobuf/timestamp";
|
||||
|
||||
export const protobufPackage = "movie.v1";
|
||||
|
||||
export interface ListMovieRequest {
|
||||
category: string;
|
||||
random: boolean;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
export interface ListMovieResponse {
|
||||
movies: Movie[];
|
||||
}
|
||||
|
||||
export interface GetMovieRequest {
|
||||
id?: string | undefined;
|
||||
slug?: string | undefined;
|
||||
}
|
||||
|
||||
export interface GetMovieResponse {
|
||||
movie: MovieDetails | undefined;
|
||||
}
|
||||
|
||||
export interface Movie {
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
poster: string;
|
||||
ratingAge: number;
|
||||
releaseDate: Timestamp | undefined;
|
||||
}
|
||||
|
||||
export interface MovieDetails {
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
description: string;
|
||||
poster: string;
|
||||
banner: string;
|
||||
duration: number;
|
||||
ratingAge: number;
|
||||
country: string;
|
||||
releaseDate: Timestamp | undefined;
|
||||
}
|
||||
|
||||
export const MOVIE_V1_PACKAGE_NAME = "movie.v1";
|
||||
|
||||
export interface MovieServiceClient {
|
||||
listMovies(request: ListMovieRequest): Observable<ListMovieResponse>;
|
||||
|
||||
getMovie(request: GetMovieRequest): Observable<GetMovieResponse>;
|
||||
}
|
||||
|
||||
export interface MovieServiceController {
|
||||
listMovies(request: ListMovieRequest): Promise<ListMovieResponse> | Observable<ListMovieResponse> | ListMovieResponse;
|
||||
|
||||
getMovie(request: GetMovieRequest): Promise<GetMovieResponse> | Observable<GetMovieResponse> | GetMovieResponse;
|
||||
}
|
||||
|
||||
export function MovieServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["listMovies", "getMovie"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("MovieService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("MovieService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const MOVIE_SERVICE_NAME = "MovieService";
|
||||
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";
|
||||
@ -37,6 +37,7 @@ export interface User {
|
||||
export interface PatchUserRequest {
|
||||
userId: string;
|
||||
name?: string | undefined;
|
||||
avatar?: string | undefined;
|
||||
}
|
||||
|
||||
export interface PatchUserResponse {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@teacinema/contracts",
|
||||
"version": "1.1.5",
|
||||
"version": "1.6.0",
|
||||
"description": "Protocol Buffers contracts for microservices",
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
|
||||
19
proto/category.proto
Normal file
19
proto/category.proto
Normal file
@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package category.v1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
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;
|
||||
}
|
||||
48
proto/hall.proto
Normal file
48
proto/hall.proto
Normal file
@ -0,0 +1,48 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package hall.v1;
|
||||
|
||||
service HallService {
|
||||
rpc CreateHall (CreateHallRequest) returns (CreateHallResponse);
|
||||
rpc GetHall (GetHallRequest) returns (GetHallResponse);
|
||||
rpc ListHallsByTheater (ListHallsByTheaterRequest) returns (ListHallsByTheaterResponse);
|
||||
}
|
||||
|
||||
message CreateHallRequest {
|
||||
string name = 1;
|
||||
string theater_id = 2;
|
||||
repeated RowLayout layout = 3;
|
||||
}
|
||||
|
||||
message CreateHallResponse {
|
||||
Hall hall = 1;
|
||||
}
|
||||
|
||||
message ListHallsByTheaterRequest {
|
||||
string theater_id = 1;
|
||||
}
|
||||
|
||||
message ListHallsByTheaterResponse {
|
||||
repeated Hall halls = 1;
|
||||
}
|
||||
|
||||
message GetHallRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message GetHallResponse {
|
||||
Hall hall = 1;
|
||||
}
|
||||
|
||||
message Hall {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string theater_id = 3;
|
||||
}
|
||||
|
||||
message RowLayout {
|
||||
int32 row = 1;
|
||||
int32 columns = 2;
|
||||
string type = 3;
|
||||
int32 price = 4;
|
||||
}
|
||||
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;
|
||||
int32 rating_age = 5;
|
||||
google.protobuf.Timestamp release_date = 6;
|
||||
}
|
||||
|
||||
message MovieDetails {
|
||||
string id = 1;
|
||||
string title = 2;
|
||||
string slug = 3;
|
||||
string description = 4;
|
||||
string poster = 5;
|
||||
string banner = 6;
|
||||
int32 duration = 7;
|
||||
int32 rating_age = 8;
|
||||
string country = 9;
|
||||
google.protobuf.Timestamp release_date = 10;
|
||||
}
|
||||
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;
|
||||
}
|
||||
79
proto/screening.proto
Normal file
79
proto/screening.proto
Normal file
@ -0,0 +1,79 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package screening.v1;
|
||||
|
||||
service ScreeningService {
|
||||
rpc CreateScreening (CreateScreeningRequest) returns (CreateScreeningResponse);
|
||||
rpc GetScreening (GetScreeningRequest) returns (GetScreeningResponse);
|
||||
rpc GetScreenings (GetScreeningsRequest) returns (GetScreeningsResponse);
|
||||
rpc GetScreeningsByMovie (GetScreeningsByMovieRequest) returns (GetScreeningsByMovieResponse);
|
||||
}
|
||||
|
||||
message CreateScreeningRequest {
|
||||
string movie_id = 1;
|
||||
string hall_id = 2;
|
||||
string start_at = 3;
|
||||
string end_at = 4;
|
||||
}
|
||||
|
||||
message CreateScreeningResponse {
|
||||
bool ok = 1;
|
||||
}
|
||||
|
||||
message GetScreeningRequest {
|
||||
string id = 1;
|
||||
}
|
||||
message GetScreeningResponse {
|
||||
Screening screening = 1;
|
||||
}
|
||||
|
||||
message GetScreeningsRequest {
|
||||
optional string theater_id = 1;
|
||||
optional string date = 2;
|
||||
}
|
||||
|
||||
message GetScreeningsResponse {
|
||||
repeated Screening screenings = 1;
|
||||
}
|
||||
|
||||
message GetScreeningsByMovieRequest {
|
||||
string movie_id = 1;
|
||||
optional string date = 2;
|
||||
}
|
||||
message GetScreeningsByMovieResponse {
|
||||
repeated Screening screenings = 1;
|
||||
}
|
||||
|
||||
message Screening {
|
||||
string id = 1;
|
||||
string start_at = 2;
|
||||
string end_at = 3;
|
||||
Theater theater = 4;
|
||||
Hall hall = 5;
|
||||
Movie movie = 6;
|
||||
repeated SeatType seat_types = 7;
|
||||
}
|
||||
|
||||
message Movie {
|
||||
string id = 1;
|
||||
string title = 2;
|
||||
string slug = 3;
|
||||
int32 duration = 4;
|
||||
string banner = 5;
|
||||
}
|
||||
|
||||
message Theater {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string adress = 3;
|
||||
}
|
||||
|
||||
message Hall {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
}
|
||||
|
||||
message SeatType {
|
||||
string type = 1;
|
||||
int32 price = 2;
|
||||
}
|
||||
33
proto/seat.proto
Normal file
33
proto/seat.proto
Normal file
@ -0,0 +1,33 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package seat.v1;
|
||||
|
||||
service SeatService {
|
||||
rpc GetSeat (GetSeatRequest) returns (GetSeatResponse);
|
||||
rpc ListSeatsByHall (ListSeatsByHallRequest) returns (ListSeatsByHallResponse);
|
||||
}
|
||||
|
||||
message GetSeatRequest {
|
||||
string id = 1;
|
||||
}
|
||||
message GetSeatResponse {
|
||||
Seat seat = 1;
|
||||
}
|
||||
|
||||
message ListSeatsByHallRequest {
|
||||
string hall_id = 1;
|
||||
string screening_id = 2;
|
||||
}
|
||||
message ListSeatsByHallResponse {
|
||||
repeated Seat seats = 1;
|
||||
}
|
||||
|
||||
message Seat {
|
||||
string id = 1;
|
||||
int32 row = 2;
|
||||
int32 number = 3;
|
||||
int32 price = 4;
|
||||
string status = 5;
|
||||
string type = 6;
|
||||
string hall_id = 7;
|
||||
}
|
||||
37
proto/theater.proto
Normal file
37
proto/theater.proto
Normal file
@ -0,0 +1,37 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package theater.v1;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
service TheaterService {
|
||||
rpc ListTheater(google.protobuf.Empty) returns (ListTheaterResponse);
|
||||
rpc GetTheater(GetTheaterRequest) returns (GetTheaterResponse);
|
||||
rpc CreateTheater(CreateTheaterRequest) returns (CreateTheaterResponse);
|
||||
}
|
||||
|
||||
message ListTheaterResponse {
|
||||
repeated Theater theaters = 1;
|
||||
}
|
||||
|
||||
message GetTheaterRequest {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message GetTheaterResponse {
|
||||
Theater theater = 1;
|
||||
}
|
||||
|
||||
message CreateTheaterRequest {
|
||||
string name = 1;
|
||||
string address = 2;
|
||||
}
|
||||
message CreateTheaterResponse {
|
||||
Theater theater = 1;
|
||||
}
|
||||
|
||||
message Theater {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string address = 3;
|
||||
}
|
||||
@ -35,6 +35,7 @@ message User {
|
||||
message PatchUserRequest {
|
||||
string user_id = 1;
|
||||
optional string name = 2;
|
||||
optional string avatar = 3;
|
||||
}
|
||||
message PatchUserResponse {
|
||||
bool ok = 1;
|
||||
|
||||
@ -28,4 +28,20 @@ export const PROTO_PATHS = {
|
||||
ACCOUNT: join(__dirname, '../../proto/account.proto'),
|
||||
/** Путь к `users.proto` (пакет `users.v1`) */
|
||||
USERS: join(__dirname, '../../proto/users.proto'),
|
||||
/** Путь к `media.proto` (пакет `media.v1`) */
|
||||
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'),
|
||||
/** Путь к `theater.proto` (пакет `theater.v1`) */
|
||||
THEATER: join(__dirname, '../../proto/theater.proto'),
|
||||
/** Путь к `hall.proto` (пакет `hall.v1`) */
|
||||
HALL: join(__dirname, '../../proto/hall.proto'),
|
||||
/** Путь к `seat.proto` (пакет `seat.v1`) */
|
||||
SEAT: join(__dirname, '../../proto/seat.proto'),
|
||||
/** Путь к `screening.proto` (пакет `screening.v1`) */
|
||||
SCREENING: join(__dirname, '../../proto/screening.proto'),
|
||||
/** Путь к `payment.proto` (пакет `payment.v1`) */
|
||||
PAYMENT: join(__dirname, '../../proto/payment.proto'),
|
||||
} as const
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user