Compare commits
29 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 | |||
| e45bf05fb9 | |||
| e71b116e06 |
36
.gitea/workflows/publish-go.yml
Normal file
36
.gitea/workflows/publish-go.yml
Normal file
@ -0,0 +1,36 @@
|
||||
name: Publish Go Bondings
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
jobs:
|
||||
Publish Go package action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
|
||||
- name: Install protoc
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y protobuf-compiler
|
||||
|
||||
- name: Install Go Protobuf
|
||||
run: |
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.1
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.4.0
|
||||
|
||||
- name: Generate Go protobuf
|
||||
run: bash ./scripts/generate_go.sh
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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()
|
||||
|
||||
62
gen/auth.ts
62
gen/auth.ts
@ -1,62 +0,0 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: auth.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "auth.v1";
|
||||
|
||||
export interface SendOtpRequest {
|
||||
identifier: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface SendOtpResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export interface VerifyOtpRequest {
|
||||
identifier: string;
|
||||
type: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export interface VerifyOtpResponse {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
||||
|
||||
export interface AuthServiceClient {
|
||||
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
||||
|
||||
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
||||
}
|
||||
|
||||
export interface AuthServiceController {
|
||||
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
||||
|
||||
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
||||
}
|
||||
|
||||
export function AuthServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const AUTH_SERVICE_NAME = "AuthService";
|
||||
425
gen/go/media/media.pb.go
Normal file
425
gen/go/media/media.pb.go
Normal file
@ -0,0 +1,425 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.4
|
||||
// source: media.proto
|
||||
|
||||
package media
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type UploadRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
|
||||
Folder string `protobuf:"bytes,2,opt,name=folder,proto3" json:"folder,omitempty"`
|
||||
ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
|
||||
Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
|
||||
ResizeWidth *int32 `protobuf:"varint,5,opt,name=resize_width,json=resizeWidth,proto3,oneof" json:"resize_width,omitempty"`
|
||||
ResizeHeight *int32 `protobuf:"varint,6,opt,name=resize_height,json=resizeHeight,proto3,oneof" json:"resize_height,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UploadRequest) Reset() {
|
||||
*x = UploadRequest{}
|
||||
mi := &file_media_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UploadRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UploadRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UploadRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_media_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UploadRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UploadRequest) Descriptor() ([]byte, []int) {
|
||||
return file_media_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *UploadRequest) GetFileName() string {
|
||||
if x != nil {
|
||||
return x.FileName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UploadRequest) GetFolder() string {
|
||||
if x != nil {
|
||||
return x.Folder
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UploadRequest) GetContentType() string {
|
||||
if x != nil {
|
||||
return x.ContentType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *UploadRequest) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UploadRequest) GetResizeWidth() int32 {
|
||||
if x != nil && x.ResizeWidth != nil {
|
||||
return *x.ResizeWidth
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *UploadRequest) GetResizeHeight() int32 {
|
||||
if x != nil && x.ResizeHeight != nil {
|
||||
return *x.ResizeHeight
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type UploadResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UploadResponse) Reset() {
|
||||
*x = UploadResponse{}
|
||||
mi := &file_media_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UploadResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UploadResponse) ProtoMessage() {}
|
||||
|
||||
func (x *UploadResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_media_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UploadResponse.ProtoReflect.Descriptor instead.
|
||||
func (*UploadResponse) Descriptor() ([]byte, []int) {
|
||||
return file_media_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *UploadResponse) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetRequest) Reset() {
|
||||
*x = GetRequest{}
|
||||
mi := &file_media_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_media_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetRequest) Descriptor() ([]byte, []int) {
|
||||
return file_media_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetRequest) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||
ContentType string `protobuf:"bytes,2,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetResponse) Reset() {
|
||||
*x = GetResponse{}
|
||||
mi := &file_media_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_media_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetResponse) Descriptor() ([]byte, []int) {
|
||||
return file_media_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetResponse) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetResponse) GetContentType() string {
|
||||
if x != nil {
|
||||
return x.ContentType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DeleteRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DeleteRequest) Reset() {
|
||||
*x = DeleteRequest{}
|
||||
mi := &file_media_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeleteRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_media_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteRequest) Descriptor() ([]byte, []int) {
|
||||
return file_media_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *DeleteRequest) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DeleteResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DeleteResponse) Reset() {
|
||||
*x = DeleteResponse{}
|
||||
mi := &file_media_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DeleteResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_media_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteResponse) Descriptor() ([]byte, []int) {
|
||||
return file_media_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *DeleteResponse) GetOk() bool {
|
||||
if x != nil {
|
||||
return x.Ok
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_media_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_media_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\vmedia.proto\x12\bmedia.v1\"\xf0\x01\n" +
|
||||
"\rUploadRequest\x12\x1b\n" +
|
||||
"\tfile_name\x18\x01 \x01(\tR\bfileName\x12\x16\n" +
|
||||
"\x06folder\x18\x02 \x01(\tR\x06folder\x12!\n" +
|
||||
"\fcontent_type\x18\x03 \x01(\tR\vcontentType\x12\x12\n" +
|
||||
"\x04data\x18\x04 \x01(\fR\x04data\x12&\n" +
|
||||
"\fresize_width\x18\x05 \x01(\x05H\x00R\vresizeWidth\x88\x01\x01\x12(\n" +
|
||||
"\rresize_height\x18\x06 \x01(\x05H\x01R\fresizeHeight\x88\x01\x01B\x0f\n" +
|
||||
"\r_resize_widthB\x10\n" +
|
||||
"\x0e_resize_height\"\"\n" +
|
||||
"\x0eUploadResponse\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\"\x1e\n" +
|
||||
"\n" +
|
||||
"GetRequest\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\"D\n" +
|
||||
"\vGetResponse\x12\x12\n" +
|
||||
"\x04data\x18\x01 \x01(\fR\x04data\x12!\n" +
|
||||
"\fcontent_type\x18\x02 \x01(\tR\vcontentType\"!\n" +
|
||||
"\rDeleteRequest\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\" \n" +
|
||||
"\x0eDeleteResponse\x12\x0e\n" +
|
||||
"\x02ok\x18\x01 \x01(\bR\x02ok2\xbc\x01\n" +
|
||||
"\fMediaService\x12;\n" +
|
||||
"\x06Upload\x12\x17.media.v1.UploadRequest\x1a\x18.media.v1.UploadResponse\x122\n" +
|
||||
"\x03Get\x12\x14.media.v1.GetRequest\x1a\x15.media.v1.GetResponse\x12;\n" +
|
||||
"\x06Delete\x12\x17.media.v1.DeleteRequest\x1a\x18.media.v1.DeleteResponseB;P\x01Z7git.ksv741.keenetic.pro/teacinema/contracts/media;mediab\x06proto3"
|
||||
|
||||
var (
|
||||
file_media_proto_rawDescOnce sync.Once
|
||||
file_media_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_media_proto_rawDescGZIP() []byte {
|
||||
file_media_proto_rawDescOnce.Do(func() {
|
||||
file_media_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_media_proto_rawDesc), len(file_media_proto_rawDesc)))
|
||||
})
|
||||
return file_media_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_media_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_media_proto_goTypes = []any{
|
||||
(*UploadRequest)(nil), // 0: media.v1.UploadRequest
|
||||
(*UploadResponse)(nil), // 1: media.v1.UploadResponse
|
||||
(*GetRequest)(nil), // 2: media.v1.GetRequest
|
||||
(*GetResponse)(nil), // 3: media.v1.GetResponse
|
||||
(*DeleteRequest)(nil), // 4: media.v1.DeleteRequest
|
||||
(*DeleteResponse)(nil), // 5: media.v1.DeleteResponse
|
||||
}
|
||||
var file_media_proto_depIdxs = []int32{
|
||||
0, // 0: media.v1.MediaService.Upload:input_type -> media.v1.UploadRequest
|
||||
2, // 1: media.v1.MediaService.Get:input_type -> media.v1.GetRequest
|
||||
4, // 2: media.v1.MediaService.Delete:input_type -> media.v1.DeleteRequest
|
||||
1, // 3: media.v1.MediaService.Upload:output_type -> media.v1.UploadResponse
|
||||
3, // 4: media.v1.MediaService.Get:output_type -> media.v1.GetResponse
|
||||
5, // 5: media.v1.MediaService.Delete:output_type -> media.v1.DeleteResponse
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_media_proto_init() }
|
||||
func file_media_proto_init() {
|
||||
if File_media_proto != nil {
|
||||
return
|
||||
}
|
||||
file_media_proto_msgTypes[0].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_media_proto_rawDesc), len(file_media_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_media_proto_goTypes,
|
||||
DependencyIndexes: file_media_proto_depIdxs,
|
||||
MessageInfos: file_media_proto_msgTypes,
|
||||
}.Build()
|
||||
File_media_proto = out.File
|
||||
file_media_proto_goTypes = nil
|
||||
file_media_proto_depIdxs = nil
|
||||
}
|
||||
197
gen/go/media/media_grpc.pb.go
Normal file
197
gen/go/media/media_grpc.pb.go
Normal file
@ -0,0 +1,197 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v6.33.4
|
||||
// source: media.proto
|
||||
|
||||
package media
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
MediaService_Upload_FullMethodName = "/media.v1.MediaService/Upload"
|
||||
MediaService_Get_FullMethodName = "/media.v1.MediaService/Get"
|
||||
MediaService_Delete_FullMethodName = "/media.v1.MediaService/Delete"
|
||||
)
|
||||
|
||||
// MediaServiceClient is the client API for MediaService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type MediaServiceClient interface {
|
||||
Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*UploadResponse, error)
|
||||
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
|
||||
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
|
||||
}
|
||||
|
||||
type mediaServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMediaServiceClient(cc grpc.ClientConnInterface) MediaServiceClient {
|
||||
return &mediaServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *mediaServiceClient) Upload(ctx context.Context, in *UploadRequest, opts ...grpc.CallOption) (*UploadResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(UploadResponse)
|
||||
err := c.cc.Invoke(ctx, MediaService_Upload_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *mediaServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetResponse)
|
||||
err := c.cc.Invoke(ctx, MediaService_Get_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *mediaServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(DeleteResponse)
|
||||
err := c.cc.Invoke(ctx, MediaService_Delete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MediaServiceServer is the server API for MediaService service.
|
||||
// All implementations must embed UnimplementedMediaServiceServer
|
||||
// for forward compatibility.
|
||||
type MediaServiceServer interface {
|
||||
Upload(context.Context, *UploadRequest) (*UploadResponse, error)
|
||||
Get(context.Context, *GetRequest) (*GetResponse, error)
|
||||
Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
|
||||
mustEmbedUnimplementedMediaServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedMediaServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedMediaServiceServer struct{}
|
||||
|
||||
func (UnimplementedMediaServiceServer) Upload(context.Context, *UploadRequest) (*UploadResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Upload not implemented")
|
||||
}
|
||||
func (UnimplementedMediaServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedMediaServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedMediaServiceServer) mustEmbedUnimplementedMediaServiceServer() {}
|
||||
func (UnimplementedMediaServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeMediaServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to MediaServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeMediaServiceServer interface {
|
||||
mustEmbedUnimplementedMediaServiceServer()
|
||||
}
|
||||
|
||||
func RegisterMediaServiceServer(s grpc.ServiceRegistrar, srv MediaServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedMediaServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&MediaService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _MediaService_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UploadRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MediaServiceServer).Upload(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MediaService_Upload_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MediaServiceServer).Upload(ctx, req.(*UploadRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MediaService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MediaServiceServer).Get(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MediaService_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MediaServiceServer).Get(ctx, req.(*GetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _MediaService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MediaServiceServer).Delete(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: MediaService_Delete_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MediaServiceServer).Delete(ctx, req.(*DeleteRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// MediaService_ServiceDesc is the grpc.ServiceDesc for MediaService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var MediaService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "media.v1.MediaService",
|
||||
HandlerType: (*MediaServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Upload",
|
||||
Handler: _MediaService_Upload_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Get",
|
||||
Handler: _MediaService_Get_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Delete",
|
||||
Handler: _MediaService_Delete_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "media.proto",
|
||||
}
|
||||
127
gen/ts/account.ts
Normal file
127
gen/ts/account.ts
Normal file
@ -0,0 +1,127 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: account.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "account.v1";
|
||||
|
||||
export enum Role {
|
||||
USER = 0,
|
||||
ADMIN = 1,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export interface GetAccountRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetAccountResponse {
|
||||
id: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
isPhoneVerified: boolean;
|
||||
isEmailVerified: boolean;
|
||||
role: Role;
|
||||
}
|
||||
|
||||
export interface InitEmailChangeRequest {
|
||||
email: string;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface InitEmailChangeResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export interface ConfirmEmailChangeRequest {
|
||||
email: string;
|
||||
code: string;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface ConfirmEmailChangeResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export interface InitPhoneChangeRequest {
|
||||
phone: string;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface InitPhoneChangeResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export interface ConfirmPhoneChangeRequest {
|
||||
phone: string;
|
||||
code: string;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface ConfirmPhoneChangeResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
||||
|
||||
export interface AccountServiceClient {
|
||||
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
||||
|
||||
initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
|
||||
|
||||
confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
|
||||
|
||||
initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
|
||||
|
||||
confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
|
||||
}
|
||||
|
||||
export interface AccountServiceController {
|
||||
getAccount(
|
||||
request: GetAccountRequest,
|
||||
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
||||
|
||||
initEmailChange(
|
||||
request: InitEmailChangeRequest,
|
||||
): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
|
||||
|
||||
confirmEmailChange(
|
||||
request: ConfirmEmailChangeRequest,
|
||||
): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
|
||||
|
||||
initPhoneChange(
|
||||
request: InitPhoneChangeRequest,
|
||||
): Promise<InitPhoneChangeResponse> | Observable<InitPhoneChangeResponse> | InitPhoneChangeResponse;
|
||||
|
||||
confirmPhoneChange(
|
||||
request: ConfirmPhoneChangeRequest,
|
||||
): Promise<ConfirmPhoneChangeResponse> | Observable<ConfirmPhoneChangeResponse> | ConfirmPhoneChangeResponse;
|
||||
}
|
||||
|
||||
export function AccountServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = [
|
||||
"getAccount",
|
||||
"initEmailChange",
|
||||
"confirmEmailChange",
|
||||
"initPhoneChange",
|
||||
"confirmPhoneChange",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
||||
143
gen/ts/auth.ts
Normal file
143
gen/ts/auth.ts
Normal file
@ -0,0 +1,143 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: auth.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
import { Empty } from "./google/protobuf/empty";
|
||||
|
||||
export const protobufPackage = "auth.v1";
|
||||
|
||||
export interface SendOtpRequest {
|
||||
identifier: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface SendOtpResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export interface VerifyOtpRequest {
|
||||
identifier: string;
|
||||
type: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
export interface VerifyOtpResponse {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export interface RefreshRequest {
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export interface RefreshResponse {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export interface TelegramInitResponse {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface TelegramVerifyRequest {
|
||||
query: { [key: string]: string };
|
||||
}
|
||||
|
||||
export interface TelegramVerifyRequest_QueryEntry {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface TelegramVerifyResponse {
|
||||
url?: string | undefined;
|
||||
accessToken?: string | undefined;
|
||||
refreshToken?: string | undefined;
|
||||
}
|
||||
|
||||
export interface TelegramCompleteRequest {
|
||||
sessionId: string;
|
||||
phone: string;
|
||||
}
|
||||
|
||||
export interface TelegramCompleteResponse {
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface TelegramConsumeRequest {
|
||||
sessionId: string;
|
||||
}
|
||||
|
||||
export interface TelegramConsumeResponse {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
}
|
||||
|
||||
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
||||
|
||||
export interface AuthServiceClient {
|
||||
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
||||
|
||||
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
||||
|
||||
refresh(request: RefreshRequest): Observable<RefreshResponse>;
|
||||
|
||||
telegramInit(request: Empty): Observable<TelegramInitResponse>;
|
||||
|
||||
telegramVerify(request: TelegramVerifyRequest): Observable<TelegramVerifyResponse>;
|
||||
|
||||
telegramComplete(request: TelegramCompleteRequest): Observable<TelegramCompleteResponse>;
|
||||
|
||||
telegramConsume(request: TelegramConsumeRequest): Observable<TelegramConsumeResponse>;
|
||||
}
|
||||
|
||||
export interface AuthServiceController {
|
||||
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
||||
|
||||
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
||||
|
||||
refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
|
||||
|
||||
telegramInit(request: Empty): Promise<TelegramInitResponse> | Observable<TelegramInitResponse> | TelegramInitResponse;
|
||||
|
||||
telegramVerify(
|
||||
request: TelegramVerifyRequest,
|
||||
): Promise<TelegramVerifyResponse> | Observable<TelegramVerifyResponse> | TelegramVerifyResponse;
|
||||
|
||||
telegramComplete(
|
||||
request: TelegramCompleteRequest,
|
||||
): Promise<TelegramCompleteResponse> | Observable<TelegramCompleteResponse> | TelegramCompleteResponse;
|
||||
|
||||
telegramConsume(
|
||||
request: TelegramConsumeRequest,
|
||||
): Promise<TelegramConsumeResponse> | Observable<TelegramConsumeResponse> | TelegramConsumeResponse;
|
||||
}
|
||||
|
||||
export function AuthServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = [
|
||||
"sendOtp",
|
||||
"verifyOtp",
|
||||
"refresh",
|
||||
"telegramInit",
|
||||
"telegramVerify",
|
||||
"telegramComplete",
|
||||
"telegramConsume",
|
||||
];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const AUTH_SERVICE_NAME = "AuthService";
|
||||
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";
|
||||
23
gen/ts/google/protobuf/empty.ts
Normal file
23
gen/ts/google/protobuf/empty.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// 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/empty.proto
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
/**
|
||||
* A generic empty message that you can re-use to avoid defining duplicated
|
||||
* empty messages in your APIs. A typical example is to use it as the request
|
||||
* or the response type of an API method. For instance:
|
||||
*
|
||||
* service Foo {
|
||||
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
* }
|
||||
*/
|
||||
export interface Empty {
|
||||
}
|
||||
|
||||
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
||||
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";
|
||||
76
gen/ts/media.ts
Normal file
76
gen/ts/media.ts
Normal file
@ -0,0 +1,76 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: media.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "media.v1";
|
||||
|
||||
export interface UploadRequest {
|
||||
fileName: string;
|
||||
folder: string;
|
||||
contentType: string;
|
||||
data: Uint8Array;
|
||||
resizeWidth?: number | undefined;
|
||||
resizeHeight?: number | undefined;
|
||||
}
|
||||
|
||||
export interface UploadResponse {
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface GetRequest {
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface GetResponse {
|
||||
data: Uint8Array;
|
||||
contentType: string;
|
||||
}
|
||||
|
||||
export interface DeleteRequest {
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface DeleteResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
||||
|
||||
export interface MediaServiceClient {
|
||||
upload(request: UploadRequest): Observable<UploadResponse>;
|
||||
|
||||
get(request: GetRequest): Observable<GetResponse>;
|
||||
|
||||
delete(request: DeleteRequest): Observable<DeleteResponse>;
|
||||
}
|
||||
|
||||
export interface MediaServiceController {
|
||||
upload(request: UploadRequest): Promise<UploadResponse> | Observable<UploadResponse> | UploadResponse;
|
||||
|
||||
get(request: GetRequest): Promise<GetResponse> | Observable<GetResponse> | GetResponse;
|
||||
|
||||
delete(request: DeleteRequest): Promise<DeleteResponse> | Observable<DeleteResponse> | DeleteResponse;
|
||||
}
|
||||
|
||||
export function MediaServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["upload", "get", "delete"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const MEDIA_SERVICE_NAME = "MediaService";
|
||||
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";
|
||||
82
gen/ts/users.ts
Normal file
82
gen/ts/users.ts
Normal file
@ -0,0 +1,82 @@
|
||||
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-ts_proto v2.11.0
|
||||
// protoc v6.33.4
|
||||
// source: users.proto
|
||||
|
||||
/* eslint-disable */
|
||||
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
export const protobufPackage = "users.v1";
|
||||
|
||||
export interface GetMeRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface GetMeResponse {
|
||||
user: User | undefined;
|
||||
}
|
||||
|
||||
export interface CreateUserRequest {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface CreateUserResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
name?: string | undefined;
|
||||
phone?: string | undefined;
|
||||
email?: string | undefined;
|
||||
avatar?: string | undefined;
|
||||
}
|
||||
|
||||
export interface PatchUserRequest {
|
||||
userId: string;
|
||||
name?: string | undefined;
|
||||
avatar?: string | undefined;
|
||||
}
|
||||
|
||||
export interface PatchUserResponse {
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
export const USERS_V1_PACKAGE_NAME = "users.v1";
|
||||
|
||||
export interface UsersServiceClient {
|
||||
getMe(request: GetMeRequest): Observable<GetMeResponse>;
|
||||
|
||||
createUser(request: CreateUserRequest): Observable<CreateUserResponse>;
|
||||
|
||||
patchUser(request: PatchUserRequest): Observable<PatchUserResponse>;
|
||||
}
|
||||
|
||||
export interface UsersServiceController {
|
||||
getMe(request: GetMeRequest): Promise<GetMeResponse> | Observable<GetMeResponse> | GetMeResponse;
|
||||
|
||||
createUser(
|
||||
request: CreateUserRequest,
|
||||
): Promise<CreateUserResponse> | Observable<CreateUserResponse> | CreateUserResponse;
|
||||
|
||||
patchUser(request: PatchUserRequest): Promise<PatchUserResponse> | Observable<PatchUserResponse> | PatchUserResponse;
|
||||
}
|
||||
|
||||
export function UsersServiceControllerMethods() {
|
||||
return function (constructor: Function) {
|
||||
const grpcMethods: string[] = ["getMe", "createUser", "patchUser"];
|
||||
for (const method of grpcMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
const grpcStreamMethods: string[] = [];
|
||||
for (const method of grpcStreamMethods) {
|
||||
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||
GrpcStreamMethod("UsersService", method)(constructor.prototype[method], method, descriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const USERS_SERVICE_NAME = "UsersService";
|
||||
3
go.mod
Normal file
3
go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module git.ksv741.keenetic.pro/teacinema/contracts
|
||||
|
||||
go 1.26.1
|
||||
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@teacinema/contracts",
|
||||
"version": "1.1.3",
|
||||
"version": "1.6.0",
|
||||
"description": "Protocol Buffers contracts for microservices",
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit",
|
||||
"generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen/ts --ts_proto_opt=nestJs=true,package=omit",
|
||||
"docs": "typedoc"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
|
||||
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;
|
||||
}
|
||||
43
proto/media.proto
Normal file
43
proto/media.proto
Normal file
@ -0,0 +1,43 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package media.v1;
|
||||
|
||||
option go_package = "git.ksv741.keenetic.pro/teacinema/contracts/media;media";
|
||||
option java_multiple_files = true;
|
||||
|
||||
|
||||
service MediaService {
|
||||
rpc Upload (UploadRequest) returns (UploadResponse);
|
||||
rpc Get (GetRequest) returns (GetResponse);
|
||||
rpc Delete (DeleteRequest) returns (DeleteResponse);
|
||||
}
|
||||
|
||||
message UploadRequest {
|
||||
string file_name = 1;
|
||||
string folder = 2;
|
||||
string content_type = 3;
|
||||
bytes data = 4;
|
||||
optional int32 resize_width = 5;
|
||||
optional int32 resize_height = 6;
|
||||
}
|
||||
|
||||
message UploadResponse {
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
message GetRequest {
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
message GetResponse {
|
||||
bytes data = 1;
|
||||
string content_type = 2;
|
||||
}
|
||||
|
||||
message DeleteRequest {
|
||||
string key = 1;
|
||||
}
|
||||
|
||||
message DeleteResponse {
|
||||
bool ok = 1;
|
||||
}
|
||||
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;
|
||||
|
||||
13
scripts/generate_go.sh
Normal file
13
scripts/generate_go.sh
Normal file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Generating Go protobuf (media).…."
|
||||
|
||||
protoc -I ./proto \
|
||||
--go_out=./gen/go \
|
||||
--go-grpc_out=./gen/go \
|
||||
--go_opt=module=git.ksv741.keenetic.pro/teacinema/contracts \
|
||||
--go-grpc_opt=module=git.ksv741.keenetic.pro/teacinema/contracts \
|
||||
./proto/media.proto
|
||||
|
||||
echo "Go generation complete."
|
||||
@ -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