diff --git a/gen/admin/audit.ts b/gen/admin/audit.ts new file mode 100644 index 0000000..57ddc57 --- /dev/null +++ b/gen/admin/audit.ts @@ -0,0 +1,76 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.6 +// protoc v4.25.9 +// source: admin/audit.proto + +/* eslint-disable */ +import type { Metadata } from "@grpc/grpc-js"; +import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices"; +import { Observable } from "rxjs"; + +export const protobufPackage = "audit.v1"; + +export interface GetAuditLogsRequest { + accountId?: string | undefined; + type?: string | undefined; + action?: + | string + | undefined; + /** ISO string */ + startDate?: + | string + | undefined; + /** ISO string */ + endDate?: string | undefined; + page: number; + limit: number; +} + +export interface AuditLogItem { + id: string; + accountId: string; + type: string; + action: string; + ipAddress: string; + userAgent: string; + detail: string; + createdAt: string; +} + +export interface GetAuditLogsResponse { + logs: AuditLogItem[]; + total: number; + page: number; + totalPages: number; +} + +export const AUDIT_V1_PACKAGE_NAME = "audit.v1"; + +export interface AuditServiceClient { + getAuditLogs(request: GetAuditLogsRequest, metadata?: Metadata): Observable; +} + +export interface AuditServiceController { + getAuditLogs( + request: GetAuditLogsRequest, + metadata?: Metadata, + ): Promise | Observable | GetAuditLogsResponse; +} + +export function AuditServiceControllerMethods() { + return function (constructor: Function) { + const grpcMethods: string[] = ["getAuditLogs"]; + for (const method of grpcMethods) { + const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); + GrpcMethod("AuditService", method)(constructor.prototype[method], method, descriptor); + } + const grpcStreamMethods: string[] = []; + for (const method of grpcStreamMethods) { + const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); + GrpcStreamMethod("AuditService", method)(constructor.prototype[method], method, descriptor); + } + }; +} + +export const AUDIT_SERVICE_NAME = "AuditService"; diff --git a/gen/go/admin/audit.pb.go b/gen/go/admin/audit.pb.go new file mode 100644 index 0000000..6a10676 --- /dev/null +++ b/gen/go/admin/audit.pb.go @@ -0,0 +1,378 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v4.25.9 +// source: admin/audit.proto + +package pb + +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 GetAuditLogsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AccountId *string `protobuf:"bytes,1,opt,name=account_id,json=accountId,proto3,oneof" json:"account_id,omitempty"` + Type *string `protobuf:"bytes,2,opt,name=type,proto3,oneof" json:"type,omitempty"` + Action *string `protobuf:"bytes,3,opt,name=action,proto3,oneof" json:"action,omitempty"` + StartDate *string `protobuf:"bytes,4,opt,name=start_date,json=startDate,proto3,oneof" json:"start_date,omitempty"` // ISO string + EndDate *string `protobuf:"bytes,5,opt,name=end_date,json=endDate,proto3,oneof" json:"end_date,omitempty"` // ISO string + Page int32 `protobuf:"varint,6,opt,name=page,proto3" json:"page,omitempty"` + Limit int32 `protobuf:"varint,7,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAuditLogsRequest) Reset() { + *x = GetAuditLogsRequest{} + mi := &file_admin_audit_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAuditLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAuditLogsRequest) ProtoMessage() {} + +func (x *GetAuditLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_admin_audit_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 GetAuditLogsRequest.ProtoReflect.Descriptor instead. +func (*GetAuditLogsRequest) Descriptor() ([]byte, []int) { + return file_admin_audit_proto_rawDescGZIP(), []int{0} +} + +func (x *GetAuditLogsRequest) GetAccountId() string { + if x != nil && x.AccountId != nil { + return *x.AccountId + } + return "" +} + +func (x *GetAuditLogsRequest) GetType() string { + if x != nil && x.Type != nil { + return *x.Type + } + return "" +} + +func (x *GetAuditLogsRequest) GetAction() string { + if x != nil && x.Action != nil { + return *x.Action + } + return "" +} + +func (x *GetAuditLogsRequest) GetStartDate() string { + if x != nil && x.StartDate != nil { + return *x.StartDate + } + return "" +} + +func (x *GetAuditLogsRequest) GetEndDate() string { + if x != nil && x.EndDate != nil { + return *x.EndDate + } + return "" +} + +func (x *GetAuditLogsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetAuditLogsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type AuditLogItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + AccountId string `protobuf:"bytes,2,opt,name=account_id,json=accountId,proto3" json:"account_id,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + Action string `protobuf:"bytes,4,opt,name=action,proto3" json:"action,omitempty"` + IpAddress string `protobuf:"bytes,5,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` + UserAgent string `protobuf:"bytes,6,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` + Detail string `protobuf:"bytes,7,opt,name=detail,proto3" json:"detail,omitempty"` + CreatedAt string `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuditLogItem) Reset() { + *x = AuditLogItem{} + mi := &file_admin_audit_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuditLogItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuditLogItem) ProtoMessage() {} + +func (x *AuditLogItem) ProtoReflect() protoreflect.Message { + mi := &file_admin_audit_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 AuditLogItem.ProtoReflect.Descriptor instead. +func (*AuditLogItem) Descriptor() ([]byte, []int) { + return file_admin_audit_proto_rawDescGZIP(), []int{1} +} + +func (x *AuditLogItem) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *AuditLogItem) GetAccountId() string { + if x != nil { + return x.AccountId + } + return "" +} + +func (x *AuditLogItem) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *AuditLogItem) GetAction() string { + if x != nil { + return x.Action + } + return "" +} + +func (x *AuditLogItem) GetIpAddress() string { + if x != nil { + return x.IpAddress + } + return "" +} + +func (x *AuditLogItem) GetUserAgent() string { + if x != nil { + return x.UserAgent + } + return "" +} + +func (x *AuditLogItem) GetDetail() string { + if x != nil { + return x.Detail + } + return "" +} + +func (x *AuditLogItem) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +type GetAuditLogsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Logs []*AuditLogItem `protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"` + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + TotalPages int32 `protobuf:"varint,4,opt,name=total_pages,json=totalPages,proto3" json:"total_pages,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAuditLogsResponse) Reset() { + *x = GetAuditLogsResponse{} + mi := &file_admin_audit_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAuditLogsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAuditLogsResponse) ProtoMessage() {} + +func (x *GetAuditLogsResponse) ProtoReflect() protoreflect.Message { + mi := &file_admin_audit_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 GetAuditLogsResponse.ProtoReflect.Descriptor instead. +func (*GetAuditLogsResponse) Descriptor() ([]byte, []int) { + return file_admin_audit_proto_rawDescGZIP(), []int{2} +} + +func (x *GetAuditLogsResponse) GetLogs() []*AuditLogItem { + if x != nil { + return x.Logs + } + return nil +} + +func (x *GetAuditLogsResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *GetAuditLogsResponse) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetAuditLogsResponse) GetTotalPages() int32 { + if x != nil { + return x.TotalPages + } + return 0 +} + +var File_admin_audit_proto protoreflect.FileDescriptor + +const file_admin_audit_proto_rawDesc = "" + + "\n" + + "\x11admin/audit.proto\x12\baudit.v1\"\x9c\x02\n" + + "\x13GetAuditLogsRequest\x12\"\n" + + "\n" + + "account_id\x18\x01 \x01(\tH\x00R\taccountId\x88\x01\x01\x12\x17\n" + + "\x04type\x18\x02 \x01(\tH\x01R\x04type\x88\x01\x01\x12\x1b\n" + + "\x06action\x18\x03 \x01(\tH\x02R\x06action\x88\x01\x01\x12\"\n" + + "\n" + + "start_date\x18\x04 \x01(\tH\x03R\tstartDate\x88\x01\x01\x12\x1e\n" + + "\bend_date\x18\x05 \x01(\tH\x04R\aendDate\x88\x01\x01\x12\x12\n" + + "\x04page\x18\x06 \x01(\x05R\x04page\x12\x14\n" + + "\x05limit\x18\a \x01(\x05R\x05limitB\r\n" + + "\v_account_idB\a\n" + + "\x05_typeB\t\n" + + "\a_actionB\r\n" + + "\v_start_dateB\v\n" + + "\t_end_date\"\xde\x01\n" + + "\fAuditLogItem\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + + "\n" + + "account_id\x18\x02 \x01(\tR\taccountId\x12\x12\n" + + "\x04type\x18\x03 \x01(\tR\x04type\x12\x16\n" + + "\x06action\x18\x04 \x01(\tR\x06action\x12\x1d\n" + + "\n" + + "ip_address\x18\x05 \x01(\tR\tipAddress\x12\x1d\n" + + "\n" + + "user_agent\x18\x06 \x01(\tR\tuserAgent\x12\x16\n" + + "\x06detail\x18\a \x01(\tR\x06detail\x12\x1d\n" + + "\n" + + "created_at\x18\b \x01(\tR\tcreatedAt\"\x8d\x01\n" + + "\x14GetAuditLogsResponse\x12*\n" + + "\x04logs\x18\x01 \x03(\v2\x16.audit.v1.AuditLogItemR\x04logs\x12\x14\n" + + "\x05total\x18\x02 \x01(\x05R\x05total\x12\x12\n" + + "\x04page\x18\x03 \x01(\x05R\x04page\x12\x1f\n" + + "\vtotal_pages\x18\x04 \x01(\x05R\n" + + "totalPages2]\n" + + "\fAuditService\x12M\n" + + "\fGetAuditLogs\x12\x1d.audit.v1.GetAuditLogsRequest\x1a\x1e.audit.v1.GetAuditLogsResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" + +var ( + file_admin_audit_proto_rawDescOnce sync.Once + file_admin_audit_proto_rawDescData []byte +) + +func file_admin_audit_proto_rawDescGZIP() []byte { + file_admin_audit_proto_rawDescOnce.Do(func() { + file_admin_audit_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_admin_audit_proto_rawDesc), len(file_admin_audit_proto_rawDesc))) + }) + return file_admin_audit_proto_rawDescData +} + +var file_admin_audit_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_admin_audit_proto_goTypes = []any{ + (*GetAuditLogsRequest)(nil), // 0: audit.v1.GetAuditLogsRequest + (*AuditLogItem)(nil), // 1: audit.v1.AuditLogItem + (*GetAuditLogsResponse)(nil), // 2: audit.v1.GetAuditLogsResponse +} +var file_admin_audit_proto_depIdxs = []int32{ + 1, // 0: audit.v1.GetAuditLogsResponse.logs:type_name -> audit.v1.AuditLogItem + 0, // 1: audit.v1.AuditService.GetAuditLogs:input_type -> audit.v1.GetAuditLogsRequest + 2, // 2: audit.v1.AuditService.GetAuditLogs:output_type -> audit.v1.GetAuditLogsResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_admin_audit_proto_init() } +func file_admin_audit_proto_init() { + if File_admin_audit_proto != nil { + return + } + file_admin_audit_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_admin_audit_proto_rawDesc), len(file_admin_audit_proto_rawDesc)), + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_admin_audit_proto_goTypes, + DependencyIndexes: file_admin_audit_proto_depIdxs, + MessageInfos: file_admin_audit_proto_msgTypes, + }.Build() + File_admin_audit_proto = out.File + file_admin_audit_proto_goTypes = nil + file_admin_audit_proto_depIdxs = nil +} diff --git a/gen/go/admin/audit_grpc.pb.go b/gen/go/admin/audit_grpc.pb.go new file mode 100644 index 0000000..be90aa6 --- /dev/null +++ b/gen/go/admin/audit_grpc.pb.go @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v4.25.9 +// source: admin/audit.proto + +package pb + +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 ( + AuditService_GetAuditLogs_FullMethodName = "/audit.v1.AuditService/GetAuditLogs" +) + +// AuditServiceClient is the client API for AuditService 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 AuditServiceClient interface { + GetAuditLogs(ctx context.Context, in *GetAuditLogsRequest, opts ...grpc.CallOption) (*GetAuditLogsResponse, error) +} + +type auditServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewAuditServiceClient(cc grpc.ClientConnInterface) AuditServiceClient { + return &auditServiceClient{cc} +} + +func (c *auditServiceClient) GetAuditLogs(ctx context.Context, in *GetAuditLogsRequest, opts ...grpc.CallOption) (*GetAuditLogsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetAuditLogsResponse) + err := c.cc.Invoke(ctx, AuditService_GetAuditLogs_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AuditServiceServer is the server API for AuditService service. +// All implementations must embed UnimplementedAuditServiceServer +// for forward compatibility. +type AuditServiceServer interface { + GetAuditLogs(context.Context, *GetAuditLogsRequest) (*GetAuditLogsResponse, error) + mustEmbedUnimplementedAuditServiceServer() +} + +// UnimplementedAuditServiceServer 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 UnimplementedAuditServiceServer struct{} + +func (UnimplementedAuditServiceServer) GetAuditLogs(context.Context, *GetAuditLogsRequest) (*GetAuditLogsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetAuditLogs not implemented") +} +func (UnimplementedAuditServiceServer) mustEmbedUnimplementedAuditServiceServer() {} +func (UnimplementedAuditServiceServer) testEmbeddedByValue() {} + +// UnsafeAuditServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AuditServiceServer will +// result in compilation errors. +type UnsafeAuditServiceServer interface { + mustEmbedUnimplementedAuditServiceServer() +} + +func RegisterAuditServiceServer(s grpc.ServiceRegistrar, srv AuditServiceServer) { + // If the following call panics, it indicates UnimplementedAuditServiceServer 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(&AuditService_ServiceDesc, srv) +} + +func _AuditService_GetAuditLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAuditLogsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AuditServiceServer).GetAuditLogs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: AuditService_GetAuditLogs_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AuditServiceServer).GetAuditLogs(ctx, req.(*GetAuditLogsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// AuditService_ServiceDesc is the grpc.ServiceDesc for AuditService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var AuditService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "audit.v1.AuditService", + HandlerType: (*AuditServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAuditLogs", + Handler: _AuditService_GetAuditLogs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "admin/audit.proto", +}