From a55fc96a6dce32f51fa77269eb1a4a06569cd30b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Apr 2026 06:49:25 +0000 Subject: [PATCH] chore: auto-generate protobuf files [skip ci] --- gen/go/notifications/notifications.pb.go | 787 ++++++++++++++++++ gen/go/notifications/notifications_grpc.pb.go | 293 +++++++ gen/google/protobuf/struct.ts | 197 +++++ gen/google/protobuf/timestamp.ts | 118 +++ gen/notifications/notifications.ts | 190 +++++ 5 files changed, 1585 insertions(+) create mode 100644 gen/go/notifications/notifications.pb.go create mode 100644 gen/go/notifications/notifications_grpc.pb.go create mode 100644 gen/google/protobuf/struct.ts create mode 100644 gen/google/protobuf/timestamp.ts create mode 100644 gen/notifications/notifications.ts diff --git a/gen/go/notifications/notifications.pb.go b/gen/go/notifications/notifications.pb.go new file mode 100644 index 0000000..e13de40 --- /dev/null +++ b/gen/go/notifications/notifications.pb.go @@ -0,0 +1,787 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v4.25.9 +// source: notifications/notifications.proto + +// Указываем пакет для логической изоляции + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + 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 Notification struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` // Например: "SYSTEM_ALERT", "NEW_MESSAGE", "TASK_ASSIGNED" + Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"` // Заголовок (опционально) + Text string `protobuf:"bytes,5,opt,name=text,proto3" json:"text,omitempty"` // Текст уведомления + Payload *structpb.Struct `protobuf:"bytes,6,opt,name=payload,proto3" json:"payload,omitempty"` // Любая динамическая JSON-нагрузка (например, { "task_id": 123 }) + IsRead bool `protobuf:"varint,7,opt,name=is_read,json=isRead,proto3" json:"is_read,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Notification) Reset() { + *x = Notification{} + mi := &file_notifications_notifications_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Notification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Notification) ProtoMessage() {} + +func (x *Notification) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_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 Notification.ProtoReflect.Descriptor instead. +func (*Notification) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{0} +} + +func (x *Notification) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Notification) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *Notification) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Notification) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Notification) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Notification) GetPayload() *structpb.Struct { + if x != nil { + return x.Payload + } + return nil +} + +func (x *Notification) GetIsRead() bool { + if x != nil { + return x.IsRead + } + return false +} + +func (x *Notification) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type GetNotificationsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // ID пользователя запрашивающего данные (Gateway берет это из JWT) + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` // Для пагинации (например, 20) + Offset int32 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` // Для пагинации (например, 0) + UnreadOnly *bool `protobuf:"varint,4,opt,name=unread_only,json=unreadOnly,proto3,oneof" json:"unread_only,omitempty"` // Фильтр: получить только непрочитанные + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetNotificationsRequest) Reset() { + *x = GetNotificationsRequest{} + mi := &file_notifications_notifications_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetNotificationsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationsRequest) ProtoMessage() {} + +func (x *GetNotificationsRequest) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_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 GetNotificationsRequest.ProtoReflect.Descriptor instead. +func (*GetNotificationsRequest) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{1} +} + +func (x *GetNotificationsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetNotificationsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *GetNotificationsRequest) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *GetNotificationsRequest) GetUnreadOnly() bool { + if x != nil && x.UnreadOnly != nil { + return *x.UnreadOnly + } + return false +} + +type GetNotificationsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Notifications []*Notification `protobuf:"bytes,1,rep,name=notifications,proto3" json:"notifications,omitempty"` // Массив уведомлений + TotalCount int32 `protobuf:"varint,2,opt,name=total_count,json=totalCount,proto3" json:"total_count,omitempty"` // Общее количество (для UI пагинации) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetNotificationsResponse) Reset() { + *x = GetNotificationsResponse{} + mi := &file_notifications_notifications_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetNotificationsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNotificationsResponse) ProtoMessage() {} + +func (x *GetNotificationsResponse) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_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 GetNotificationsResponse.ProtoReflect.Descriptor instead. +func (*GetNotificationsResponse) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{2} +} + +func (x *GetNotificationsResponse) GetNotifications() []*Notification { + if x != nil { + return x.Notifications + } + return nil +} + +func (x *GetNotificationsResponse) GetTotalCount() int32 { + if x != nil { + return x.TotalCount + } + return 0 +} + +type GetUnreadCountRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUnreadCountRequest) Reset() { + *x = GetUnreadCountRequest{} + mi := &file_notifications_notifications_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUnreadCountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUnreadCountRequest) ProtoMessage() {} + +func (x *GetUnreadCountRequest) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_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 GetUnreadCountRequest.ProtoReflect.Descriptor instead. +func (*GetUnreadCountRequest) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{3} +} + +func (x *GetUnreadCountRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type GetUnreadCountResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Count int32 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUnreadCountResponse) Reset() { + *x = GetUnreadCountResponse{} + mi := &file_notifications_notifications_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUnreadCountResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUnreadCountResponse) ProtoMessage() {} + +func (x *GetUnreadCountResponse) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_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 GetUnreadCountResponse.ProtoReflect.Descriptor instead. +func (*GetUnreadCountResponse) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{4} +} + +func (x *GetUnreadCountResponse) GetCount() int32 { + if x != nil { + return x.Count + } + return 0 +} + +type MarkAsReadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + NotificationId string `protobuf:"bytes,2,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkAsReadRequest) Reset() { + *x = MarkAsReadRequest{} + mi := &file_notifications_notifications_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkAsReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkAsReadRequest) ProtoMessage() {} + +func (x *MarkAsReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_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 MarkAsReadRequest.ProtoReflect.Descriptor instead. +func (*MarkAsReadRequest) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{5} +} + +func (x *MarkAsReadRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *MarkAsReadRequest) GetNotificationId() string { + if x != nil { + return x.NotificationId + } + return "" +} + +type MarkAsReadResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkAsReadResponse) Reset() { + *x = MarkAsReadResponse{} + mi := &file_notifications_notifications_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkAsReadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkAsReadResponse) ProtoMessage() {} + +func (x *MarkAsReadResponse) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_proto_msgTypes[6] + 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 MarkAsReadResponse.ProtoReflect.Descriptor instead. +func (*MarkAsReadResponse) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{6} +} + +func (x *MarkAsReadResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +type MarkAllAsReadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkAllAsReadRequest) Reset() { + *x = MarkAllAsReadRequest{} + mi := &file_notifications_notifications_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkAllAsReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkAllAsReadRequest) ProtoMessage() {} + +func (x *MarkAllAsReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_proto_msgTypes[7] + 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 MarkAllAsReadRequest.ProtoReflect.Descriptor instead. +func (*MarkAllAsReadRequest) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{7} +} + +func (x *MarkAllAsReadRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +type MarkAllAsReadResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + UpdatedCount int32 `protobuf:"varint,2,opt,name=updated_count,json=updatedCount,proto3" json:"updated_count,omitempty"` // Сколько уведомлений было обновлено + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkAllAsReadResponse) Reset() { + *x = MarkAllAsReadResponse{} + mi := &file_notifications_notifications_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkAllAsReadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkAllAsReadResponse) ProtoMessage() {} + +func (x *MarkAllAsReadResponse) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_proto_msgTypes[8] + 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 MarkAllAsReadResponse.ProtoReflect.Descriptor instead. +func (*MarkAllAsReadResponse) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{8} +} + +func (x *MarkAllAsReadResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *MarkAllAsReadResponse) GetUpdatedCount() int32 { + if x != nil { + return x.UpdatedCount + } + return 0 +} + +type SendNotificationRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Кому отправляем (если пусто — можно сделать бродкаст, но лучше отдельный метод) + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"` + Payload *structpb.Struct `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"` // Метаданные для UI (ссылки, ID сущностей) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendNotificationRequest) Reset() { + *x = SendNotificationRequest{} + mi := &file_notifications_notifications_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendNotificationRequest) ProtoMessage() {} + +func (x *SendNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_proto_msgTypes[9] + 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 SendNotificationRequest.ProtoReflect.Descriptor instead. +func (*SendNotificationRequest) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{9} +} + +func (x *SendNotificationRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *SendNotificationRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *SendNotificationRequest) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *SendNotificationRequest) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *SendNotificationRequest) GetPayload() *structpb.Struct { + if x != nil { + return x.Payload + } + return nil +} + +type SendNotificationResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + NotificationId string `protobuf:"bytes,2,opt,name=notification_id,json=notificationId,proto3" json:"notification_id,omitempty"` // ID созданного уведомления в Postgres + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendNotificationResponse) Reset() { + *x = SendNotificationResponse{} + mi := &file_notifications_notifications_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendNotificationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendNotificationResponse) ProtoMessage() {} + +func (x *SendNotificationResponse) ProtoReflect() protoreflect.Message { + mi := &file_notifications_notifications_proto_msgTypes[10] + 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 SendNotificationResponse.ProtoReflect.Descriptor instead. +func (*SendNotificationResponse) Descriptor() ([]byte, []int) { + return file_notifications_notifications_proto_rawDescGZIP(), []int{10} +} + +func (x *SendNotificationResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SendNotificationResponse) GetNotificationId() string { + if x != nil { + return x.NotificationId + } + return "" +} + +var File_notifications_notifications_proto protoreflect.FileDescriptor + +const file_notifications_notifications_proto_rawDesc = "" + + "\n" + + "!notifications/notifications.proto\x12\x10notifications.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xfc\x01\n" + + "\fNotification\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\auser_id\x18\x02 \x01(\tR\x06userId\x12\x12\n" + + "\x04type\x18\x03 \x01(\tR\x04type\x12\x14\n" + + "\x05title\x18\x04 \x01(\tR\x05title\x12\x12\n" + + "\x04text\x18\x05 \x01(\tR\x04text\x121\n" + + "\apayload\x18\x06 \x01(\v2\x17.google.protobuf.StructR\apayload\x12\x17\n" + + "\ais_read\x18\a \x01(\bR\x06isRead\x129\n" + + "\n" + + "created_at\x18\b \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\"\x96\x01\n" + + "\x17GetNotificationsRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x14\n" + + "\x05limit\x18\x02 \x01(\x05R\x05limit\x12\x16\n" + + "\x06offset\x18\x03 \x01(\x05R\x06offset\x12$\n" + + "\vunread_only\x18\x04 \x01(\bH\x00R\n" + + "unreadOnly\x88\x01\x01B\x0e\n" + + "\f_unread_only\"\x81\x01\n" + + "\x18GetNotificationsResponse\x12D\n" + + "\rnotifications\x18\x01 \x03(\v2\x1e.notifications.v1.NotificationR\rnotifications\x12\x1f\n" + + "\vtotal_count\x18\x02 \x01(\x05R\n" + + "totalCount\"0\n" + + "\x15GetUnreadCountRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\".\n" + + "\x16GetUnreadCountResponse\x12\x14\n" + + "\x05count\x18\x01 \x01(\x05R\x05count\"U\n" + + "\x11MarkAsReadRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12'\n" + + "\x0fnotification_id\x18\x02 \x01(\tR\x0enotificationId\".\n" + + "\x12MarkAsReadResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\"/\n" + + "\x14MarkAllAsReadRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\"V\n" + + "\x15MarkAllAsReadResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12#\n" + + "\rupdated_count\x18\x02 \x01(\x05R\fupdatedCount\"\xa3\x01\n" + + "\x17SendNotificationRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x14\n" + + "\x05title\x18\x03 \x01(\tR\x05title\x12\x12\n" + + "\x04text\x18\x04 \x01(\tR\x04text\x121\n" + + "\apayload\x18\x05 \x01(\v2\x17.google.protobuf.StructR\apayload\"]\n" + + "\x18SendNotificationResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12'\n" + + "\x0fnotification_id\x18\x02 \x01(\tR\x0enotificationId2\x8f\x04\n" + + "\x13NotificationService\x12m\n" + + "\x14GetUserNotifications\x12).notifications.v1.GetNotificationsRequest\x1a*.notifications.v1.GetNotificationsResponse\x12c\n" + + "\x0eGetUnreadCount\x12'.notifications.v1.GetUnreadCountRequest\x1a(.notifications.v1.GetUnreadCountResponse\x12W\n" + + "\n" + + "MarkAsRead\x12#.notifications.v1.MarkAsReadRequest\x1a$.notifications.v1.MarkAsReadResponse\x12`\n" + + "\rMarkAllAsRead\x12&.notifications.v1.MarkAllAsReadRequest\x1a'.notifications.v1.MarkAllAsReadResponse\x12i\n" + + "\x10SendNotification\x12).notifications.v1.SendNotificationRequest\x1a*.notifications.v1.SendNotificationResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" + +var ( + file_notifications_notifications_proto_rawDescOnce sync.Once + file_notifications_notifications_proto_rawDescData []byte +) + +func file_notifications_notifications_proto_rawDescGZIP() []byte { + file_notifications_notifications_proto_rawDescOnce.Do(func() { + file_notifications_notifications_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_notifications_notifications_proto_rawDesc), len(file_notifications_notifications_proto_rawDesc))) + }) + return file_notifications_notifications_proto_rawDescData +} + +var file_notifications_notifications_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_notifications_notifications_proto_goTypes = []any{ + (*Notification)(nil), // 0: notifications.v1.Notification + (*GetNotificationsRequest)(nil), // 1: notifications.v1.GetNotificationsRequest + (*GetNotificationsResponse)(nil), // 2: notifications.v1.GetNotificationsResponse + (*GetUnreadCountRequest)(nil), // 3: notifications.v1.GetUnreadCountRequest + (*GetUnreadCountResponse)(nil), // 4: notifications.v1.GetUnreadCountResponse + (*MarkAsReadRequest)(nil), // 5: notifications.v1.MarkAsReadRequest + (*MarkAsReadResponse)(nil), // 6: notifications.v1.MarkAsReadResponse + (*MarkAllAsReadRequest)(nil), // 7: notifications.v1.MarkAllAsReadRequest + (*MarkAllAsReadResponse)(nil), // 8: notifications.v1.MarkAllAsReadResponse + (*SendNotificationRequest)(nil), // 9: notifications.v1.SendNotificationRequest + (*SendNotificationResponse)(nil), // 10: notifications.v1.SendNotificationResponse + (*structpb.Struct)(nil), // 11: google.protobuf.Struct + (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp +} +var file_notifications_notifications_proto_depIdxs = []int32{ + 11, // 0: notifications.v1.Notification.payload:type_name -> google.protobuf.Struct + 12, // 1: notifications.v1.Notification.created_at:type_name -> google.protobuf.Timestamp + 0, // 2: notifications.v1.GetNotificationsResponse.notifications:type_name -> notifications.v1.Notification + 11, // 3: notifications.v1.SendNotificationRequest.payload:type_name -> google.protobuf.Struct + 1, // 4: notifications.v1.NotificationService.GetUserNotifications:input_type -> notifications.v1.GetNotificationsRequest + 3, // 5: notifications.v1.NotificationService.GetUnreadCount:input_type -> notifications.v1.GetUnreadCountRequest + 5, // 6: notifications.v1.NotificationService.MarkAsRead:input_type -> notifications.v1.MarkAsReadRequest + 7, // 7: notifications.v1.NotificationService.MarkAllAsRead:input_type -> notifications.v1.MarkAllAsReadRequest + 9, // 8: notifications.v1.NotificationService.SendNotification:input_type -> notifications.v1.SendNotificationRequest + 2, // 9: notifications.v1.NotificationService.GetUserNotifications:output_type -> notifications.v1.GetNotificationsResponse + 4, // 10: notifications.v1.NotificationService.GetUnreadCount:output_type -> notifications.v1.GetUnreadCountResponse + 6, // 11: notifications.v1.NotificationService.MarkAsRead:output_type -> notifications.v1.MarkAsReadResponse + 8, // 12: notifications.v1.NotificationService.MarkAllAsRead:output_type -> notifications.v1.MarkAllAsReadResponse + 10, // 13: notifications.v1.NotificationService.SendNotification:output_type -> notifications.v1.SendNotificationResponse + 9, // [9:14] is the sub-list for method output_type + 4, // [4:9] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_notifications_notifications_proto_init() } +func file_notifications_notifications_proto_init() { + if File_notifications_notifications_proto != nil { + return + } + file_notifications_notifications_proto_msgTypes[1].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_notifications_notifications_proto_rawDesc), len(file_notifications_notifications_proto_rawDesc)), + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_notifications_notifications_proto_goTypes, + DependencyIndexes: file_notifications_notifications_proto_depIdxs, + MessageInfos: file_notifications_notifications_proto_msgTypes, + }.Build() + File_notifications_notifications_proto = out.File + file_notifications_notifications_proto_goTypes = nil + file_notifications_notifications_proto_depIdxs = nil +} diff --git a/gen/go/notifications/notifications_grpc.pb.go b/gen/go/notifications/notifications_grpc.pb.go new file mode 100644 index 0000000..ed6f357 --- /dev/null +++ b/gen/go/notifications/notifications_grpc.pb.go @@ -0,0 +1,293 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v4.25.9 +// source: notifications/notifications.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 ( + NotificationService_GetUserNotifications_FullMethodName = "/notifications.v1.NotificationService/GetUserNotifications" + NotificationService_GetUnreadCount_FullMethodName = "/notifications.v1.NotificationService/GetUnreadCount" + NotificationService_MarkAsRead_FullMethodName = "/notifications.v1.NotificationService/MarkAsRead" + NotificationService_MarkAllAsRead_FullMethodName = "/notifications.v1.NotificationService/MarkAllAsRead" + NotificationService_SendNotification_FullMethodName = "/notifications.v1.NotificationService/SendNotification" +) + +// NotificationServiceClient is the client API for NotificationService 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 NotificationServiceClient interface { + // Получить список уведомлений пользователя с пагинацией + GetUserNotifications(ctx context.Context, in *GetNotificationsRequest, opts ...grpc.CallOption) (*GetNotificationsResponse, error) + // Получить количество непрочитанных уведомлений (для бейджика на иконке) + GetUnreadCount(ctx context.Context, in *GetUnreadCountRequest, opts ...grpc.CallOption) (*GetUnreadCountResponse, error) + // Отметить конкретное уведомление как прочитанное + MarkAsRead(ctx context.Context, in *MarkAsReadRequest, opts ...grpc.CallOption) (*MarkAsReadResponse, error) + // Отметить все уведомления пользователя как прочитанные + MarkAllAsRead(ctx context.Context, in *MarkAllAsReadRequest, opts ...grpc.CallOption) (*MarkAllAsReadResponse, error) + // Отправить уведомление (CRM/ERP вызывает этот метод, а NestJS уже кидает в RabbitMQ) + SendNotification(ctx context.Context, in *SendNotificationRequest, opts ...grpc.CallOption) (*SendNotificationResponse, error) +} + +type notificationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNotificationServiceClient(cc grpc.ClientConnInterface) NotificationServiceClient { + return ¬ificationServiceClient{cc} +} + +func (c *notificationServiceClient) GetUserNotifications(ctx context.Context, in *GetNotificationsRequest, opts ...grpc.CallOption) (*GetNotificationsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetNotificationsResponse) + err := c.cc.Invoke(ctx, NotificationService_GetUserNotifications_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *notificationServiceClient) GetUnreadCount(ctx context.Context, in *GetUnreadCountRequest, opts ...grpc.CallOption) (*GetUnreadCountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUnreadCountResponse) + err := c.cc.Invoke(ctx, NotificationService_GetUnreadCount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *notificationServiceClient) MarkAsRead(ctx context.Context, in *MarkAsReadRequest, opts ...grpc.CallOption) (*MarkAsReadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MarkAsReadResponse) + err := c.cc.Invoke(ctx, NotificationService_MarkAsRead_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *notificationServiceClient) MarkAllAsRead(ctx context.Context, in *MarkAllAsReadRequest, opts ...grpc.CallOption) (*MarkAllAsReadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MarkAllAsReadResponse) + err := c.cc.Invoke(ctx, NotificationService_MarkAllAsRead_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *notificationServiceClient) SendNotification(ctx context.Context, in *SendNotificationRequest, opts ...grpc.CallOption) (*SendNotificationResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SendNotificationResponse) + err := c.cc.Invoke(ctx, NotificationService_SendNotification_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NotificationServiceServer is the server API for NotificationService service. +// All implementations must embed UnimplementedNotificationServiceServer +// for forward compatibility. +// +// ----------------------------------------------------------------------------- +// Сервис Уведомлений +// ----------------------------------------------------------------------------- +type NotificationServiceServer interface { + // Получить список уведомлений пользователя с пагинацией + GetUserNotifications(context.Context, *GetNotificationsRequest) (*GetNotificationsResponse, error) + // Получить количество непрочитанных уведомлений (для бейджика на иконке) + GetUnreadCount(context.Context, *GetUnreadCountRequest) (*GetUnreadCountResponse, error) + // Отметить конкретное уведомление как прочитанное + MarkAsRead(context.Context, *MarkAsReadRequest) (*MarkAsReadResponse, error) + // Отметить все уведомления пользователя как прочитанные + MarkAllAsRead(context.Context, *MarkAllAsReadRequest) (*MarkAllAsReadResponse, error) + // Отправить уведомление (CRM/ERP вызывает этот метод, а NestJS уже кидает в RabbitMQ) + SendNotification(context.Context, *SendNotificationRequest) (*SendNotificationResponse, error) + mustEmbedUnimplementedNotificationServiceServer() +} + +// UnimplementedNotificationServiceServer 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 UnimplementedNotificationServiceServer struct{} + +func (UnimplementedNotificationServiceServer) GetUserNotifications(context.Context, *GetNotificationsRequest) (*GetNotificationsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserNotifications not implemented") +} +func (UnimplementedNotificationServiceServer) GetUnreadCount(context.Context, *GetUnreadCountRequest) (*GetUnreadCountResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUnreadCount not implemented") +} +func (UnimplementedNotificationServiceServer) MarkAsRead(context.Context, *MarkAsReadRequest) (*MarkAsReadResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MarkAsRead not implemented") +} +func (UnimplementedNotificationServiceServer) MarkAllAsRead(context.Context, *MarkAllAsReadRequest) (*MarkAllAsReadResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MarkAllAsRead not implemented") +} +func (UnimplementedNotificationServiceServer) SendNotification(context.Context, *SendNotificationRequest) (*SendNotificationResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SendNotification not implemented") +} +func (UnimplementedNotificationServiceServer) mustEmbedUnimplementedNotificationServiceServer() {} +func (UnimplementedNotificationServiceServer) testEmbeddedByValue() {} + +// UnsafeNotificationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to NotificationServiceServer will +// result in compilation errors. +type UnsafeNotificationServiceServer interface { + mustEmbedUnimplementedNotificationServiceServer() +} + +func RegisterNotificationServiceServer(s grpc.ServiceRegistrar, srv NotificationServiceServer) { + // If the following call panics, it indicates UnimplementedNotificationServiceServer 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(&NotificationService_ServiceDesc, srv) +} + +func _NotificationService_GetUserNotifications_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNotificationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NotificationServiceServer).GetUserNotifications(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NotificationService_GetUserNotifications_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NotificationServiceServer).GetUserNotifications(ctx, req.(*GetNotificationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NotificationService_GetUnreadCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUnreadCountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NotificationServiceServer).GetUnreadCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NotificationService_GetUnreadCount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NotificationServiceServer).GetUnreadCount(ctx, req.(*GetUnreadCountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NotificationService_MarkAsRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MarkAsReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NotificationServiceServer).MarkAsRead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NotificationService_MarkAsRead_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NotificationServiceServer).MarkAsRead(ctx, req.(*MarkAsReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NotificationService_MarkAllAsRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MarkAllAsReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NotificationServiceServer).MarkAllAsRead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NotificationService_MarkAllAsRead_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NotificationServiceServer).MarkAllAsRead(ctx, req.(*MarkAllAsReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NotificationService_SendNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NotificationServiceServer).SendNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NotificationService_SendNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NotificationServiceServer).SendNotification(ctx, req.(*SendNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// NotificationService_ServiceDesc is the grpc.ServiceDesc for NotificationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var NotificationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "notifications.v1.NotificationService", + HandlerType: (*NotificationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetUserNotifications", + Handler: _NotificationService_GetUserNotifications_Handler, + }, + { + MethodName: "GetUnreadCount", + Handler: _NotificationService_GetUnreadCount_Handler, + }, + { + MethodName: "MarkAsRead", + Handler: _NotificationService_MarkAsRead_Handler, + }, + { + MethodName: "MarkAllAsRead", + Handler: _NotificationService_MarkAllAsRead_Handler, + }, + { + MethodName: "SendNotification", + Handler: _NotificationService_SendNotification_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "notifications/notifications.proto", +} diff --git a/gen/google/protobuf/struct.ts b/gen/google/protobuf/struct.ts new file mode 100644 index 0000000..7708bb2 --- /dev/null +++ b/gen/google/protobuf/struct.ts @@ -0,0 +1,197 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.6 +// protoc v4.25.9 +// source: google/protobuf/struct.proto + +/* eslint-disable */ +import { wrappers } from "protobufjs"; + +export const protobufPackage = "google.protobuf"; + +/** + * `NullValue` is a singleton enumeration to represent the null value for the + * `Value` type union. + * + * The JSON representation for `NullValue` is JSON `null`. + */ +export enum NullValue { + /** NULL_VALUE - Null value. */ + NULL_VALUE = 0, + UNRECOGNIZED = -1, +} + +/** + * `Struct` represents a structured data value, consisting of fields + * which map to dynamically typed values. In some languages, `Struct` + * might be supported by a native representation. For example, in + * scripting languages like JS a struct is represented as an + * object. The details of that representation are described together + * with the proto support for the language. + * + * The JSON representation for `Struct` is JSON object. + */ +export interface Struct { + /** Unordered map of dynamically typed values. */ + fields: { [key: string]: any | undefined }; +} + +export interface Struct_FieldsEntry { + key: string; + value: any | undefined; +} + +/** + * `Value` represents a dynamically typed value which can be either + * null, a number, a string, a boolean, a recursive struct value, or a + * list of values. A producer of value is expected to set one of these + * variants. Absence of any variant indicates an error. + * + * The JSON representation for `Value` is JSON value. + */ +export interface Value { + /** Represents a null value. */ + nullValue?: + | NullValue + | undefined; + /** Represents a double value. */ + numberValue?: + | number + | undefined; + /** Represents a string value. */ + stringValue?: + | string + | undefined; + /** Represents a boolean value. */ + boolValue?: + | boolean + | undefined; + /** Represents a structured value. */ + structValue?: + | { [key: string]: any } + | undefined; + /** Represents a repeated `Value`. */ + listValue?: Array | undefined; +} + +/** + * `ListValue` is a wrapper around a repeated field of values. + * + * The JSON representation for `ListValue` is JSON array. + */ +export interface ListValue { + /** Repeated field of dynamically typed values. */ + values: any[]; +} + +export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf"; + +function createBaseStruct(): Struct { + return { fields: {} }; +} + +export const Struct: MessageFns & StructWrapperFns = { + wrap(object: { [key: string]: any } | undefined): Struct { + const struct = createBaseStruct(); + + if (object !== undefined) { + for (const key of globalThis.Object.keys(object)) { + struct.fields[key] = Value.wrap(object[key]); + } + } + return struct; + }, + + unwrap(message: Struct): { [key: string]: any } { + const object: { [key: string]: any } = {}; + if (message.fields) { + for (const key of globalThis.Object.keys(message.fields)) { + object[key] = Value.unwrap(message.fields[key]); + } + } + return object; + }, +}; + +function createBaseValue(): Value { + return {}; +} + +export const Value: MessageFns & AnyValueWrapperFns = { + wrap(value: any): Value { + const result = {} as any; + if (value === null) { + result.nullValue = NullValue.NULL_VALUE; + } else if (typeof value === "boolean") { + result.boolValue = value; + } else if (typeof value === "number") { + result.numberValue = value; + } else if (typeof value === "string") { + result.stringValue = value; + } else if (globalThis.Array.isArray(value)) { + result.listValue = ListValue.wrap(value); + } else if (typeof value === "object") { + result.structValue = Struct.wrap(value); + } else if (typeof value !== "undefined") { + throw new globalThis.Error("Unsupported any value type: " + typeof value); + } + return result; + }, + + unwrap(message: any): string | number | boolean | Object | null | Array | undefined { + if (message?.hasOwnProperty("stringValue") && message.stringValue !== undefined) { + return message.stringValue; + } else if (message?.hasOwnProperty("numberValue") && message?.numberValue !== undefined) { + return message.numberValue; + } else if (message?.hasOwnProperty("boolValue") && message?.boolValue !== undefined) { + return message.boolValue; + } else if (message?.hasOwnProperty("structValue") && message?.structValue !== undefined) { + return Struct.unwrap(message.structValue as any); + } else if (message?.hasOwnProperty("listValue") && message?.listValue !== undefined) { + return ListValue.unwrap(message.listValue); + } else if (message?.hasOwnProperty("nullValue") && message?.nullValue !== undefined) { + return null; + } + return undefined; + }, +}; + +function createBaseListValue(): ListValue { + return { values: [] }; +} + +export const ListValue: MessageFns & ListValueWrapperFns = { + wrap(array: Array | undefined): ListValue { + const result = createBaseListValue(); + result.values = (array ?? []).map(Value.wrap); + return result; + }, + + unwrap(message: ListValue): Array { + if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) { + return message.values.map(Value.unwrap); + } else { + return message as any; + } + }, +}; + +wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any; + +export interface MessageFns { +} + +export interface StructWrapperFns { + wrap(object: { [key: string]: any } | undefined): Struct; + unwrap(message: Struct): { [key: string]: any }; +} + +export interface AnyValueWrapperFns { + wrap(value: any): Value; + unwrap(message: any): string | number | boolean | Object | null | Array | undefined; +} + +export interface ListValueWrapperFns { + wrap(array: Array | undefined): ListValue; + unwrap(message: ListValue): Array; +} diff --git a/gen/google/protobuf/timestamp.ts b/gen/google/protobuf/timestamp.ts new file mode 100644 index 0000000..15fc5e3 --- /dev/null +++ b/gen/google/protobuf/timestamp.ts @@ -0,0 +1,118 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.6 +// protoc v4.25.9 +// 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 from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} + +export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf"; diff --git a/gen/notifications/notifications.ts b/gen/notifications/notifications.ts new file mode 100644 index 0000000..a214a1c --- /dev/null +++ b/gen/notifications/notifications.ts @@ -0,0 +1,190 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.6 +// protoc v4.25.9 +// source: notifications/notifications.proto + +/* eslint-disable */ +import type { Metadata } from "@grpc/grpc-js"; +import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices"; +import { wrappers } from "protobufjs"; +import { Observable } from "rxjs"; +import { Struct } from "../google/protobuf/struct"; +import { Timestamp } from "../google/protobuf/timestamp"; + +export const protobufPackage = "notifications.v1"; + +/** Структура самого уведомления */ +export interface Notification { + id: string; + userId: string; + /** Например: "SYSTEM_ALERT", "NEW_MESSAGE", "TASK_ASSIGNED" */ + type: string; + /** Заголовок (опционально) */ + title: string; + /** Текст уведомления */ + text: string; + /** Любая динамическая JSON-нагрузка (например, { "task_id": 123 }) */ + payload: { [key: string]: any } | undefined; + isRead: boolean; + createdAt: Timestamp | undefined; +} + +export interface GetNotificationsRequest { + /** ID пользователя запрашивающего данные (Gateway берет это из JWT) */ + userId: string; + /** Для пагинации (например, 20) */ + limit: number; + /** Для пагинации (например, 0) */ + offset: number; + /** Фильтр: получить только непрочитанные */ + unreadOnly?: boolean | undefined; +} + +export interface GetNotificationsResponse { + /** Массив уведомлений */ + notifications: Notification[]; + /** Общее количество (для UI пагинации) */ + totalCount: number; +} + +export interface GetUnreadCountRequest { + userId: string; +} + +export interface GetUnreadCountResponse { + count: number; +} + +export interface MarkAsReadRequest { + userId: string; + notificationId: string; +} + +export interface MarkAsReadResponse { + success: boolean; +} + +export interface MarkAllAsReadRequest { + userId: string; +} + +export interface MarkAllAsReadResponse { + success: boolean; + /** Сколько уведомлений было обновлено */ + updatedCount: number; +} + +export interface SendNotificationRequest { + /** Кому отправляем (если пусто — можно сделать бродкаст, но лучше отдельный метод) */ + userId: string; + type: string; + title: string; + text: string; + /** Метаданные для UI (ссылки, ID сущностей) */ + payload: { [key: string]: any } | undefined; +} + +export interface SendNotificationResponse { + success: boolean; + /** ID созданного уведомления в Postgres */ + notificationId: string; +} + +export const NOTIFICATIONS_V1_PACKAGE_NAME = "notifications.v1"; + +wrappers[".google.protobuf.Struct"] = { fromObject: Struct.wrap, toObject: Struct.unwrap } as any; + +/** + * ----------------------------------------------------------------------------- + * Сервис Уведомлений + * ----------------------------------------------------------------------------- + */ + +export interface NotificationServiceClient { + /** Получить список уведомлений пользователя с пагинацией */ + + getUserNotifications(request: GetNotificationsRequest, metadata?: Metadata): Observable; + + /** Получить количество непрочитанных уведомлений (для бейджика на иконке) */ + + getUnreadCount(request: GetUnreadCountRequest, metadata?: Metadata): Observable; + + /** Отметить конкретное уведомление как прочитанное */ + + markAsRead(request: MarkAsReadRequest, metadata?: Metadata): Observable; + + /** Отметить все уведомления пользователя как прочитанные */ + + markAllAsRead(request: MarkAllAsReadRequest, metadata?: Metadata): Observable; + + /** Отправить уведомление (CRM/ERP вызывает этот метод, а NestJS уже кидает в RabbitMQ) */ + + sendNotification(request: SendNotificationRequest, metadata?: Metadata): Observable; +} + +/** + * ----------------------------------------------------------------------------- + * Сервис Уведомлений + * ----------------------------------------------------------------------------- + */ + +export interface NotificationServiceController { + /** Получить список уведомлений пользователя с пагинацией */ + + getUserNotifications( + request: GetNotificationsRequest, + metadata?: Metadata, + ): Promise | Observable | GetNotificationsResponse; + + /** Получить количество непрочитанных уведомлений (для бейджика на иконке) */ + + getUnreadCount( + request: GetUnreadCountRequest, + metadata?: Metadata, + ): Promise | Observable | GetUnreadCountResponse; + + /** Отметить конкретное уведомление как прочитанное */ + + markAsRead( + request: MarkAsReadRequest, + metadata?: Metadata, + ): Promise | Observable | MarkAsReadResponse; + + /** Отметить все уведомления пользователя как прочитанные */ + + markAllAsRead( + request: MarkAllAsReadRequest, + metadata?: Metadata, + ): Promise | Observable | MarkAllAsReadResponse; + + /** Отправить уведомление (CRM/ERP вызывает этот метод, а NestJS уже кидает в RabbitMQ) */ + + sendNotification( + request: SendNotificationRequest, + metadata?: Metadata, + ): Promise | Observable | SendNotificationResponse; +} + +export function NotificationServiceControllerMethods() { + return function (constructor: Function) { + const grpcMethods: string[] = [ + "getUserNotifications", + "getUnreadCount", + "markAsRead", + "markAllAsRead", + "sendNotification", + ]; + for (const method of grpcMethods) { + const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); + GrpcMethod("NotificationService", method)(constructor.prototype[method], method, descriptor); + } + const grpcStreamMethods: string[] = []; + for (const method of grpcStreamMethods) { + const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); + GrpcStreamMethod("NotificationService", method)(constructor.prototype[method], method, descriptor); + } + }; +} + +export const NOTIFICATION_SERVICE_NAME = "NotificationService";