From f23c0e337f342f637a6f1694ada3a6f60fbfcd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 16:45:34 +0100 Subject: [PATCH 01/34] feat(nest): update proto definitions --- proto/api/v1/memo_service.proto | 5 + proto/gen/api/v1/memo_service.pb.go | 613 ++++++++++++++-------------- proto/gen/apidocs.swagger.yaml | 11 + 3 files changed, 332 insertions(+), 297 deletions(-) diff --git a/proto/api/v1/memo_service.proto b/proto/api/v1/memo_service.proto index d1ac3d177872c..d306b9e99063d 100644 --- a/proto/api/v1/memo_service.proto +++ b/proto/api/v1/memo_service.proto @@ -176,6 +176,9 @@ message Memo { // The location of the memo. optional Location location = 20; + + // The nest of the memo. + int32 nest = 21; } message MemoProperty { @@ -202,6 +205,8 @@ message CreateMemoRequest { repeated MemoRelation relations = 4; optional Location location = 5; + + int32 nest = 6; } enum MemoView { diff --git a/proto/gen/api/v1/memo_service.pb.go b/proto/gen/api/v1/memo_service.pb.go index b42a6ad33a3ab..81764093a13b2 100644 --- a/proto/gen/api/v1/memo_service.pb.go +++ b/proto/gen/api/v1/memo_service.pb.go @@ -161,6 +161,8 @@ type Memo struct { Snippet string `protobuf:"bytes,19,opt,name=snippet,proto3" json:"snippet,omitempty"` // The location of the memo. Location *Location `protobuf:"bytes,20,opt,name=location,proto3,oneof" json:"location,omitempty"` + // The nest of the memo. + Nest int32 `protobuf:"varint,21,opt,name=nest,proto3" json:"nest,omitempty"` } func (x *Memo) Reset() { @@ -326,6 +328,13 @@ func (x *Memo) GetLocation() *Location { return nil } +func (x *Memo) GetNest() int32 { + if x != nil { + return x.Nest + } + return 0 +} + type MemoProperty struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -474,6 +483,7 @@ type CreateMemoRequest struct { Resources []*Resource `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"` Relations []*MemoRelation `protobuf:"bytes,4,rep,name=relations,proto3" json:"relations,omitempty"` Location *Location `protobuf:"bytes,5,opt,name=location,proto3,oneof" json:"location,omitempty"` + Nest int32 `protobuf:"varint,6,opt,name=nest,proto3" json:"nest,omitempty"` } func (x *CreateMemoRequest) Reset() { @@ -541,6 +551,13 @@ func (x *CreateMemoRequest) GetLocation() *Location { return nil } +func (x *CreateMemoRequest) GetNest() int32 { + if x != nil { + return x.Nest + } + return 0 +} + type ListMemosRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1649,7 +1666,7 @@ var file_api_v1_memo_service_proto_rawDesc = []byte{ 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe5, 0x06, 0x0a, 0x04, 0x4d, 0x65, 0x6d, 0x6f, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf9, 0x06, 0x0a, 0x04, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x36, 0x0a, 0x0a, 0x72, 0x6f, 0x77, 0x5f, 0x73, 0x74, @@ -1702,310 +1719,312 @@ var file_api_v1_memo_service_proto_rawDesc = []byte{ 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x70, 0x61, 0x72, 0x65, - 0x6e, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xae, 0x01, 0x0a, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, - 0x74, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12, - 0x22, 0x0a, 0x0d, 0x68, 0x61, 0x73, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6c, 0x69, 0x73, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x54, 0x61, 0x73, 0x6b, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x30, - 0x0a, 0x14, 0x68, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, - 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x68, 0x61, - 0x73, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x73, - 0x22, 0x66, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, - 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x1a, - 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, - 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x6c, - 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x22, 0x9d, 0x02, 0x0a, 0x11, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x73, 0x69, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x79, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x09, 0x72, 0x65, 0x6c, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, - 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, - 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x92, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, - 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, - 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, - 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, - 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x12, 0x2a, 0x0a, 0x04, 0x76, 0x69, 0x65, 0x77, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x65, 0x6d, 0x6f, 0x56, 0x69, 0x65, 0x77, 0x52, 0x04, 0x76, 0x69, 0x65, 0x77, 0x22, 0x65, 0x0a, - 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x26, 0x0a, 0x0f, - 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, - 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x75, 0x69, 0x64, 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, - 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, - 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, - 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x27, 0x0a, - 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x14, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, - 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x6c, 0x64, 0x5f, 0x74, 0x61, - 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x6c, 0x64, 0x54, 0x61, 0x67, 0x12, - 0x17, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x6e, 0x65, 0x77, 0x54, 0x61, 0x67, 0x22, 0x72, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x30, 0x0a, 0x14, 0x64, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x22, 0x63, 0x0a, 0x17, - 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x22, 0x2e, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x22, 0x51, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, - 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x73, 0x22, 0x67, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, - 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2e, 0x0a, - 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, - 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x72, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, - 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x69, 0x0a, 0x18, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, - 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, - 0x2d, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x44, - 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6d, 0x65, + 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, + 0x15, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0xae, 0x01, 0x0a, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x50, 0x72, 0x6f, 0x70, + 0x65, 0x72, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, + 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x4c, + 0x69, 0x6e, 0x6b, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x61, 0x73, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, + 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x61, 0x73, 0x54, + 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, 0x63, + 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x43, 0x6f, + 0x64, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x68, 0x61, 0x73, 0x5f, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x70, + 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x12, 0x68, 0x61, 0x73, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, + 0x61, 0x73, 0x6b, 0x73, 0x22, 0x66, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, + 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x22, 0xb1, 0x02, 0x0a, + 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x0a, + 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x18, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x09, + 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x6c, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x48, 0x00, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6e, + 0x65, 0x73, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x22, 0x92, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x04, 0x76, 0x69, 0x65, + 0x77, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x56, 0x69, 0x65, 0x77, 0x52, + 0x04, 0x76, 0x69, 0x65, 0x77, 0x22, 0x65, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, + 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x05, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x22, 0x2e, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, - 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x51, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, - 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x63, 0x0a, 0x19, 0x55, 0x70, 0x73, 0x65, 0x72, - 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x08, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3c, 0x0a, 0x19, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, - 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x2a, 0x50, 0x0a, 0x0a, 0x56, 0x69, - 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x56, 0x49, 0x53, 0x49, - 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, - 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x4f, 0x54, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, - 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x03, 0x2a, 0x56, 0x0a, 0x08, - 0x4d, 0x65, 0x6d, 0x6f, 0x56, 0x69, 0x65, 0x77, 0x12, 0x19, 0x0a, 0x15, 0x4d, 0x45, 0x4d, 0x4f, - 0x5f, 0x56, 0x49, 0x45, 0x57, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x56, 0x49, 0x45, 0x57, - 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, - 0x56, 0x49, 0x45, 0x57, 0x5f, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x4f, 0x4e, - 0x4c, 0x59, 0x10, 0x02, 0x32, 0x9d, 0x11, 0x0a, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, - 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, - 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x1e, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, - 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, - 0x6f, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x65, 0x6d, 0x6f, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, - 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x42, 0x79, 0x55, 0x69, 0x64, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, - 0x6f, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, - 0x6f, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, - 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x62, - 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x7f, 0x0a, 0x0a, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x3c, - 0xda, 0x41, 0x10, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, - 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x32, - 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6d, 0x65, 0x6d, 0x6f, 0x2e, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7c, 0x0a, 0x0d, 0x52, 0x65, - 0x6e, 0x61, 0x6d, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x12, 0x22, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, - 0x01, 0x2a, 0x32, 0x24, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, - 0x65, 0x6e, 0x74, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x74, 0x61, 0x67, - 0x73, 0x3a, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x78, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, - 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, + 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, + 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x24, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x42, 0x79, 0x55, + 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x78, 0x0a, 0x11, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x26, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, + 0x6d, 0x6f, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x2a, 0x23, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x2f, 0x7b, 0x74, 0x61, - 0x67, 0x7d, 0x12, 0x85, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x32, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, - 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x11, 0x4c, - 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, - 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x27, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, + 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x60, + 0x0a, 0x14, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x17, + 0x0a, 0x07, 0x6f, 0x6c, 0x64, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x6f, 0x6c, 0x64, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x74, + 0x61, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x65, 0x77, 0x54, 0x61, 0x67, + 0x22, 0x72, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, + 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, + 0x61, 0x67, 0x12, 0x30, 0x0a, 0x14, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x5f, 0x72, 0x65, 0x6c, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x12, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x22, 0x63, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x2e, 0x0a, 0x18, 0x4c, 0x69, 0x73, + 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x51, 0x0a, 0x19, 0x4c, 0x69, 0x73, + 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x67, 0x0a, 0x17, + 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x72, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, + 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2e, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, + 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, + 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x09, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x69, 0x0a, 0x18, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a, 0x07, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x07, + 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x2d, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4d, + 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x44, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, + 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x22, 0x2e, 0x0a, 0x18, + 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x51, 0x0a, 0x19, + 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x72, 0x65, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, + 0x63, 0x0a, 0x19, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x72, 0x65, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3c, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, + 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x2a, 0x50, 0x0a, 0x0a, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x12, 0x1a, 0x0a, 0x16, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, + 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, + 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x52, 0x4f, + 0x54, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x50, 0x55, 0x42, 0x4c, + 0x49, 0x43, 0x10, 0x03, 0x2a, 0x56, 0x0a, 0x08, 0x4d, 0x65, 0x6d, 0x6f, 0x56, 0x69, 0x65, 0x77, + 0x12, 0x19, 0x0a, 0x15, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x56, 0x49, 0x45, 0x57, 0x5f, 0x55, 0x4e, + 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x4d, + 0x45, 0x4d, 0x4f, 0x5f, 0x56, 0x49, 0x45, 0x57, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x10, 0x01, 0x12, + 0x1b, 0x0a, 0x17, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x56, 0x49, 0x45, 0x57, 0x5f, 0x4d, 0x45, 0x54, + 0x41, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x32, 0x9d, 0x11, 0x0a, + 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x0a, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x22, + 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x3a, 0x01, 0x2a, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, + 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, + 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x62, + 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x25, 0xda, 0x41, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, + 0x2a, 0x7d, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x42, 0x79, 0x55, + 0x69, 0x64, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, + 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, + 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, + 0x69, 0x64, 0x7d, 0x12, 0x7f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, + 0x6f, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x3c, 0xda, 0x41, 0x10, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x23, 0x3a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, + 0x2f, 0x7b, 0x6d, 0x65, 0x6d, 0x6f, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, + 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, + 0x2a, 0x7d, 0x12, 0x7c, 0x0a, 0x0d, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4d, 0x65, 0x6d, 0x6f, + 0x54, 0x61, 0x67, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x52, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, + 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, 0x32, 0x24, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x74, 0x61, 0x67, 0x73, 0x3a, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x78, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, + 0x67, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x54, 0x61, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2b, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x2a, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, + 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, + 0x74, 0x61, 0x67, 0x73, 0x2f, 0x7b, 0x74, 0x61, 0x67, 0x7d, 0x12, 0x85, 0x01, 0x0a, 0x10, 0x53, + 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, + 0x25, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x32, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, + 0x32, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0xda, 0x41, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x85, 0x01, 0x0a, 0x10, 0x53, + 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x25, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x32, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, + 0x32, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, + 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, - 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2f, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, - 0x12, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x73, 0x12, 0x85, 0x01, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x25, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, - 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x32, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0xda, 0x41, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, - 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x11, 0x4c, - 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x88, 0x01, 0x0a, 0x11, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, - 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2f, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, - 0x12, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x88, 0x01, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, - 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, - 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x37, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x2a, 0x3a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x1f, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x91, 0x01, - 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x25, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, - 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2e, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, - 0x12, 0x1f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x12, 0x95, 0x01, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, - 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x22, 0x37, 0xda, 0x41, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x3a, 0x07, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x1f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x91, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, + 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x25, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, + 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x43, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2e, 0xda, 0x41, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x12, 0x1f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x95, 0x01, 0x0a, 0x11, 0x4c, 0x69, + 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, - 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, - 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x89, 0x01, 0x0a, 0x12, 0x55, 0x70, - 0x73, 0x65, 0x72, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, - 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, - 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x72, 0x65, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x8c, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x35, 0xda, - 0x41, 0x0b, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x21, 0x2a, 0x1f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x5f, 0x69, 0x64, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x4d, 0x65, 0x6d, 0x6f, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, - 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, - 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, - 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, - 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, - 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, - 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, + 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x2f, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, + 0x20, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x12, 0x89, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x65, 0x6d, 0x6f, + 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x65, + 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x32, 0xda, 0x41, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2f, 0x2a, 0x7d, 0x2f, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x8c, 0x01, + 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x35, 0xda, 0x41, 0x0b, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x2a, 0x1f, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, + 0x72, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x7d, 0x42, 0xa8, 0x01, 0x0a, + 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x42, 0x10, 0x4d, 0x65, 0x6d, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, + 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index e2fade861c5ce..ff726efadb1ff 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -901,6 +901,10 @@ paths: location: $ref: '#/definitions/apiv1Location' description: The location of the memo. + nest: + type: integer + format: int32 + description: The nest of the memo. tags: - MemoService /api/v1/{name_1}: @@ -2033,6 +2037,10 @@ definitions: location: $ref: '#/definitions/apiv1Location' description: The location of the memo. + nest: + type: integer + format: int32 + description: The nest of the memo. apiv1OAuth2Config: type: object properties: @@ -2419,6 +2427,9 @@ definitions: $ref: '#/definitions/v1MemoRelation' location: $ref: '#/definitions/apiv1Location' + nest: + type: integer + format: int32 v1CreateWebhookRequest: type: object properties: From 37b805f07a1cdc54f1bcbaab2258bde8db0456b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 16:50:13 +0100 Subject: [PATCH 02/34] feat(nest): update sql migrations --- store/migration/mysql/dev/LATEST.sql | 13 +++++++++++- store/migration/mysql/prod/0.23/01__nests.sql | 20 +++++++++++++++++++ store/migration/mysql/prod/LATEST.sql | 13 +++++++++++- store/migration/postgres/dev/LATEST.sql | 11 ++++++++++ .../postgres/prod/0.23/01__nests.sql | 20 +++++++++++++++++++ store/migration/postgres/prod/LATEST.sql | 11 ++++++++++ store/migration/sqlite/dev/LATEST.sql | 11 ++++++++++ .../migration/sqlite/prod/0.23/01__nests.sql | 20 +++++++++++++++++++ store/migration/sqlite/prod/LATEST.sql | 11 ++++++++++ store/seed/sqlite/00__reset.sql | 1 + 10 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 store/migration/mysql/prod/0.23/01__nests.sql create mode 100644 store/migration/postgres/prod/0.23/01__nests.sql create mode 100644 store/migration/sqlite/prod/0.23/01__nests.sql diff --git a/store/migration/mysql/dev/LATEST.sql b/store/migration/mysql/dev/LATEST.sql index 3a3fb7d009179..398afd4d92dd0 100644 --- a/store/migration/mysql/dev/LATEST.sql +++ b/store/migration/mysql/dev/LATEST.sql @@ -41,6 +41,7 @@ CREATE TABLE `memo` ( `creator_id` INT NOT NULL, `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `nest` INT NOT NULL DEFAULT 0, `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL', `content` TEXT NOT NULL, `visibility` VARCHAR(256) NOT NULL DEFAULT 'PRIVATE', @@ -48,6 +49,16 @@ CREATE TABLE `memo` ( `payload` JSON NOT NULL ); +-- nest +CREATE TABLE nest ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `uid` VARCHAR(256) NOT NULL, + `creator_id` INT NOT NULL, + `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' +); + -- memo_organizer CREATE TABLE `memo_organizer` ( `memo_id` INT NOT NULL, @@ -128,5 +139,5 @@ CREATE TABLE `reaction` ( `creator_id` INT NOT NULL, `content_id` VARCHAR(256) NOT NULL, `reaction_type` VARCHAR(256) NOT NULL, - UNIQUE(`creator_id`,`content_id`,`reaction_type`) + UNIQUE(`creator_id`,`content_id`,`reaction_type`) ); diff --git a/store/migration/mysql/prod/0.23/01__nests.sql b/store/migration/mysql/prod/0.23/01__nests.sql new file mode 100644 index 0000000000000..e890f090803d1 --- /dev/null +++ b/store/migration/mysql/prod/0.23/01__nests.sql @@ -0,0 +1,20 @@ +ALTER TABLE + memo +ADD + COLUMN nest INT NOT NULL DEFAULT 0; + +CREATE TABLE nest ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `uid` VARCHAR(256) NOT NULL, + `creator_id` INT NOT NULL, + `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' +); + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + user; \ No newline at end of file diff --git a/store/migration/mysql/prod/LATEST.sql b/store/migration/mysql/prod/LATEST.sql index 3a3fb7d009179..398afd4d92dd0 100644 --- a/store/migration/mysql/prod/LATEST.sql +++ b/store/migration/mysql/prod/LATEST.sql @@ -41,6 +41,7 @@ CREATE TABLE `memo` ( `creator_id` INT NOT NULL, `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `nest` INT NOT NULL DEFAULT 0, `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL', `content` TEXT NOT NULL, `visibility` VARCHAR(256) NOT NULL DEFAULT 'PRIVATE', @@ -48,6 +49,16 @@ CREATE TABLE `memo` ( `payload` JSON NOT NULL ); +-- nest +CREATE TABLE nest ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `uid` VARCHAR(256) NOT NULL, + `creator_id` INT NOT NULL, + `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' +); + -- memo_organizer CREATE TABLE `memo_organizer` ( `memo_id` INT NOT NULL, @@ -128,5 +139,5 @@ CREATE TABLE `reaction` ( `creator_id` INT NOT NULL, `content_id` VARCHAR(256) NOT NULL, `reaction_type` VARCHAR(256) NOT NULL, - UNIQUE(`creator_id`,`content_id`,`reaction_type`) + UNIQUE(`creator_id`,`content_id`,`reaction_type`) ); diff --git a/store/migration/postgres/dev/LATEST.sql b/store/migration/postgres/dev/LATEST.sql index 957eaced5c7cb..c90db00eb2b50 100644 --- a/store/migration/postgres/dev/LATEST.sql +++ b/store/migration/postgres/dev/LATEST.sql @@ -41,6 +41,7 @@ CREATE TABLE memo ( creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + nest INTEGER NOT NULL DEFAULT 0, row_status TEXT NOT NULL DEFAULT 'NORMAL', content TEXT NOT NULL, visibility TEXT NOT NULL DEFAULT 'PRIVATE', @@ -48,6 +49,16 @@ CREATE TABLE memo ( payload JSONB NOT NULL DEFAULT '{}' ); +-- nest +CREATE TABLE nest ( + id SERIAL PRIMARY KEY, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + row_status TEXT NOT NULL DEFAULT 'NORMAL' +); + -- memo_organizer CREATE TABLE memo_organizer ( memo_id INTEGER NOT NULL, diff --git a/store/migration/postgres/prod/0.23/01__nests.sql b/store/migration/postgres/prod/0.23/01__nests.sql new file mode 100644 index 0000000000000..88096f9c41936 --- /dev/null +++ b/store/migration/postgres/prod/0.23/01__nests.sql @@ -0,0 +1,20 @@ +ALTER TABLE + memo +ADD + COLUMN nest INTEGER NOT NULL DEFAULT 0; + +CREATE TABLE nest ( + id SERIAL PRIMARY KEY, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + row_status TEXT NOT NULL DEFAULT 'NORMAL' +); + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + "user"; \ No newline at end of file diff --git a/store/migration/postgres/prod/LATEST.sql b/store/migration/postgres/prod/LATEST.sql index 957eaced5c7cb..c90db00eb2b50 100644 --- a/store/migration/postgres/prod/LATEST.sql +++ b/store/migration/postgres/prod/LATEST.sql @@ -41,6 +41,7 @@ CREATE TABLE memo ( creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + nest INTEGER NOT NULL DEFAULT 0, row_status TEXT NOT NULL DEFAULT 'NORMAL', content TEXT NOT NULL, visibility TEXT NOT NULL DEFAULT 'PRIVATE', @@ -48,6 +49,16 @@ CREATE TABLE memo ( payload JSONB NOT NULL DEFAULT '{}' ); +-- nest +CREATE TABLE nest ( + id SERIAL PRIMARY KEY, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + row_status TEXT NOT NULL DEFAULT 'NORMAL' +); + -- memo_organizer CREATE TABLE memo_organizer ( memo_id INTEGER NOT NULL, diff --git a/store/migration/sqlite/dev/LATEST.sql b/store/migration/sqlite/dev/LATEST.sql index bcaeefc04d948..b786513d10ab1 100644 --- a/store/migration/sqlite/dev/LATEST.sql +++ b/store/migration/sqlite/dev/LATEST.sql @@ -44,6 +44,7 @@ CREATE TABLE memo ( creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + nest INTEGER NOT NULL DEFAULT 0, row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL', content TEXT NOT NULL DEFAULT '', visibility TEXT NOT NULL CHECK (visibility IN ('PUBLIC', 'PROTECTED', 'PRIVATE')) DEFAULT 'PRIVATE', @@ -51,6 +52,16 @@ CREATE TABLE memo ( payload TEXT NOT NULL DEFAULT '{}' ); +-- nest +CREATE TABLE nest ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' +); + CREATE INDEX idx_memo_creator_id ON memo (creator_id); CREATE INDEX idx_memo_content ON memo (content); CREATE INDEX idx_memo_visibility ON memo (visibility); diff --git a/store/migration/sqlite/prod/0.23/01__nests.sql b/store/migration/sqlite/prod/0.23/01__nests.sql new file mode 100644 index 0000000000000..484d614304371 --- /dev/null +++ b/store/migration/sqlite/prod/0.23/01__nests.sql @@ -0,0 +1,20 @@ +ALTER TABLE + memo +ADD + COLUMN nest INTEGER NOT NULL DEFAULT 0; + +CREATE TABLE nest ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' +); + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + user; \ No newline at end of file diff --git a/store/migration/sqlite/prod/LATEST.sql b/store/migration/sqlite/prod/LATEST.sql index 8052de8c8e0aa..1d1cdc54a559b 100644 --- a/store/migration/sqlite/prod/LATEST.sql +++ b/store/migration/sqlite/prod/LATEST.sql @@ -44,6 +44,7 @@ CREATE TABLE memo ( creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + nest INTEGER NOT NULL DEFAULT 0, row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL', content TEXT NOT NULL DEFAULT '', visibility TEXT NOT NULL CHECK (visibility IN ('PUBLIC', 'PROTECTED', 'PRIVATE')) DEFAULT 'PRIVATE', @@ -51,6 +52,16 @@ CREATE TABLE memo ( payload TEXT NOT NULL DEFAULT '{}' ); +-- nest +CREATE TABLE nest ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' +); + CREATE INDEX idx_memo_creator_id ON memo (creator_id); CREATE INDEX idx_memo_content ON memo (content); CREATE INDEX idx_memo_visibility ON memo (visibility); diff --git a/store/seed/sqlite/00__reset.sql b/store/seed/sqlite/00__reset.sql index 4112901ca3cd7..692a4d5b5bdd7 100644 --- a/store/seed/sqlite/00__reset.sql +++ b/store/seed/sqlite/00__reset.sql @@ -2,6 +2,7 @@ DELETE FROM system_setting; DELETE FROM user; DELETE FROM user_setting; DELETE FROM memo; +DELETE FROM nest; DELETE FROM memo_organizer; DELETE FROM memo_relation; DELETE FROM resource; From b4a4c8273b99a23bb209b7a9d48f52132e857d8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 16:51:48 +0100 Subject: [PATCH 03/34] feat(nest): update store --- store/db/mysql/memo.go | 3 + store/db/mysql/nest.go | 179 ++++++++++++++++++++++++++++++++++++++ store/db/postgres/memo.go | 3 + store/db/postgres/nest.go | 170 ++++++++++++++++++++++++++++++++++++ store/db/sqlite/memo.go | 12 ++- store/db/sqlite/nest.go | 155 +++++++++++++++++++++++++++++++++ store/driver.go | 6 ++ store/memo.go | 3 + store/nest.go | 96 ++++++++++++++++++++ store/user.go | 9 ++ 10 files changed, 633 insertions(+), 3 deletions(-) create mode 100644 store/db/mysql/nest.go create mode 100644 store/db/postgres/nest.go create mode 100644 store/db/sqlite/nest.go create mode 100644 store/nest.go diff --git a/store/db/mysql/memo.go b/store/db/mysql/memo.go index db9ccba3505fb..b982506ac3497 100644 --- a/store/db/mysql/memo.go +++ b/store/db/mysql/memo.go @@ -58,6 +58,9 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo if v := find.CreatorID; v != nil { where, args = append(where, "`memo`.`creator_id` = ?"), append(args, *v) } + if v := find.Nest; v != nil { + where, args = append(where, "`memo`.`nest` = ?"), append(args, *v) + } if v := find.RowStatus; v != nil { where, args = append(where, "`memo`.`row_status` = ?"), append(args, *v) } diff --git a/store/db/mysql/nest.go b/store/db/mysql/nest.go new file mode 100644 index 0000000000000..2b12322ec479e --- /dev/null +++ b/store/db/mysql/nest.go @@ -0,0 +1,179 @@ +package mysql + +import ( + "context" + "fmt" + "strings" + + "github.com/pkg/errors" + + "github.com/usememos/memos/store" +) + +func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, error) { + fields := []string{"`uid`", "`creator_id`"} + placeholder := []string{"?", "?"} + args := []any{create.UID, create.CreatorID} + + stmt := "INSERT INTO `nest` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ")" + result, err := d.db.ExecContext(ctx, stmt, args...) + if err != nil { + return nil, err + } + + rawID, err := result.LastInsertId() + if err != nil { + return nil, err + } + id := int32(rawID) + nest, err := d.GetNest(ctx, &store.FindNest{ID: &id}) + if err != nil { + return nil, err + } + if nest == nil { + return nil, errors.Errorf("failed to create nest") + } + return nest, nil +} + +func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest, error) { + where, having, args := []string{"1 = 1"}, []string{"1 = 1"}, []any{} + + if v := find.ID; v != nil { + where, args = append(where, "`nest`.`id` = ?"), append(args, *v) + } + if v := find.UID; v != nil { + where, args = append(where, "`nest`.`uid` = ?"), append(args, *v) + } + if v := find.CreatorID; v != nil { + where, args = append(where, "`nest`.`creator_id` = ?"), append(args, *v) + } + if v := find.RowStatus; v != nil { + where, args = append(where, "`nest`.`row_status` = ?"), append(args, *v) + } + if v := find.CreatedTsBefore; v != nil { + where, args = append(where, "UNIX_TIMESTAMP(`nest`.`created_ts`) < ?"), append(args, *v) + } + if v := find.CreatedTsAfter; v != nil { + where, args = append(where, "UNIX_TIMESTAMP(`nest`.`created_ts`) > ?"), append(args, *v) + } + if v := find.UpdatedTsBefore; v != nil { + where, args = append(where, "UNIX_TIMESTAMP(`nest`.`updated_ts`) < ?"), append(args, *v) + } + if v := find.UpdatedTsAfter; v != nil { + where, args = append(where, "UNIX_TIMESTAMP(`nest`.`updated_ts`) > ?"), append(args, *v) + } + + orders := []string{} + if find.OrderByPinned { + orders = append(orders, "`pinned` DESC") + } + order := "DESC" + if find.OrderByTimeAsc { + order = "ASC" + } + if find.OrderByUpdatedTs { + orders = append(orders, "`updated_ts` "+order) + } else { + orders = append(orders, "`created_ts` "+order) + } + orders = append(orders, "`id` "+order) + + fields := []string{ + "`nest`.`id` AS `id`", + "`nest`.`uid` AS `uid`", + "`nest`.`creator_id` AS `creator_id`", + "UNIX_TIMESTAMP(`nest`.`created_ts`) AS `created_ts`", + "UNIX_TIMESTAMP(`nest`.`updated_ts`) AS `updated_ts`", + "`nest`.`row_status` AS `row_status`", + } + + query := "SELECT " + strings.Join(fields, ", ") + " FROM `nest`" + " " + + "WHERE " + strings.Join(where, " AND ") + " " + + "HAVING " + strings.Join(having, " AND ") + " " + + "ORDER BY " + strings.Join(orders, ", ") + if find.Limit != nil { + query = fmt.Sprintf("%s LIMIT %d", query, *find.Limit) + if find.Offset != nil { + query = fmt.Sprintf("%s OFFSET %d", query, *find.Offset) + } + } + + rows, err := d.db.QueryContext(ctx, query, args...) + if err != nil { + return nil, err + } + defer rows.Close() + + list := make([]*store.Nest, 0) + for rows.Next() { + var nest store.Nest + dests := []any{ + &nest.ID, + &nest.UID, + &nest.CreatorID, + &nest.CreatedTs, + &nest.UpdatedTs, + &nest.RowStatus, + } + if err := rows.Scan(dests...); err != nil { + return nil, err + } + list = append(list, &nest) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return list, nil +} + +func (d *DB) GetNest(ctx context.Context, find *store.FindNest) (*store.Nest, error) { + list, err := d.ListNests(ctx, find) + if err != nil { + return nil, err + } + if len(list) == 0 { + return nil, nil + } + + nest := list[0] + return nest, nil +} + +func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { + set, args := []string{}, []any{} + if v := update.UID; v != nil { + set, args = append(set, "`uid` = ?"), append(args, *v) + } + if v := update.CreatedTs; v != nil { + set, args = append(set, "`created_ts` = FROM_UNIXTIME(?)"), append(args, *v) + } + if v := update.UpdatedTs; v != nil { + set, args = append(set, "`updated_ts` = FROM_UNIXTIME(?)"), append(args, *v) + } + if v := update.RowStatus; v != nil { + set, args = append(set, "`row_status` = ?"), append(args, *v) + } + args = append(args, update.ID) + + stmt := "UPDATE `nest` SET " + strings.Join(set, ", ") + " WHERE `id` = ?" + if _, err := d.db.ExecContext(ctx, stmt, args...); err != nil { + return err + } + return nil +} + +func (d *DB) DeleteNest(ctx context.Context, delete *store.DeleteNest) error { + where, args := []string{"`id` = ?"}, []any{delete.ID} + stmt := "DELETE FROM `nest` WHERE " + strings.Join(where, " AND ") + result, err := d.db.ExecContext(ctx, stmt, args...) + if err != nil { + return err + } + if _, err := result.RowsAffected(); err != nil { + return err + } + return nil +} diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.go index c9ff66a867d6e..6810204ab2d07 100644 --- a/store/db/postgres/memo.go +++ b/store/db/postgres/memo.go @@ -49,6 +49,9 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo if v := find.CreatorID; v != nil { where, args = append(where, "memo.creator_id = "+placeholder(len(args)+1)), append(args, *v) } + if v := find.Nest; v != nil { + where, args = append(where, "memo.nest = "+placeholder(len(args)+1)), append(args, *v) + } if v := find.RowStatus; v != nil { where, args = append(where, "memo.row_status = "+placeholder(len(args)+1)), append(args, *v) } diff --git a/store/db/postgres/nest.go b/store/db/postgres/nest.go new file mode 100644 index 0000000000000..859a4d9cc56e9 --- /dev/null +++ b/store/db/postgres/nest.go @@ -0,0 +1,170 @@ +package postgres + +import ( + "context" + "fmt" + "strings" + + "github.com/pkg/errors" + + "github.com/usememos/memos/store" +) + +func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, error) { + fields := []string{"uid", "creator_id"} + args := []any{create.UID, create.CreatorID} + + stmt := "INSERT INTO nest (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts, updated_ts, row_status" + if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( + &create.ID, + &create.CreatedTs, + &create.UpdatedTs, + &create.RowStatus, + ); err != nil { + return nil, err + } + + return create, nil +} + +func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest, error) { + where, args := []string{"1 = 1"}, []any{} + + if v := find.ID; v != nil { + where, args = append(where, "nest.id = "+placeholder(len(args)+1)), append(args, *v) + } + if v := find.UID; v != nil { + where, args = append(where, "nest.uid = "+placeholder(len(args)+1)), append(args, *v) + } + if v := find.CreatorID; v != nil { + where, args = append(where, "nest.creator_id = "+placeholder(len(args)+1)), append(args, *v) + } + if v := find.RowStatus; v != nil { + where, args = append(where, "nest.row_status = "+placeholder(len(args)+1)), append(args, *v) + } + if v := find.CreatedTsBefore; v != nil { + where, args = append(where, "nest.created_ts < "+placeholder(len(args)+1)), append(args, *v) + } + if v := find.CreatedTsAfter; v != nil { + where, args = append(where, "nest.created_ts > "+placeholder(len(args)+1)), append(args, *v) + } + if v := find.UpdatedTsBefore; v != nil { + where, args = append(where, "nest.updated_ts < "+placeholder(len(args)+1)), append(args, *v) + } + if v := find.UpdatedTsAfter; v != nil { + where, args = append(where, "nest.updated_ts > "+placeholder(len(args)+1)), append(args, *v) + } + + orders := []string{} + if find.OrderByPinned { + orders = append(orders, "pinned DESC") + } + order := "DESC" + if find.OrderByTimeAsc { + order = "ASC" + } + if find.OrderByUpdatedTs { + orders = append(orders, "updated_ts "+order) + } else { + orders = append(orders, "created_ts "+order) + } + orders = append(orders, "id "+order) + + fields := []string{ + `nest.id AS id`, + `nest.uid AS uid`, + `nest.creator_id AS creator_id`, + `nest.created_ts AS created_ts`, + `nest.updated_ts AS updated_ts`, + `nest.row_status AS row_status`, + } + + query := `SELECT ` + strings.Join(fields, ", ") + ` + FROM nest + WHERE ` + strings.Join(where, " AND ") + ` + ORDER BY ` + strings.Join(orders, ", ") + if find.Limit != nil { + query = fmt.Sprintf("%s LIMIT %d", query, *find.Limit) + if find.Offset != nil { + query = fmt.Sprintf("%s OFFSET %d", query, *find.Offset) + } + } + + rows, err := d.db.QueryContext(ctx, query, args...) + if err != nil { + return nil, err + } + defer rows.Close() + + list := make([]*store.Nest, 0) + for rows.Next() { + var nest store.Nest + dests := []any{ + &nest.ID, + &nest.UID, + &nest.CreatorID, + &nest.CreatedTs, + &nest.UpdatedTs, + &nest.RowStatus, + } + if err := rows.Scan(dests...); err != nil { + return nil, err + } + list = append(list, &nest) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return list, nil +} + +func (d *DB) GetNest(ctx context.Context, find *store.FindNest) (*store.Nest, error) { + list, err := d.ListNests(ctx, find) + if err != nil { + return nil, err + } + if len(list) == 0 { + return nil, nil + } + + nest := list[0] + return nest, nil +} + +func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { + set, args := []string{}, []any{} + if v := update.UID; v != nil { + set, args = append(set, "uid = "+placeholder(len(args)+1)), append(args, *v) + } + if v := update.CreatedTs; v != nil { + set, args = append(set, "created_ts = "+placeholder(len(args)+1)), append(args, *v) + } + if v := update.UpdatedTs; v != nil { + set, args = append(set, "updated_ts = "+placeholder(len(args)+1)), append(args, *v) + } + if v := update.RowStatus; v != nil { + set, args = append(set, "row_status = "+placeholder(len(args)+1)), append(args, *v) + } + + stmt := `UPDATE nest SET ` + strings.Join(set, ", ") + ` WHERE id = ` + placeholder(len(args)+1) + args = append(args, update.ID) + if _, err := d.db.ExecContext(ctx, stmt, args...); err != nil { + return err + } + return nil +} + +func (d *DB) DeleteNest(ctx context.Context, delete *store.DeleteNest) error { + where, args := []string{"id = " + placeholder(1)}, []any{delete.ID} + stmt := `DELETE FROM nest WHERE ` + strings.Join(where, " AND ") + result, err := d.db.ExecContext(ctx, stmt, args...) + if err != nil { + return errors.Wrap(err, "failed to delete nest") + } + if _, err := result.RowsAffected(); err != nil { + return err + } + return nil +} diff --git a/store/db/sqlite/memo.go b/store/db/sqlite/memo.go index cbde004c91078..bf6ea5b6751aa 100644 --- a/store/db/sqlite/memo.go +++ b/store/db/sqlite/memo.go @@ -13,8 +13,8 @@ import ( ) func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, error) { - fields := []string{"`uid`", "`creator_id`", "`content`", "`visibility`", "`payload`"} - placeholder := []string{"?", "?", "?", "?", "?"} + fields := []string{"`uid`", "`creator_id`", "`nest`", "`content`", "`visibility`", "`payload`"} + placeholder := []string{"?", "?", "?", "?", "?", "?"} payload := "{}" if create.Payload != nil { payloadBytes, err := protojson.Marshal(create.Payload) @@ -23,7 +23,7 @@ func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, e } payload = string(payloadBytes) } - args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, payload} + args := []any{create.UID, create.CreatorID, create.Nest, create.Content, create.Visibility, payload} stmt := "INSERT INTO `memo` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `updated_ts`, `row_status`" if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( @@ -50,6 +50,9 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo if v := find.CreatorID; v != nil { where, args = append(where, "`memo`.`creator_id` = ?"), append(args, *v) } + if v := find.Nest; v != nil { + where, args = append(where, "`memo`.`nest` = ?"), append(args, *v) + } if v := find.RowStatus; v != nil { where, args = append(where, "`memo`.`row_status` = ?"), append(args, *v) } @@ -207,6 +210,9 @@ func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error { if v := update.RowStatus; v != nil { set, args = append(set, "`row_status` = ?"), append(args, *v) } + if v := update.Nest; v != nil { + set, args = append(set, "`nest` = ?"), append(args, *v) + } if v := update.Content; v != nil { set, args = append(set, "`content` = ?"), append(args, *v) } diff --git a/store/db/sqlite/nest.go b/store/db/sqlite/nest.go new file mode 100644 index 0000000000000..d1ed35508413d --- /dev/null +++ b/store/db/sqlite/nest.go @@ -0,0 +1,155 @@ +package sqlite + +import ( + "context" + "fmt" + "strings" + + "github.com/usememos/memos/store" +) + +func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, error) { + fields := []string{"`uid`", "`creator_id`"} + placeholder := []string{"?", "?"} + args := []any{create.UID, create.CreatorID} + + stmt := "INSERT INTO `nest` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `updated_ts`, `row_status`" + if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( + &create.ID, + &create.CreatedTs, + &create.UpdatedTs, + &create.RowStatus, + ); err != nil { + return nil, err + } + + return create, nil +} + +func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest, error) { + where, args := []string{"1 = 1"}, []any{} + + if v := find.ID; v != nil { + where, args = append(where, "`nest`.`id` = ?"), append(args, *v) + } + if v := find.UID; v != nil { + where, args = append(where, "`nest`.`uid` = ?"), append(args, *v) + } + if v := find.CreatorID; v != nil { + where, args = append(where, "`nest`.`creator_id` = ?"), append(args, *v) + } + if v := find.RowStatus; v != nil { + where, args = append(where, "`nest`.`row_status` = ?"), append(args, *v) + } + if v := find.CreatedTsBefore; v != nil { + where, args = append(where, "`nest`.`created_ts` < ?"), append(args, *v) + } + if v := find.CreatedTsAfter; v != nil { + where, args = append(where, "`nest`.`created_ts` > ?"), append(args, *v) + } + if v := find.UpdatedTsBefore; v != nil { + where, args = append(where, "`nest`.`updated_ts` < ?"), append(args, *v) + } + if v := find.UpdatedTsAfter; v != nil { + where, args = append(where, "`nest`.`updated_ts` > ?"), append(args, *v) + } + + orderBy := []string{} + if find.OrderByPinned { + orderBy = append(orderBy, "`pinned` DESC") + } + order := "DESC" + if find.OrderByTimeAsc { + order = "ASC" + } + if find.OrderByUpdatedTs { + orderBy = append(orderBy, "`updated_ts` "+order) + } else { + orderBy = append(orderBy, "`created_ts` "+order) + } + orderBy = append(orderBy, "`id` "+order) + + fields := []string{ + "`nest`.`id` AS `id`", + "`nest`.`uid` AS `uid`", + "`nest`.`creator_id` AS `creator_id`", + "`nest`.`created_ts` AS `created_ts`", + "`nest`.`updated_ts` AS `updated_ts`", + "`nest`.`row_status` AS `row_status`", + } + + query := "SELECT " + strings.Join(fields, ", ") + "FROM `nest` " + + "WHERE " + strings.Join(where, " AND ") + " " + + "ORDER BY " + strings.Join(orderBy, ", ") + if find.Limit != nil { + query = fmt.Sprintf("%s LIMIT %d", query, *find.Limit) + if find.Offset != nil { + query = fmt.Sprintf("%s OFFSET %d", query, *find.Offset) + } + } + + rows, err := d.db.QueryContext(ctx, query, args...) + if err != nil { + return nil, err + } + defer rows.Close() + + list := make([]*store.Nest, 0) + for rows.Next() { + var nest store.Nest + dests := []any{ + &nest.ID, + &nest.UID, + &nest.CreatorID, + &nest.CreatedTs, + &nest.UpdatedTs, + &nest.RowStatus, + } + if err := rows.Scan(dests...); err != nil { + return nil, err + } + list = append(list, &nest) + } + + if err := rows.Err(); err != nil { + return nil, err + } + + return list, nil +} + +func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { + set, args := []string{}, []any{} + if v := update.UID; v != nil { + set, args = append(set, "`uid` = ?"), append(args, *v) + } + if v := update.CreatedTs; v != nil { + set, args = append(set, "`created_ts` = ?"), append(args, *v) + } + if v := update.UpdatedTs; v != nil { + set, args = append(set, "`updated_ts` = ?"), append(args, *v) + } + if v := update.RowStatus; v != nil { + set, args = append(set, "`row_status` = ?"), append(args, *v) + } + args = append(args, update.ID) + + stmt := "UPDATE `nest` SET " + strings.Join(set, ", ") + " WHERE `id` = ?" + if _, err := d.db.ExecContext(ctx, stmt, args...); err != nil { + return err + } + return nil +} + +func (d *DB) DeleteNest(ctx context.Context, delete *store.DeleteNest) error { + where, args := []string{"`id` = ?"}, []any{delete.ID} + stmt := "DELETE FROM `nest` WHERE " + strings.Join(where, " AND ") + result, err := d.db.ExecContext(ctx, stmt, args...) + if err != nil { + return err + } + if _, err := result.RowsAffected(); err != nil { + return err + } + return nil +} diff --git a/store/driver.go b/store/driver.go index c152a9372627d..7dc6ececebdd4 100644 --- a/store/driver.go +++ b/store/driver.go @@ -31,6 +31,12 @@ type Driver interface { UpdateMemo(ctx context.Context, update *UpdateMemo) error DeleteMemo(ctx context.Context, delete *DeleteMemo) error + // Nest model related methods. + CreateNest(ctx context.Context, create *Nest) (*Nest, error) + ListNests(ctx context.Context, find *FindNest) ([]*Nest, error) + UpdateNest(ctx context.Context, update *UpdateNest) error + DeleteNest(ctx context.Context, delete *DeleteNest) error + // MemoRelation model related methods. UpsertMemoRelation(ctx context.Context, create *MemoRelation) (*MemoRelation, error) ListMemoRelations(ctx context.Context, find *FindMemoRelation) ([]*MemoRelation, error) diff --git a/store/memo.go b/store/memo.go index e8513fa4d2188..2e7680ca46ff9 100644 --- a/store/memo.go +++ b/store/memo.go @@ -48,6 +48,7 @@ type Memo struct { // Domain specific fields Content string Visibility Visibility + Nest int32 Payload *storepb.MemoPayload // Composed fields @@ -70,6 +71,7 @@ type FindMemo struct { // Domain specific fields ContentSearch []string VisibilityList []Visibility + Nest *int32 PayloadFind *FindMemoPayload ExcludeContent bool ExcludeComments bool @@ -102,6 +104,7 @@ type UpdateMemo struct { RowStatus *RowStatus Content *string Visibility *Visibility + Nest *int32 Payload *storepb.MemoPayload } diff --git a/store/nest.go b/store/nest.go new file mode 100644 index 0000000000000..d3c6cbeae968e --- /dev/null +++ b/store/nest.go @@ -0,0 +1,96 @@ +package store + +import ( + "context" + "errors" + + "github.com/usememos/memos/internal/util" +) + +type Nest struct { + // ID is the system generated unique identifier for the memo. + ID int32 + // UID is the user defined unique identifier for the memo. + UID string + + // Standard fields + RowStatus RowStatus + CreatorID int32 + CreatedTs int64 + UpdatedTs int64 + + // Domain specific fields + + // Composed fields +} + +type FindNest struct { + ID *int32 + UID *string + + // Standard fields + RowStatus *RowStatus + CreatorID *int32 + CreatedTsAfter *int64 + CreatedTsBefore *int64 + UpdatedTsAfter *int64 + UpdatedTsBefore *int64 + + // Domain specific fields + + // Pagination + Limit *int + Offset *int + + // Ordering + OrderByUpdatedTs bool + OrderByPinned bool + OrderByTimeAsc bool +} + +type UpdateNest struct { + ID int32 + UID *string + CreatedTs *int64 + UpdatedTs *int64 + RowStatus *RowStatus +} + +type DeleteNest struct { + ID int32 +} + +func (s *Store) CreateNest(ctx context.Context, create *Nest) (*Nest, error) { + if !util.UIDMatcher.MatchString(create.UID) { + return nil, errors.New("invalid uid") + } + return s.driver.CreateNest(ctx, create) +} + +func (s *Store) ListNests(ctx context.Context, find *FindNest) ([]*Nest, error) { + return s.driver.ListNests(ctx, find) +} + +func (s *Store) GetNest(ctx context.Context, find *FindNest) (*Nest, error) { + list, err := s.ListNests(ctx, find) + if err != nil { + return nil, err + } + if len(list) == 0 { + return nil, nil + } + + memo := list[0] + return memo, nil +} + +func (s *Store) UpdateNest(ctx context.Context, update *UpdateNest) error { + if update.UID != nil && !util.UIDMatcher.MatchString(*update.UID) { + return errors.New("invalid uid") + } + return s.driver.UpdateNest(ctx, update) +} + +func (s *Store) DeleteNest(ctx context.Context, delete *DeleteNest) error { + return s.driver.DeleteNest(ctx, delete) +} diff --git a/store/user.go b/store/user.go index e61d876ee1a7b..21a9fcb5c3a9f 100644 --- a/store/user.go +++ b/store/user.go @@ -100,6 +100,15 @@ func (s *Store) CreateUser(ctx context.Context, create *User) (*User, error) { return nil, err } + nestCreate := &Nest{ + UID: "Personal", + CreatorID: user.ID, + } + _, err = s.driver.CreateNest(ctx, nestCreate) + if err != nil { + return nil, err + } + s.userCache.Store(user.ID, user) return user, nil } From 94f9ed2ea2b041e11e0ff4b1e7da1ffde98b4a88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 16:52:31 +0100 Subject: [PATCH 04/34] feat(nest): update router --- server/router/api/v1/memo_service.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/router/api/v1/memo_service.go b/server/router/api/v1/memo_service.go index 328b97cc609c4..0e22d0de2e757 100644 --- a/server/router/api/v1/memo_service.go +++ b/server/router/api/v1/memo_service.go @@ -43,6 +43,7 @@ func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoR create := &store.Memo{ UID: shortuuid.New(), CreatorID: user.ID, + Nest: request.Nest, Content: request.Content, Visibility: convertVisibilityToStore(request.Visibility), } @@ -830,6 +831,9 @@ func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store. } find.CreatorID = &user.ID } + if filter.Nest != nil { + find.Nest = filter.Nest + } if filter.RowStatus != nil { find.RowStatus = filter.RowStatus } @@ -901,6 +905,7 @@ var MemoFilterCELAttributes = []cel.EnvOption{ cel.Variable("display_time_before", cel.IntType), cel.Variable("display_time_after", cel.IntType), cel.Variable("creator", cel.StringType), + cel.Variable("nest", cel.IntType), cel.Variable("uid", cel.StringType), cel.Variable("row_status", cel.StringType), cel.Variable("random", cel.BoolType), @@ -921,6 +926,7 @@ type MemoFilter struct { DisplayTimeBefore *int64 DisplayTimeAfter *int64 Creator *string + Nest *int32 RowStatus *store.RowStatus Random bool Limit *int @@ -990,6 +996,9 @@ func findMemoField(callExpr *expr.Expr_Call, filter *MemoFilter) { } else if idExpr.Name == "creator" { creator := callExpr.Args[1].GetConstExpr().GetStringValue() filter.Creator = &creator + } else if idExpr.Name == "nest" { + nest := int32(callExpr.Args[1].GetConstExpr().GetInt64Value()) + filter.Nest = &nest } else if idExpr.Name == "row_status" { rowStatus := store.RowStatus(callExpr.Args[1].GetConstExpr().GetStringValue()) filter.RowStatus = &rowStatus From 388d66bae641ad3d79f47dfd70fac7d3116b4aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 16:55:23 +0100 Subject: [PATCH 05/34] feat(nest): add global nest selection --- web/src/hooks/useCurrentNest.ts | 8 ++++++++ web/src/layouts/CommonContextProvider.tsx | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 web/src/hooks/useCurrentNest.ts diff --git a/web/src/hooks/useCurrentNest.ts b/web/src/hooks/useCurrentNest.ts new file mode 100644 index 0000000000000..e2a4b9a17caef --- /dev/null +++ b/web/src/hooks/useCurrentNest.ts @@ -0,0 +1,8 @@ +import { useCommonContext } from "@/layouts/CommonContextProvider"; + +const useCurrentNest = () => { + const commonContext = useCommonContext(); + return commonContext.nest; +}; + +export default useCurrentNest; diff --git a/web/src/layouts/CommonContextProvider.tsx b/web/src/layouts/CommonContextProvider.tsx index 36f7f088eace2..7e2713dc9f6ef 100644 --- a/web/src/layouts/CommonContextProvider.tsx +++ b/web/src/layouts/CommonContextProvider.tsx @@ -9,29 +9,35 @@ interface Context { locale: string; appearance: string; profile: WorkspaceProfile; + nest: number; setLocale: (locale: string) => void; setAppearance: (appearance: string) => void; + setNest: (nest: number) => void; } const CommonContext = createContext({ locale: "en", appearance: "system", profile: WorkspaceProfile.fromPartial({}), + nest: 0, setLocale: () => {}, setAppearance: () => {}, + setNest: () => {}, }); const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { const workspaceSettingStore = useWorkspaceSettingStore(); const userStore = useUserStore(); const [initialized, setInitialized] = useState(false); - const [commonContext, setCommonContext] = useState>({ + const [commonContext, setCommonContext] = useState>({ locale: "en", appearance: "system", + nest: 0, profile: WorkspaceProfile.fromPartial({}), }); const [locale] = useLocalStorage("locale", "en"); const [appearance] = useLocalStorage("appearance", "system"); + const [nest] = useLocalStorage("nest", 0); useEffect(() => { const initialWorkspace = async () => { @@ -49,6 +55,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { setCommonContext({ locale: locale || workspaceGeneralSetting.customProfile?.locale || "en", appearance: appearance || workspaceGeneralSetting.customProfile?.appearance || "system", + nest: nest || 0, profile: workspaceProfile, }); }; @@ -70,6 +77,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { ...commonContext, setLocale: (locale: string) => setCommonContext({ ...commonContext, locale }), setAppearance: (appearance: string) => setCommonContext({ ...commonContext, appearance }), + setNest: (nest: number) => setCommonContext({ ...commonContext, nest }), }} > {!initialized ? null : <>{children}} From 803888f1631c770546f28b1204d3f0d4a75bd626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 16:56:02 +0100 Subject: [PATCH 06/34] feat(nest): add nest banner --- web/src/components/Navigation.tsx | 2 ++ web/src/components/NestBanner.tsx | 46 +++++++++++++++++++++++++++++++ web/src/components/NestIcon.tsx | 8 ++++++ 3 files changed, 56 insertions(+) create mode 100644 web/src/components/NestBanner.tsx create mode 100644 web/src/components/NestIcon.tsx diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index 7b1fe4d9fbe79..f05587e7bd5a0 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -9,6 +9,7 @@ import { useInboxStore } from "@/store/v1"; import { Inbox_Status } from "@/types/proto/api/v1/inbox_service"; import { useTranslate } from "@/utils/i18n"; import UserBanner from "./UserBanner"; +import NestBanner from "./NestBanner"; interface NavLinkItem { id: string; @@ -119,6 +120,7 @@ const Navigation = (props: Props) => { className={clsx("w-full h-full overflow-auto flex flex-col justify-start items-start py-4 md:pt-6 z-30 hide-scrollbar", className)} > +
{navLinks.map((navLink) => ( { + const { collapsed } = props; + const user = useCurrentUser(); + const commonContext = useCommonContext(); + + const handleNestChange = (nest: number) => { + commonContext.setNest(nest) + } + + return ( +
+ + +
+ + {!collapsed && Nest{commonContext.nest}} +
+
+ + {[0, 1].map((item) => ( + handleNestChange(item)} key={item}> + Nest{item} + + ))} + +
+
+ ); +}; + +export default NestBanner; diff --git a/web/src/components/NestIcon.tsx b/web/src/components/NestIcon.tsx new file mode 100644 index 0000000000000..314b6fce4abe3 --- /dev/null +++ b/web/src/components/NestIcon.tsx @@ -0,0 +1,8 @@ +import clsx from "clsx"; +import { BirdIcon } from "lucide-react"; + +const NestIcon = () => { + return ; +}; + +export default NestIcon; From 9a62aa9f4ed6df571cd09ad0b2aceb1e06c012ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 16:56:56 +0100 Subject: [PATCH 07/34] feat(nest): filter requests with selected nest --- web/src/components/ExploreSidebar/ExploreSidebar.tsx | 6 ++++-- web/src/components/HomeSidebar/HomeSidebar.tsx | 6 ++++-- web/src/components/HomeSidebar/TagsSection.tsx | 4 +++- .../MemoEditor/ActionButton/AddMemoRelationPopover.tsx | 3 +++ web/src/components/MemoEditor/index.tsx | 3 +++ web/src/components/RenameTagDialog.tsx | 4 +++- web/src/hooks/index.ts | 1 + web/src/pages/Home.tsx | 5 ++++- web/src/store/v1/memoMetadata.ts | 3 ++- 9 files changed, 27 insertions(+), 8 deletions(-) diff --git a/web/src/components/ExploreSidebar/ExploreSidebar.tsx b/web/src/components/ExploreSidebar/ExploreSidebar.tsx index a550d5db8d644..ed491250d17e9 100644 --- a/web/src/components/ExploreSidebar/ExploreSidebar.tsx +++ b/web/src/components/ExploreSidebar/ExploreSidebar.tsx @@ -4,6 +4,7 @@ import useDebounce from "react-use/lib/useDebounce"; import SearchBar from "@/components/SearchBar"; import { useMemoList, useMemoMetadataStore } from "@/store/v1"; import TagsSection from "../HomeSidebar/TagsSection"; +import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { className?: string; @@ -13,14 +14,15 @@ const ExploreSidebar = (props: Props) => { const location = useLocation(); const memoList = useMemoList(); const memoMetadataStore = useMemoMetadataStore(); + const nest = useCurrentNest(); useDebounce( async () => { if (memoList.size() === 0) return; - await memoMetadataStore.fetchMemoMetadata({ location }); + await memoMetadataStore.fetchMemoMetadata({ location, nest }); }, 300, - [memoList.size(), location.pathname], + [memoList.size(), location.pathname, nest], ); return ( diff --git a/web/src/components/HomeSidebar/HomeSidebar.tsx b/web/src/components/HomeSidebar/HomeSidebar.tsx index 11a9d29285e0b..335448682ddfb 100644 --- a/web/src/components/HomeSidebar/HomeSidebar.tsx +++ b/web/src/components/HomeSidebar/HomeSidebar.tsx @@ -6,6 +6,7 @@ import UserStatisticsView from "@/components/UserStatisticsView"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useMemoList, useMemoMetadataStore } from "@/store/v1"; import TagsSection from "./TagsSection"; +import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { className?: string; @@ -16,13 +17,14 @@ const HomeSidebar = (props: Props) => { const user = useCurrentUser(); const memoList = useMemoList(); const memoMetadataStore = useMemoMetadataStore(); + const nest = useCurrentNest(); useDebounce( async () => { - await memoMetadataStore.fetchMemoMetadata({ user, location }); + await memoMetadataStore.fetchMemoMetadata({ user, location, nest }); }, 300, - [memoList.size(), user, location.pathname], + [memoList.size(), user, location.pathname, nest], ); return ( diff --git a/web/src/components/HomeSidebar/TagsSection.tsx b/web/src/components/HomeSidebar/TagsSection.tsx index 7a078cf91cb03..1619fe1173230 100644 --- a/web/src/components/HomeSidebar/TagsSection.tsx +++ b/web/src/components/HomeSidebar/TagsSection.tsx @@ -11,6 +11,7 @@ import { useTranslate } from "@/utils/i18n"; import showRenameTagDialog from "../RenameTagDialog"; import TagTree from "../TagTree"; import { Popover, PopoverContent, PopoverTrigger } from "../ui/Popover"; +import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { readonly?: boolean; @@ -26,6 +27,7 @@ const TagsSection = (props: Props) => { const tags = Object.entries(useMemoTagList()) .sort((a, b) => a[0].localeCompare(b[0])) .sort((a, b) => b[1] - a[1]); + const nest = useCurrentNest(); const handleTagClick = (tag: string) => { const isActive = memoFilterStore.getFiltersByFactor("tagSearch").some((filter) => filter.value === tag); @@ -46,7 +48,7 @@ const TagsSection = (props: Props) => { parent: "memos/-", tag: tag, }); - await memoMetadataStore.fetchMemoMetadata({ user, location }); + await memoMetadataStore.fetchMemoMetadata({ user, location, nest }); toast.success(t("message.deleted-successfully")); } }; diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx index ead9cc3d76a02..6096d05d63309 100644 --- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx +++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx @@ -14,6 +14,7 @@ import { Memo, MemoView } from "@/types/proto/api/v1/memo_service"; import { useTranslate } from "@/utils/i18n"; import { EditorRefActions } from "../Editor"; import { MemoEditorContext } from "../types"; +import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { editorRef: React.RefObject; @@ -30,6 +31,7 @@ const AddMemoRelationPopover = (props: Props) => { const [selectedMemos, setSelectedMemos] = useState([]); const [embedded, setEmbedded] = useState(false); const [popoverOpen, setPopoverOpen] = useState(false); + const nest = useCurrentNest(); const filteredMemos = fetchedMemos.filter( (memo) => @@ -45,6 +47,7 @@ const AddMemoRelationPopover = (props: Props) => { setIsFetching(true); try { const filters = [`creator == "${user.name}"`, `row_status == "NORMAL"`]; + filters.push(`nest == ${nest}`); if (searchText) { filters.push(`content_search == [${JSON.stringify(searchText)}]`); } diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index 6caeb2a6c2c4e..32badb7b53424 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -33,6 +33,7 @@ import RelationListView from "./RelationListView"; import ResourceListView from "./ResourceListView"; import { handleEditorKeydownWithMarkdownShortcuts, hyperlinkHighlightedText } from "./handlers"; import { MemoEditorContext } from "./types"; +import useCurrentNest from "@/hooks/useCurrentNest"; export interface Props { className?: string; @@ -90,6 +91,7 @@ const MemoEditor = (props: Props) => { const workspaceMemoRelatedSetting = workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.MEMO_RELATED)?.memoRelatedSetting || WorkspaceMemoRelatedSetting.fromPartial({}); + const nest = useCurrentNest(); useEffect(() => { editorRef.current?.setContent(contentCache || ""); @@ -338,6 +340,7 @@ const MemoEditor = (props: Props) => { resources: state.resourceList, relations: state.relationList, location: state.location, + nest, }) : memoServiceClient .createMemoComment({ diff --git a/web/src/components/RenameTagDialog.tsx b/web/src/components/RenameTagDialog.tsx index 3e14d95be2197..3e6d981b3f8ce 100644 --- a/web/src/components/RenameTagDialog.tsx +++ b/web/src/components/RenameTagDialog.tsx @@ -9,6 +9,7 @@ import useLoading from "@/hooks/useLoading"; import { useMemoMetadataStore } from "@/store/v1"; import { useTranslate } from "@/utils/i18n"; import { generateDialog } from "./Dialog"; +import useCurrentNest from "@/hooks/useCurrentNest"; interface Props extends DialogProps { tag: string; @@ -21,6 +22,7 @@ const RenameTagDialog: React.FC = (props: Props) => { const [newName, setNewName] = useState(tag); const requestState = useLoading(false); const user = useCurrentUser(); + const nest = useCurrentNest(); const handleTagNameInputChange = (e: React.ChangeEvent) => { setNewName(e.target.value.trim()); @@ -43,7 +45,7 @@ const RenameTagDialog: React.FC = (props: Props) => { newTag: newName, }); toast.success("Rename tag successfully"); - memoMetadataStore.fetchMemoMetadata({ user }); + memoMetadataStore.fetchMemoMetadata({ user , nest }); } catch (error: any) { console.error(error); toast.error(error.details); diff --git a/web/src/hooks/index.ts b/web/src/hooks/index.ts index eec8f21436fb3..ee9992f58ab0f 100644 --- a/web/src/hooks/index.ts +++ b/web/src/hooks/index.ts @@ -3,3 +3,4 @@ export * from "./useCurrentUser"; export * from "./useNavigateTo"; export * from "./useAsyncEffect"; export * from "./useResponsiveWidth"; +export * from "./useCurrentNest"; diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index f98a71bed6c92..ebc858279951f 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -12,14 +12,17 @@ import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import { useMemoFilterStore } from "@/store/v1"; import { RowStatus } from "@/types/proto/api/v1/common"; import { Memo } from "@/types/proto/api/v1/memo_service"; +import useCurrentNest from "@/hooks/useCurrentNest"; const Home = () => { const { md } = useResponsiveWidth(); const user = useCurrentUser(); const memoFilterStore = useMemoFilterStore(); + const nest = useCurrentNest(); const memoListFilter = useMemo(() => { const filters = [`creator == "${user.name}"`, `row_status == "NORMAL"`, `order_by_pinned == true`]; + filters.push(`nest == ${nest}`); const contentSearch: string[] = []; const tagSearch: string[] = []; for (const filter of memoFilterStore.filters) { @@ -51,7 +54,7 @@ const Home = () => { filters.push(`tag_search == [${tagSearch.join(", ")}]`); } return filters.join(" && "); - }, [user, memoFilterStore.filters, memoFilterStore.orderByTimeAsc]); + }, [user, memoFilterStore.filters, memoFilterStore.orderByTimeAsc, nest]); return (
diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts index 2c92f3852d85a..059977e866338 100644 --- a/web/src/store/v1/memoMetadata.ts +++ b/web/src/store/v1/memoMetadata.ts @@ -26,8 +26,9 @@ export const useMemoMetadataStore = create( combine(getDefaultState(), (set, get) => ({ setState: (state: State) => set(state), getState: () => get(), - fetchMemoMetadata: async (params: { user?: User; location?: Location }) => { + fetchMemoMetadata: async (params: { user?: User; location?: Location; nest?: number}) => { const filters = [`row_status == "NORMAL"`]; + filters.push(`nest == ${params.nest}`); if (params.user) { if (params.location?.pathname === Routes.EXPLORE) { filters.push(`visibilities == ["PUBLIC", "PROTECTED"]`); From 0cfd2fc1ab07e2127b6391a8c2346699fa55447e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 17:36:50 +0100 Subject: [PATCH 08/34] feat(nest): fix eslint --- .../ExploreSidebar/ExploreSidebar.tsx | 2 +- .../components/HomeSidebar/HomeSidebar.tsx | 2 +- .../components/HomeSidebar/TagsSection.tsx | 2 +- .../ActionButton/AddMemoRelationPopover.tsx | 2 +- web/src/components/MemoEditor/index.tsx | 2 +- web/src/components/Navigation.tsx | 2 +- web/src/components/NestBanner.tsx | 20 ++++++++++--------- web/src/components/RenameTagDialog.tsx | 4 ++-- web/src/pages/Home.tsx | 2 +- web/src/store/v1/memoMetadata.ts | 2 +- 10 files changed, 21 insertions(+), 19 deletions(-) diff --git a/web/src/components/ExploreSidebar/ExploreSidebar.tsx b/web/src/components/ExploreSidebar/ExploreSidebar.tsx index ed491250d17e9..56c0a1af95deb 100644 --- a/web/src/components/ExploreSidebar/ExploreSidebar.tsx +++ b/web/src/components/ExploreSidebar/ExploreSidebar.tsx @@ -2,9 +2,9 @@ import clsx from "clsx"; import { useLocation } from "react-router-dom"; import useDebounce from "react-use/lib/useDebounce"; import SearchBar from "@/components/SearchBar"; +import useCurrentNest from "@/hooks/useCurrentNest"; import { useMemoList, useMemoMetadataStore } from "@/store/v1"; import TagsSection from "../HomeSidebar/TagsSection"; -import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { className?: string; diff --git a/web/src/components/HomeSidebar/HomeSidebar.tsx b/web/src/components/HomeSidebar/HomeSidebar.tsx index 335448682ddfb..0a68c06a322fb 100644 --- a/web/src/components/HomeSidebar/HomeSidebar.tsx +++ b/web/src/components/HomeSidebar/HomeSidebar.tsx @@ -3,10 +3,10 @@ import { useLocation } from "react-router-dom"; import useDebounce from "react-use/lib/useDebounce"; import SearchBar from "@/components/SearchBar"; import UserStatisticsView from "@/components/UserStatisticsView"; +import useCurrentNest from "@/hooks/useCurrentNest"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useMemoList, useMemoMetadataStore } from "@/store/v1"; import TagsSection from "./TagsSection"; -import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { className?: string; diff --git a/web/src/components/HomeSidebar/TagsSection.tsx b/web/src/components/HomeSidebar/TagsSection.tsx index 1619fe1173230..91392eabbfb1c 100644 --- a/web/src/components/HomeSidebar/TagsSection.tsx +++ b/web/src/components/HomeSidebar/TagsSection.tsx @@ -5,13 +5,13 @@ import toast from "react-hot-toast"; import { useLocation } from "react-router-dom"; import useLocalStorage from "react-use/lib/useLocalStorage"; import { memoServiceClient } from "@/grpcweb"; +import useCurrentNest from "@/hooks/useCurrentNest"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useMemoFilterStore, useMemoMetadataStore, useMemoTagList } from "@/store/v1"; import { useTranslate } from "@/utils/i18n"; import showRenameTagDialog from "../RenameTagDialog"; import TagTree from "../TagTree"; import { Popover, PopoverContent, PopoverTrigger } from "../ui/Popover"; -import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { readonly?: boolean; diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx index 6096d05d63309..85eda3e405e6e 100644 --- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx +++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx @@ -8,13 +8,13 @@ import useDebounce from "react-use/lib/useDebounce"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/Popover"; import { memoServiceClient } from "@/grpcweb"; import { DEFAULT_LIST_MEMOS_PAGE_SIZE } from "@/helpers/consts"; +import useCurrentNest from "@/hooks/useCurrentNest"; import useCurrentUser from "@/hooks/useCurrentUser"; import { MemoRelation_Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_relation_service"; import { Memo, MemoView } from "@/types/proto/api/v1/memo_service"; import { useTranslate } from "@/utils/i18n"; import { EditorRefActions } from "../Editor"; import { MemoEditorContext } from "../types"; -import useCurrentNest from "@/hooks/useCurrentNest"; interface Props { editorRef: React.RefObject; diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index 32badb7b53424..6694c70f3aafc 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -12,6 +12,7 @@ import { memoServiceClient } from "@/grpcweb"; import { TAB_SPACE_WIDTH } from "@/helpers/consts"; import { isValidUrl } from "@/helpers/utils"; import useAsyncEffect from "@/hooks/useAsyncEffect"; +import useCurrentNest from "@/hooks/useCurrentNest"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useMemoStore, useResourceStore, useUserStore, useWorkspaceSettingStore } from "@/store/v1"; import { MemoRelation, MemoRelation_Type } from "@/types/proto/api/v1/memo_relation_service"; @@ -33,7 +34,6 @@ import RelationListView from "./RelationListView"; import ResourceListView from "./ResourceListView"; import { handleEditorKeydownWithMarkdownShortcuts, hyperlinkHighlightedText } from "./handlers"; import { MemoEditorContext } from "./types"; -import useCurrentNest from "@/hooks/useCurrentNest"; export interface Props { className?: string; diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index f05587e7bd5a0..83e84a6219f79 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -8,8 +8,8 @@ import { Routes } from "@/router"; import { useInboxStore } from "@/store/v1"; import { Inbox_Status } from "@/types/proto/api/v1/inbox_service"; import { useTranslate } from "@/utils/i18n"; -import UserBanner from "./UserBanner"; import NestBanner from "./NestBanner"; +import UserBanner from "./UserBanner"; interface NavLinkItem { id: string; diff --git a/web/src/components/NestBanner.tsx b/web/src/components/NestBanner.tsx index 9bb0dc36c4682..e0b2dc45c455f 100644 --- a/web/src/components/NestBanner.tsx +++ b/web/src/components/NestBanner.tsx @@ -1,8 +1,8 @@ import { Dropdown, Menu, MenuButton, MenuItem } from "@mui/joy"; import clsx from "clsx"; import useCurrentUser from "@/hooks/useCurrentUser"; -import NestIcon from "./NestIcon"; import { useCommonContext } from "@/layouts/CommonContextProvider"; +import NestIcon from "./NestIcon"; interface Props { collapsed?: boolean; @@ -14,8 +14,8 @@ const NestBanner = (props: Props) => { const commonContext = useCommonContext(); const handleNestChange = (nest: number) => { - commonContext.setNest(nest) - } + commonContext.setNest(nest); + }; return (
@@ -28,15 +28,17 @@ const NestBanner = (props: Props) => { )} > - {!collapsed && Nest{commonContext.nest}} + {!collapsed && ( + Nest{commonContext.nest} + )}
- {[0, 1].map((item) => ( - handleNestChange(item)} key={item}> - Nest{item} - - ))} + {[0, 1].map((item) => ( + handleNestChange(item)} key={item}> + Nest{item} + + ))}
diff --git a/web/src/components/RenameTagDialog.tsx b/web/src/components/RenameTagDialog.tsx index 3e6d981b3f8ce..dff476e57ba82 100644 --- a/web/src/components/RenameTagDialog.tsx +++ b/web/src/components/RenameTagDialog.tsx @@ -4,12 +4,12 @@ import { XIcon } from "lucide-react"; import React, { useState } from "react"; import { toast } from "react-hot-toast"; import { memoServiceClient } from "@/grpcweb"; +import useCurrentNest from "@/hooks/useCurrentNest"; import useCurrentUser from "@/hooks/useCurrentUser"; import useLoading from "@/hooks/useLoading"; import { useMemoMetadataStore } from "@/store/v1"; import { useTranslate } from "@/utils/i18n"; import { generateDialog } from "./Dialog"; -import useCurrentNest from "@/hooks/useCurrentNest"; interface Props extends DialogProps { tag: string; @@ -45,7 +45,7 @@ const RenameTagDialog: React.FC = (props: Props) => { newTag: newName, }); toast.success("Rename tag successfully"); - memoMetadataStore.fetchMemoMetadata({ user , nest }); + memoMetadataStore.fetchMemoMetadata({ user, nest }); } catch (error: any) { console.error(error); toast.error(error.details); diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index ebc858279951f..32fd8c3c16b4a 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -7,12 +7,12 @@ import MemoFilters from "@/components/MemoFilters"; import MemoView from "@/components/MemoView"; import MobileHeader from "@/components/MobileHeader"; import PagedMemoList from "@/components/PagedMemoList"; +import useCurrentNest from "@/hooks/useCurrentNest"; import useCurrentUser from "@/hooks/useCurrentUser"; import useResponsiveWidth from "@/hooks/useResponsiveWidth"; import { useMemoFilterStore } from "@/store/v1"; import { RowStatus } from "@/types/proto/api/v1/common"; import { Memo } from "@/types/proto/api/v1/memo_service"; -import useCurrentNest from "@/hooks/useCurrentNest"; const Home = () => { const { md } = useResponsiveWidth(); diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts index 059977e866338..ff58761c397c2 100644 --- a/web/src/store/v1/memoMetadata.ts +++ b/web/src/store/v1/memoMetadata.ts @@ -26,7 +26,7 @@ export const useMemoMetadataStore = create( combine(getDefaultState(), (set, get) => ({ setState: (state: State) => set(state), getState: () => get(), - fetchMemoMetadata: async (params: { user?: User; location?: Location; nest?: number}) => { + fetchMemoMetadata: async (params: { user?: User; location?: Location; nest?: number }) => { const filters = [`row_status == "NORMAL"`]; filters.push(`nest == ${params.nest}`); if (params.user) { From 5a5f7eb8a2fd967ad6530b06e4a8d56e4cc200d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 8 Nov 2024 17:44:19 +0100 Subject: [PATCH 09/34] feat(nest): fix migrations --- .../mysql/prod/0.23/00__reactions.sql | 27 ++++++++++++++++--- store/migration/mysql/prod/0.23/01__nests.sql | 20 -------------- .../postgres/prod/0.23/00__reactions.sql | 27 ++++++++++++++++--- .../postgres/prod/0.23/01__nests.sql | 20 -------------- .../sqlite/prod/0.23/00__reactions.sql | 27 ++++++++++++++++--- .../migration/sqlite/prod/0.23/01__nests.sql | 20 -------------- 6 files changed, 72 insertions(+), 69 deletions(-) delete mode 100644 store/migration/mysql/prod/0.23/01__nests.sql delete mode 100644 store/migration/postgres/prod/0.23/01__nests.sql delete mode 100644 store/migration/sqlite/prod/0.23/01__nests.sql diff --git a/store/migration/mysql/prod/0.23/00__reactions.sql b/store/migration/mysql/prod/0.23/00__reactions.sql index 7087558740025..b3cabdb8631a8 100644 --- a/store/migration/mysql/prod/0.23/00__reactions.sql +++ b/store/migration/mysql/prod/0.23/00__reactions.sql @@ -18,9 +18,30 @@ VALUES ( '' ) ON DUPLICATE KEY UPDATE -value = +value = JSON_SET( - value, - '$.reactions', + value, + '$.reactions', JSON_ARRAY('👍', '👎', '💛', '🔥', '👏', '😂', '👌', '🚀', '👀', '🤔', '🤡', '❓') ); + +ALTER TABLE + memo +ADD + COLUMN nest INT NOT NULL DEFAULT 0; + +CREATE TABLE nest ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `uid` VARCHAR(256) NOT NULL, + `creator_id` INT NOT NULL, + `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' +); + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + user; \ No newline at end of file diff --git a/store/migration/mysql/prod/0.23/01__nests.sql b/store/migration/mysql/prod/0.23/01__nests.sql deleted file mode 100644 index e890f090803d1..0000000000000 --- a/store/migration/mysql/prod/0.23/01__nests.sql +++ /dev/null @@ -1,20 +0,0 @@ -ALTER TABLE - memo -ADD - COLUMN nest INT NOT NULL DEFAULT 0; - -CREATE TABLE nest ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `uid` VARCHAR(256) NOT NULL, - `creator_id` INT NOT NULL, - `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' -); - -INSERT INTO - nest (uid, creator_id) -SELECT - 'Personal', id -FROM - user; \ No newline at end of file diff --git a/store/migration/postgres/prod/0.23/00__reactions.sql b/store/migration/postgres/prod/0.23/00__reactions.sql index e0d3e97dfdf26..0c2b735a8a4ca 100644 --- a/store/migration/postgres/prod/0.23/00__reactions.sql +++ b/store/migration/postgres/prod/0.23/00__reactions.sql @@ -18,9 +18,30 @@ VALUES ( '' ) ON CONFLICT("name") DO UPDATE -SET "value" = +SET "value" = jsonb_set( - "system_setting"."value"::jsonb, - '{reactions}', + "system_setting"."value"::jsonb, + '{reactions}', '["👍","👎","💛","🔥","👏","😂","👌","🚀","👀","🤔","🤡","❓"]'::jsonb ); + +ALTER TABLE + memo +ADD + COLUMN nest INTEGER NOT NULL DEFAULT 0; + +CREATE TABLE nest ( + id SERIAL PRIMARY KEY, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + row_status TEXT NOT NULL DEFAULT 'NORMAL' +); + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + "user"; \ No newline at end of file diff --git a/store/migration/postgres/prod/0.23/01__nests.sql b/store/migration/postgres/prod/0.23/01__nests.sql deleted file mode 100644 index 88096f9c41936..0000000000000 --- a/store/migration/postgres/prod/0.23/01__nests.sql +++ /dev/null @@ -1,20 +0,0 @@ -ALTER TABLE - memo -ADD - COLUMN nest INTEGER NOT NULL DEFAULT 0; - -CREATE TABLE nest ( - id SERIAL PRIMARY KEY, - uid TEXT NOT NULL, - creator_id INTEGER NOT NULL, - created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), - updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), - row_status TEXT NOT NULL DEFAULT 'NORMAL' -); - -INSERT INTO - nest (uid, creator_id) -SELECT - 'Personal', id -FROM - "user"; \ No newline at end of file diff --git a/store/migration/sqlite/prod/0.23/00__reactions.sql b/store/migration/sqlite/prod/0.23/00__reactions.sql index 395b556773002..3797ff1eb5224 100644 --- a/store/migration/sqlite/prod/0.23/00__reactions.sql +++ b/store/migration/sqlite/prod/0.23/00__reactions.sql @@ -18,9 +18,30 @@ VALUES ( '' ) ON CONFLICT(name) DO UPDATE -SET value = +SET value = json_set( - value, - '$.reactions', + value, + '$.reactions', json_array('👍', '👎', '💛', '🔥', '👏', '😂', '👌', '🚀', '👀', '🤔', '🤡', '❓') ); + +ALTER TABLE + memo +ADD + COLUMN nest INTEGER NOT NULL DEFAULT 0; + +CREATE TABLE nest ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + uid TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' +); + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + user; \ No newline at end of file diff --git a/store/migration/sqlite/prod/0.23/01__nests.sql b/store/migration/sqlite/prod/0.23/01__nests.sql deleted file mode 100644 index 484d614304371..0000000000000 --- a/store/migration/sqlite/prod/0.23/01__nests.sql +++ /dev/null @@ -1,20 +0,0 @@ -ALTER TABLE - memo -ADD - COLUMN nest INTEGER NOT NULL DEFAULT 0; - -CREATE TABLE nest ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - uid TEXT NOT NULL, - creator_id INTEGER NOT NULL, - created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), - updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), - row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' -); - -INSERT INTO - nest (uid, creator_id) -SELECT - 'Personal', id -FROM - user; \ No newline at end of file From 57bdf7685ebf9ab3f2bc39f14fa8ed597b68678b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Sun, 10 Nov 2024 17:19:16 +0100 Subject: [PATCH 10/34] feat(nest): update metadata on nest change --- web/src/store/v1/memoMetadata.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts index ff58761c397c2..673f6fda923fe 100644 --- a/web/src/store/v1/memoMetadata.ts +++ b/web/src/store/v1/memoMetadata.ts @@ -14,11 +14,13 @@ interface State { // stateId is used to identify the store instance state. // It should be update when any state change. stateId: string; + nest: number; dataMapByName: Record; } const getDefaultState = (): State => ({ stateId: uniqueId(), + nest: 0, dataMapByName: {}, }); @@ -29,6 +31,11 @@ export const useMemoMetadataStore = create( fetchMemoMetadata: async (params: { user?: User; location?: Location; nest?: number }) => { const filters = [`row_status == "NORMAL"`]; filters.push(`nest == ${params.nest}`); + + if (get().nest != params.nest) { + set({ nest: params.nest, dataMapByName: {} }); + } + if (params.user) { if (params.location?.pathname === Routes.EXPLORE) { filters.push(`visibilities == ["PUBLIC", "PROTECTED"]`); From c5b1939fc2bb395abd31c86b18e6353d0bf779f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Mon, 11 Nov 2024 22:44:35 +0100 Subject: [PATCH 11/34] feat(nest): update proto to use nest name as input --- proto/api/v1/memo_service.proto | 4 +- proto/api/v1/nest_service.proto | 108 ++++ proto/gen/api/v1/memo_service.pb.go | 16 +- proto/gen/api/v1/nest_service.pb.go | 629 ++++++++++++++++++++ proto/gen/api/v1/nest_service.pb.gw.go | 711 +++++++++++++++++++++++ proto/gen/api/v1/nest_service_grpc.pb.go | 324 +++++++++++ proto/gen/apidocs.swagger.yaml | 197 ++++++- 7 files changed, 1973 insertions(+), 16 deletions(-) create mode 100644 proto/api/v1/nest_service.proto create mode 100644 proto/gen/api/v1/nest_service.pb.go create mode 100644 proto/gen/api/v1/nest_service.pb.gw.go create mode 100644 proto/gen/api/v1/nest_service_grpc.pb.go diff --git a/proto/api/v1/memo_service.proto b/proto/api/v1/memo_service.proto index d306b9e99063d..f7a91266940bf 100644 --- a/proto/api/v1/memo_service.proto +++ b/proto/api/v1/memo_service.proto @@ -178,7 +178,7 @@ message Memo { optional Location location = 20; // The nest of the memo. - int32 nest = 21; + string nest = 21; } message MemoProperty { @@ -206,7 +206,7 @@ message CreateMemoRequest { optional Location location = 5; - int32 nest = 6; + string nest = 6; } enum MemoView { diff --git a/proto/api/v1/nest_service.proto b/proto/api/v1/nest_service.proto new file mode 100644 index 0000000000000..b87a2efc1497f --- /dev/null +++ b/proto/api/v1/nest_service.proto @@ -0,0 +1,108 @@ +syntax = "proto3"; + +package memos.api.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/httpbody.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "gen/api/v1"; + +service NestService { + // CreateNest creates a new nest. + rpc CreateNest(CreateNestRequest) returns (Nest) { + option (google.api.http) = { + post: "/api/v1/nests" + body: "nest" + }; + } + // ListNests lists all nests. + rpc ListNests(ListNestsRequest) returns (ListNestsResponse) { + option (google.api.http) = {get: "/api/v1/nests"}; + } + // GetNest returns a nest by name. + rpc GetNest(GetNestRequest) returns (Nest) { + option (google.api.http) = {get: "/api/v1/{name=nests/*}"}; + option (google.api.method_signature) = "name"; + } + // GetNestByUid returns a nest by uid. + rpc GetNestByUid(GetNestByUidRequest) returns (Nest) { + option (google.api.http) = {get: "/api/v1/nests:by-uid/{uid}"}; + option (google.api.method_signature) = "uid"; + } + // UpdateNest updates a nest. + rpc UpdateNest(UpdateNestRequest) returns (Nest) { + option (google.api.http) = { + patch: "/api/v1/{nest.name=nests/*}" + body: "nest" + }; + option (google.api.method_signature) = "nest,update_mask"; + } + // DeleteNest deletes a nest by name. + rpc DeleteNest(DeleteNestRequest) returns (google.protobuf.Empty) { + option (google.api.http) = {delete: "/api/v1/{name=nests/*}"}; + option (google.api.method_signature) = "name"; + } +} + +message Nest { + // The name of the nest. + // Format: nests/{id} + // id is the system generated unique identifier. + string name = 1; + + // The user defined id of the nest. + string uid = 2; + + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +message CreateNestRequest { + Nest nest = 1; +} + +message ListNestsRequest { + // The maximum number of nests to return. + int32 page_size = 1; + + // A page token, received from a previous `ListNests` call. + // Provide this to retrieve the subsequent page. + string page_token = 2; +} + +message ListNestsResponse { + repeated Nest nests = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +message GetNestRequest { + // The name of the nest. + // Format: nest/{id} + // id is the system generated unique identifier. + string name = 1; +} + +message GetNestByUidRequest { + // The uid of the nest. + string uid = 1; +} + +message UpdateNestRequest { + Nest nest = 1; + + google.protobuf.FieldMask update_mask = 2; +} + +message DeleteNestRequest { + // The name of the nest. + // Format: nests/{id} + // id is the system generated unique identifier. + string name = 1; +} diff --git a/proto/gen/api/v1/memo_service.pb.go b/proto/gen/api/v1/memo_service.pb.go index 81764093a13b2..fd0730d2ec5ff 100644 --- a/proto/gen/api/v1/memo_service.pb.go +++ b/proto/gen/api/v1/memo_service.pb.go @@ -162,7 +162,7 @@ type Memo struct { // The location of the memo. Location *Location `protobuf:"bytes,20,opt,name=location,proto3,oneof" json:"location,omitempty"` // The nest of the memo. - Nest int32 `protobuf:"varint,21,opt,name=nest,proto3" json:"nest,omitempty"` + Nest string `protobuf:"bytes,21,opt,name=nest,proto3" json:"nest,omitempty"` } func (x *Memo) Reset() { @@ -328,11 +328,11 @@ func (x *Memo) GetLocation() *Location { return nil } -func (x *Memo) GetNest() int32 { +func (x *Memo) GetNest() string { if x != nil { return x.Nest } - return 0 + return "" } type MemoProperty struct { @@ -483,7 +483,7 @@ type CreateMemoRequest struct { Resources []*Resource `protobuf:"bytes,3,rep,name=resources,proto3" json:"resources,omitempty"` Relations []*MemoRelation `protobuf:"bytes,4,rep,name=relations,proto3" json:"relations,omitempty"` Location *Location `protobuf:"bytes,5,opt,name=location,proto3,oneof" json:"location,omitempty"` - Nest int32 `protobuf:"varint,6,opt,name=nest,proto3" json:"nest,omitempty"` + Nest string `protobuf:"bytes,6,opt,name=nest,proto3" json:"nest,omitempty"` } func (x *CreateMemoRequest) Reset() { @@ -551,11 +551,11 @@ func (x *CreateMemoRequest) GetLocation() *Location { return nil } -func (x *CreateMemoRequest) GetNest() int32 { +func (x *CreateMemoRequest) GetNest() string { if x != nil { return x.Nest } - return 0 + return "" } type ListMemosRequest struct { @@ -1720,7 +1720,7 @@ var file_api_v1_memo_service_proto_rawDesc = []byte{ 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, - 0x15, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xae, 0x01, 0x0a, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, @@ -1757,7 +1757,7 @@ var file_api_v1_memo_service_proto_rawDesc = []byte{ 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6e, + 0x12, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x92, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, diff --git a/proto/gen/api/v1/nest_service.pb.go b/proto/gen/api/v1/nest_service.pb.go new file mode 100644 index 0000000000000..b46b4caa08cb1 --- /dev/null +++ b/proto/gen/api/v1/nest_service.pb.go @@ -0,0 +1,629 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.1 +// protoc (unknown) +// source: api/v1/nest_service.proto + +package apiv1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + _ "google.golang.org/genproto/googleapis/api/httpbody" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +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 Nest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the nest. + // Format: nests/{id} + // id is the system generated unique identifier. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The user defined id of the nest. + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` + CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` +} + +func (x *Nest) Reset() { + *x = Nest{} + mi := &file_api_v1_nest_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Nest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Nest) ProtoMessage() {} + +func (x *Nest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 Nest.ProtoReflect.Descriptor instead. +func (*Nest) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Nest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Nest) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *Nest) GetCreateTime() *timestamppb.Timestamp { + if x != nil { + return x.CreateTime + } + return nil +} + +type CreateNestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Nest *Nest `protobuf:"bytes,1,opt,name=nest,proto3" json:"nest,omitempty"` +} + +func (x *CreateNestRequest) Reset() { + *x = CreateNestRequest{} + mi := &file_api_v1_nest_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateNestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNestRequest) ProtoMessage() {} + +func (x *CreateNestRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 CreateNestRequest.ProtoReflect.Descriptor instead. +func (*CreateNestRequest) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateNestRequest) GetNest() *Nest { + if x != nil { + return x.Nest + } + return nil +} + +type ListNestsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The maximum number of nests to return. + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + // A page token, received from a previous `ListNests` call. + // Provide this to retrieve the subsequent page. + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` +} + +func (x *ListNestsRequest) Reset() { + *x = ListNestsRequest{} + mi := &file_api_v1_nest_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListNestsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListNestsRequest) ProtoMessage() {} + +func (x *ListNestsRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 ListNestsRequest.ProtoReflect.Descriptor instead. +func (*ListNestsRequest) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListNestsRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListNestsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListNestsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Nests []*Nest `protobuf:"bytes,1,rep,name=nests,proto3" json:"nests,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` +} + +func (x *ListNestsResponse) Reset() { + *x = ListNestsResponse{} + mi := &file_api_v1_nest_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListNestsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListNestsResponse) ProtoMessage() {} + +func (x *ListNestsResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 ListNestsResponse.ProtoReflect.Descriptor instead. +func (*ListNestsResponse) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{3} +} + +func (x *ListNestsResponse) GetNests() []*Nest { + if x != nil { + return x.Nests + } + return nil +} + +func (x *ListNestsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type GetNestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the nest. + // Format: nest/{id} + // id is the system generated unique identifier. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *GetNestRequest) Reset() { + *x = GetNestRequest{} + mi := &file_api_v1_nest_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetNestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNestRequest) ProtoMessage() {} + +func (x *GetNestRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 GetNestRequest.ProtoReflect.Descriptor instead. +func (*GetNestRequest) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{4} +} + +func (x *GetNestRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetNestByUidRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The uid of the nest. + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` +} + +func (x *GetNestByUidRequest) Reset() { + *x = GetNestByUidRequest{} + mi := &file_api_v1_nest_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetNestByUidRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetNestByUidRequest) ProtoMessage() {} + +func (x *GetNestByUidRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 GetNestByUidRequest.ProtoReflect.Descriptor instead. +func (*GetNestByUidRequest) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{5} +} + +func (x *GetNestByUidRequest) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +type UpdateNestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Nest *Nest `protobuf:"bytes,1,opt,name=nest,proto3" json:"nest,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` +} + +func (x *UpdateNestRequest) Reset() { + *x = UpdateNestRequest{} + mi := &file_api_v1_nest_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateNestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNestRequest) ProtoMessage() {} + +func (x *UpdateNestRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 UpdateNestRequest.ProtoReflect.Descriptor instead. +func (*UpdateNestRequest) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateNestRequest) GetNest() *Nest { + if x != nil { + return x.Nest + } + return nil +} + +func (x *UpdateNestRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type DeleteNestRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the nest. + // Format: nests/{id} + // id is the system generated unique identifier. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeleteNestRequest) Reset() { + *x = DeleteNestRequest{} + mi := &file_api_v1_nest_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteNestRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteNestRequest) ProtoMessage() {} + +func (x *DeleteNestRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v1_nest_service_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 DeleteNestRequest.ProtoReflect.Descriptor instead. +func (*DeleteNestRequest) Descriptor() ([]byte, []int) { + return file_api_v1_nest_service_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteNestRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_api_v1_nest_service_proto protoreflect.FileDescriptor + +var file_api_v1_nest_service_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, + 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, + 0x74, 0x70, 0x62, 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, + 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, + 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6f, 0x0a, 0x04, + 0x4e, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0xe2, 0x41, 0x01, + 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3b, 0x0a, + 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x22, 0x4e, 0x0a, 0x10, 0x4c, 0x69, + 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, + 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x65, 0x0a, 0x11, 0x4c, 0x69, + 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x28, 0x0a, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, + 0x73, 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, + 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x65, + 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, + 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, + 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x27, 0x0a, 0x11, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x32, 0x96, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, + 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, + 0x6e, 0x65, 0x73, 0x74, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, + 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, + 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, + 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6f, 0x0a, 0x0c, + 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x12, 0x21, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, + 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, + 0x65, 0x73, 0x74, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, + 0x3a, 0x62, 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x7f, 0x0a, + 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, + 0x22, 0x3c, 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x04, 0x6e, 0x65, 0x73, + 0x74, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, + 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, + 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa8, 0x01, 0x0a, + 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, + 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_v1_nest_service_proto_rawDescOnce sync.Once + file_api_v1_nest_service_proto_rawDescData = file_api_v1_nest_service_proto_rawDesc +) + +func file_api_v1_nest_service_proto_rawDescGZIP() []byte { + file_api_v1_nest_service_proto_rawDescOnce.Do(func() { + file_api_v1_nest_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v1_nest_service_proto_rawDescData) + }) + return file_api_v1_nest_service_proto_rawDescData +} + +var file_api_v1_nest_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_api_v1_nest_service_proto_goTypes = []any{ + (*Nest)(nil), // 0: memos.api.v1.Nest + (*CreateNestRequest)(nil), // 1: memos.api.v1.CreateNestRequest + (*ListNestsRequest)(nil), // 2: memos.api.v1.ListNestsRequest + (*ListNestsResponse)(nil), // 3: memos.api.v1.ListNestsResponse + (*GetNestRequest)(nil), // 4: memos.api.v1.GetNestRequest + (*GetNestByUidRequest)(nil), // 5: memos.api.v1.GetNestByUidRequest + (*UpdateNestRequest)(nil), // 6: memos.api.v1.UpdateNestRequest + (*DeleteNestRequest)(nil), // 7: memos.api.v1.DeleteNestRequest + (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp + (*fieldmaskpb.FieldMask)(nil), // 9: google.protobuf.FieldMask + (*emptypb.Empty)(nil), // 10: google.protobuf.Empty +} +var file_api_v1_nest_service_proto_depIdxs = []int32{ + 8, // 0: memos.api.v1.Nest.create_time:type_name -> google.protobuf.Timestamp + 0, // 1: memos.api.v1.CreateNestRequest.nest:type_name -> memos.api.v1.Nest + 0, // 2: memos.api.v1.ListNestsResponse.nests:type_name -> memos.api.v1.Nest + 0, // 3: memos.api.v1.UpdateNestRequest.nest:type_name -> memos.api.v1.Nest + 9, // 4: memos.api.v1.UpdateNestRequest.update_mask:type_name -> google.protobuf.FieldMask + 1, // 5: memos.api.v1.NestService.CreateNest:input_type -> memos.api.v1.CreateNestRequest + 2, // 6: memos.api.v1.NestService.ListNests:input_type -> memos.api.v1.ListNestsRequest + 4, // 7: memos.api.v1.NestService.GetNest:input_type -> memos.api.v1.GetNestRequest + 5, // 8: memos.api.v1.NestService.GetNestByUid:input_type -> memos.api.v1.GetNestByUidRequest + 6, // 9: memos.api.v1.NestService.UpdateNest:input_type -> memos.api.v1.UpdateNestRequest + 7, // 10: memos.api.v1.NestService.DeleteNest:input_type -> memos.api.v1.DeleteNestRequest + 0, // 11: memos.api.v1.NestService.CreateNest:output_type -> memos.api.v1.Nest + 3, // 12: memos.api.v1.NestService.ListNests:output_type -> memos.api.v1.ListNestsResponse + 0, // 13: memos.api.v1.NestService.GetNest:output_type -> memos.api.v1.Nest + 0, // 14: memos.api.v1.NestService.GetNestByUid:output_type -> memos.api.v1.Nest + 0, // 15: memos.api.v1.NestService.UpdateNest:output_type -> memos.api.v1.Nest + 10, // 16: memos.api.v1.NestService.DeleteNest:output_type -> google.protobuf.Empty + 11, // [11:17] is the sub-list for method output_type + 5, // [5:11] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_api_v1_nest_service_proto_init() } +func file_api_v1_nest_service_proto_init() { + if File_api_v1_nest_service_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_v1_nest_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_v1_nest_service_proto_goTypes, + DependencyIndexes: file_api_v1_nest_service_proto_depIdxs, + MessageInfos: file_api_v1_nest_service_proto_msgTypes, + }.Build() + File_api_v1_nest_service_proto = out.File + file_api_v1_nest_service_proto_rawDesc = nil + file_api_v1_nest_service_proto_goTypes = nil + file_api_v1_nest_service_proto_depIdxs = nil +} diff --git a/proto/gen/api/v1/nest_service.pb.gw.go b/proto/gen/api/v1/nest_service.pb.gw.go new file mode 100644 index 0000000000000..e5f20d1d39639 --- /dev/null +++ b/proto/gen/api/v1/nest_service.pb.gw.go @@ -0,0 +1,711 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: api/v1/nest_service.proto + +/* +Package apiv1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package apiv1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_NestService_CreateNest_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateNestRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Nest); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateNest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NestService_CreateNest_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateNestRequest + var metadata runtime.ServerMetadata + + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Nest); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateNest(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_NestService_ListNests_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_NestService_ListNests_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListNestsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NestService_ListNests_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListNests(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NestService_ListNests_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListNestsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NestService_ListNests_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListNests(ctx, &protoReq) + return msg, metadata, err + +} + +func request_NestService_GetNest_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNestRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.GetNest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NestService_GetNest_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNestRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.GetNest(ctx, &protoReq) + return msg, metadata, err + +} + +func request_NestService_GetNestByUid_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNestByUidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") + } + + protoReq.Uid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) + } + + msg, err := client.GetNestByUid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NestService_GetNestByUid_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNestByUidRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["uid"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") + } + + protoReq.Uid, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) + } + + msg, err := server.GetNestByUid(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_NestService_UpdateNest_0 = &utilities.DoubleArray{Encoding: map[string]int{"nest": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} +) + +func request_NestService_UpdateNest_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateNestRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Nest); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Nest); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["nest.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nest.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "nest.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nest.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NestService_UpdateNest_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateNest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NestService_UpdateNest_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateNestRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Nest); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Nest); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["nest.name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nest.name") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "nest.name", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nest.name", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NestService_UpdateNest_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateNest(ctx, &protoReq) + return msg, metadata, err + +} + +func request_NestService_DeleteNest_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteNestRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.DeleteNest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_NestService_DeleteNest_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteNestRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.DeleteNest(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterNestServiceHandlerServer registers the http handlers for service NestService to "mux". +// UnaryRPC :call NestServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterNestServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NestServiceServer) error { + + mux.Handle("POST", pattern_NestService_CreateNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/CreateNest", runtime.WithHTTPPathPattern("/api/v1/nests")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NestService_CreateNest_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_CreateNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_NestService_ListNests_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/ListNests", runtime.WithHTTPPathPattern("/api/v1/nests")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NestService_ListNests_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_ListNests_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_NestService_GetNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/GetNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NestService_GetNest_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_GetNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_NestService_GetNestByUid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/GetNestByUid", runtime.WithHTTPPathPattern("/api/v1/nests:by-uid/{uid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NestService_GetNestByUid_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_GetNestByUid_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_NestService_UpdateNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/UpdateNest", runtime.WithHTTPPathPattern("/api/v1/{nest.name=nests/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NestService_UpdateNest_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_UpdateNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_NestService_DeleteNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_NestService_DeleteNest_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_DeleteNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterNestServiceHandlerFromEndpoint is same as RegisterNestServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterNestServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterNestServiceHandler(ctx, mux, conn) +} + +// RegisterNestServiceHandler registers the http handlers for service NestService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterNestServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterNestServiceHandlerClient(ctx, mux, NewNestServiceClient(conn)) +} + +// RegisterNestServiceHandlerClient registers the http handlers for service NestService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NestServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NestServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "NestServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterNestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NestServiceClient) error { + + mux.Handle("POST", pattern_NestService_CreateNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/CreateNest", runtime.WithHTTPPathPattern("/api/v1/nests")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NestService_CreateNest_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_CreateNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_NestService_ListNests_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/ListNests", runtime.WithHTTPPathPattern("/api/v1/nests")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NestService_ListNests_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_ListNests_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_NestService_GetNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/GetNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NestService_GetNest_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_GetNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_NestService_GetNestByUid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/GetNestByUid", runtime.WithHTTPPathPattern("/api/v1/nests:by-uid/{uid}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NestService_GetNestByUid_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_GetNestByUid_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_NestService_UpdateNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/UpdateNest", runtime.WithHTTPPathPattern("/api/v1/{nest.name=nests/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NestService_UpdateNest_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_UpdateNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_NestService_DeleteNest_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_NestService_DeleteNest_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_NestService_DeleteNest_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_NestService_CreateNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "nests"}, "")) + + pattern_NestService_ListNests_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "nests"}, "")) + + pattern_NestService_GetNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "name"}, "")) + + pattern_NestService_GetNestByUid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "nests:by-uid", "uid"}, "")) + + pattern_NestService_UpdateNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "nest.name"}, "")) + + pattern_NestService_DeleteNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "name"}, "")) +) + +var ( + forward_NestService_CreateNest_0 = runtime.ForwardResponseMessage + + forward_NestService_ListNests_0 = runtime.ForwardResponseMessage + + forward_NestService_GetNest_0 = runtime.ForwardResponseMessage + + forward_NestService_GetNestByUid_0 = runtime.ForwardResponseMessage + + forward_NestService_UpdateNest_0 = runtime.ForwardResponseMessage + + forward_NestService_DeleteNest_0 = runtime.ForwardResponseMessage +) diff --git a/proto/gen/api/v1/nest_service_grpc.pb.go b/proto/gen/api/v1/nest_service_grpc.pb.go new file mode 100644 index 0000000000000..2cbfc25207a98 --- /dev/null +++ b/proto/gen/api/v1/nest_service_grpc.pb.go @@ -0,0 +1,324 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: api/v1/nest_service.proto + +package apiv1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// 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 ( + NestService_CreateNest_FullMethodName = "/memos.api.v1.NestService/CreateNest" + NestService_ListNests_FullMethodName = "/memos.api.v1.NestService/ListNests" + NestService_GetNest_FullMethodName = "/memos.api.v1.NestService/GetNest" + NestService_GetNestByUid_FullMethodName = "/memos.api.v1.NestService/GetNestByUid" + NestService_UpdateNest_FullMethodName = "/memos.api.v1.NestService/UpdateNest" + NestService_DeleteNest_FullMethodName = "/memos.api.v1.NestService/DeleteNest" +) + +// NestServiceClient is the client API for NestService 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 NestServiceClient interface { + // CreateNest creates a new nest. + CreateNest(ctx context.Context, in *CreateNestRequest, opts ...grpc.CallOption) (*Nest, error) + // ListNests lists all nests. + ListNests(ctx context.Context, in *ListNestsRequest, opts ...grpc.CallOption) (*ListNestsResponse, error) + // GetNest returns a nest by name. + GetNest(ctx context.Context, in *GetNestRequest, opts ...grpc.CallOption) (*Nest, error) + // GetNestByUid returns a nest by uid. + GetNestByUid(ctx context.Context, in *GetNestByUidRequest, opts ...grpc.CallOption) (*Nest, error) + // UpdateNest updates a nest. + UpdateNest(ctx context.Context, in *UpdateNestRequest, opts ...grpc.CallOption) (*Nest, error) + // DeleteNest deletes a nest by name. + DeleteNest(ctx context.Context, in *DeleteNestRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) +} + +type nestServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNestServiceClient(cc grpc.ClientConnInterface) NestServiceClient { + return &nestServiceClient{cc} +} + +func (c *nestServiceClient) CreateNest(ctx context.Context, in *CreateNestRequest, opts ...grpc.CallOption) (*Nest, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Nest) + err := c.cc.Invoke(ctx, NestService_CreateNest_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nestServiceClient) ListNests(ctx context.Context, in *ListNestsRequest, opts ...grpc.CallOption) (*ListNestsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListNestsResponse) + err := c.cc.Invoke(ctx, NestService_ListNests_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nestServiceClient) GetNest(ctx context.Context, in *GetNestRequest, opts ...grpc.CallOption) (*Nest, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Nest) + err := c.cc.Invoke(ctx, NestService_GetNest_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nestServiceClient) GetNestByUid(ctx context.Context, in *GetNestByUidRequest, opts ...grpc.CallOption) (*Nest, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Nest) + err := c.cc.Invoke(ctx, NestService_GetNestByUid_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nestServiceClient) UpdateNest(ctx context.Context, in *UpdateNestRequest, opts ...grpc.CallOption) (*Nest, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Nest) + err := c.cc.Invoke(ctx, NestService_UpdateNest_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nestServiceClient) DeleteNest(ctx context.Context, in *DeleteNestRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, NestService_DeleteNest_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NestServiceServer is the server API for NestService service. +// All implementations must embed UnimplementedNestServiceServer +// for forward compatibility. +type NestServiceServer interface { + // CreateNest creates a new nest. + CreateNest(context.Context, *CreateNestRequest) (*Nest, error) + // ListNests lists all nests. + ListNests(context.Context, *ListNestsRequest) (*ListNestsResponse, error) + // GetNest returns a nest by name. + GetNest(context.Context, *GetNestRequest) (*Nest, error) + // GetNestByUid returns a nest by uid. + GetNestByUid(context.Context, *GetNestByUidRequest) (*Nest, error) + // UpdateNest updates a nest. + UpdateNest(context.Context, *UpdateNestRequest) (*Nest, error) + // DeleteNest deletes a nest by name. + DeleteNest(context.Context, *DeleteNestRequest) (*emptypb.Empty, error) + mustEmbedUnimplementedNestServiceServer() +} + +// UnimplementedNestServiceServer 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 UnimplementedNestServiceServer struct{} + +func (UnimplementedNestServiceServer) CreateNest(context.Context, *CreateNestRequest) (*Nest, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateNest not implemented") +} +func (UnimplementedNestServiceServer) ListNests(context.Context, *ListNestsRequest) (*ListNestsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListNests not implemented") +} +func (UnimplementedNestServiceServer) GetNest(context.Context, *GetNestRequest) (*Nest, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNest not implemented") +} +func (UnimplementedNestServiceServer) GetNestByUid(context.Context, *GetNestByUidRequest) (*Nest, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNestByUid not implemented") +} +func (UnimplementedNestServiceServer) UpdateNest(context.Context, *UpdateNestRequest) (*Nest, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateNest not implemented") +} +func (UnimplementedNestServiceServer) DeleteNest(context.Context, *DeleteNestRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteNest not implemented") +} +func (UnimplementedNestServiceServer) mustEmbedUnimplementedNestServiceServer() {} +func (UnimplementedNestServiceServer) testEmbeddedByValue() {} + +// UnsafeNestServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to NestServiceServer will +// result in compilation errors. +type UnsafeNestServiceServer interface { + mustEmbedUnimplementedNestServiceServer() +} + +func RegisterNestServiceServer(s grpc.ServiceRegistrar, srv NestServiceServer) { + // If the following call pancis, it indicates UnimplementedNestServiceServer 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(&NestService_ServiceDesc, srv) +} + +func _NestService_CreateNest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NestServiceServer).CreateNest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NestService_CreateNest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NestServiceServer).CreateNest(ctx, req.(*CreateNestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NestService_ListNests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListNestsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NestServiceServer).ListNests(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NestService_ListNests_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NestServiceServer).ListNests(ctx, req.(*ListNestsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NestService_GetNest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NestServiceServer).GetNest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NestService_GetNest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NestServiceServer).GetNest(ctx, req.(*GetNestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NestService_GetNestByUid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNestByUidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NestServiceServer).GetNestByUid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NestService_GetNestByUid_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NestServiceServer).GetNestByUid(ctx, req.(*GetNestByUidRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NestService_UpdateNest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NestServiceServer).UpdateNest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NestService_UpdateNest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NestServiceServer).UpdateNest(ctx, req.(*UpdateNestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NestService_DeleteNest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteNestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NestServiceServer).DeleteNest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NestService_DeleteNest_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NestServiceServer).DeleteNest(ctx, req.(*DeleteNestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// NestService_ServiceDesc is the grpc.ServiceDesc for NestService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var NestService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "memos.api.v1.NestService", + HandlerType: (*NestServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateNest", + Handler: _NestService_CreateNest_Handler, + }, + { + MethodName: "ListNests", + Handler: _NestService_ListNests_Handler, + }, + { + MethodName: "GetNest", + Handler: _NestService_GetNest_Handler, + }, + { + MethodName: "GetNestByUid", + Handler: _NestService_GetNestByUid_Handler, + }, + { + MethodName: "UpdateNest", + Handler: _NestService_UpdateNest_Handler, + }, + { + MethodName: "DeleteNest", + Handler: _NestService_DeleteNest_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/v1/nest_service.proto", +} diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index ff726efadb1ff..021ae601bd617 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -11,6 +11,7 @@ tags: - name: MarkdownService - name: ResourceService - name: MemoService + - name: NestService - name: WebhookService - name: WorkspaceService - name: WorkspaceSettingService @@ -381,6 +382,76 @@ paths: type: string tags: - MemoService + /api/v1/nests: + get: + summary: ListNests lists all nests. + operationId: NestService_ListNests + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1ListNestsResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: pageSize + description: The maximum number of nests to return. + in: query + required: false + type: integer + format: int32 + - name: pageToken + description: |- + A page token, received from a previous `ListNests` call. + Provide this to retrieve the subsequent page. + in: query + required: false + type: string + tags: + - NestService + post: + summary: CreateNest creates a new nest. + operationId: NestService_CreateNest + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1Nest' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: nest + in: body + required: true + schema: + $ref: '#/definitions/v1Nest' + tags: + - NestService + /api/v1/nests:by-uid/{uid}: + get: + summary: GetNestByUid returns a nest by uid. + operationId: NestService_GetNestByUid + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1Nest' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: uid + description: The uid of the nest. + in: path + required: true + type: string + tags: + - NestService /api/v1/reactions/{reactionId}: delete: summary: DeleteMemoReaction deletes a reaction for a memo. @@ -902,8 +973,7 @@ paths: $ref: '#/definitions/apiv1Location' description: The location of the memo. nest: - type: integer - format: int32 + type: string description: The nest of the memo. tags: - MemoService @@ -1101,6 +1171,56 @@ paths: pattern: memos/[^/]+ tags: - MemoService + /api/v1/{name_5}: + get: + summary: GetNest returns a nest by name. + operationId: NestService_GetNest + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1Nest' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: name_5 + description: |- + The name of the nest. + Format: nest/{id} + id is the system generated unique identifier. + in: path + required: true + type: string + pattern: nests/[^/]+ + tags: + - NestService + delete: + summary: DeleteNest deletes a nest by name. + operationId: NestService_DeleteNest + responses: + "200": + description: A successful response. + schema: + type: object + properties: {} + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: name_5 + description: |- + The name of the nest. + Format: nests/{id} + id is the system generated unique identifier. + in: path + required: true + type: string + pattern: nests/[^/]+ + tags: + - NestService /api/v1/{name}: get: summary: GetActivity returns the activity with the given id. @@ -1465,6 +1585,44 @@ paths: pattern: users/[^/]+ tags: - UserService + /api/v1/{nest.name}: + patch: + summary: UpdateNest updates a nest. + operationId: NestService_UpdateNest + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1Nest' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: nest.name + description: |- + The name of the nest. + Format: nests/{id} + id is the system generated unique identifier. + in: path + required: true + type: string + pattern: nests/[^/]+ + - name: nest + in: body + required: true + schema: + type: object + properties: + uid: + type: string + description: The user defined id of the nest. + createTime: + type: string + format: date-time + readOnly: true + tags: + - NestService /api/v1/{parent}/tags/{tag}: delete: summary: DeleteMemoTag deletes a tag for a memo. @@ -2038,8 +2196,7 @@ definitions: $ref: '#/definitions/apiv1Location' description: The location of the memo. nest: - type: integer - format: int32 + type: string description: The nest of the memo. apiv1OAuth2Config: type: object @@ -2428,8 +2585,7 @@ definitions: location: $ref: '#/definitions/apiv1Location' nest: - type: integer - format: int32 + type: string v1CreateWebhookRequest: type: object properties: @@ -2615,6 +2771,19 @@ definitions: description: |- A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + v1ListNestsResponse: + type: object + properties: + nests: + type: array + items: + type: object + $ref: '#/definitions/v1Nest' + nextPageToken: + type: string + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. v1ListNode: type: object properties: @@ -2731,6 +2900,22 @@ definitions: description: |2- - MEMO_VIEW_FULL: The full view of the memo. Includes all fields. - MEMO_VIEW_METADATA_ONLY: The metadata only view of the memo. Excludes the content/snippet fields. + v1Nest: + type: object + properties: + name: + type: string + description: |- + The name of the nest. + Format: nests/{id} + id is the system generated unique identifier. + uid: + type: string + description: The user defined id of the nest. + createTime: + type: string + format: date-time + readOnly: true v1Node: type: object properties: From 76c645124462c3227e8750b4a9d676cd60e497eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Mon, 11 Nov 2024 22:45:44 +0100 Subject: [PATCH 12/34] feat(nest): add nest_service.go --- server/router/api/v1/memo_service.go | 19 +- server/router/api/v1/nest_service.go | 279 ++++++++++++++++++++++++++ server/router/api/v1/resource_name.go | 14 ++ server/router/api/v1/v1.go | 5 + store/db/mysql/memo.go | 2 +- store/db/postgres/memo.go | 2 +- store/db/sqlite/memo.go | 4 +- store/memo.go | 4 +- 8 files changed, 318 insertions(+), 11 deletions(-) create mode 100644 server/router/api/v1/nest_service.go diff --git a/server/router/api/v1/memo_service.go b/server/router/api/v1/memo_service.go index 0e22d0de2e757..b2669d45aa996 100644 --- a/server/router/api/v1/memo_service.go +++ b/server/router/api/v1/memo_service.go @@ -40,10 +40,15 @@ func (s *APIV1Service) CreateMemo(ctx context.Context, request *v1pb.CreateMemoR return nil, status.Errorf(codes.Internal, "failed to get user") } + nestID, err := ExtractNestIDFromName(request.Nest) + if err != nil { + return nil, errors.Wrap(err, "invalid nest") + } + create := &store.Memo{ UID: shortuuid.New(), CreatorID: user.ID, - Nest: request.Nest, + NestID: nestID, Content: request.Content, Visibility: convertVisibilityToStore(request.Visibility), } @@ -832,7 +837,11 @@ func (s *APIV1Service) buildMemoFindWithFilter(ctx context.Context, find *store. find.CreatorID = &user.ID } if filter.Nest != nil { - find.Nest = filter.Nest + nestID, err := ExtractNestIDFromName(*filter.Nest) + if err != nil { + return errors.Wrap(err, "invalid nest") + } + find.NestID = &nestID } if filter.RowStatus != nil { find.RowStatus = filter.RowStatus @@ -905,7 +914,7 @@ var MemoFilterCELAttributes = []cel.EnvOption{ cel.Variable("display_time_before", cel.IntType), cel.Variable("display_time_after", cel.IntType), cel.Variable("creator", cel.StringType), - cel.Variable("nest", cel.IntType), + cel.Variable("nest", cel.StringType), cel.Variable("uid", cel.StringType), cel.Variable("row_status", cel.StringType), cel.Variable("random", cel.BoolType), @@ -926,7 +935,7 @@ type MemoFilter struct { DisplayTimeBefore *int64 DisplayTimeAfter *int64 Creator *string - Nest *int32 + Nest *string RowStatus *store.RowStatus Random bool Limit *int @@ -997,7 +1006,7 @@ func findMemoField(callExpr *expr.Expr_Call, filter *MemoFilter) { creator := callExpr.Args[1].GetConstExpr().GetStringValue() filter.Creator = &creator } else if idExpr.Name == "nest" { - nest := int32(callExpr.Args[1].GetConstExpr().GetInt64Value()) + nest := callExpr.Args[1].GetConstExpr().GetStringValue() filter.Nest = &nest } else if idExpr.Name == "row_status" { rowStatus := store.RowStatus(callExpr.Args[1].GetConstExpr().GetStringValue()) diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go new file mode 100644 index 0000000000000..28c83288e0fad --- /dev/null +++ b/server/router/api/v1/nest_service.go @@ -0,0 +1,279 @@ +package v1 + +import ( + "context" + "fmt" + "time" + + "github.com/pkg/errors" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/timestamppb" + + "github.com/usememos/memos/internal/util" + v1pb "github.com/usememos/memos/proto/gen/api/v1" + "github.com/usememos/memos/store" +) + +func (s *APIV1Service) CreateNest(ctx context.Context, request *v1pb.CreateNestRequest) (*v1pb.Nest, error) { + user, err := s.GetCurrentUser(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get user") + } + + if user == nil { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + create := &store.Nest{ + CreatorID: user.ID, + UID: request.Nest.Name, + } + + nest, err := s.Store.CreateNest(ctx, create) + if err != nil { + return nil, err + } + + nestMessage, err := s.convertNestFromStore(nest) + if err != nil { + return nil, errors.Wrap(err, "failed to convert nest") + } + + return nestMessage, nil +} + +func (s *APIV1Service) ListNests(ctx context.Context, request *v1pb.ListNestsRequest) (*v1pb.ListNestsResponse, error) { + user, err := s.GetCurrentUser(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get user") + } + + if user == nil { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + nestFind := &store.FindNest{ + CreatorID: &user.ID, + } + + var limit, offset int + if request.PageToken != "" { + var pageToken v1pb.PageToken + if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err) + } + limit = int(pageToken.Limit) + offset = int(pageToken.Offset) + } else { + limit = int(request.PageSize) + } + if limit <= 0 { + limit = DefaultPageSize + } + limitPlusOne := limit + 1 + nestFind.Limit = &limitPlusOne + nestFind.Offset = &offset + + nests, err := s.Store.ListNests(ctx, nestFind) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to list nests: %v", err) + } + + nestMessages := []*v1pb.Nest{} + nextPageToken := "" + if len(nests) == limitPlusOne { + nests = nests[:limit] + nextPageToken, err = getPageToken(limit, offset+limit) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get next page token, error: %v", err) + } + } + for _, nest := range nests { + nestMessage, err := s.convertNestFromStore(nest) + if err != nil { + return nil, errors.Wrap(err, "failed to convert nest") + } + nestMessages = append(nestMessages, nestMessage) + } + + response := &v1pb.ListNestsResponse{ + Nests: nestMessages, + NextPageToken: nextPageToken, + } + return response, nil +} + +func (s *APIV1Service) GetNest(ctx context.Context, request *v1pb.GetNestRequest) (*v1pb.Nest, error) { + user, err := s.GetCurrentUser(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get user") + } + + if user == nil { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + id, err := ExtractNestIDFromName(request.Name) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid nest name: %v", err) + } + nest, err := s.Store.GetNest(ctx, &store.FindNest{ + CreatorID: &user.ID, + ID: &id, + }) + if err != nil { + return nil, err + } + if nest == nil { + return nil, status.Errorf(codes.NotFound, "nest not found") + } + + nestMessage, err := s.convertNestFromStore(nest) + if err != nil { + return nil, errors.Wrap(err, "failed to convert nest") + } + return nestMessage, nil +} + +//nolint:all +func (s *APIV1Service) GetNestByUid(ctx context.Context, request *v1pb.GetNestByUidRequest) (*v1pb.Nest, error) { + user, err := s.GetCurrentUser(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get user") + } + + if user == nil { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + nest, err := s.Store.GetNest(ctx, &store.FindNest{ + UID: &request.Uid, + CreatorID: &user.ID, + }) + if err != nil { + return nil, err + } + if nest == nil { + return nil, status.Errorf(codes.NotFound, "nest not found") + } + + nestMessage, err := s.convertNestFromStore(nest) + if err != nil { + return nil, errors.Wrap(err, "failed to convert nest") + } + return nestMessage, nil +} + +func (s *APIV1Service) UpdateNest(ctx context.Context, request *v1pb.UpdateNestRequest) (*v1pb.Nest, error) { + user, err := s.GetCurrentUser(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get user") + } + + if user == nil { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + id, err := ExtractNestIDFromName(request.Nest.Name) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid nest name: %v", err) + } + if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { + return nil, status.Errorf(codes.InvalidArgument, "update mask is required") + } + + nest, err := s.Store.GetNest(ctx, &store.FindNest{ + ID: &id, + }) + if err != nil { + return nil, err + } + if nest == nil { + return nil, status.Errorf(codes.NotFound, "nest not found") + } + + // Only the creator or admin can update the nest. + if nest.CreatorID != user.ID && !isSuperUser(user) { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + currentTs := time.Now().Unix() + update := &store.UpdateNest{ + ID: id, + UpdatedTs: ¤tTs, + } + for _, path := range request.UpdateMask.Paths { + if path == "uid" { + update.UID = &request.Nest.Uid + if !util.UIDMatcher.MatchString(*update.UID) { + return nil, status.Errorf(codes.InvalidArgument, "invalid resource name") + } + } + } + + if err = s.Store.UpdateNest(ctx, update); err != nil { + return nil, status.Errorf(codes.Internal, "failed to update nest") + } + + nest, err = s.Store.GetNest(ctx, &store.FindNest{ + ID: &id, + }) + if err != nil { + return nil, errors.Wrap(err, "failed to get nest") + } + nestMessage, err := s.convertNestFromStore(nest) + if err != nil { + return nil, errors.Wrap(err, "failed to convert nest") + } + + return nestMessage, nil +} + +func (s *APIV1Service) DeleteNest(ctx context.Context, request *v1pb.DeleteNestRequest) (*emptypb.Empty, error) { + user, err := s.GetCurrentUser(ctx) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get user") + } + + if user == nil { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + id, err := ExtractNestIDFromName(request.Name) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid nest name: %v", err) + } + nest, err := s.Store.GetNest(ctx, &store.FindNest{ + ID: &id, + }) + if err != nil { + return nil, err + } + if nest == nil { + return nil, status.Errorf(codes.NotFound, "nest not found") + } + + // Only the creator or admin can update the nest. + if nest.CreatorID != user.ID && !isSuperUser(user) { + return nil, status.Errorf(codes.PermissionDenied, "permission denied") + } + + if err = s.Store.DeleteNest(ctx, &store.DeleteNest{ID: id}); err != nil { + return nil, status.Errorf(codes.Internal, "failed to delete nest") + } + + return &emptypb.Empty{}, nil +} + +func (s *APIV1Service) convertNestFromStore(nest *store.Nest) (*v1pb.Nest, error) { + name := fmt.Sprintf("%s%d", NestNamePrefix, nest.ID) + nestMessage := &v1pb.Nest{ + Name: name, + Uid: nest.UID, + CreateTime: timestamppb.New(time.Unix(nest.CreatedTs, 0)), + } + + return nestMessage, nil +} diff --git a/server/router/api/v1/resource_name.go b/server/router/api/v1/resource_name.go index 94b41836ef3a6..b80a756d70a35 100644 --- a/server/router/api/v1/resource_name.go +++ b/server/router/api/v1/resource_name.go @@ -13,6 +13,7 @@ const ( WorkspaceSettingNamePrefix = "settings/" UserNamePrefix = "users/" MemoNamePrefix = "memos/" + NestNamePrefix = "nests/" ResourceNamePrefix = "resources/" InboxNamePrefix = "inboxes/" StorageNamePrefix = "storages/" @@ -74,6 +75,19 @@ func ExtractMemoIDFromName(name string) (int32, error) { return id, nil } +// ExtractNestIDFromName returns the nest ID from a resource name. +func ExtractNestIDFromName(name string) (int32, error) { + tokens, err := GetNameParentTokens(name, NestNamePrefix) + if err != nil { + return 0, err + } + id, err := util.ConvertStringToInt32(tokens[0]) + if err != nil { + return 0, errors.Errorf("invalid nest ID %q", tokens[0]) + } + return id, nil +} + // ExtractResourceIDFromName returns the resource ID from a resource name. func ExtractResourceIDFromName(name string) (int32, error) { tokens, err := GetNameParentTokens(name, ResourceNamePrefix) diff --git a/server/router/api/v1/v1.go b/server/router/api/v1/v1.go index a8ba11fd0ad63..654fe12e56d79 100644 --- a/server/router/api/v1/v1.go +++ b/server/router/api/v1/v1.go @@ -24,6 +24,7 @@ type APIV1Service struct { v1pb.UnimplementedAuthServiceServer v1pb.UnimplementedUserServiceServer v1pb.UnimplementedMemoServiceServer + v1pb.UnimplementedNestServiceServer v1pb.UnimplementedResourceServiceServer v1pb.UnimplementedInboxServiceServer v1pb.UnimplementedActivityServiceServer @@ -51,6 +52,7 @@ func NewAPIV1Service(secret string, profile *profile.Profile, store *store.Store v1pb.RegisterAuthServiceServer(grpcServer, apiv1Service) v1pb.RegisterUserServiceServer(grpcServer, apiv1Service) v1pb.RegisterMemoServiceServer(grpcServer, apiv1Service) + v1pb.RegisterNestServiceServer(grpcServer, apiv1Service) v1pb.RegisterResourceServiceServer(grpcServer, apiv1Service) v1pb.RegisterInboxServiceServer(grpcServer, apiv1Service) v1pb.RegisterActivityServiceServer(grpcServer, apiv1Service) @@ -88,6 +90,9 @@ func (s *APIV1Service) RegisterGateway(ctx context.Context, echoServer *echo.Ech if err := v1pb.RegisterMemoServiceHandler(ctx, gwMux, conn); err != nil { return err } + if err := v1pb.RegisterNestServiceHandler(ctx, gwMux, conn); err != nil { + return err + } if err := v1pb.RegisterResourceServiceHandler(ctx, gwMux, conn); err != nil { return err } diff --git a/store/db/mysql/memo.go b/store/db/mysql/memo.go index b982506ac3497..19a703f39083a 100644 --- a/store/db/mysql/memo.go +++ b/store/db/mysql/memo.go @@ -58,7 +58,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo if v := find.CreatorID; v != nil { where, args = append(where, "`memo`.`creator_id` = ?"), append(args, *v) } - if v := find.Nest; v != nil { + if v := find.NestID; v != nil { where, args = append(where, "`memo`.`nest` = ?"), append(args, *v) } if v := find.RowStatus; v != nil { diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.go index 6810204ab2d07..ad0fac1060763 100644 --- a/store/db/postgres/memo.go +++ b/store/db/postgres/memo.go @@ -49,7 +49,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo if v := find.CreatorID; v != nil { where, args = append(where, "memo.creator_id = "+placeholder(len(args)+1)), append(args, *v) } - if v := find.Nest; v != nil { + if v := find.NestID; v != nil { where, args = append(where, "memo.nest = "+placeholder(len(args)+1)), append(args, *v) } if v := find.RowStatus; v != nil { diff --git a/store/db/sqlite/memo.go b/store/db/sqlite/memo.go index bf6ea5b6751aa..4365a6e830a2f 100644 --- a/store/db/sqlite/memo.go +++ b/store/db/sqlite/memo.go @@ -23,7 +23,7 @@ func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, e } payload = string(payloadBytes) } - args := []any{create.UID, create.CreatorID, create.Nest, create.Content, create.Visibility, payload} + args := []any{create.UID, create.CreatorID, create.NestID, create.Content, create.Visibility, payload} stmt := "INSERT INTO `memo` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `updated_ts`, `row_status`" if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( @@ -50,7 +50,7 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo if v := find.CreatorID; v != nil { where, args = append(where, "`memo`.`creator_id` = ?"), append(args, *v) } - if v := find.Nest; v != nil { + if v := find.NestID; v != nil { where, args = append(where, "`memo`.`nest` = ?"), append(args, *v) } if v := find.RowStatus; v != nil { diff --git a/store/memo.go b/store/memo.go index 2e7680ca46ff9..701fa90eedeb1 100644 --- a/store/memo.go +++ b/store/memo.go @@ -48,7 +48,7 @@ type Memo struct { // Domain specific fields Content string Visibility Visibility - Nest int32 + NestID int32 Payload *storepb.MemoPayload // Composed fields @@ -71,7 +71,7 @@ type FindMemo struct { // Domain specific fields ContentSearch []string VisibilityList []Visibility - Nest *int32 + NestID *int32 PayloadFind *FindMemoPayload ExcludeContent bool ExcludeComments bool From 7e5e73e6f0fbfb9a641e682a599627e55626ba98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Mon, 11 Nov 2024 22:48:02 +0100 Subject: [PATCH 13/34] feat(nest): use nest type to list nests and filter metadata --- .../ActionButton/AddMemoRelationPopover.tsx | 2 +- web/src/components/MemoEditor/index.tsx | 2 +- web/src/components/NestBanner.tsx | 13 +++-- web/src/grpcweb.ts | 3 ++ web/src/layouts/CommonContextProvider.tsx | 18 ++++--- web/src/pages/Home.tsx | 2 +- web/src/store/v1/memoMetadata.ts | 13 ++--- web/src/store/v1/nest.ts | 51 +++++++++++++++++++ 8 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 web/src/store/v1/nest.ts diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx index 85eda3e405e6e..f2f6a46e76076 100644 --- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx +++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx @@ -47,7 +47,7 @@ const AddMemoRelationPopover = (props: Props) => { setIsFetching(true); try { const filters = [`creator == "${user.name}"`, `row_status == "NORMAL"`]; - filters.push(`nest == ${nest}`); + filters.push(`nest == "${nest.name}"`); if (searchText) { filters.push(`content_search == [${JSON.stringify(searchText)}]`); } diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index 6694c70f3aafc..e8dc1e109f426 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -340,7 +340,7 @@ const MemoEditor = (props: Props) => { resources: state.resourceList, relations: state.relationList, location: state.location, - nest, + nest: nest.name, }) : memoServiceClient .createMemoComment({ diff --git a/web/src/components/NestBanner.tsx b/web/src/components/NestBanner.tsx index e0b2dc45c455f..ef2a2d08092fb 100644 --- a/web/src/components/NestBanner.tsx +++ b/web/src/components/NestBanner.tsx @@ -3,6 +3,8 @@ import clsx from "clsx"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useCommonContext } from "@/layouts/CommonContextProvider"; import NestIcon from "./NestIcon"; +import { useNestList } from "@/store/v1/nest"; +import { Nest } from "@/types/proto/api/v1/nest_service"; interface Props { collapsed?: boolean; @@ -11,9 +13,10 @@ interface Props { const NestBanner = (props: Props) => { const { collapsed } = props; const user = useCurrentUser(); + const nests = useNestList(); const commonContext = useCommonContext(); - const handleNestChange = (nest: number) => { + const handleNestChange = (nest: Nest) => { commonContext.setNest(nest); }; @@ -29,14 +32,14 @@ const NestBanner = (props: Props) => { > {!collapsed && ( - Nest{commonContext.nest} + {commonContext.nest.uid} )} - {[0, 1].map((item) => ( - handleNestChange(item)} key={item}> - Nest{item} + {nests.map((nest) => ( + handleNestChange(nest)} key={nest.uid}> + {nest.uid} ))} diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts index abecc81cbad83..058d5d4025192 100644 --- a/web/src/grpcweb.ts +++ b/web/src/grpcweb.ts @@ -10,6 +10,7 @@ import { UserServiceDefinition } from "./types/proto/api/v1/user_service"; import { WebhookServiceDefinition } from "./types/proto/api/v1/webhook_service"; import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_service"; import { WorkspaceSettingServiceDefinition } from "./types/proto/api/v1/workspace_setting_service"; +import { NestServiceDefinition } from "./types/proto/api/v1/nest_service"; const channel = createChannel( window.location.origin, @@ -41,3 +42,5 @@ export const webhookServiceClient = clientFactory.create(WebhookServiceDefinitio export const markdownServiceClient = clientFactory.create(MarkdownServiceDefinition, channel); export const identityProviderServiceClient = clientFactory.create(IdentityProviderServiceDefinition, channel); + +export const nestServiceClient = clientFactory.create(NestServiceDefinition, channel); diff --git a/web/src/layouts/CommonContextProvider.tsx b/web/src/layouts/CommonContextProvider.tsx index 7e2713dc9f6ef..7518b3d4f4b8c 100644 --- a/web/src/layouts/CommonContextProvider.tsx +++ b/web/src/layouts/CommonContextProvider.tsx @@ -2,6 +2,8 @@ import { createContext, useContext, useEffect, useState } from "react"; import useLocalStorage from "react-use/lib/useLocalStorage"; import { workspaceServiceClient } from "@/grpcweb"; import { useUserStore, useWorkspaceSettingStore } from "@/store/v1"; +import { useNestStore } from "@/store/v1/nest"; +import { Nest } from "@/types/proto/api/v1/nest_service"; import { WorkspaceProfile } from "@/types/proto/api/v1/workspace_service"; import { WorkspaceGeneralSetting, WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; @@ -9,17 +11,17 @@ interface Context { locale: string; appearance: string; profile: WorkspaceProfile; - nest: number; + nest: Nest; setLocale: (locale: string) => void; setAppearance: (appearance: string) => void; - setNest: (nest: number) => void; + setNest: (nest: Nest) => void; } const CommonContext = createContext({ locale: "en", appearance: "system", profile: WorkspaceProfile.fromPartial({}), - nest: 0, + nest: Nest.fromPartial({}), setLocale: () => {}, setAppearance: () => {}, setNest: () => {}, @@ -28,20 +30,22 @@ const CommonContext = createContext({ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { const workspaceSettingStore = useWorkspaceSettingStore(); const userStore = useUserStore(); + const nestStore = useNestStore(); const [initialized, setInitialized] = useState(false); const [commonContext, setCommonContext] = useState>({ locale: "en", appearance: "system", - nest: 0, + nest: Nest.fromPartial({}), profile: WorkspaceProfile.fromPartial({}), }); const [locale] = useLocalStorage("locale", "en"); const [appearance] = useLocalStorage("appearance", "system"); - const [nest] = useLocalStorage("nest", 0); + const [nest] = useLocalStorage("nest", ""); useEffect(() => { const initialWorkspace = async () => { const workspaceProfile = await workspaceServiceClient.getWorkspaceProfile({}); + const nests = await nestStore.fetchNests(); // Initial fetch for workspace settings. (async () => { [WorkspaceSettingKey.GENERAL, WorkspaceSettingKey.MEMO_RELATED].forEach(async (key) => { @@ -55,7 +59,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { setCommonContext({ locale: locale || workspaceGeneralSetting.customProfile?.locale || "en", appearance: appearance || workspaceGeneralSetting.customProfile?.appearance || "system", - nest: nest || 0, + nest: Object.entries(nests)[0][1] || nest || "", profile: workspaceProfile, }); }; @@ -77,7 +81,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { ...commonContext, setLocale: (locale: string) => setCommonContext({ ...commonContext, locale }), setAppearance: (appearance: string) => setCommonContext({ ...commonContext, appearance }), - setNest: (nest: number) => setCommonContext({ ...commonContext, nest }), + setNest: (nest: Nest) => setCommonContext({ ...commonContext, nest }), }} > {!initialized ? null : <>{children}} diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index 32fd8c3c16b4a..b829fabefd46c 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -22,7 +22,7 @@ const Home = () => { const memoListFilter = useMemo(() => { const filters = [`creator == "${user.name}"`, `row_status == "NORMAL"`, `order_by_pinned == true`]; - filters.push(`nest == ${nest}`); + filters.push(`nest == "${nest.name}"`); const contentSearch: string[] = []; const tagSearch: string[] = []; for (const filter of memoFilterStore.filters) { diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts index 673f6fda923fe..b3d62424b6079 100644 --- a/web/src/store/v1/memoMetadata.ts +++ b/web/src/store/v1/memoMetadata.ts @@ -6,6 +6,7 @@ import { memoServiceClient } from "@/grpcweb"; import { Routes } from "@/router"; import { Memo, MemoView } from "@/types/proto/api/v1/memo_service"; import { User } from "@/types/proto/api/v1/user_service"; +import { Nest } from "@/types/proto/api/v1/nest_service"; // Set the maximum number of memos to fetch. const DEFAULT_MEMO_PAGE_SIZE = 1000000; @@ -14,13 +15,13 @@ interface State { // stateId is used to identify the store instance state. // It should be update when any state change. stateId: string; - nest: number; + nest: string; dataMapByName: Record; } const getDefaultState = (): State => ({ stateId: uniqueId(), - nest: 0, + nest: "", dataMapByName: {}, }); @@ -28,12 +29,12 @@ export const useMemoMetadataStore = create( combine(getDefaultState(), (set, get) => ({ setState: (state: State) => set(state), getState: () => get(), - fetchMemoMetadata: async (params: { user?: User; location?: Location; nest?: number }) => { + fetchMemoMetadata: async (params: { user?: User; location?: Location; nest: Nest }) => { const filters = [`row_status == "NORMAL"`]; - filters.push(`nest == ${params.nest}`); + filters.push(`nest == "${params.nest.name}"`); - if (get().nest != params.nest) { - set({ nest: params.nest, dataMapByName: {} }); + if (get().nest != params.nest.name) { + set({ nest: params.nest.name, dataMapByName: {} }); } if (params.user) { diff --git a/web/src/store/v1/nest.ts b/web/src/store/v1/nest.ts new file mode 100644 index 0000000000000..4a169084d6292 --- /dev/null +++ b/web/src/store/v1/nest.ts @@ -0,0 +1,51 @@ +import { create } from "zustand"; +import { combine } from "zustand/middleware"; +import { nestServiceClient } from "@/grpcweb"; +import { CreateNestRequest, Nest, UpdateNestRequest } from "@/types/proto/api/v1/nest_service"; + +interface State { + nestMapByName: Record; +} + +const getDefaultState = (): State => ({ + nestMapByName: {}, +}); + +export const useNestStore = create( + combine(getDefaultState(), (set, get) => ({ + setState: (state: State) => set(state), + getState: () => get(), + fetchNests: async () => { + const { nests } = await nestServiceClient.listNests({}); + const nestMap = get().nestMapByName; + for (const nest of nests) { + nestMap[nest.name] = nest; + } + set({ nestMapByName: nestMap }); + return nestMap + }, + getNestByName: (name: string) => { + const nestMap = get().nestMapByName; + return Object.values(nestMap).find((r) => r.name === name); + }, + async createNest(create: CreateNestRequest): Promise { + const nest = await nestServiceClient.createNest(create); + const nestMap = get().nestMapByName; + nestMap[nest.name] = nest; + return nest; + }, + async updateNest(update: UpdateNestRequest): Promise { + const nest = await nestServiceClient.updateNest(update); + const nestMap = get().nestMapByName; + nestMap[nest.name] = nest; + return nest; + }, + })), +); + +export const useNestList = () => { + const nestStore = useNestStore(); + const nests = Object.values(nestStore.getState().nestMapByName); + + return nests +}; From 22e44329c23d20c62397e2aabdf839eca428838e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Mon, 11 Nov 2024 22:51:15 +0100 Subject: [PATCH 14/34] fix buf lint --- proto/api/v1/nest_service.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/api/v1/nest_service.proto b/proto/api/v1/nest_service.proto index b87a2efc1497f..6f6333fffb4b3 100644 --- a/proto/api/v1/nest_service.proto +++ b/proto/api/v1/nest_service.proto @@ -5,7 +5,6 @@ package memos.api.v1; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; From 37b640e3cbf06d92f3fe78db0f397f3a3c8473a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 00:49:16 +0100 Subject: [PATCH 15/34] feat(nest): add default nest user setting --- proto/api/v1/user_service.proto | 2 + proto/gen/api/v1/nest_service.pb.go | 194 +++++----- proto/gen/api/v1/user_service.pb.go | 330 +++++++++--------- proto/gen/apidocs.swagger.yaml | 6 + proto/gen/store/user_setting.pb.go | 87 +++-- proto/store/user_setting.proto | 3 + server/router/api/v1/auth_service.go | 19 + server/router/api/v1/user_service.go | 36 ++ store/user.go | 9 - store/user_setting.go | 4 + web/src/App.tsx | 1 + .../ActionButton/AddMemoRelationPopover.tsx | 2 +- web/src/components/MemoEditor/index.tsx | 2 +- web/src/components/NestBanner.tsx | 9 +- .../Settings/PreferencesSection.tsx | 33 ++ web/src/layouts/CommonContextProvider.tsx | 17 +- web/src/locales/en.json | 1 + web/src/pages/Home.tsx | 2 +- web/src/pages/SignUp.tsx | 4 +- web/src/store/v1/index.ts | 1 + web/src/store/v1/memoMetadata.ts | 8 +- web/src/store/v1/user.ts | 1 + 22 files changed, 450 insertions(+), 321 deletions(-) diff --git a/proto/api/v1/user_service.proto b/proto/api/v1/user_service.proto index 80fdf98a513a5..a12a5770b7035 100644 --- a/proto/api/v1/user_service.proto +++ b/proto/api/v1/user_service.proto @@ -178,6 +178,8 @@ message UserSetting { string appearance = 3; // The default visibility of the memo. string memo_visibility = 4; + // The default nest of the user. + string nest = 5; } message GetUserSettingRequest { diff --git a/proto/gen/api/v1/nest_service.pb.go b/proto/gen/api/v1/nest_service.pb.go index b46b4caa08cb1..ecfa05b3208c0 100644 --- a/proto/gen/api/v1/nest_service.pb.go +++ b/proto/gen/api/v1/nest_service.pb.go @@ -8,7 +8,6 @@ package apiv1 import ( _ "google.golang.org/genproto/googleapis/api/annotations" - _ "google.golang.org/genproto/googleapis/api/httpbody" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" @@ -452,104 +451,103 @@ var file_api_v1_nest_service_proto_rawDesc = []byte{ 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x68, 0x74, - 0x74, 0x70, 0x62, 0x6f, 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, - 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, - 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6f, 0x0a, 0x04, - 0x4e, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x41, 0x0a, 0x0b, 0x63, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0xe2, 0x41, 0x01, - 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3b, 0x0a, - 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x22, 0x4e, 0x0a, 0x10, 0x4c, 0x69, - 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, - 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, - 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x65, 0x0a, 0x11, 0x4c, 0x69, - 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x28, 0x0a, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, - 0x73, 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, - 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x65, - 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, - 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, - 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, - 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x27, 0x0a, 0x11, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x32, 0x96, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, - 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, - 0x6e, 0x65, 0x73, 0x74, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, - 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, - 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, - 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x6f, 0x0a, 0x04, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, + 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, + 0x41, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x22, + 0x4e, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, + 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x65, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x26, + 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, + 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, + 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, + 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, + 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, + 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, + 0x27, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x96, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x73, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, + 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x62, 0x0a, + 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, + 0x7d, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, + 0x64, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, 0x64, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, + 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, + 0x64, 0x7d, 0x12, 0x7f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6f, 0x0a, 0x0c, - 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x12, 0x21, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, - 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, - 0x65, 0x73, 0x74, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, - 0x3a, 0x62, 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x7f, 0x0a, - 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, - 0x22, 0x3c, 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x04, 0x6e, 0x65, 0x73, - 0x74, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, - 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, - 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa8, 0x01, 0x0a, - 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, - 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3c, 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, + 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, + 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, + 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, + 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, + 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, + 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/api/v1/user_service.pb.go b/proto/gen/api/v1/user_service.pb.go index f007908d5fcf5..d65b4432308b4 100644 --- a/proto/gen/api/v1/user_service.pb.go +++ b/proto/gen/api/v1/user_service.pb.go @@ -648,6 +648,8 @@ type UserSetting struct { Appearance string `protobuf:"bytes,3,opt,name=appearance,proto3" json:"appearance,omitempty"` // The default visibility of the memo. MemoVisibility string `protobuf:"bytes,4,opt,name=memo_visibility,json=memoVisibility,proto3" json:"memo_visibility,omitempty"` + // The default nest of the user. + Nest string `protobuf:"bytes,5,opt,name=nest,proto3" json:"nest,omitempty"` } func (x *UserSetting) Reset() { @@ -708,6 +710,13 @@ func (x *UserSetting) GetMemoVisibility() string { return "" } +func (x *UserSetting) GetNest() string { + if x != nil { + return x.Nest + } + return "" +} + type GetUserSettingRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1174,7 +1183,7 @@ var file_api_v1_user_service_proto_rawDesc = []byte{ 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x27, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x82, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, @@ -1183,168 +1192,169 @@ var file_api_v1_user_service_proto_rawDesc = []byte{ 0x61, 0x70, 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x65, 0x6d, 0x6f, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x22, 0x2b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x22, 0x92, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, - 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x02, 0x52, - 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0xca, 0x01, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x37, - 0x0a, 0x09, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x69, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x22, 0x2b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x39, 0x0a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x04, 0xe2, + 0x41, 0x01, 0x02, 0x52, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x3b, 0x0a, 0x0b, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x08, 0x69, - 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, - 0x41, 0x74, 0x22, 0x31, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x62, 0x0a, 0x1c, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x22, 0xa3, 0x01, 0x0a, 0x1c, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x3e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x48, 0x00, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x22, - 0x55, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xbc, 0x0c, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x70, 0x0a, 0x0b, 0x53, - 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, - 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, - 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x62, 0x0a, - 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, - 0x7d, 0x12, 0x81, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, - 0x74, 0x61, 0x72, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x2a, 0xda, 0x41, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, - 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, - 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x65, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x22, 0xda, 0x41, 0x04, 0x75, 0x73, 0x65, - 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x0d, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x7f, 0x0a, 0x0a, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, - 0x3c, 0xda, 0x41, 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, - 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x04, 0x75, 0x73, 0x65, 0x72, - 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x75, 0x73, 0x65, 0x72, 0x2e, - 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, - 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, - 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7f, 0x0a, 0x0e, 0x47, - 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x23, 0x2e, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0xca, 0x01, 0x0a, 0x0f, 0x55, 0x73, + 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x0a, + 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x37, 0x0a, 0x09, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x08, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x65, + 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x65, 0x78, 0x70, + 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x22, 0x31, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, + 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x62, 0x0a, 0x1c, 0x4c, 0x69, 0x73, + 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, + 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x22, 0xa3, 0x01, + 0x0a, 0x1c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x5f, + 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x48, 0x00, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, + 0x5f, 0x61, 0x74, 0x22, 0x55, 0x0a, 0x1c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xbc, 0x0c, 0x0a, 0x0b, 0x55, + 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, + 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, + 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, + 0x70, 0x0a, 0x0b, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x20, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x25, + 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, + 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x81, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x28, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x2d, 0xda, - 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, - 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0xa5, 0x01, 0x0a, - 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x4d, 0xda, 0x41, 0x13, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x31, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x32, 0x26, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x7d, 0x12, 0xa2, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, - 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x29, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x2a, 0xda, + 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x66, + 0x69, 0x6c, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, + 0x2a, 0x7d, 0x2f, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x65, 0x0a, 0x0a, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x22, 0x22, 0xda, 0x41, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x73, + 0x12, 0x7f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, + 0x73, 0x65, 0x72, 0x22, 0x3c, 0xda, 0x41, 0x10, 0x75, 0x73, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x04, + 0x75, 0x73, 0x65, 0x72, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x75, + 0x73, 0x65, 0x72, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, + 0x7d, 0x12, 0x6c, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, + 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, + 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x12, + 0x7f, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, + 0x67, 0x22, 0x2d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, + 0x12, 0x1e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, + 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x12, 0xa5, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x53, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x4d, 0xda, 0x41, 0x13, 0x73, 0x65, + 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, + 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x31, 0x3a, 0x07, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, + 0x32, 0x26, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x73, 0x65, 0x74, 0x74, 0x69, + 0x6e, 0x67, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x2f, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x7d, 0x12, 0xa2, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x26, 0x12, 0x24, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, - 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x9a, 0x01, 0x0a, 0x15, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x36, - 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x3a, 0x01, 0x2a, - 0x22, 0x24, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0xac, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x12, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x22, 0x4f, 0xda, 0x41, 0x11, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x35, - 0x2a, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, - 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, 0x7b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x55, 0x73, 0x65, 0x72, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, - 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, - 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, - 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, - 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x12, 0x29, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x12, 0x24, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, + 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x9a, 0x01, + 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, + 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x36, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x29, 0x3a, 0x01, 0x2a, 0x22, 0x24, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0xac, 0x01, 0x0a, 0x15, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x41, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x4f, 0xda, 0x41, 0x11, 0x6e, 0x61, 0x6d, + 0x65, 0x2c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x35, 0x2a, 0x33, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x2f, 0x7b, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, + 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, + 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, + 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, + 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, + 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index 021ae601bd617..2135b361ac593 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -1778,6 +1778,9 @@ paths: memoVisibility: type: string description: The default visibility of the memo. + nest: + type: string + description: The default nest of the user. required: - setting tags: @@ -2234,6 +2237,9 @@ definitions: memoVisibility: type: string description: The default visibility of the memo. + nest: + type: string + description: The default nest of the user. apiv1WorkspaceCustomProfile: type: object properties: diff --git a/proto/gen/store/user_setting.pb.go b/proto/gen/store/user_setting.pb.go index d8954f6621222..15df2b116f40e 100644 --- a/proto/gen/store/user_setting.pb.go +++ b/proto/gen/store/user_setting.pb.go @@ -32,6 +32,8 @@ const ( UserSettingKey_APPEARANCE UserSettingKey = 3 // The visibility of the memo. UserSettingKey_MEMO_VISIBILITY UserSettingKey = 4 + // The default nest of the user. + UserSettingKey_NEST UserSettingKey = 5 ) // Enum value maps for UserSettingKey. @@ -42,6 +44,7 @@ var ( 2: "LOCALE", 3: "APPEARANCE", 4: "MEMO_VISIBILITY", + 5: "NEST", } UserSettingKey_value = map[string]int32{ "USER_SETTING_KEY_UNSPECIFIED": 0, @@ -49,6 +52,7 @@ var ( "LOCALE": 2, "APPEARANCE": 3, "MEMO_VISIBILITY": 4, + "NEST": 5, } ) @@ -92,6 +96,7 @@ type UserSetting struct { // *UserSetting_Locale // *UserSetting_Appearance // *UserSetting_MemoVisibility + // *UserSetting_Nest Value isUserSetting_Value `protobuf_oneof:"value"` } @@ -174,6 +179,13 @@ func (x *UserSetting) GetMemoVisibility() string { return "" } +func (x *UserSetting) GetNest() string { + if x, ok := x.GetValue().(*UserSetting_Nest); ok { + return x.Nest + } + return "" +} + type isUserSetting_Value interface { isUserSetting_Value() } @@ -194,6 +206,10 @@ type UserSetting_MemoVisibility struct { MemoVisibility string `protobuf:"bytes,6,opt,name=memo_visibility,json=memoVisibility,proto3,oneof"` } +type UserSetting_Nest struct { + Nest string `protobuf:"bytes,7,opt,name=nest,proto3,oneof"` +} + func (*UserSetting_AccessTokens) isUserSetting_Value() {} func (*UserSetting_Locale) isUserSetting_Value() {} @@ -202,6 +218,8 @@ func (*UserSetting_Appearance) isUserSetting_Value() {} func (*UserSetting_MemoVisibility) isUserSetting_Value() {} +func (*UserSetting_Nest) isUserSetting_Value() {} + type AccessTokensUserSetting struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -308,7 +326,7 @@ var File_store_user_setting_proto protoreflect.FileDescriptor var file_store_user_setting_proto_rawDesc = []byte{ 0x0a, 0x18, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0x92, 0x02, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, + 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x22, 0xa8, 0x02, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, @@ -325,38 +343,40 @@ var file_store_user_setting_proto_rawDesc = []byte{ 0x70, 0x65, 0x61, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x29, 0x0a, 0x0f, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x6d, 0x65, 0x6d, 0x6f, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc4, 0x01, 0x0a, - 0x17, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, - 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x55, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x30, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x1a, - 0x52, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, - 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x2a, 0x76, 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x1c, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, - 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, - 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, - 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x50, 0x50, 0x45, 0x41, 0x52, - 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x56, - 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x10, 0x04, 0x42, 0x9b, 0x01, 0x0a, 0x0f, - 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, - 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, 0x02, - 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x6f, - 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, - 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, 0x6d, - 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0xc4, 0x01, 0x0a, 0x17, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x55, + 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, + 0x6f, 0x72, 0x65, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x1a, 0x52, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x80, 0x01, 0x0a, 0x0e, 0x55, 0x73, + 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x1c, + 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x4b, 0x45, 0x59, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x11, + 0x0a, 0x0d, 0x41, 0x43, 0x43, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x53, 0x10, + 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x4f, 0x43, 0x41, 0x4c, 0x45, 0x10, 0x02, 0x12, 0x0e, 0x0a, + 0x0a, 0x41, 0x50, 0x50, 0x45, 0x41, 0x52, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x03, 0x12, 0x13, 0x0a, + 0x0f, 0x4d, 0x45, 0x4d, 0x4f, 0x5f, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, + 0x10, 0x04, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x45, 0x53, 0x54, 0x10, 0x05, 0x42, 0x9b, 0x01, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, + 0x42, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0xa2, + 0x02, 0x03, 0x4d, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x53, 0x74, + 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, + 0x65, 0xe2, 0x02, 0x17, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -400,6 +420,7 @@ func file_store_user_setting_proto_init() { (*UserSetting_Locale)(nil), (*UserSetting_Appearance)(nil), (*UserSetting_MemoVisibility)(nil), + (*UserSetting_Nest)(nil), } type x struct{} out := protoimpl.TypeBuilder{ diff --git a/proto/store/user_setting.proto b/proto/store/user_setting.proto index 345e8dacdb7bd..c63bbf4ff9462 100644 --- a/proto/store/user_setting.proto +++ b/proto/store/user_setting.proto @@ -14,6 +14,8 @@ enum UserSettingKey { APPEARANCE = 3; // The visibility of the memo. MEMO_VISIBILITY = 4; + // The default nest of the user. + NEST = 5; } message UserSetting { @@ -24,6 +26,7 @@ message UserSetting { string locale = 4; string appearance = 5; string memo_visibility = 6; + string nest = 7; } } diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go index bb7f03390b02a..531d2e3f9dd7a 100644 --- a/server/router/api/v1/auth_service.go +++ b/server/router/api/v1/auth_service.go @@ -221,6 +221,25 @@ func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest) return nil, status.Errorf(codes.Internal, "failed to create user, error: %v", err) } + nest, err := s.Store.CreateNest(ctx, &store.Nest{ + UID: "Personal", + CreatorID: user.ID, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to create default nest: %v", err) + } + + _, err = s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ + UserId: user.ID, + Key: storepb.UserSettingKey_NEST, + Value: &storepb.UserSetting_Nest{ + Nest: fmt.Sprintf("%d", nest.ID), + }, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to upsert user setting: %v", err) + } + if err := s.doSignIn(ctx, user, time.Now().Add(AccessTokenDuration)); err != nil { return nil, status.Errorf(codes.Internal, "failed to sign in, error: %v", err) } diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go index 8a501376044d8..82fdf560a8530 100644 --- a/server/router/api/v1/user_service.go +++ b/server/router/api/v1/user_service.go @@ -162,6 +162,25 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR return nil, status.Errorf(codes.Internal, "failed to create user: %v", err) } + nest, err := s.Store.CreateNest(ctx, &store.Nest{ + UID: "Personal", + CreatorID: user.ID, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to create default nest: %v", err) + } + + _, err = s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ + UserId: user.ID, + Key: storepb.UserSettingKey_NEST, + Value: &storepb.UserSetting_Nest{ + Nest: fmt.Sprintf("%d", nest.ID), + }, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to upsert user setting: %v", err) + } + return convertUserFromStore(user), nil } @@ -284,6 +303,7 @@ func getDefaultUserSetting(workspaceMemoRelatedSetting *storepb.WorkspaceMemoRel Locale: "en", Appearance: "system", MemoVisibility: defaultVisibility, + Nest: "nests/0", } } @@ -313,6 +333,8 @@ func (s *APIV1Service) GetUserSetting(ctx context.Context, _ *v1pb.GetUserSettin userSettingMessage.Appearance = setting.GetAppearance() } else if setting.Key == storepb.UserSettingKey_MEMO_VISIBILITY { userSettingMessage.MemoVisibility = setting.GetMemoVisibility() + } else if setting.Key == storepb.UserSettingKey_NEST { + userSettingMessage.Nest = fmt.Sprintf("%s%s", NestNamePrefix, setting.GetNest()) } } return userSettingMessage, nil @@ -359,6 +381,20 @@ func (s *APIV1Service) UpdateUserSetting(ctx context.Context, request *v1pb.Upda }); err != nil { return nil, status.Errorf(codes.Internal, "failed to upsert user setting: %v", err) } + } else if field == "nest" { + nest, err := ExtractNestIDFromName(request.Setting.Nest) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid nest: %s", request.Setting.Nest) + } + if _, err := s.Store.UpsertUserSetting(ctx, &storepb.UserSetting{ + UserId: user.ID, + Key: storepb.UserSettingKey_NEST, + Value: &storepb.UserSetting_Nest{ + Nest: fmt.Sprintf("%d", nest), + }, + }); err != nil { + return nil, status.Errorf(codes.Internal, "failed to upsert user setting: %v", err) + } } else { return nil, status.Errorf(codes.InvalidArgument, "invalid update path: %s", field) } diff --git a/store/user.go b/store/user.go index 21a9fcb5c3a9f..e61d876ee1a7b 100644 --- a/store/user.go +++ b/store/user.go @@ -100,15 +100,6 @@ func (s *Store) CreateUser(ctx context.Context, create *User) (*User, error) { return nil, err } - nestCreate := &Nest{ - UID: "Personal", - CreatorID: user.ID, - } - _, err = s.driver.CreateNest(ctx, nestCreate) - if err != nil { - return nil, err - } - s.userCache.Store(user.ID, user) return user, nil } diff --git a/store/user_setting.go b/store/user_setting.go index 8ef1bb117cf72..2dfd0297f6f90 100644 --- a/store/user_setting.go +++ b/store/user_setting.go @@ -151,6 +151,8 @@ func convertUserSettingFromRaw(raw *UserSetting) (*storepb.UserSetting, error) { userSetting.Value = &storepb.UserSetting_Appearance{Appearance: raw.Value} case storepb.UserSettingKey_MEMO_VISIBILITY: userSetting.Value = &storepb.UserSetting_MemoVisibility{MemoVisibility: raw.Value} + case storepb.UserSettingKey_NEST: + userSetting.Value = &storepb.UserSetting_Nest{Nest: raw.Value} default: return nil, nil } @@ -177,6 +179,8 @@ func convertUserSettingToRaw(userSetting *storepb.UserSetting) (*UserSetting, er raw.Value = userSetting.GetAppearance() case storepb.UserSettingKey_MEMO_VISIBILITY: raw.Value = userSetting.GetMemoVisibility() + case storepb.UserSettingKey_NEST: + raw.Value = userSetting.GetNest() default: return nil, errors.Errorf("unsupported user setting key: %v", userSetting.Key) } diff --git a/web/src/App.tsx b/web/src/App.tsx index 6aac053da91f8..5b73339b339a0 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -114,6 +114,7 @@ const App = () => { commonContext.setLocale(userSetting.locale); commonContext.setAppearance(userSetting.appearance); + commonContext.setNest(userSetting.nest); }, [userSetting?.locale, userSetting?.appearance]); return ; diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx index f2f6a46e76076..9c1abe8156412 100644 --- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx +++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx @@ -47,7 +47,7 @@ const AddMemoRelationPopover = (props: Props) => { setIsFetching(true); try { const filters = [`creator == "${user.name}"`, `row_status == "NORMAL"`]; - filters.push(`nest == "${nest.name}"`); + filters.push(`nest == "${nest}"`); if (searchText) { filters.push(`content_search == [${JSON.stringify(searchText)}]`); } diff --git a/web/src/components/MemoEditor/index.tsx b/web/src/components/MemoEditor/index.tsx index e8dc1e109f426..5f2be5d1c75c8 100644 --- a/web/src/components/MemoEditor/index.tsx +++ b/web/src/components/MemoEditor/index.tsx @@ -340,7 +340,7 @@ const MemoEditor = (props: Props) => { resources: state.resourceList, relations: state.relationList, location: state.location, - nest: nest.name, + nest: nest, }) : memoServiceClient .createMemoComment({ diff --git a/web/src/components/NestBanner.tsx b/web/src/components/NestBanner.tsx index ef2a2d08092fb..e9497c312df8a 100644 --- a/web/src/components/NestBanner.tsx +++ b/web/src/components/NestBanner.tsx @@ -3,7 +3,7 @@ import clsx from "clsx"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useCommonContext } from "@/layouts/CommonContextProvider"; import NestIcon from "./NestIcon"; -import { useNestList } from "@/store/v1/nest"; +import { useNestList, useNestStore } from "@/store/v1"; import { Nest } from "@/types/proto/api/v1/nest_service"; interface Props { @@ -14,9 +14,10 @@ const NestBanner = (props: Props) => { const { collapsed } = props; const user = useCurrentUser(); const nests = useNestList(); + const nestStore = useNestStore(); const commonContext = useCommonContext(); - const handleNestChange = (nest: Nest) => { + const handleNestChange = (nest: string) => { commonContext.setNest(nest); }; @@ -32,13 +33,13 @@ const NestBanner = (props: Props) => { > {!collapsed && ( - {commonContext.nest.uid} + {nestStore.getNestByName(commonContext.nest)?.uid} )} {nests.map((nest) => ( - handleNestChange(nest)} key={nest.uid}> + handleNestChange(nest.name)} key={nest.uid}> {nest.uid} ))} diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx index c4b9519b324b4..f3bbcb3dfe179 100644 --- a/web/src/components/Settings/PreferencesSection.tsx +++ b/web/src/components/Settings/PreferencesSection.tsx @@ -9,12 +9,16 @@ import AppearanceSelect from "../AppearanceSelect"; import LocaleSelect from "../LocaleSelect"; import VisibilityIcon from "../VisibilityIcon"; import WebhookSection from "./WebhookSection"; +import NestIcon from "../NestIcon"; +import { useNestList, useNestStore } from "@/store/v1/nest"; const PreferencesSection = () => { const t = useTranslate(); const commonContext = useCommonContext(); const userStore = useUserStore(); const setting = userStore.userSetting as UserSetting; + const nests = useNestList(); + const nestStore = useNestStore(); const handleLocaleSelectChange = async (locale: Locale) => { commonContext.setLocale(locale); @@ -45,6 +49,15 @@ const PreferencesSection = () => { ); }; + const handleDefaultNestChanged = async (value: string) => { + await userStore.updateUserSetting( + { + nest: value, + }, + ["nest"], + ); + }; + return (

{t("common.basic")}

@@ -78,6 +91,26 @@ const PreferencesSection = () => { ))}
+
+ {t("setting.preference-section.default-nest")} + +
diff --git a/web/src/layouts/CommonContextProvider.tsx b/web/src/layouts/CommonContextProvider.tsx index 7518b3d4f4b8c..3a6fd2d62114c 100644 --- a/web/src/layouts/CommonContextProvider.tsx +++ b/web/src/layouts/CommonContextProvider.tsx @@ -6,22 +6,23 @@ import { useNestStore } from "@/store/v1/nest"; import { Nest } from "@/types/proto/api/v1/nest_service"; import { WorkspaceProfile } from "@/types/proto/api/v1/workspace_service"; import { WorkspaceGeneralSetting, WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; +import { UserSetting } from "@/types/proto/api/v1/user_service"; interface Context { locale: string; appearance: string; profile: WorkspaceProfile; - nest: Nest; + nest: string; setLocale: (locale: string) => void; setAppearance: (appearance: string) => void; - setNest: (nest: Nest) => void; + setNest: (nest: string) => void; } const CommonContext = createContext({ locale: "en", appearance: "system", profile: WorkspaceProfile.fromPartial({}), - nest: Nest.fromPartial({}), + nest: "none", setLocale: () => {}, setAppearance: () => {}, setNest: () => {}, @@ -35,18 +36,15 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { const [commonContext, setCommonContext] = useState>({ locale: "en", appearance: "system", - nest: Nest.fromPartial({}), + nest: "none", profile: WorkspaceProfile.fromPartial({}), }); const [locale] = useLocalStorage("locale", "en"); const [appearance] = useLocalStorage("appearance", "system"); - const [nest] = useLocalStorage("nest", ""); useEffect(() => { const initialWorkspace = async () => { const workspaceProfile = await workspaceServiceClient.getWorkspaceProfile({}); - const nests = await nestStore.fetchNests(); - // Initial fetch for workspace settings. (async () => { [WorkspaceSettingKey.GENERAL, WorkspaceSettingKey.MEMO_RELATED].forEach(async (key) => { await workspaceSettingStore.fetchWorkspaceSetting(key); @@ -59,7 +57,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { setCommonContext({ locale: locale || workspaceGeneralSetting.customProfile?.locale || "en", appearance: appearance || workspaceGeneralSetting.customProfile?.appearance || "system", - nest: Object.entries(nests)[0][1] || nest || "", + nest: "none", profile: workspaceProfile, }); }; @@ -67,6 +65,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { const initialUser = async () => { try { await userStore.fetchCurrentUser(); + await nestStore.fetchNests(); } catch (error) { // Do nothing. } @@ -81,7 +80,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { ...commonContext, setLocale: (locale: string) => setCommonContext({ ...commonContext, locale }), setAppearance: (appearance: string) => setCommonContext({ ...commonContext, appearance }), - setNest: (nest: Nest) => setCommonContext({ ...commonContext, nest }), + setNest: (nest: string) => setCommonContext({ ...commonContext, nest }), }} > {!initialized ? null : <>{children}} diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 4301742bd7ea8..61d15bd6816c1 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -212,6 +212,7 @@ "preference-section": { "default-memo-sort-option": "Memo display time", "default-memo-visibility": "Default memo visibility", + "default-nest": "Default nest", "theme": "Theme" }, "sso": "SSO", diff --git a/web/src/pages/Home.tsx b/web/src/pages/Home.tsx index b829fabefd46c..3c01d62180af3 100644 --- a/web/src/pages/Home.tsx +++ b/web/src/pages/Home.tsx @@ -22,7 +22,7 @@ const Home = () => { const memoListFilter = useMemo(() => { const filters = [`creator == "${user.name}"`, `row_status == "NORMAL"`, `order_by_pinned == true`]; - filters.push(`nest == "${nest.name}"`); + filters.push(`nest == "${nest}"`); const contentSearch: string[] = []; const tagSearch: string[] = []; for (const filter of memoFilterStore.filters) { diff --git a/web/src/pages/SignUp.tsx b/web/src/pages/SignUp.tsx index 14874213cf468..7677ff85e1b40 100644 --- a/web/src/pages/SignUp.tsx +++ b/web/src/pages/SignUp.tsx @@ -10,7 +10,7 @@ import { authServiceClient } from "@/grpcweb"; import useLoading from "@/hooks/useLoading"; import useNavigateTo from "@/hooks/useNavigateTo"; import { useCommonContext } from "@/layouts/CommonContextProvider"; -import { useUserStore, useWorkspaceSettingStore } from "@/store/v1"; +import { useNestStore, useUserStore, useWorkspaceSettingStore } from "@/store/v1"; import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_service"; import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; @@ -21,6 +21,7 @@ const SignUp = () => { const commonContext = useCommonContext(); const workspaceSettingStore = useWorkspaceSettingStore(); const userStore = useUserStore(); + const nestStore = useNestStore(); const actionBtnLoadingState = useLoading(false); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); @@ -63,6 +64,7 @@ const SignUp = () => { actionBtnLoadingState.setLoading(); await authServiceClient.signUp({ username, password }); await userStore.fetchCurrentUser(); + await nestStore.fetchNests(); navigateTo("/"); } catch (error: any) { console.error(error); diff --git a/web/src/store/v1/index.ts b/web/src/store/v1/index.ts index 9cc46daa2079e..a1e2c0af16762 100644 --- a/web/src/store/v1/index.ts +++ b/web/src/store/v1/index.ts @@ -6,3 +6,4 @@ export * from "./resource"; export * from "./workspaceSetting"; export * from "./memoFilter"; export * from "./memoMetadata"; +export * from "./nest"; diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts index b3d62424b6079..9e9387c44d56c 100644 --- a/web/src/store/v1/memoMetadata.ts +++ b/web/src/store/v1/memoMetadata.ts @@ -29,12 +29,12 @@ export const useMemoMetadataStore = create( combine(getDefaultState(), (set, get) => ({ setState: (state: State) => set(state), getState: () => get(), - fetchMemoMetadata: async (params: { user?: User; location?: Location; nest: Nest }) => { + fetchMemoMetadata: async (params: { user?: User; location?: Location; nest: string }) => { const filters = [`row_status == "NORMAL"`]; - filters.push(`nest == "${params.nest.name}"`); + filters.push(`nest == "${params.nest}"`); - if (get().nest != params.nest.name) { - set({ nest: params.nest.name, dataMapByName: {} }); + if (get().nest != params.nest) { + set({ nest: params.nest, dataMapByName: {} }); } if (params.user) { diff --git a/web/src/store/v1/user.ts b/web/src/store/v1/user.ts index f65a878aa2e0e..9f1b9a00d33f5 100644 --- a/web/src/store/v1/user.ts +++ b/web/src/store/v1/user.ts @@ -21,6 +21,7 @@ const getDefaultUserSetting = () => { locale: "en", appearance: "auto", memoVisibility: "PRIVATE", + nest: "none", }); }; From 8a75c568efe61ad25c0da3149ecec14c04482cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 01:41:13 +0100 Subject: [PATCH 16/34] feat(nest): add create nest popover --- proto/api/v1/nest_service.proto | 4 +- proto/gen/api/v1/nest_service.pb.go | 211 ++++++++++++------------- proto/gen/api/v1/nest_service.pb.gw.go | 4 +- proto/gen/apidocs.swagger.yaml | 4 +- server/router/api/v1/nest_service.go | 2 +- web/src/components/AddNestPopover.tsx | 56 +++++++ web/src/components/NestBanner.tsx | 5 +- web/src/locales/en.json | 3 + 8 files changed, 173 insertions(+), 116 deletions(-) create mode 100644 web/src/components/AddNestPopover.tsx diff --git a/proto/api/v1/nest_service.proto b/proto/api/v1/nest_service.proto index 6f6333fffb4b3..b2510a1f5755a 100644 --- a/proto/api/v1/nest_service.proto +++ b/proto/api/v1/nest_service.proto @@ -16,7 +16,7 @@ service NestService { rpc CreateNest(CreateNestRequest) returns (Nest) { option (google.api.http) = { post: "/api/v1/nests" - body: "nest" + body: "uid" }; } // ListNests lists all nests. @@ -61,7 +61,7 @@ message Nest { } message CreateNestRequest { - Nest nest = 1; + string uid = 1; } message ListNestsRequest { diff --git a/proto/gen/api/v1/nest_service.pb.go b/proto/gen/api/v1/nest_service.pb.go index ecfa05b3208c0..bbc008bea7ecf 100644 --- a/proto/gen/api/v1/nest_service.pb.go +++ b/proto/gen/api/v1/nest_service.pb.go @@ -94,7 +94,7 @@ type CreateNestRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Nest *Nest `protobuf:"bytes,1,opt,name=nest,proto3" json:"nest,omitempty"` + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` } func (x *CreateNestRequest) Reset() { @@ -127,11 +127,11 @@ func (*CreateNestRequest) Descriptor() ([]byte, []int) { return file_api_v1_nest_service_proto_rawDescGZIP(), []int{1} } -func (x *CreateNestRequest) GetNest() *Nest { +func (x *CreateNestRequest) GetUid() string { if x != nil { - return x.Nest + return x.Uid } - return nil + return "" } type ListNestsRequest struct { @@ -464,90 +464,88 @@ var file_api_v1_nest_service_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x22, - 0x4e, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, - 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, - 0x65, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x26, - 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, - 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, - 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, - 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, - 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, - 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, - 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, - 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, - 0x27, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x96, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x73, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, - 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x62, 0x0a, - 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, - 0x7d, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, - 0x64, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, 0x64, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, - 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, - 0x64, 0x7d, 0x12, 0x7f, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x6d, 0x65, 0x22, 0x25, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x4e, 0x0a, 0x10, 0x4c, 0x69, 0x73, + 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, + 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, + 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x65, 0x0a, 0x11, 0x4c, 0x69, 0x73, + 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, + 0x0a, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, + 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, + 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, + 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, + 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, + 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x27, 0x0a, 0x11, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x32, 0x95, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x5d, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3c, 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, - 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, - 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, - 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, - 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, - 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, - 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x03, 0x75, + 0x69, 0x64, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, + 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, + 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, + 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, + 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, + 0x65, 0x73, 0x74, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, + 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, + 0x74, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, + 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, + 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x7f, 0x0a, 0x0a, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, + 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3c, + 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, + 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, + 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, + 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, + 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, + 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, + 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, + 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, + 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, + 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, + 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -578,27 +576,26 @@ var file_api_v1_nest_service_proto_goTypes = []any{ } var file_api_v1_nest_service_proto_depIdxs = []int32{ 8, // 0: memos.api.v1.Nest.create_time:type_name -> google.protobuf.Timestamp - 0, // 1: memos.api.v1.CreateNestRequest.nest:type_name -> memos.api.v1.Nest - 0, // 2: memos.api.v1.ListNestsResponse.nests:type_name -> memos.api.v1.Nest - 0, // 3: memos.api.v1.UpdateNestRequest.nest:type_name -> memos.api.v1.Nest - 9, // 4: memos.api.v1.UpdateNestRequest.update_mask:type_name -> google.protobuf.FieldMask - 1, // 5: memos.api.v1.NestService.CreateNest:input_type -> memos.api.v1.CreateNestRequest - 2, // 6: memos.api.v1.NestService.ListNests:input_type -> memos.api.v1.ListNestsRequest - 4, // 7: memos.api.v1.NestService.GetNest:input_type -> memos.api.v1.GetNestRequest - 5, // 8: memos.api.v1.NestService.GetNestByUid:input_type -> memos.api.v1.GetNestByUidRequest - 6, // 9: memos.api.v1.NestService.UpdateNest:input_type -> memos.api.v1.UpdateNestRequest - 7, // 10: memos.api.v1.NestService.DeleteNest:input_type -> memos.api.v1.DeleteNestRequest - 0, // 11: memos.api.v1.NestService.CreateNest:output_type -> memos.api.v1.Nest - 3, // 12: memos.api.v1.NestService.ListNests:output_type -> memos.api.v1.ListNestsResponse - 0, // 13: memos.api.v1.NestService.GetNest:output_type -> memos.api.v1.Nest - 0, // 14: memos.api.v1.NestService.GetNestByUid:output_type -> memos.api.v1.Nest - 0, // 15: memos.api.v1.NestService.UpdateNest:output_type -> memos.api.v1.Nest - 10, // 16: memos.api.v1.NestService.DeleteNest:output_type -> google.protobuf.Empty - 11, // [11:17] is the sub-list for method output_type - 5, // [5:11] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 0, // 1: memos.api.v1.ListNestsResponse.nests:type_name -> memos.api.v1.Nest + 0, // 2: memos.api.v1.UpdateNestRequest.nest:type_name -> memos.api.v1.Nest + 9, // 3: memos.api.v1.UpdateNestRequest.update_mask:type_name -> google.protobuf.FieldMask + 1, // 4: memos.api.v1.NestService.CreateNest:input_type -> memos.api.v1.CreateNestRequest + 2, // 5: memos.api.v1.NestService.ListNests:input_type -> memos.api.v1.ListNestsRequest + 4, // 6: memos.api.v1.NestService.GetNest:input_type -> memos.api.v1.GetNestRequest + 5, // 7: memos.api.v1.NestService.GetNestByUid:input_type -> memos.api.v1.GetNestByUidRequest + 6, // 8: memos.api.v1.NestService.UpdateNest:input_type -> memos.api.v1.UpdateNestRequest + 7, // 9: memos.api.v1.NestService.DeleteNest:input_type -> memos.api.v1.DeleteNestRequest + 0, // 10: memos.api.v1.NestService.CreateNest:output_type -> memos.api.v1.Nest + 3, // 11: memos.api.v1.NestService.ListNests:output_type -> memos.api.v1.ListNestsResponse + 0, // 12: memos.api.v1.NestService.GetNest:output_type -> memos.api.v1.Nest + 0, // 13: memos.api.v1.NestService.GetNestByUid:output_type -> memos.api.v1.Nest + 0, // 14: memos.api.v1.NestService.UpdateNest:output_type -> memos.api.v1.Nest + 10, // 15: memos.api.v1.NestService.DeleteNest:output_type -> google.protobuf.Empty + 10, // [10:16] is the sub-list for method output_type + 4, // [4:10] 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_api_v1_nest_service_proto_init() } diff --git a/proto/gen/api/v1/nest_service.pb.gw.go b/proto/gen/api/v1/nest_service.pb.gw.go index e5f20d1d39639..3ee5a8d70f730 100644 --- a/proto/gen/api/v1/nest_service.pb.gw.go +++ b/proto/gen/api/v1/nest_service.pb.gw.go @@ -35,7 +35,7 @@ func request_NestService_CreateNest_0(ctx context.Context, marshaler runtime.Mar var protoReq CreateNestRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Nest); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Uid); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -48,7 +48,7 @@ func local_request_NestService_CreateNest_0(ctx context.Context, marshaler runti var protoReq CreateNestRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Nest); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Uid); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index 2135b361ac593..21129ec9303e7 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -424,11 +424,11 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: nest + - name: uid in: body required: true schema: - $ref: '#/definitions/v1Nest' + type: string tags: - NestService /api/v1/nests:by-uid/{uid}: diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go index 28c83288e0fad..ef71439c83f9d 100644 --- a/server/router/api/v1/nest_service.go +++ b/server/router/api/v1/nest_service.go @@ -28,7 +28,7 @@ func (s *APIV1Service) CreateNest(ctx context.Context, request *v1pb.CreateNestR create := &store.Nest{ CreatorID: user.ID, - UID: request.Nest.Name, + UID: request.Uid, } nest, err := s.Store.CreateNest(ctx, create) diff --git a/web/src/components/AddNestPopover.tsx b/web/src/components/AddNestPopover.tsx new file mode 100644 index 0000000000000..400ff417ecf2e --- /dev/null +++ b/web/src/components/AddNestPopover.tsx @@ -0,0 +1,56 @@ +import { Input } from "@mui/joy"; +import { Button } from "@usememos/mui"; +import { PlusIcon } from "lucide-react"; +import { useState } from "react"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/Popover"; +import { useTranslate } from "@/utils/i18n"; +import { useNestStore } from "@/store/v1"; +import { useCommonContext } from "@/layouts/CommonContextProvider"; + +const AddNestPopover = () => { + const t = useTranslate(); + const nestStore = useNestStore(); + const [popoverOpen, setPopoverOpen] = useState(false); + const [nestUID, setNestUID] = useState(""); + const commonContext = useCommonContext(); + + const addNest = async () => { + const nest = await nestStore.createNest({ + uid: nestUID + }) + if (nest) { + await nestStore.fetchNests(); + commonContext.setNest(nest.name); + } + setPopoverOpen(false); + setNestUID(""); + }; + + return ( + + + + + +
+ setNestUID(e.target.value.trim())} + /> +
+ +
+
+
+
+ ); +}; + +export default AddNestPopover diff --git a/web/src/components/NestBanner.tsx b/web/src/components/NestBanner.tsx index e9497c312df8a..135e3ec4f83fe 100644 --- a/web/src/components/NestBanner.tsx +++ b/web/src/components/NestBanner.tsx @@ -4,7 +4,7 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { useCommonContext } from "@/layouts/CommonContextProvider"; import NestIcon from "./NestIcon"; import { useNestList, useNestStore } from "@/store/v1"; -import { Nest } from "@/types/proto/api/v1/nest_service"; +import AddNestPopover from "./AddNestPopover"; interface Props { collapsed?: boolean; @@ -22,7 +22,7 @@ const NestBanner = (props: Props) => { }; return ( -
+
{ ))}
+ ); }; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 61d15bd6816c1..093a2b08bc457 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -143,6 +143,9 @@ "no-memos-found": "No memos found", "search-placeholder": "Search content" }, + "nest": { + "add-nest": "Add nest" + }, "resource": { "clear": "Clear", "copy-link": "Copy Link", From 754e766da8f0732ae16a4e141bd8adbd81b59577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 01:48:50 +0100 Subject: [PATCH 17/34] feat(nest): fix swagger docs --- proto/gen/apidocs.swagger.yaml | 248 ++++++++------------------------- 1 file changed, 60 insertions(+), 188 deletions(-) diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index 21129ec9303e7..d529ac4c5cf4e 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -312,16 +312,12 @@ paths: type: integer format: int32 - name: pageToken - description: |- - A page token, received from a previous `ListMemos` call. - Provide this to retrieve the subsequent page. + description: "A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page." in: query required: false type: string - name: filter - description: |- - Filter is used to filter memos returned in the list. - Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']" + description: "Filter is used to filter memos returned in the list.\r\nFormat: \"creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']\"" in: query required: false type: string @@ -580,9 +576,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: filter - description: |- - Filter is used to filter users returned in the list. - Format: "username == 'frank'" + description: "Filter is used to filter users returned in the list.\r\nFormat: \"username == 'frank'\"" in: query required: false type: string @@ -743,9 +737,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The resource name of the workspace setting. - Format: settings/{setting} + description: "The resource name of the workspace setting.\r\nFormat: settings/{setting}" in: path required: true type: string @@ -767,9 +759,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: |- - name is the name of the setting. - Format: settings/{setting} + description: "name is the name of the setting.\r\nFormat: settings/{setting}" in: path required: true type: string @@ -805,9 +795,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: identityProvider.name - description: |- - The name of the identityProvider. - Format: identityProviders/{id} + description: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" in: path required: true type: string @@ -845,9 +833,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: inbox.name - description: |- - The name of the inbox. - Format: inboxes/{id} + description: "The name of the inbox.\r\nFormat: inboxes/{id}" in: path required: true type: string @@ -891,10 +877,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: memo.name - description: |- - The name of the memo. - Format: memos/{id} - id is the system generated id. + description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." in: path required: true type: string @@ -912,9 +895,7 @@ paths: $ref: '#/definitions/v1RowStatus' creator: type: string - title: |- - The name of the creator. - Format: users/{id} + title: "The name of the creator.\r\nFormat: users/{id}" createTime: type: string format: date-time @@ -961,9 +942,7 @@ paths: readOnly: true parent: type: string - title: |- - The name of the parent memo. - Format: memos/{id} + title: "The name of the parent memo.\r\nFormat: memos/{id}" readOnly: true snippet: type: string @@ -992,9 +971,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1016,9 +993,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: |- - The name of the identityProvider to delete. - Format: identityProviders/{id} + description: "The name of the identityProvider to delete.\r\nFormat: identityProviders/{id}" in: path required: true type: string @@ -1040,9 +1015,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: |- - The name of the identityProvider to get. - Format: identityProviders/{id} + description: "The name of the identityProvider to get.\r\nFormat: identityProviders/{id}" in: path required: true type: string @@ -1064,9 +1037,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: |- - The name of the inbox to delete. - Format: inboxes/{id} + description: "The name of the inbox to delete.\r\nFormat: inboxes/{id}" in: path required: true type: string @@ -1088,10 +1059,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." in: path required: true type: string @@ -1113,10 +1081,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." in: path required: true type: string @@ -1138,9 +1103,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1162,9 +1125,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1236,9 +1197,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the activity. - Format: activities/{id} + description: "The name of the activity.\r\nFormat: activities/{id}" in: path required: true type: string @@ -1260,9 +1219,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1284,9 +1241,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1307,9 +1262,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1337,9 +1290,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1366,9 +1317,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1389,9 +1338,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1418,9 +1365,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1441,9 +1386,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1470,9 +1413,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1494,9 +1435,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1523,9 +1462,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1547,9 +1484,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the memo. - Format: memos/{id} + description: "The name of the memo.\r\nFormat: memos/{id}" in: path required: true type: string @@ -1576,9 +1511,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1639,9 +1572,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: |- - The parent, who owns the tags. - Format: memos/{id}. Use "memos/-" to delete all tags. + description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to delete all tags." in: path required: true type: string @@ -1672,9 +1603,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: |- - The parent, who owns the tags. - Format: memos/{id}. Use "memos/-" to rename all tags. + description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to rename all tags." in: path required: true type: string @@ -1701,10 +1630,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: resource.name - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." in: path required: true type: string @@ -1736,9 +1662,7 @@ paths: format: int64 memo: type: string - title: |- - The related memo. - Format: memos/{id} + title: "The related memo.\r\nFormat: memos/{id}" tags: - ResourceService /api/v1/{setting.name}: @@ -1756,9 +1680,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1800,9 +1722,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: user.name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1858,9 +1778,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the user. - Format: users/{id} + description: "The name of the user.\r\nFormat: users/{id}" in: path required: true type: string @@ -1893,10 +1811,7 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." in: path required: true type: string @@ -2089,9 +2004,7 @@ definitions: properties: name: type: string - title: |- - The name of the identityProvider. - Format: identityProviders/{id} + title: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" type: $ref: '#/definitions/apiv1IdentityProviderType' title: @@ -2127,10 +2040,7 @@ definitions: properties: name: type: string - description: |- - The name of the memo. - Format: memos/{id} - id is the system generated id. + description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." uid: type: string description: The user defined id of the memo. @@ -2138,9 +2048,7 @@ definitions: $ref: '#/definitions/v1RowStatus' creator: type: string - title: |- - The name of the creator. - Format: users/{id} + title: "The name of the creator.\r\nFormat: users/{id}" createTime: type: string format: date-time @@ -2187,9 +2095,7 @@ definitions: readOnly: true parent: type: string - title: |- - The name of the parent memo. - Format: memos/{id} + title: "The name of the parent memo.\r\nFormat: memos/{id}" readOnly: true snippet: type: string @@ -2225,9 +2131,7 @@ definitions: properties: name: type: string - title: |- - The name of the user. - Format: users/{id} + title: "The name of the user.\r\nFormat: users/{id}" locale: type: string description: The preferred locale of the user. @@ -2274,10 +2178,7 @@ definitions: weekStartDayOffset: type: integer format: int32 - description: |- - week_start_day_offset is the week start day offset from Sunday. - 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday - Default is Sunday. + description: "week_start_day_offset is the week start day offset from Sunday.\r\n0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday\r\nDefault is Sunday." disallowChangeUsername: type: boolean description: disallow_change_username disallows changing username. @@ -2328,9 +2229,7 @@ definitions: properties: name: type: string - title: |- - name is the name of the setting. - Format: settings/{setting} + title: "name is the name of the setting.\r\nFormat: settings/{setting}" generalSetting: $ref: '#/definitions/apiv1WorkspaceGeneralSetting' storageSetting: @@ -2345,9 +2244,7 @@ definitions: description: storage_type is the storage type. filepathTemplate: type: string - title: |- - The template of file path. - e.g. assets/{timestamp}_{filename} + title: "The template of file path.\r\ne.g. assets/{timestamp}_{filename}" uploadSizeLimitMb: type: string format: int64 @@ -2506,9 +2403,7 @@ definitions: properties: name: type: string - title: |- - The name of the activity. - Format: activities/{id} + title: "The name of the activity.\r\nFormat: activities/{id}" creatorId: type: integer format: int32 @@ -2653,9 +2548,7 @@ definitions: properties: name: type: string - title: |- - The name of the inbox. - Format: inboxes/{id} + title: "The name of the inbox.\r\nFormat: inboxes/{id}" sender: type: string title: 'Format: users/{id}' @@ -2729,9 +2622,7 @@ definitions: $ref: '#/definitions/v1Inbox' nextPageToken: type: string - description: |- - A token, which can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. + description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages." v1ListMemoCommentsResponse: type: object properties: @@ -2774,9 +2665,7 @@ definitions: $ref: '#/definitions/apiv1Memo' nextPageToken: type: string - description: |- - A token, which can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. + description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages." v1ListNestsResponse: type: object properties: @@ -2865,14 +2754,10 @@ definitions: properties: memo: $ref: '#/definitions/v1MemoRelationMemo' - title: |- - The name of memo. - Format: "memos/{uid}" + title: "The name of memo.\r\nFormat: \"memos/{uid}\"" relatedMemo: $ref: '#/definitions/v1MemoRelationMemo' - title: |- - The name of related memo. - Format: "memos/{uid}" + title: "The name of related memo.\r\nFormat: \"memos/{uid}\"" type: $ref: '#/definitions/v1MemoRelationType' v1MemoRelationMemo: @@ -2880,9 +2765,7 @@ definitions: properties: name: type: string - title: |- - The name of the memo. - Format: memos/{id} + title: "The name of the memo.\r\nFormat: memos/{id}" uid: type: string snippet: @@ -3072,9 +2955,7 @@ definitions: format: int32 creator: type: string - title: |- - The name of the creator. - Format: users/{id} + title: "The name of the creator.\r\nFormat: users/{id}" contentId: type: string reactionType: @@ -3091,10 +2972,7 @@ definitions: properties: name: type: string - description: |- - The name of the resource. - Format: resources/{id} - id is the system generated unique identifier. + description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." uid: type: string description: The user defined id of the resource. @@ -3116,9 +2994,7 @@ definitions: format: int64 memo: type: string - title: |- - The related memo. - Format: memos/{id} + title: "The related memo.\r\nFormat: memos/{id}" v1RestoreMarkdownNodesRequest: type: object properties: @@ -3240,9 +3116,7 @@ definitions: properties: name: type: string - title: |- - The name of the user. - Format: users/{id} + title: "The name of the user.\r\nFormat: users/{id}" id: type: integer format: int32 @@ -3316,9 +3190,7 @@ definitions: properties: owner: type: string - title: |- - The name of instance owner. - Format: "users/{id}" + title: "The name of instance owner.\r\nFormat: \"users/{id}\"" version: type: string title: version is the current version of instance From 7d6832a3ec61b87ebbc3a3143212538af4b1dffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 01:56:09 +0100 Subject: [PATCH 18/34] feat(nest): fix eslint --- web/src/components/AddNestPopover.tsx | 12 ++++++------ web/src/components/NestBanner.tsx | 8 +++++--- .../components/Settings/PreferencesSection.tsx | 16 +++++++--------- web/src/grpcweb.ts | 2 +- web/src/layouts/CommonContextProvider.tsx | 2 -- web/src/store/v1/memoMetadata.ts | 1 - web/src/store/v1/nest.ts | 4 ++-- 7 files changed, 21 insertions(+), 24 deletions(-) diff --git a/web/src/components/AddNestPopover.tsx b/web/src/components/AddNestPopover.tsx index 400ff417ecf2e..d44c6a5433cd2 100644 --- a/web/src/components/AddNestPopover.tsx +++ b/web/src/components/AddNestPopover.tsx @@ -3,21 +3,21 @@ import { Button } from "@usememos/mui"; import { PlusIcon } from "lucide-react"; import { useState } from "react"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/Popover"; -import { useTranslate } from "@/utils/i18n"; -import { useNestStore } from "@/store/v1"; import { useCommonContext } from "@/layouts/CommonContextProvider"; +import { useNestStore } from "@/store/v1"; +import { useTranslate } from "@/utils/i18n"; const AddNestPopover = () => { const t = useTranslate(); const nestStore = useNestStore(); const [popoverOpen, setPopoverOpen] = useState(false); const [nestUID, setNestUID] = useState(""); - const commonContext = useCommonContext(); + const commonContext = useCommonContext(); const addNest = async () => { const nest = await nestStore.createNest({ - uid: nestUID - }) + uid: nestUID, + }); if (nest) { await nestStore.fetchNests(); commonContext.setNest(nest.name); @@ -53,4 +53,4 @@ const AddNestPopover = () => { ); }; -export default AddNestPopover +export default AddNestPopover; diff --git a/web/src/components/NestBanner.tsx b/web/src/components/NestBanner.tsx index 135e3ec4f83fe..174c435c2b1ed 100644 --- a/web/src/components/NestBanner.tsx +++ b/web/src/components/NestBanner.tsx @@ -2,9 +2,9 @@ import { Dropdown, Menu, MenuButton, MenuItem } from "@mui/joy"; import clsx from "clsx"; import useCurrentUser from "@/hooks/useCurrentUser"; import { useCommonContext } from "@/layouts/CommonContextProvider"; -import NestIcon from "./NestIcon"; import { useNestList, useNestStore } from "@/store/v1"; import AddNestPopover from "./AddNestPopover"; +import NestIcon from "./NestIcon"; interface Props { collapsed?: boolean; @@ -33,7 +33,9 @@ const NestBanner = (props: Props) => { > {!collapsed && ( - {nestStore.getNestByName(commonContext.nest)?.uid} + + {nestStore.getNestByName(commonContext.nest)?.uid} + )} @@ -45,7 +47,7 @@ const NestBanner = (props: Props) => { ))} - + ); }; diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx index f3bbcb3dfe179..ffc97fa57eb20 100644 --- a/web/src/components/Settings/PreferencesSection.tsx +++ b/web/src/components/Settings/PreferencesSection.tsx @@ -1,16 +1,16 @@ import { Divider, Option, Select } from "@mui/joy"; import { useCommonContext } from "@/layouts/CommonContextProvider"; import { useUserStore } from "@/store/v1"; +import { useNestList } from "@/store/v1/nest"; import { Visibility } from "@/types/proto/api/v1/memo_service"; import { UserSetting } from "@/types/proto/api/v1/user_service"; import { useTranslate } from "@/utils/i18n"; import { convertVisibilityFromString, convertVisibilityToString } from "@/utils/memo"; import AppearanceSelect from "../AppearanceSelect"; import LocaleSelect from "../LocaleSelect"; +import NestIcon from "../NestIcon"; import VisibilityIcon from "../VisibilityIcon"; import WebhookSection from "./WebhookSection"; -import NestIcon from "../NestIcon"; -import { useNestList, useNestStore } from "@/store/v1/nest"; const PreferencesSection = () => { const t = useTranslate(); @@ -18,7 +18,6 @@ const PreferencesSection = () => { const userStore = useUserStore(); const setting = userStore.userSetting as UserSetting; const nests = useNestList(); - const nestStore = useNestStore(); const handleLocaleSelectChange = async (locale: Locale) => { commonContext.setLocale(locale); @@ -103,12 +102,11 @@ const PreferencesSection = () => { } }} > - {nests - .map((v) => ( - - ))} + {nests.map((v) => ( + + ))} diff --git a/web/src/grpcweb.ts b/web/src/grpcweb.ts index 058d5d4025192..a6f7715859848 100644 --- a/web/src/grpcweb.ts +++ b/web/src/grpcweb.ts @@ -5,12 +5,12 @@ import { IdentityProviderServiceDefinition } from "./types/proto/api/v1/idp_serv import { InboxServiceDefinition } from "./types/proto/api/v1/inbox_service"; import { MarkdownServiceDefinition } from "./types/proto/api/v1/markdown_service"; import { MemoServiceDefinition } from "./types/proto/api/v1/memo_service"; +import { NestServiceDefinition } from "./types/proto/api/v1/nest_service"; import { ResourceServiceDefinition } from "./types/proto/api/v1/resource_service"; import { UserServiceDefinition } from "./types/proto/api/v1/user_service"; import { WebhookServiceDefinition } from "./types/proto/api/v1/webhook_service"; import { WorkspaceServiceDefinition } from "./types/proto/api/v1/workspace_service"; import { WorkspaceSettingServiceDefinition } from "./types/proto/api/v1/workspace_setting_service"; -import { NestServiceDefinition } from "./types/proto/api/v1/nest_service"; const channel = createChannel( window.location.origin, diff --git a/web/src/layouts/CommonContextProvider.tsx b/web/src/layouts/CommonContextProvider.tsx index 3a6fd2d62114c..07696044ed772 100644 --- a/web/src/layouts/CommonContextProvider.tsx +++ b/web/src/layouts/CommonContextProvider.tsx @@ -3,10 +3,8 @@ import useLocalStorage from "react-use/lib/useLocalStorage"; import { workspaceServiceClient } from "@/grpcweb"; import { useUserStore, useWorkspaceSettingStore } from "@/store/v1"; import { useNestStore } from "@/store/v1/nest"; -import { Nest } from "@/types/proto/api/v1/nest_service"; import { WorkspaceProfile } from "@/types/proto/api/v1/workspace_service"; import { WorkspaceGeneralSetting, WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; -import { UserSetting } from "@/types/proto/api/v1/user_service"; interface Context { locale: string; diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts index 9e9387c44d56c..46d5a4a1bb40e 100644 --- a/web/src/store/v1/memoMetadata.ts +++ b/web/src/store/v1/memoMetadata.ts @@ -6,7 +6,6 @@ import { memoServiceClient } from "@/grpcweb"; import { Routes } from "@/router"; import { Memo, MemoView } from "@/types/proto/api/v1/memo_service"; import { User } from "@/types/proto/api/v1/user_service"; -import { Nest } from "@/types/proto/api/v1/nest_service"; // Set the maximum number of memos to fetch. const DEFAULT_MEMO_PAGE_SIZE = 1000000; diff --git a/web/src/store/v1/nest.ts b/web/src/store/v1/nest.ts index 4a169084d6292..d964af9aa3906 100644 --- a/web/src/store/v1/nest.ts +++ b/web/src/store/v1/nest.ts @@ -22,7 +22,7 @@ export const useNestStore = create( nestMap[nest.name] = nest; } set({ nestMapByName: nestMap }); - return nestMap + return nestMap; }, getNestByName: (name: string) => { const nestMap = get().nestMapByName; @@ -47,5 +47,5 @@ export const useNestList = () => { const nestStore = useNestStore(); const nests = Object.values(nestStore.getState().nestMapByName); - return nests + return nests; }; From 63991de36642b5c1f26bcc7a07af9b90d49d80fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 01:58:50 +0100 Subject: [PATCH 19/34] feat(nest): rewrite function as static --- server/router/api/v1/nest_service.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go index ef71439c83f9d..844e2e0b431ac 100644 --- a/server/router/api/v1/nest_service.go +++ b/server/router/api/v1/nest_service.go @@ -36,7 +36,7 @@ func (s *APIV1Service) CreateNest(ctx context.Context, request *v1pb.CreateNestR return nil, err } - nestMessage, err := s.convertNestFromStore(nest) + nestMessage, err := convertNestFromStore(nest) if err != nil { return nil, errors.Wrap(err, "failed to convert nest") } @@ -91,7 +91,7 @@ func (s *APIV1Service) ListNests(ctx context.Context, request *v1pb.ListNestsReq } } for _, nest := range nests { - nestMessage, err := s.convertNestFromStore(nest) + nestMessage, err := convertNestFromStore(nest) if err != nil { return nil, errors.Wrap(err, "failed to convert nest") } @@ -130,7 +130,7 @@ func (s *APIV1Service) GetNest(ctx context.Context, request *v1pb.GetNestRequest return nil, status.Errorf(codes.NotFound, "nest not found") } - nestMessage, err := s.convertNestFromStore(nest) + nestMessage, err := convertNestFromStore(nest) if err != nil { return nil, errors.Wrap(err, "failed to convert nest") } @@ -159,7 +159,7 @@ func (s *APIV1Service) GetNestByUid(ctx context.Context, request *v1pb.GetNestBy return nil, status.Errorf(codes.NotFound, "nest not found") } - nestMessage, err := s.convertNestFromStore(nest) + nestMessage, err := convertNestFromStore(nest) if err != nil { return nil, errors.Wrap(err, "failed to convert nest") } @@ -223,7 +223,7 @@ func (s *APIV1Service) UpdateNest(ctx context.Context, request *v1pb.UpdateNestR if err != nil { return nil, errors.Wrap(err, "failed to get nest") } - nestMessage, err := s.convertNestFromStore(nest) + nestMessage, err := convertNestFromStore(nest) if err != nil { return nil, errors.Wrap(err, "failed to convert nest") } @@ -267,7 +267,7 @@ func (s *APIV1Service) DeleteNest(ctx context.Context, request *v1pb.DeleteNestR return &emptypb.Empty{}, nil } -func (s *APIV1Service) convertNestFromStore(nest *store.Nest) (*v1pb.Nest, error) { +func convertNestFromStore(nest *store.Nest) (*v1pb.Nest, error) { name := fmt.Sprintf("%s%d", NestNamePrefix, nest.ID) nestMessage := &v1pb.Nest{ Name: name, From 6dacec3daf6b6d4dc286f51ab8ab1fd77d9e6549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 19:01:47 +0100 Subject: [PATCH 20/34] feat(nest): add missing nest entry in create and update memo for mysql and postgres --- store/db/mysql/memo.go | 9 ++++++--- store/db/postgres/memo.go | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/store/db/mysql/memo.go b/store/db/mysql/memo.go index 19a703f39083a..4a1a1331c0e0d 100644 --- a/store/db/mysql/memo.go +++ b/store/db/mysql/memo.go @@ -13,8 +13,8 @@ import ( ) func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, error) { - fields := []string{"`uid`", "`creator_id`", "`content`", "`visibility`", "`tags`", "`payload`"} - placeholder := []string{"?", "?", "?", "?", "?", "?"} + fields := []string{"`uid`", "`creator_id`", "`nest`", "`content`", "`visibility`", "`tags`", "`payload`"} + placeholder := []string{"?", "?", "?", "?", "?", "?", "?"} payload := "{}" if create.Payload != nil { payloadBytes, err := protojson.Marshal(create.Payload) @@ -23,7 +23,7 @@ func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, e } payload = string(payloadBytes) } - args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, "[]", payload} + args := []any{create.UID, create.CreatorID, create.NestID, create.Content, create.Visibility, "[]", payload} stmt := "INSERT INTO `memo` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ")" result, err := d.db.ExecContext(ctx, stmt, args...) @@ -238,6 +238,9 @@ func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error { if v := update.Visibility; v != nil { set, args = append(set, "`visibility` = ?"), append(args, *v) } + if v := update.Nest; v != nil { + set, args = append(set, "`nest` = ?"), append(args, *v) + } if v := update.Payload; v != nil { payloadBytes, err := protojson.Marshal(v) if err != nil { diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.go index ad0fac1060763..810abcdd73e0d 100644 --- a/store/db/postgres/memo.go +++ b/store/db/postgres/memo.go @@ -13,7 +13,7 @@ import ( ) func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, error) { - fields := []string{"uid", "creator_id", "content", "visibility", "payload"} + fields := []string{"uid", "creator_id", "nest", "content", "visibility", "payload"} payload := "{}" if create.Payload != nil { payloadBytes, err := protojson.Marshal(create.Payload) @@ -22,7 +22,7 @@ func (d *DB) CreateMemo(ctx context.Context, create *store.Memo) (*store.Memo, e } payload = string(payloadBytes) } - args := []any{create.UID, create.CreatorID, create.Content, create.Visibility, payload} + args := []any{create.UID, create.CreatorID, create.NestID, create.Content, create.Visibility, payload} stmt := "INSERT INTO memo (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts, updated_ts, row_status" if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( @@ -229,6 +229,9 @@ func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) error { if v := update.Visibility; v != nil { set, args = append(set, "visibility = "+placeholder(len(args)+1)), append(args, *v) } + if v := update.Nest; v != nil { + set, args = append(set, "nest = "+placeholder(len(args)+1)), append(args, *v) + } if v := update.Payload; v != nil { payloadBytes, err := protojson.Marshal(v) if err != nil { From a3a1f0f8aee96fb93d7054f48f597bc25215e71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 19:10:42 +0100 Subject: [PATCH 21/34] feat(nest): update migration scripts --- .../mysql/prod/0.23/00__reactions.sql | 27 +++---------------- store/migration/mysql/prod/0.24/00__nests.sql | 11 ++++++++ .../postgres/prod/0.23/00__reactions.sql | 27 +++---------------- .../postgres/prod/0.24/00__nests.sql | 11 ++++++++ .../sqlite/prod/0.23/00__reactions.sql | 27 +++---------------- .../migration/sqlite/prod/0.24/00__nests.sql | 11 ++++++++ 6 files changed, 42 insertions(+), 72 deletions(-) create mode 100644 store/migration/mysql/prod/0.24/00__nests.sql create mode 100644 store/migration/postgres/prod/0.24/00__nests.sql create mode 100644 store/migration/sqlite/prod/0.24/00__nests.sql diff --git a/store/migration/mysql/prod/0.23/00__reactions.sql b/store/migration/mysql/prod/0.23/00__reactions.sql index b3cabdb8631a8..7087558740025 100644 --- a/store/migration/mysql/prod/0.23/00__reactions.sql +++ b/store/migration/mysql/prod/0.23/00__reactions.sql @@ -18,30 +18,9 @@ VALUES ( '' ) ON DUPLICATE KEY UPDATE -value = +value = JSON_SET( - value, - '$.reactions', + value, + '$.reactions', JSON_ARRAY('👍', '👎', '💛', '🔥', '👏', '😂', '👌', '🚀', '👀', '🤔', '🤡', '❓') ); - -ALTER TABLE - memo -ADD - COLUMN nest INT NOT NULL DEFAULT 0; - -CREATE TABLE nest ( - `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `uid` VARCHAR(256) NOT NULL, - `creator_id` INT NOT NULL, - `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' -); - -INSERT INTO - nest (uid, creator_id) -SELECT - 'Personal', id -FROM - user; \ No newline at end of file diff --git a/store/migration/mysql/prod/0.24/00__nests.sql b/store/migration/mysql/prod/0.24/00__nests.sql new file mode 100644 index 0000000000000..aa84487958aff --- /dev/null +++ b/store/migration/mysql/prod/0.24/00__nests.sql @@ -0,0 +1,11 @@ +ALTER TABLE + memo +ADD + COLUMN nest INT NOT NULL DEFAULT 0; + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + user; \ No newline at end of file diff --git a/store/migration/postgres/prod/0.23/00__reactions.sql b/store/migration/postgres/prod/0.23/00__reactions.sql index 0c2b735a8a4ca..e0d3e97dfdf26 100644 --- a/store/migration/postgres/prod/0.23/00__reactions.sql +++ b/store/migration/postgres/prod/0.23/00__reactions.sql @@ -18,30 +18,9 @@ VALUES ( '' ) ON CONFLICT("name") DO UPDATE -SET "value" = +SET "value" = jsonb_set( - "system_setting"."value"::jsonb, - '{reactions}', + "system_setting"."value"::jsonb, + '{reactions}', '["👍","👎","💛","🔥","👏","😂","👌","🚀","👀","🤔","🤡","❓"]'::jsonb ); - -ALTER TABLE - memo -ADD - COLUMN nest INTEGER NOT NULL DEFAULT 0; - -CREATE TABLE nest ( - id SERIAL PRIMARY KEY, - uid TEXT NOT NULL, - creator_id INTEGER NOT NULL, - created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), - updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), - row_status TEXT NOT NULL DEFAULT 'NORMAL' -); - -INSERT INTO - nest (uid, creator_id) -SELECT - 'Personal', id -FROM - "user"; \ No newline at end of file diff --git a/store/migration/postgres/prod/0.24/00__nests.sql b/store/migration/postgres/prod/0.24/00__nests.sql new file mode 100644 index 0000000000000..65cb96f490bed --- /dev/null +++ b/store/migration/postgres/prod/0.24/00__nests.sql @@ -0,0 +1,11 @@ +ALTER TABLE + memo +ADD + COLUMN nest INTEGER NOT NULL DEFAULT 0; + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + "user"; \ No newline at end of file diff --git a/store/migration/sqlite/prod/0.23/00__reactions.sql b/store/migration/sqlite/prod/0.23/00__reactions.sql index 3797ff1eb5224..395b556773002 100644 --- a/store/migration/sqlite/prod/0.23/00__reactions.sql +++ b/store/migration/sqlite/prod/0.23/00__reactions.sql @@ -18,30 +18,9 @@ VALUES ( '' ) ON CONFLICT(name) DO UPDATE -SET value = +SET value = json_set( - value, - '$.reactions', + value, + '$.reactions', json_array('👍', '👎', '💛', '🔥', '👏', '😂', '👌', '🚀', '👀', '🤔', '🤡', '❓') ); - -ALTER TABLE - memo -ADD - COLUMN nest INTEGER NOT NULL DEFAULT 0; - -CREATE TABLE nest ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - uid TEXT NOT NULL, - creator_id INTEGER NOT NULL, - created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), - updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), - row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' -); - -INSERT INTO - nest (uid, creator_id) -SELECT - 'Personal', id -FROM - user; \ No newline at end of file diff --git a/store/migration/sqlite/prod/0.24/00__nests.sql b/store/migration/sqlite/prod/0.24/00__nests.sql new file mode 100644 index 0000000000000..3db2b15466ccf --- /dev/null +++ b/store/migration/sqlite/prod/0.24/00__nests.sql @@ -0,0 +1,11 @@ +ALTER TABLE + memo +ADD + COLUMN nest INTEGER NOT NULL DEFAULT 0; + +INSERT INTO + nest (uid, creator_id) +SELECT + 'Personal', id +FROM + user; \ No newline at end of file From e8057c3e04420b17da28259097b0367c05adb296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 19:32:01 +0100 Subject: [PATCH 22/34] feat(nest): change uid to name --- proto/api/v1/nest_service.proto | 48 +-- proto/gen/api/v1/nest_service.pb.go | 224 +++++------ proto/gen/api/v1/nest_service.pb.gw.go | 120 +++--- proto/gen/api/v1/nest_service_grpc.pb.go | 50 +-- proto/gen/apidocs.swagger.yaml | 378 ++++++++++++------ server/router/api/v1/auth_service.go | 2 +- server/router/api/v1/nest_service.go | 24 +- server/router/api/v1/user_service.go | 2 +- store/db/mysql/nest.go | 16 +- store/db/postgres/nest.go | 16 +- store/db/sqlite/nest.go | 16 +- store/migration/mysql/dev/LATEST.sql | 2 +- store/migration/mysql/prod/0.24/00__nests.sql | 2 +- store/migration/mysql/prod/LATEST.sql | 2 +- store/migration/postgres/dev/LATEST.sql | 2 +- .../postgres/prod/0.24/00__nests.sql | 2 +- store/migration/postgres/prod/LATEST.sql | 2 +- store/migration/sqlite/dev/LATEST.sql | 2 +- .../migration/sqlite/prod/0.24/00__nests.sql | 2 +- store/migration/sqlite/prod/LATEST.sql | 2 +- store/nest.go | 16 +- web/src/components/AddNestPopover.tsx | 14 +- web/src/components/NestBanner.tsx | 6 +- .../Settings/PreferencesSection.tsx | 4 +- web/src/store/v1/nest.ts | 10 +- 25 files changed, 546 insertions(+), 418 deletions(-) diff --git a/proto/api/v1/nest_service.proto b/proto/api/v1/nest_service.proto index b2510a1f5755a..46c5f0172f1ec 100644 --- a/proto/api/v1/nest_service.proto +++ b/proto/api/v1/nest_service.proto @@ -16,52 +16,52 @@ service NestService { rpc CreateNest(CreateNestRequest) returns (Nest) { option (google.api.http) = { post: "/api/v1/nests" - body: "uid" + body: "name" }; } // ListNests lists all nests. rpc ListNests(ListNestsRequest) returns (ListNestsResponse) { option (google.api.http) = {get: "/api/v1/nests"}; } - // GetNest returns a nest by name. + // GetNest returns a nest by id. rpc GetNest(GetNestRequest) returns (Nest) { - option (google.api.http) = {get: "/api/v1/{name=nests/*}"}; - option (google.api.method_signature) = "name"; + option (google.api.http) = {get: "/api/v1/{id=nests/*}"}; + option (google.api.method_signature) = "id"; } - // GetNestByUid returns a nest by uid. - rpc GetNestByUid(GetNestByUidRequest) returns (Nest) { - option (google.api.http) = {get: "/api/v1/nests:by-uid/{uid}"}; - option (google.api.method_signature) = "uid"; + // GetNestByName returns a nest by name. + rpc GetNestByName(GetNestByNameRequest) returns (Nest) { + option (google.api.http) = {get: "/api/v1/nests:by-name/{name}"}; + option (google.api.method_signature) = "name"; } // UpdateNest updates a nest. rpc UpdateNest(UpdateNestRequest) returns (Nest) { option (google.api.http) = { - patch: "/api/v1/{nest.name=nests/*}" + patch: "/api/v1/{nest.id=nests/*}" body: "nest" }; option (google.api.method_signature) = "nest,update_mask"; } - // DeleteNest deletes a nest by name. + // DeleteNest deletes a nest by id. rpc DeleteNest(DeleteNestRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{name=nests/*}"}; - option (google.api.method_signature) = "name"; + option (google.api.http) = {delete: "/api/v1/{id=nests/*}"}; + option (google.api.method_signature) = "id"; } } message Nest { - // The name of the nest. + // The id of the nest. // Format: nests/{id} // id is the system generated unique identifier. - string name = 1; + string id = 1; - // The user defined id of the nest. - string uid = 2; + // The user defined name of the nest. + string name = 2; google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; } message CreateNestRequest { - string uid = 1; + string name = 1; } message ListNestsRequest { @@ -82,15 +82,15 @@ message ListNestsResponse { } message GetNestRequest { - // The name of the nest. + // The id of the nest. // Format: nest/{id} // id is the system generated unique identifier. - string name = 1; + string id = 1; } -message GetNestByUidRequest { - // The uid of the nest. - string uid = 1; +message GetNestByNameRequest { + // The name of the nest. + string name = 1; } message UpdateNestRequest { @@ -100,8 +100,8 @@ message UpdateNestRequest { } message DeleteNestRequest { - // The name of the nest. + // The id of the nest. // Format: nests/{id} // id is the system generated unique identifier. - string name = 1; + string id = 1; } diff --git a/proto/gen/api/v1/nest_service.pb.go b/proto/gen/api/v1/nest_service.pb.go index bbc008bea7ecf..7e8044ffa7afe 100644 --- a/proto/gen/api/v1/nest_service.pb.go +++ b/proto/gen/api/v1/nest_service.pb.go @@ -29,12 +29,12 @@ type Nest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The name of the nest. + // The id of the nest. // Format: nests/{id} // id is the system generated unique identifier. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // The user defined id of the nest. - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The user defined name of the nest. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` CreateTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` } @@ -68,16 +68,16 @@ func (*Nest) Descriptor() ([]byte, []int) { return file_api_v1_nest_service_proto_rawDescGZIP(), []int{0} } -func (x *Nest) GetName() string { +func (x *Nest) GetId() string { if x != nil { - return x.Name + return x.Id } return "" } -func (x *Nest) GetUid() string { +func (x *Nest) GetName() string { if x != nil { - return x.Uid + return x.Name } return "" } @@ -94,7 +94,7 @@ type CreateNestRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } func (x *CreateNestRequest) Reset() { @@ -127,9 +127,9 @@ func (*CreateNestRequest) Descriptor() ([]byte, []int) { return file_api_v1_nest_service_proto_rawDescGZIP(), []int{1} } -func (x *CreateNestRequest) GetUid() string { +func (x *CreateNestRequest) GetName() string { if x != nil { - return x.Uid + return x.Name } return "" } @@ -250,10 +250,10 @@ type GetNestRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The name of the nest. + // The id of the nest. // Format: nest/{id} // id is the system generated unique identifier. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *GetNestRequest) Reset() { @@ -286,36 +286,36 @@ func (*GetNestRequest) Descriptor() ([]byte, []int) { return file_api_v1_nest_service_proto_rawDescGZIP(), []int{4} } -func (x *GetNestRequest) GetName() string { +func (x *GetNestRequest) GetId() string { if x != nil { - return x.Name + return x.Id } return "" } -type GetNestByUidRequest struct { +type GetNestByNameRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The uid of the nest. - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` + // The name of the nest. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` } -func (x *GetNestByUidRequest) Reset() { - *x = GetNestByUidRequest{} +func (x *GetNestByNameRequest) Reset() { + *x = GetNestByNameRequest{} mi := &file_api_v1_nest_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *GetNestByUidRequest) String() string { +func (x *GetNestByNameRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetNestByUidRequest) ProtoMessage() {} +func (*GetNestByNameRequest) ProtoMessage() {} -func (x *GetNestByUidRequest) ProtoReflect() protoreflect.Message { +func (x *GetNestByNameRequest) ProtoReflect() protoreflect.Message { mi := &file_api_v1_nest_service_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -327,14 +327,14 @@ func (x *GetNestByUidRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetNestByUidRequest.ProtoReflect.Descriptor instead. -func (*GetNestByUidRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use GetNestByNameRequest.ProtoReflect.Descriptor instead. +func (*GetNestByNameRequest) Descriptor() ([]byte, []int) { return file_api_v1_nest_service_proto_rawDescGZIP(), []int{5} } -func (x *GetNestByUidRequest) GetUid() string { +func (x *GetNestByNameRequest) GetName() string { if x != nil { - return x.Uid + return x.Name } return "" } @@ -397,10 +397,10 @@ type DeleteNestRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // The name of the nest. + // The id of the nest. // Format: nests/{id} // id is the system generated unique identifier. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } func (x *DeleteNestRequest) Reset() { @@ -433,9 +433,9 @@ func (*DeleteNestRequest) Descriptor() ([]byte, []int) { return file_api_v1_nest_service_proto_rawDescGZIP(), []int{7} } -func (x *DeleteNestRequest) GetName() string { +func (x *DeleteNestRequest) GetId() string { if x != nil { - return x.Name + return x.Id } return "" } @@ -457,16 +457,16 @@ var file_api_v1_nest_service_proto_rawDesc = []byte{ 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0x6f, 0x0a, 0x04, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, - 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, - 0x41, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x42, 0x04, 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x22, 0x25, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x4e, 0x0a, 0x10, 0x4c, 0x69, 0x73, + 0x6f, 0x22, 0x6d, 0x0a, 0x04, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, + 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x04, + 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, + 0x22, 0x27, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4e, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, @@ -478,74 +478,74 @@ var file_api_v1_nest_service_proto_rawDesc = []byte{ 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0x24, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, - 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, - 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, - 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x27, 0x0a, 0x11, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x32, 0x95, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x5d, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, - 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x03, 0x75, - 0x69, 0x64, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, - 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, - 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, - 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x62, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, - 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, - 0x65, 0x73, 0x74, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x18, 0x12, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6f, 0x0a, 0x0c, 0x47, 0x65, - 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x12, 0x21, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, - 0x74, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, - 0x74, 0x22, 0x28, 0xda, 0x41, 0x03, 0x75, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, - 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, - 0x79, 0x2d, 0x75, 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x7f, 0x0a, 0x0a, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, - 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3c, - 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, - 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, - 0x1b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x6e, - 0x61, 0x6d, 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, - 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, - 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, - 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, - 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, - 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, - 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x20, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x78, + 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x23, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0x91, 0x05, + 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, + 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, + 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0d, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, + 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, + 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, + 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, + 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, + 0x21, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, + 0x2a, 0x7d, 0x12, 0x74, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x2b, 0xda, 0x41, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x6e, 0x61, 0x6d, + 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x7d, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3a, 0xda, 0x41, 0x10, + 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, 0x19, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x64, 0x3d, 0x6e, + 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x68, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, + 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x2a, 0x14, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, + 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, + 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, + 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, + 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, + 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -567,7 +567,7 @@ var file_api_v1_nest_service_proto_goTypes = []any{ (*ListNestsRequest)(nil), // 2: memos.api.v1.ListNestsRequest (*ListNestsResponse)(nil), // 3: memos.api.v1.ListNestsResponse (*GetNestRequest)(nil), // 4: memos.api.v1.GetNestRequest - (*GetNestByUidRequest)(nil), // 5: memos.api.v1.GetNestByUidRequest + (*GetNestByNameRequest)(nil), // 5: memos.api.v1.GetNestByNameRequest (*UpdateNestRequest)(nil), // 6: memos.api.v1.UpdateNestRequest (*DeleteNestRequest)(nil), // 7: memos.api.v1.DeleteNestRequest (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp @@ -582,13 +582,13 @@ var file_api_v1_nest_service_proto_depIdxs = []int32{ 1, // 4: memos.api.v1.NestService.CreateNest:input_type -> memos.api.v1.CreateNestRequest 2, // 5: memos.api.v1.NestService.ListNests:input_type -> memos.api.v1.ListNestsRequest 4, // 6: memos.api.v1.NestService.GetNest:input_type -> memos.api.v1.GetNestRequest - 5, // 7: memos.api.v1.NestService.GetNestByUid:input_type -> memos.api.v1.GetNestByUidRequest + 5, // 7: memos.api.v1.NestService.GetNestByName:input_type -> memos.api.v1.GetNestByNameRequest 6, // 8: memos.api.v1.NestService.UpdateNest:input_type -> memos.api.v1.UpdateNestRequest 7, // 9: memos.api.v1.NestService.DeleteNest:input_type -> memos.api.v1.DeleteNestRequest 0, // 10: memos.api.v1.NestService.CreateNest:output_type -> memos.api.v1.Nest 3, // 11: memos.api.v1.NestService.ListNests:output_type -> memos.api.v1.ListNestsResponse 0, // 12: memos.api.v1.NestService.GetNest:output_type -> memos.api.v1.Nest - 0, // 13: memos.api.v1.NestService.GetNestByUid:output_type -> memos.api.v1.Nest + 0, // 13: memos.api.v1.NestService.GetNestByName:output_type -> memos.api.v1.Nest 0, // 14: memos.api.v1.NestService.UpdateNest:output_type -> memos.api.v1.Nest 10, // 15: memos.api.v1.NestService.DeleteNest:output_type -> google.protobuf.Empty 10, // [10:16] is the sub-list for method output_type diff --git a/proto/gen/api/v1/nest_service.pb.gw.go b/proto/gen/api/v1/nest_service.pb.gw.go index 3ee5a8d70f730..d110e458a6656 100644 --- a/proto/gen/api/v1/nest_service.pb.gw.go +++ b/proto/gen/api/v1/nest_service.pb.gw.go @@ -35,7 +35,7 @@ func request_NestService_CreateNest_0(ctx context.Context, marshaler runtime.Mar var protoReq CreateNestRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Uid); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Name); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -48,7 +48,7 @@ func local_request_NestService_CreateNest_0(ctx context.Context, marshaler runti var protoReq CreateNestRequest var metadata runtime.ServerMetadata - if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Uid); err != nil && err != io.EOF { + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Name); err != nil && err != io.EOF { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -104,14 +104,14 @@ func request_NestService_GetNest_0(ctx context.Context, marshaler runtime.Marsha _ = err ) - val, ok = pathParams["name"] + val, ok = pathParams["id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } - protoReq.Name, err = runtime.String(val) + protoReq.Id, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } msg, err := client.GetNest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -130,14 +130,14 @@ func local_request_NestService_GetNest_0(ctx context.Context, marshaler runtime. _ = err ) - val, ok = pathParams["name"] + val, ok = pathParams["id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } - protoReq.Name, err = runtime.String(val) + protoReq.Id, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } msg, err := server.GetNest(ctx, &protoReq) @@ -145,8 +145,8 @@ func local_request_NestService_GetNest_0(ctx context.Context, marshaler runtime. } -func request_NestService_GetNestByUid_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetNestByUidRequest +func request_NestService_GetNestByName_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNestByNameRequest var metadata runtime.ServerMetadata var ( @@ -156,23 +156,23 @@ func request_NestService_GetNestByUid_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["uid"] + val, ok = pathParams["name"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") } - protoReq.Uid, err = runtime.String(val) + protoReq.Name, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - msg, err := client.GetNestByUid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetNestByName(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_NestService_GetNestByUid_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetNestByUidRequest +func local_request_NestService_GetNestByName_0(ctx context.Context, marshaler runtime.Marshaler, server NestServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetNestByNameRequest var metadata runtime.ServerMetadata var ( @@ -182,23 +182,23 @@ func local_request_NestService_GetNestByUid_0(ctx context.Context, marshaler run _ = err ) - val, ok = pathParams["uid"] + val, ok = pathParams["name"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") } - protoReq.Uid, err = runtime.String(val) + protoReq.Name, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) } - msg, err := server.GetNestByUid(ctx, &protoReq) + msg, err := server.GetNestByName(ctx, &protoReq) return msg, metadata, err } var ( - filter_NestService_UpdateNest_0 = &utilities.DoubleArray{Encoding: map[string]int{"nest": 0, "name": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} + filter_NestService_UpdateNest_0 = &utilities.DoubleArray{Encoding: map[string]int{"nest": 0, "id": 1}, Base: []int{1, 2, 1, 0, 0}, Check: []int{0, 1, 2, 3, 2}} ) func request_NestService_UpdateNest_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -227,14 +227,14 @@ func request_NestService_UpdateNest_0(ctx context.Context, marshaler runtime.Mar _ = err ) - val, ok = pathParams["nest.name"] + val, ok = pathParams["nest.id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nest.name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nest.id") } - err = runtime.PopulateFieldFromPath(&protoReq, "nest.name", val) + err = runtime.PopulateFieldFromPath(&protoReq, "nest.id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nest.name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nest.id", err) } if err := req.ParseForm(); err != nil { @@ -275,14 +275,14 @@ func local_request_NestService_UpdateNest_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["nest.name"] + val, ok = pathParams["nest.id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nest.name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nest.id") } - err = runtime.PopulateFieldFromPath(&protoReq, "nest.name", val) + err = runtime.PopulateFieldFromPath(&protoReq, "nest.id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nest.name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nest.id", err) } if err := req.ParseForm(); err != nil { @@ -308,14 +308,14 @@ func request_NestService_DeleteNest_0(ctx context.Context, marshaler runtime.Mar _ = err ) - val, ok = pathParams["name"] + val, ok = pathParams["id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } - protoReq.Name, err = runtime.String(val) + protoReq.Id, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } msg, err := client.DeleteNest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -334,14 +334,14 @@ func local_request_NestService_DeleteNest_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["name"] + val, ok = pathParams["id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") } - protoReq.Name, err = runtime.String(val) + protoReq.Id, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } msg, err := server.DeleteNest(ctx, &protoReq) @@ -414,7 +414,7 @@ func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/GetNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/GetNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -431,7 +431,7 @@ func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_NestService_GetNestByUid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_NestService_GetNestByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -439,12 +439,12 @@ func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/GetNestByUid", runtime.WithHTTPPathPattern("/api/v1/nests:by-uid/{uid}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/GetNestByName", runtime.WithHTTPPathPattern("/api/v1/nests:by-name/{name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_NestService_GetNestByUid_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_NestService_GetNestByName_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -452,7 +452,7 @@ func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } - forward_NestService_GetNestByUid_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_NestService_GetNestByName_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -464,7 +464,7 @@ func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/UpdateNest", runtime.WithHTTPPathPattern("/api/v1/{nest.name=nests/*}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/UpdateNest", runtime.WithHTTPPathPattern("/api/v1/{nest.id=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -489,7 +489,7 @@ func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -597,7 +597,7 @@ func RegisterNestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/GetNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/GetNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -613,25 +613,25 @@ func RegisterNestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux }) - mux.Handle("GET", pattern_NestService_GetNestByUid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_NestService_GetNestByName_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/GetNestByUid", runtime.WithHTTPPathPattern("/api/v1/nests:by-uid/{uid}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/GetNestByName", runtime.WithHTTPPathPattern("/api/v1/nests:by-name/{name}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_NestService_GetNestByUid_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_NestService_GetNestByName_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_NestService_GetNestByUid_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_NestService_GetNestByName_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -641,7 +641,7 @@ func RegisterNestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/UpdateNest", runtime.WithHTTPPathPattern("/api/v1/{nest.name=nests/*}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/UpdateNest", runtime.WithHTTPPathPattern("/api/v1/{nest.id=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -663,7 +663,7 @@ func RegisterNestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{name=nests/*}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -687,13 +687,13 @@ var ( pattern_NestService_ListNests_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "nests"}, "")) - pattern_NestService_GetNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "name"}, "")) + pattern_NestService_GetNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "id"}, "")) - pattern_NestService_GetNestByUid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "nests:by-uid", "uid"}, "")) + pattern_NestService_GetNestByName_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "nests:by-name", "name"}, "")) - pattern_NestService_UpdateNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "nest.name"}, "")) + pattern_NestService_UpdateNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "nest.id"}, "")) - pattern_NestService_DeleteNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "name"}, "")) + pattern_NestService_DeleteNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "id"}, "")) ) var ( @@ -703,7 +703,7 @@ var ( forward_NestService_GetNest_0 = runtime.ForwardResponseMessage - forward_NestService_GetNestByUid_0 = runtime.ForwardResponseMessage + forward_NestService_GetNestByName_0 = runtime.ForwardResponseMessage forward_NestService_UpdateNest_0 = runtime.ForwardResponseMessage diff --git a/proto/gen/api/v1/nest_service_grpc.pb.go b/proto/gen/api/v1/nest_service_grpc.pb.go index 2cbfc25207a98..242498c15e7ac 100644 --- a/proto/gen/api/v1/nest_service_grpc.pb.go +++ b/proto/gen/api/v1/nest_service_grpc.pb.go @@ -20,12 +20,12 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - NestService_CreateNest_FullMethodName = "/memos.api.v1.NestService/CreateNest" - NestService_ListNests_FullMethodName = "/memos.api.v1.NestService/ListNests" - NestService_GetNest_FullMethodName = "/memos.api.v1.NestService/GetNest" - NestService_GetNestByUid_FullMethodName = "/memos.api.v1.NestService/GetNestByUid" - NestService_UpdateNest_FullMethodName = "/memos.api.v1.NestService/UpdateNest" - NestService_DeleteNest_FullMethodName = "/memos.api.v1.NestService/DeleteNest" + NestService_CreateNest_FullMethodName = "/memos.api.v1.NestService/CreateNest" + NestService_ListNests_FullMethodName = "/memos.api.v1.NestService/ListNests" + NestService_GetNest_FullMethodName = "/memos.api.v1.NestService/GetNest" + NestService_GetNestByName_FullMethodName = "/memos.api.v1.NestService/GetNestByName" + NestService_UpdateNest_FullMethodName = "/memos.api.v1.NestService/UpdateNest" + NestService_DeleteNest_FullMethodName = "/memos.api.v1.NestService/DeleteNest" ) // NestServiceClient is the client API for NestService service. @@ -36,13 +36,13 @@ type NestServiceClient interface { CreateNest(ctx context.Context, in *CreateNestRequest, opts ...grpc.CallOption) (*Nest, error) // ListNests lists all nests. ListNests(ctx context.Context, in *ListNestsRequest, opts ...grpc.CallOption) (*ListNestsResponse, error) - // GetNest returns a nest by name. + // GetNest returns a nest by id. GetNest(ctx context.Context, in *GetNestRequest, opts ...grpc.CallOption) (*Nest, error) - // GetNestByUid returns a nest by uid. - GetNestByUid(ctx context.Context, in *GetNestByUidRequest, opts ...grpc.CallOption) (*Nest, error) + // GetNestByName returns a nest by name. + GetNestByName(ctx context.Context, in *GetNestByNameRequest, opts ...grpc.CallOption) (*Nest, error) // UpdateNest updates a nest. UpdateNest(ctx context.Context, in *UpdateNestRequest, opts ...grpc.CallOption) (*Nest, error) - // DeleteNest deletes a nest by name. + // DeleteNest deletes a nest by id. DeleteNest(ctx context.Context, in *DeleteNestRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) } @@ -84,10 +84,10 @@ func (c *nestServiceClient) GetNest(ctx context.Context, in *GetNestRequest, opt return out, nil } -func (c *nestServiceClient) GetNestByUid(ctx context.Context, in *GetNestByUidRequest, opts ...grpc.CallOption) (*Nest, error) { +func (c *nestServiceClient) GetNestByName(ctx context.Context, in *GetNestByNameRequest, opts ...grpc.CallOption) (*Nest, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Nest) - err := c.cc.Invoke(ctx, NestService_GetNestByUid_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, NestService_GetNestByName_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -122,13 +122,13 @@ type NestServiceServer interface { CreateNest(context.Context, *CreateNestRequest) (*Nest, error) // ListNests lists all nests. ListNests(context.Context, *ListNestsRequest) (*ListNestsResponse, error) - // GetNest returns a nest by name. + // GetNest returns a nest by id. GetNest(context.Context, *GetNestRequest) (*Nest, error) - // GetNestByUid returns a nest by uid. - GetNestByUid(context.Context, *GetNestByUidRequest) (*Nest, error) + // GetNestByName returns a nest by name. + GetNestByName(context.Context, *GetNestByNameRequest) (*Nest, error) // UpdateNest updates a nest. UpdateNest(context.Context, *UpdateNestRequest) (*Nest, error) - // DeleteNest deletes a nest by name. + // DeleteNest deletes a nest by id. DeleteNest(context.Context, *DeleteNestRequest) (*emptypb.Empty, error) mustEmbedUnimplementedNestServiceServer() } @@ -149,8 +149,8 @@ func (UnimplementedNestServiceServer) ListNests(context.Context, *ListNestsReque func (UnimplementedNestServiceServer) GetNest(context.Context, *GetNestRequest) (*Nest, error) { return nil, status.Errorf(codes.Unimplemented, "method GetNest not implemented") } -func (UnimplementedNestServiceServer) GetNestByUid(context.Context, *GetNestByUidRequest) (*Nest, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetNestByUid not implemented") +func (UnimplementedNestServiceServer) GetNestByName(context.Context, *GetNestByNameRequest) (*Nest, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetNestByName not implemented") } func (UnimplementedNestServiceServer) UpdateNest(context.Context, *UpdateNestRequest) (*Nest, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateNest not implemented") @@ -233,20 +233,20 @@ func _NestService_GetNest_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } -func _NestService_GetNestByUid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetNestByUidRequest) +func _NestService_GetNestByName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetNestByNameRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(NestServiceServer).GetNestByUid(ctx, in) + return srv.(NestServiceServer).GetNestByName(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: NestService_GetNestByUid_FullMethodName, + FullMethod: NestService_GetNestByName_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NestServiceServer).GetNestByUid(ctx, req.(*GetNestByUidRequest)) + return srv.(NestServiceServer).GetNestByName(ctx, req.(*GetNestByNameRequest)) } return interceptor(ctx, in, info, handler) } @@ -307,8 +307,8 @@ var NestService_ServiceDesc = grpc.ServiceDesc{ Handler: _NestService_GetNest_Handler, }, { - MethodName: "GetNestByUid", - Handler: _NestService_GetNestByUid_Handler, + MethodName: "GetNestByName", + Handler: _NestService_GetNestByName_Handler, }, { MethodName: "UpdateNest", diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index d529ac4c5cf4e..cfd4cdc9366d6 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -312,12 +312,16 @@ paths: type: integer format: int32 - name: pageToken - description: "A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page." + description: |- + A page token, received from a previous `ListMemos` call. + Provide this to retrieve the subsequent page. in: query required: false type: string - name: filter - description: "Filter is used to filter memos returned in the list.\r\nFormat: \"creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']\"" + description: |- + Filter is used to filter memos returned in the list. + Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']" in: query required: false type: string @@ -420,17 +424,17 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: uid + - name: name in: body required: true schema: type: string tags: - NestService - /api/v1/nests:by-uid/{uid}: + /api/v1/nests:by-name/{name}: get: - summary: GetNestByUid returns a nest by uid. - operationId: NestService_GetNestByUid + summary: GetNestByName returns a nest by name. + operationId: NestService_GetNestByName responses: "200": description: A successful response. @@ -441,8 +445,8 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: uid - description: The uid of the nest. + - name: name + description: The name of the nest. in: path required: true type: string @@ -576,7 +580,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: filter - description: "Filter is used to filter users returned in the list.\r\nFormat: \"username == 'frank'\"" + description: |- + Filter is used to filter users returned in the list. + Format: "username == 'frank'" in: query required: false type: string @@ -737,7 +743,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The resource name of the workspace setting.\r\nFormat: settings/{setting}" + description: |- + The resource name of the workspace setting. + Format: settings/{setting} in: path required: true type: string @@ -759,7 +767,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: "name is the name of the setting.\r\nFormat: settings/{setting}" + description: |- + name is the name of the setting. + Format: settings/{setting} in: path required: true type: string @@ -795,7 +805,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: identityProvider.name - description: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider. + Format: identityProviders/{id} in: path required: true type: string @@ -818,6 +830,56 @@ paths: title: The identityProvider to update. tags: - IdentityProviderService + /api/v1/{id}: + get: + summary: GetNest returns a nest by id. + operationId: NestService_GetNest + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/v1Nest' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: id + description: |- + The id of the nest. + Format: nest/{id} + id is the system generated unique identifier. + in: path + required: true + type: string + pattern: nests/[^/]+ + tags: + - NestService + delete: + summary: DeleteNest deletes a nest by id. + operationId: NestService_DeleteNest + responses: + "200": + description: A successful response. + schema: + type: object + properties: {} + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: id + description: |- + The id of the nest. + Format: nests/{id} + id is the system generated unique identifier. + in: path + required: true + type: string + pattern: nests/[^/]+ + tags: + - NestService /api/v1/{inbox.name}: patch: summary: UpdateInbox updates an inbox. @@ -833,7 +895,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: inbox.name - description: "The name of the inbox.\r\nFormat: inboxes/{id}" + description: |- + The name of the inbox. + Format: inboxes/{id} in: path required: true type: string @@ -877,7 +941,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: memo.name - description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." + description: |- + The name of the memo. + Format: memos/{id} + id is the system generated id. in: path required: true type: string @@ -895,7 +962,9 @@ paths: $ref: '#/definitions/v1RowStatus' creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} createTime: type: string format: date-time @@ -942,7 +1011,9 @@ paths: readOnly: true parent: type: string - title: "The name of the parent memo.\r\nFormat: memos/{id}" + title: |- + The name of the parent memo. + Format: memos/{id} readOnly: true snippet: type: string @@ -971,7 +1042,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -993,7 +1066,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: "The name of the identityProvider to delete.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider to delete. + Format: identityProviders/{id} in: path required: true type: string @@ -1015,7 +1090,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: "The name of the identityProvider to get.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider to get. + Format: identityProviders/{id} in: path required: true type: string @@ -1037,7 +1114,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: "The name of the inbox to delete.\r\nFormat: inboxes/{id}" + description: |- + The name of the inbox to delete. + Format: inboxes/{id} in: path required: true type: string @@ -1059,7 +1138,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1081,7 +1163,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1103,7 +1188,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1125,63 +1212,15 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string pattern: memos/[^/]+ tags: - MemoService - /api/v1/{name_5}: - get: - summary: GetNest returns a nest by name. - operationId: NestService_GetNest - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/v1Nest' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: name_5 - description: |- - The name of the nest. - Format: nest/{id} - id is the system generated unique identifier. - in: path - required: true - type: string - pattern: nests/[^/]+ - tags: - - NestService - delete: - summary: DeleteNest deletes a nest by name. - operationId: NestService_DeleteNest - responses: - "200": - description: A successful response. - schema: - type: object - properties: {} - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - parameters: - - name: name_5 - description: |- - The name of the nest. - Format: nests/{id} - id is the system generated unique identifier. - in: path - required: true - type: string - pattern: nests/[^/]+ - tags: - - NestService /api/v1/{name}: get: summary: GetActivity returns the activity with the given id. @@ -1197,7 +1236,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the activity.\r\nFormat: activities/{id}" + description: |- + The name of the activity. + Format: activities/{id} in: path required: true type: string @@ -1219,7 +1260,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1241,7 +1284,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1262,7 +1307,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1290,7 +1337,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1317,7 +1366,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1338,7 +1389,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1365,7 +1418,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1386,7 +1441,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1413,7 +1470,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1435,7 +1494,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1462,7 +1523,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1484,7 +1547,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1511,14 +1576,16 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string pattern: users/[^/]+ tags: - UserService - /api/v1/{nest.name}: + /api/v1/{nest.id}: patch: summary: UpdateNest updates a nest. operationId: NestService_UpdateNest @@ -1532,9 +1599,9 @@ paths: schema: $ref: '#/definitions/googlerpcStatus' parameters: - - name: nest.name + - name: nest.id description: |- - The name of the nest. + The id of the nest. Format: nests/{id} id is the system generated unique identifier. in: path @@ -1547,9 +1614,9 @@ paths: schema: type: object properties: - uid: + name: type: string - description: The user defined id of the nest. + description: The user defined name of the nest. createTime: type: string format: date-time @@ -1572,7 +1639,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to delete all tags." + description: |- + The parent, who owns the tags. + Format: memos/{id}. Use "memos/-" to delete all tags. in: path required: true type: string @@ -1603,7 +1672,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to rename all tags." + description: |- + The parent, who owns the tags. + Format: memos/{id}. Use "memos/-" to rename all tags. in: path required: true type: string @@ -1630,7 +1701,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: resource.name - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1662,7 +1736,9 @@ paths: format: int64 memo: type: string - title: "The related memo.\r\nFormat: memos/{id}" + title: |- + The related memo. + Format: memos/{id} tags: - ResourceService /api/v1/{setting.name}: @@ -1680,7 +1756,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1722,7 +1800,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: user.name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1778,7 +1858,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1811,7 +1893,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -2004,7 +2089,9 @@ definitions: properties: name: type: string - title: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" + title: |- + The name of the identityProvider. + Format: identityProviders/{id} type: $ref: '#/definitions/apiv1IdentityProviderType' title: @@ -2040,7 +2127,10 @@ definitions: properties: name: type: string - description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." + description: |- + The name of the memo. + Format: memos/{id} + id is the system generated id. uid: type: string description: The user defined id of the memo. @@ -2048,7 +2138,9 @@ definitions: $ref: '#/definitions/v1RowStatus' creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} createTime: type: string format: date-time @@ -2095,7 +2187,9 @@ definitions: readOnly: true parent: type: string - title: "The name of the parent memo.\r\nFormat: memos/{id}" + title: |- + The name of the parent memo. + Format: memos/{id} readOnly: true snippet: type: string @@ -2131,7 +2225,9 @@ definitions: properties: name: type: string - title: "The name of the user.\r\nFormat: users/{id}" + title: |- + The name of the user. + Format: users/{id} locale: type: string description: The preferred locale of the user. @@ -2178,7 +2274,10 @@ definitions: weekStartDayOffset: type: integer format: int32 - description: "week_start_day_offset is the week start day offset from Sunday.\r\n0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday\r\nDefault is Sunday." + description: |- + week_start_day_offset is the week start day offset from Sunday. + 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday + Default is Sunday. disallowChangeUsername: type: boolean description: disallow_change_username disallows changing username. @@ -2229,7 +2328,9 @@ definitions: properties: name: type: string - title: "name is the name of the setting.\r\nFormat: settings/{setting}" + title: |- + name is the name of the setting. + Format: settings/{setting} generalSetting: $ref: '#/definitions/apiv1WorkspaceGeneralSetting' storageSetting: @@ -2244,7 +2345,9 @@ definitions: description: storage_type is the storage type. filepathTemplate: type: string - title: "The template of file path.\r\ne.g. assets/{timestamp}_{filename}" + title: |- + The template of file path. + e.g. assets/{timestamp}_{filename} uploadSizeLimitMb: type: string format: int64 @@ -2403,7 +2506,9 @@ definitions: properties: name: type: string - title: "The name of the activity.\r\nFormat: activities/{id}" + title: |- + The name of the activity. + Format: activities/{id} creatorId: type: integer format: int32 @@ -2548,7 +2653,9 @@ definitions: properties: name: type: string - title: "The name of the inbox.\r\nFormat: inboxes/{id}" + title: |- + The name of the inbox. + Format: inboxes/{id} sender: type: string title: 'Format: users/{id}' @@ -2622,7 +2729,9 @@ definitions: $ref: '#/definitions/v1Inbox' nextPageToken: type: string - description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages." + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. v1ListMemoCommentsResponse: type: object properties: @@ -2665,7 +2774,9 @@ definitions: $ref: '#/definitions/apiv1Memo' nextPageToken: type: string - description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages." + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. v1ListNestsResponse: type: object properties: @@ -2754,10 +2865,14 @@ definitions: properties: memo: $ref: '#/definitions/v1MemoRelationMemo' - title: "The name of memo.\r\nFormat: \"memos/{uid}\"" + title: |- + The name of memo. + Format: "memos/{uid}" relatedMemo: $ref: '#/definitions/v1MemoRelationMemo' - title: "The name of related memo.\r\nFormat: \"memos/{uid}\"" + title: |- + The name of related memo. + Format: "memos/{uid}" type: $ref: '#/definitions/v1MemoRelationType' v1MemoRelationMemo: @@ -2765,7 +2880,9 @@ definitions: properties: name: type: string - title: "The name of the memo.\r\nFormat: memos/{id}" + title: |- + The name of the memo. + Format: memos/{id} uid: type: string snippet: @@ -2792,15 +2909,15 @@ definitions: v1Nest: type: object properties: - name: + id: type: string description: |- - The name of the nest. + The id of the nest. Format: nests/{id} id is the system generated unique identifier. - uid: + name: type: string - description: The user defined id of the nest. + description: The user defined name of the nest. createTime: type: string format: date-time @@ -2955,7 +3072,9 @@ definitions: format: int32 creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} contentId: type: string reactionType: @@ -2972,7 +3091,10 @@ definitions: properties: name: type: string - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. uid: type: string description: The user defined id of the resource. @@ -2994,7 +3116,9 @@ definitions: format: int64 memo: type: string - title: "The related memo.\r\nFormat: memos/{id}" + title: |- + The related memo. + Format: memos/{id} v1RestoreMarkdownNodesRequest: type: object properties: @@ -3116,7 +3240,9 @@ definitions: properties: name: type: string - title: "The name of the user.\r\nFormat: users/{id}" + title: |- + The name of the user. + Format: users/{id} id: type: integer format: int32 @@ -3190,7 +3316,9 @@ definitions: properties: owner: type: string - title: "The name of instance owner.\r\nFormat: \"users/{id}\"" + title: |- + The name of instance owner. + Format: "users/{id}" version: type: string title: version is the current version of instance diff --git a/server/router/api/v1/auth_service.go b/server/router/api/v1/auth_service.go index 531d2e3f9dd7a..b3b814353a2eb 100644 --- a/server/router/api/v1/auth_service.go +++ b/server/router/api/v1/auth_service.go @@ -222,7 +222,7 @@ func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest) } nest, err := s.Store.CreateNest(ctx, &store.Nest{ - UID: "Personal", + Name: "Personal", CreatorID: user.ID, }) if err != nil { diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go index 844e2e0b431ac..1d603e534f3fa 100644 --- a/server/router/api/v1/nest_service.go +++ b/server/router/api/v1/nest_service.go @@ -28,7 +28,7 @@ func (s *APIV1Service) CreateNest(ctx context.Context, request *v1pb.CreateNestR create := &store.Nest{ CreatorID: user.ID, - UID: request.Uid, + Name: request.Name, } nest, err := s.Store.CreateNest(ctx, create) @@ -115,7 +115,7 @@ func (s *APIV1Service) GetNest(ctx context.Context, request *v1pb.GetNestRequest return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - id, err := ExtractNestIDFromName(request.Name) + id, err := ExtractNestIDFromName(request.Id) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid nest name: %v", err) } @@ -138,7 +138,7 @@ func (s *APIV1Service) GetNest(ctx context.Context, request *v1pb.GetNestRequest } //nolint:all -func (s *APIV1Service) GetNestByUid(ctx context.Context, request *v1pb.GetNestByUidRequest) (*v1pb.Nest, error) { +func (s *APIV1Service) GetNestByName(ctx context.Context, request *v1pb.GetNestByNameRequest) (*v1pb.Nest, error) { user, err := s.GetCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user") @@ -149,7 +149,7 @@ func (s *APIV1Service) GetNestByUid(ctx context.Context, request *v1pb.GetNestBy } nest, err := s.Store.GetNest(ctx, &store.FindNest{ - UID: &request.Uid, + Name: &request.Name, CreatorID: &user.ID, }) if err != nil { @@ -176,7 +176,7 @@ func (s *APIV1Service) UpdateNest(ctx context.Context, request *v1pb.UpdateNestR return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - id, err := ExtractNestIDFromName(request.Nest.Name) + id, err := ExtractNestIDFromName(request.Nest.Id) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid nest name: %v", err) } @@ -205,9 +205,9 @@ func (s *APIV1Service) UpdateNest(ctx context.Context, request *v1pb.UpdateNestR UpdatedTs: ¤tTs, } for _, path := range request.UpdateMask.Paths { - if path == "uid" { - update.UID = &request.Nest.Uid - if !util.UIDMatcher.MatchString(*update.UID) { + if path == "name" { + update.Name = &request.Nest.Name + if !util.UIDMatcher.MatchString(*update.Name) { return nil, status.Errorf(codes.InvalidArgument, "invalid resource name") } } @@ -241,7 +241,7 @@ func (s *APIV1Service) DeleteNest(ctx context.Context, request *v1pb.DeleteNestR return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - id, err := ExtractNestIDFromName(request.Name) + id, err := ExtractNestIDFromName(request.Id) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid nest name: %v", err) } @@ -268,10 +268,10 @@ func (s *APIV1Service) DeleteNest(ctx context.Context, request *v1pb.DeleteNestR } func convertNestFromStore(nest *store.Nest) (*v1pb.Nest, error) { - name := fmt.Sprintf("%s%d", NestNamePrefix, nest.ID) + id := fmt.Sprintf("%s%d", NestNamePrefix, nest.ID) nestMessage := &v1pb.Nest{ - Name: name, - Uid: nest.UID, + Id: id, + Name: nest.Name, CreateTime: timestamppb.New(time.Unix(nest.CreatedTs, 0)), } diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go index 82fdf560a8530..30e77f13282ee 100644 --- a/server/router/api/v1/user_service.go +++ b/server/router/api/v1/user_service.go @@ -163,7 +163,7 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR } nest, err := s.Store.CreateNest(ctx, &store.Nest{ - UID: "Personal", + Name: "Personal", CreatorID: user.ID, }) if err != nil { diff --git a/store/db/mysql/nest.go b/store/db/mysql/nest.go index 2b12322ec479e..403f52e9eae27 100644 --- a/store/db/mysql/nest.go +++ b/store/db/mysql/nest.go @@ -11,9 +11,9 @@ import ( ) func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, error) { - fields := []string{"`uid`", "`creator_id`"} + fields := []string{"`name`", "`creator_id`"} placeholder := []string{"?", "?"} - args := []any{create.UID, create.CreatorID} + args := []any{create.Name, create.CreatorID} stmt := "INSERT INTO `nest` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ")" result, err := d.db.ExecContext(ctx, stmt, args...) @@ -42,8 +42,8 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest if v := find.ID; v != nil { where, args = append(where, "`nest`.`id` = ?"), append(args, *v) } - if v := find.UID; v != nil { - where, args = append(where, "`nest`.`uid` = ?"), append(args, *v) + if v := find.Name; v != nil { + where, args = append(where, "`nest`.`name` = ?"), append(args, *v) } if v := find.CreatorID; v != nil { where, args = append(where, "`nest`.`creator_id` = ?"), append(args, *v) @@ -81,7 +81,7 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest fields := []string{ "`nest`.`id` AS `id`", - "`nest`.`uid` AS `uid`", + "`nest`.`name` AS `name`", "`nest`.`creator_id` AS `creator_id`", "UNIX_TIMESTAMP(`nest`.`created_ts`) AS `created_ts`", "UNIX_TIMESTAMP(`nest`.`updated_ts`) AS `updated_ts`", @@ -110,7 +110,7 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest var nest store.Nest dests := []any{ &nest.ID, - &nest.UID, + &nest.Name, &nest.CreatorID, &nest.CreatedTs, &nest.UpdatedTs, @@ -144,8 +144,8 @@ func (d *DB) GetNest(ctx context.Context, find *store.FindNest) (*store.Nest, er func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { set, args := []string{}, []any{} - if v := update.UID; v != nil { - set, args = append(set, "`uid` = ?"), append(args, *v) + if v := update.Name; v != nil { + set, args = append(set, "`name` = ?"), append(args, *v) } if v := update.CreatedTs; v != nil { set, args = append(set, "`created_ts` = FROM_UNIXTIME(?)"), append(args, *v) diff --git a/store/db/postgres/nest.go b/store/db/postgres/nest.go index 859a4d9cc56e9..2fd740f612b87 100644 --- a/store/db/postgres/nest.go +++ b/store/db/postgres/nest.go @@ -11,8 +11,8 @@ import ( ) func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, error) { - fields := []string{"uid", "creator_id"} - args := []any{create.UID, create.CreatorID} + fields := []string{"name", "creator_id"} + args := []any{create.Name, create.CreatorID} stmt := "INSERT INTO nest (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts, updated_ts, row_status" if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( @@ -33,8 +33,8 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest if v := find.ID; v != nil { where, args = append(where, "nest.id = "+placeholder(len(args)+1)), append(args, *v) } - if v := find.UID; v != nil { - where, args = append(where, "nest.uid = "+placeholder(len(args)+1)), append(args, *v) + if v := find.Name; v != nil { + where, args = append(where, "nest.name = "+placeholder(len(args)+1)), append(args, *v) } if v := find.CreatorID; v != nil { where, args = append(where, "nest.creator_id = "+placeholder(len(args)+1)), append(args, *v) @@ -72,7 +72,7 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest fields := []string{ `nest.id AS id`, - `nest.uid AS uid`, + `nest.name AS name`, `nest.creator_id AS creator_id`, `nest.created_ts AS created_ts`, `nest.updated_ts AS updated_ts`, @@ -101,7 +101,7 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest var nest store.Nest dests := []any{ &nest.ID, - &nest.UID, + &nest.Name, &nest.CreatorID, &nest.CreatedTs, &nest.UpdatedTs, @@ -135,8 +135,8 @@ func (d *DB) GetNest(ctx context.Context, find *store.FindNest) (*store.Nest, er func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { set, args := []string{}, []any{} - if v := update.UID; v != nil { - set, args = append(set, "uid = "+placeholder(len(args)+1)), append(args, *v) + if v := update.Name; v != nil { + set, args = append(set, "name = "+placeholder(len(args)+1)), append(args, *v) } if v := update.CreatedTs; v != nil { set, args = append(set, "created_ts = "+placeholder(len(args)+1)), append(args, *v) diff --git a/store/db/sqlite/nest.go b/store/db/sqlite/nest.go index d1ed35508413d..18c05080c1822 100644 --- a/store/db/sqlite/nest.go +++ b/store/db/sqlite/nest.go @@ -9,9 +9,9 @@ import ( ) func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, error) { - fields := []string{"`uid`", "`creator_id`"} + fields := []string{"`name`", "`creator_id`"} placeholder := []string{"?", "?"} - args := []any{create.UID, create.CreatorID} + args := []any{create.Name, create.CreatorID} stmt := "INSERT INTO `nest` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `updated_ts`, `row_status`" if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( @@ -32,8 +32,8 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest if v := find.ID; v != nil { where, args = append(where, "`nest`.`id` = ?"), append(args, *v) } - if v := find.UID; v != nil { - where, args = append(where, "`nest`.`uid` = ?"), append(args, *v) + if v := find.Name; v != nil { + where, args = append(where, "`nest`.`name` = ?"), append(args, *v) } if v := find.CreatorID; v != nil { where, args = append(where, "`nest`.`creator_id` = ?"), append(args, *v) @@ -71,7 +71,7 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest fields := []string{ "`nest`.`id` AS `id`", - "`nest`.`uid` AS `uid`", + "`nest`.`name` AS `name`", "`nest`.`creator_id` AS `creator_id`", "`nest`.`created_ts` AS `created_ts`", "`nest`.`updated_ts` AS `updated_ts`", @@ -99,7 +99,7 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest var nest store.Nest dests := []any{ &nest.ID, - &nest.UID, + &nest.Name, &nest.CreatorID, &nest.CreatedTs, &nest.UpdatedTs, @@ -120,8 +120,8 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { set, args := []string{}, []any{} - if v := update.UID; v != nil { - set, args = append(set, "`uid` = ?"), append(args, *v) + if v := update.Name; v != nil { + set, args = append(set, "`name` = ?"), append(args, *v) } if v := update.CreatedTs; v != nil { set, args = append(set, "`created_ts` = ?"), append(args, *v) diff --git a/store/migration/mysql/dev/LATEST.sql b/store/migration/mysql/dev/LATEST.sql index 398afd4d92dd0..9bbf9ebd63fa9 100644 --- a/store/migration/mysql/dev/LATEST.sql +++ b/store/migration/mysql/dev/LATEST.sql @@ -52,7 +52,7 @@ CREATE TABLE `memo` ( -- nest CREATE TABLE nest ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `uid` VARCHAR(256) NOT NULL, + `name` VARCHAR(256) NOT NULL, `creator_id` INT NOT NULL, `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/store/migration/mysql/prod/0.24/00__nests.sql b/store/migration/mysql/prod/0.24/00__nests.sql index aa84487958aff..7bc622a9a20c7 100644 --- a/store/migration/mysql/prod/0.24/00__nests.sql +++ b/store/migration/mysql/prod/0.24/00__nests.sql @@ -4,7 +4,7 @@ ADD COLUMN nest INT NOT NULL DEFAULT 0; INSERT INTO - nest (uid, creator_id) + nest (name, creator_id) SELECT 'Personal', id FROM diff --git a/store/migration/mysql/prod/LATEST.sql b/store/migration/mysql/prod/LATEST.sql index 398afd4d92dd0..9bbf9ebd63fa9 100644 --- a/store/migration/mysql/prod/LATEST.sql +++ b/store/migration/mysql/prod/LATEST.sql @@ -52,7 +52,7 @@ CREATE TABLE `memo` ( -- nest CREATE TABLE nest ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - `uid` VARCHAR(256) NOT NULL, + `name` VARCHAR(256) NOT NULL, `creator_id` INT NOT NULL, `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, diff --git a/store/migration/postgres/dev/LATEST.sql b/store/migration/postgres/dev/LATEST.sql index c90db00eb2b50..354f2400da82a 100644 --- a/store/migration/postgres/dev/LATEST.sql +++ b/store/migration/postgres/dev/LATEST.sql @@ -52,7 +52,7 @@ CREATE TABLE memo ( -- nest CREATE TABLE nest ( id SERIAL PRIMARY KEY, - uid TEXT NOT NULL, + name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), diff --git a/store/migration/postgres/prod/0.24/00__nests.sql b/store/migration/postgres/prod/0.24/00__nests.sql index 65cb96f490bed..a0b6b31800af0 100644 --- a/store/migration/postgres/prod/0.24/00__nests.sql +++ b/store/migration/postgres/prod/0.24/00__nests.sql @@ -4,7 +4,7 @@ ADD COLUMN nest INTEGER NOT NULL DEFAULT 0; INSERT INTO - nest (uid, creator_id) + nest (name, creator_id) SELECT 'Personal', id FROM diff --git a/store/migration/postgres/prod/LATEST.sql b/store/migration/postgres/prod/LATEST.sql index c90db00eb2b50..354f2400da82a 100644 --- a/store/migration/postgres/prod/LATEST.sql +++ b/store/migration/postgres/prod/LATEST.sql @@ -52,7 +52,7 @@ CREATE TABLE memo ( -- nest CREATE TABLE nest ( id SERIAL PRIMARY KEY, - uid TEXT NOT NULL, + name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), diff --git a/store/migration/sqlite/dev/LATEST.sql b/store/migration/sqlite/dev/LATEST.sql index b786513d10ab1..8f278e8dedef9 100644 --- a/store/migration/sqlite/dev/LATEST.sql +++ b/store/migration/sqlite/dev/LATEST.sql @@ -55,7 +55,7 @@ CREATE TABLE memo ( -- nest CREATE TABLE nest ( id INTEGER PRIMARY KEY AUTOINCREMENT, - uid TEXT NOT NULL, + name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), diff --git a/store/migration/sqlite/prod/0.24/00__nests.sql b/store/migration/sqlite/prod/0.24/00__nests.sql index 3db2b15466ccf..7eb2d8ab67bc9 100644 --- a/store/migration/sqlite/prod/0.24/00__nests.sql +++ b/store/migration/sqlite/prod/0.24/00__nests.sql @@ -4,7 +4,7 @@ ADD COLUMN nest INTEGER NOT NULL DEFAULT 0; INSERT INTO - nest (uid, creator_id) + nest (name, creator_id) SELECT 'Personal', id FROM diff --git a/store/migration/sqlite/prod/LATEST.sql b/store/migration/sqlite/prod/LATEST.sql index 1d1cdc54a559b..f2a6eb3689ec4 100644 --- a/store/migration/sqlite/prod/LATEST.sql +++ b/store/migration/sqlite/prod/LATEST.sql @@ -55,7 +55,7 @@ CREATE TABLE memo ( -- nest CREATE TABLE nest ( id INTEGER PRIMARY KEY AUTOINCREMENT, - uid TEXT NOT NULL, + name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), diff --git a/store/nest.go b/store/nest.go index d3c6cbeae968e..bd3652c899877 100644 --- a/store/nest.go +++ b/store/nest.go @@ -10,8 +10,8 @@ import ( type Nest struct { // ID is the system generated unique identifier for the memo. ID int32 - // UID is the user defined unique identifier for the memo. - UID string + // Name is the user defined name for this nest. + Name string // Standard fields RowStatus RowStatus @@ -25,8 +25,8 @@ type Nest struct { } type FindNest struct { - ID *int32 - UID *string + ID *int32 + Name *string // Standard fields RowStatus *RowStatus @@ -50,7 +50,7 @@ type FindNest struct { type UpdateNest struct { ID int32 - UID *string + Name *string CreatedTs *int64 UpdatedTs *int64 RowStatus *RowStatus @@ -61,8 +61,8 @@ type DeleteNest struct { } func (s *Store) CreateNest(ctx context.Context, create *Nest) (*Nest, error) { - if !util.UIDMatcher.MatchString(create.UID) { - return nil, errors.New("invalid uid") + if !util.UIDMatcher.MatchString(create.Name) { + return nil, errors.New("invalid name") } return s.driver.CreateNest(ctx, create) } @@ -85,7 +85,7 @@ func (s *Store) GetNest(ctx context.Context, find *FindNest) (*Nest, error) { } func (s *Store) UpdateNest(ctx context.Context, update *UpdateNest) error { - if update.UID != nil && !util.UIDMatcher.MatchString(*update.UID) { + if update.Name != nil && !util.UIDMatcher.MatchString(*update.Name) { return errors.New("invalid uid") } return s.driver.UpdateNest(ctx, update) diff --git a/web/src/components/AddNestPopover.tsx b/web/src/components/AddNestPopover.tsx index d44c6a5433cd2..b782894de49f9 100644 --- a/web/src/components/AddNestPopover.tsx +++ b/web/src/components/AddNestPopover.tsx @@ -11,19 +11,19 @@ const AddNestPopover = () => { const t = useTranslate(); const nestStore = useNestStore(); const [popoverOpen, setPopoverOpen] = useState(false); - const [nestUID, setNestUID] = useState(""); + const [nestName, setNestName] = useState(""); const commonContext = useCommonContext(); const addNest = async () => { const nest = await nestStore.createNest({ - uid: nestUID, + name: nestName, }); if (nest) { await nestStore.fetchNests(); - commonContext.setNest(nest.name); + commonContext.setNest(nest.id); } setPopoverOpen(false); - setNestUID(""); + setNestName(""); }; return ( @@ -39,11 +39,11 @@ const AddNestPopover = () => { className="w-full" size="md" placeholder={t("nest.add-nest")} - value={nestUID} - onChange={(e) => setNestUID(e.target.value.trim())} + value={nestName} + onChange={(e) => setNestName(e.target.value.trim())} />
-
diff --git a/web/src/components/NestBanner.tsx b/web/src/components/NestBanner.tsx index 174c435c2b1ed..7dabcefeec844 100644 --- a/web/src/components/NestBanner.tsx +++ b/web/src/components/NestBanner.tsx @@ -34,15 +34,15 @@ const NestBanner = (props: Props) => { {!collapsed && ( - {nestStore.getNestByName(commonContext.nest)?.uid} + {nestStore.getNestById(commonContext.nest)?.name} )} {nests.map((nest) => ( - handleNestChange(nest.name)} key={nest.uid}> - {nest.uid} + handleNestChange(nest.id)} key={nest.id}> + {nest.name} ))} diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx index ffc97fa57eb20..9ceb78883a83b 100644 --- a/web/src/components/Settings/PreferencesSection.tsx +++ b/web/src/components/Settings/PreferencesSection.tsx @@ -103,8 +103,8 @@ const PreferencesSection = () => { }} > {nests.map((v) => ( - ))} diff --git a/web/src/store/v1/nest.ts b/web/src/store/v1/nest.ts index d964af9aa3906..4a7c782260f5d 100644 --- a/web/src/store/v1/nest.ts +++ b/web/src/store/v1/nest.ts @@ -19,25 +19,25 @@ export const useNestStore = create( const { nests } = await nestServiceClient.listNests({}); const nestMap = get().nestMapByName; for (const nest of nests) { - nestMap[nest.name] = nest; + nestMap[nest.id] = nest; } set({ nestMapByName: nestMap }); return nestMap; }, - getNestByName: (name: string) => { + getNestById: (id: string) => { const nestMap = get().nestMapByName; - return Object.values(nestMap).find((r) => r.name === name); + return Object.values(nestMap).find((r) => r.id === id); }, async createNest(create: CreateNestRequest): Promise { const nest = await nestServiceClient.createNest(create); const nestMap = get().nestMapByName; - nestMap[nest.name] = nest; + nestMap[nest.id] = nest; return nest; }, async updateNest(update: UpdateNestRequest): Promise { const nest = await nestServiceClient.updateNest(update); const nestMap = get().nestMapByName; - nestMap[nest.name] = nest; + nestMap[nest.id] = nest; return nest; }, })), From 92cf6c0cedef11dd0809abb1e04ac6e99ffd7f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 20:02:12 +0100 Subject: [PATCH 23/34] feat(nest): remove pagination for nests --- proto/api/v1/nest_service.proto | 13 +- proto/gen/api/v1/nest_service.pb.go | 179 ++++++++++--------------- proto/gen/api/v1/nest_service.pb.gw.go | 18 --- proto/gen/apidocs.swagger.yaml | 19 --- server/router/api/v1/nest_service.go | 29 +--- 5 files changed, 73 insertions(+), 185 deletions(-) diff --git a/proto/api/v1/nest_service.proto b/proto/api/v1/nest_service.proto index 46c5f0172f1ec..af1904e2ec572 100644 --- a/proto/api/v1/nest_service.proto +++ b/proto/api/v1/nest_service.proto @@ -64,21 +64,10 @@ message CreateNestRequest { string name = 1; } -message ListNestsRequest { - // The maximum number of nests to return. - int32 page_size = 1; - - // A page token, received from a previous `ListNests` call. - // Provide this to retrieve the subsequent page. - string page_token = 2; -} +message ListNestsRequest {} message ListNestsResponse { repeated Nest nests = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; } message GetNestRequest { diff --git a/proto/gen/api/v1/nest_service.pb.go b/proto/gen/api/v1/nest_service.pb.go index 7e8044ffa7afe..d6140f9c7f9c0 100644 --- a/proto/gen/api/v1/nest_service.pb.go +++ b/proto/gen/api/v1/nest_service.pb.go @@ -138,12 +138,6 @@ type ListNestsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - // The maximum number of nests to return. - PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` - // A page token, received from a previous `ListNests` call. - // Provide this to retrieve the subsequent page. - PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` } func (x *ListNestsRequest) Reset() { @@ -176,29 +170,12 @@ func (*ListNestsRequest) Descriptor() ([]byte, []int) { return file_api_v1_nest_service_proto_rawDescGZIP(), []int{2} } -func (x *ListNestsRequest) GetPageSize() int32 { - if x != nil { - return x.PageSize - } - return 0 -} - -func (x *ListNestsRequest) GetPageToken() string { - if x != nil { - return x.PageToken - } - return "" -} - type ListNestsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields Nests []*Nest `protobuf:"bytes,1,rep,name=nests,proto3" json:"nests,omitempty"` - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` } func (x *ListNestsResponse) Reset() { @@ -238,13 +215,6 @@ func (x *ListNestsResponse) GetNests() []*Nest { return nil } -func (x *ListNestsResponse) GetNextPageToken() string { - if x != nil { - return x.NextPageToken - } - return "" -} - type GetNestRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -466,86 +436,79 @@ var file_api_v1_nest_service_proto_rawDesc = []byte{ 0xe2, 0x41, 0x01, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4e, 0x0a, 0x10, 0x4c, 0x69, 0x73, - 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, - 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, - 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x70, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x65, 0x0a, 0x11, 0x4c, 0x69, 0x73, - 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, - 0x0a, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, - 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74, - 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0x20, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, - 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x78, - 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, + 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3d, 0x0a, + 0x11, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x23, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0x91, 0x05, - 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, - 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, - 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0d, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, - 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, - 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, - 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, - 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, - 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, - 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, - 0x21, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, - 0x2a, 0x7d, 0x12, 0x74, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x2b, 0xda, 0x41, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x6e, 0x61, 0x6d, - 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x7d, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x05, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x22, 0x20, 0x0a, 0x0e, + 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2a, + 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x26, 0x0a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, + 0x74, 0x52, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, + 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x23, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, + 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0x91, 0x05, 0x0a, 0x0b, 0x4e, 0x65, + 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, + 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, + 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x5e, + 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3a, 0xda, 0x41, 0x10, - 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, 0x19, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x64, 0x3d, 0x6e, - 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x68, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, - 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x2a, 0x14, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, - 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, - 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, - 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, - 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x21, 0xda, 0x41, 0x02, + 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x74, + 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, + 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x2b, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, + 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x7d, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, + 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3a, 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, + 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x21, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, + 0x2f, 0x2a, 0x7d, 0x12, 0x68, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, + 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0xda, 0x41, 0x02, 0x69, + 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x2a, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, + 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa8, 0x01, + 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, + 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/api/v1/nest_service.pb.gw.go b/proto/gen/api/v1/nest_service.pb.gw.go index d110e458a6656..aad76e601f8f0 100644 --- a/proto/gen/api/v1/nest_service.pb.gw.go +++ b/proto/gen/api/v1/nest_service.pb.gw.go @@ -57,21 +57,10 @@ func local_request_NestService_CreateNest_0(ctx context.Context, marshaler runti } -var ( - filter_NestService_ListNests_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - func request_NestService_ListNests_0(ctx context.Context, marshaler runtime.Marshaler, client NestServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListNestsRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NestService_ListNests_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := client.ListNests(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -81,13 +70,6 @@ func local_request_NestService_ListNests_0(ctx context.Context, marshaler runtim var protoReq ListNestsRequest var metadata runtime.ServerMetadata - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_NestService_ListNests_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - msg, err := server.ListNests(ctx, &protoReq) return msg, metadata, err diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index cfd4cdc9366d6..c477ccf2b1f7d 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -395,20 +395,6 @@ paths: description: An unexpected error response. schema: $ref: '#/definitions/googlerpcStatus' - parameters: - - name: pageSize - description: The maximum number of nests to return. - in: query - required: false - type: integer - format: int32 - - name: pageToken - description: |- - A page token, received from a previous `ListNests` call. - Provide this to retrieve the subsequent page. - in: query - required: false - type: string tags: - NestService post: @@ -2785,11 +2771,6 @@ definitions: items: type: object $ref: '#/definitions/v1Nest' - nextPageToken: - type: string - description: |- - A token, which can be sent as `page_token` to retrieve the next page. - If this field is omitted, there are no subsequent pages. v1ListNode: type: object properties: diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go index 1d603e534f3fa..bcbb23f41fa9b 100644 --- a/server/router/api/v1/nest_service.go +++ b/server/router/api/v1/nest_service.go @@ -58,38 +58,12 @@ func (s *APIV1Service) ListNests(ctx context.Context, request *v1pb.ListNestsReq CreatorID: &user.ID, } - var limit, offset int - if request.PageToken != "" { - var pageToken v1pb.PageToken - if err := unmarshalPageToken(request.PageToken, &pageToken); err != nil { - return nil, status.Errorf(codes.InvalidArgument, "invalid page token: %v", err) - } - limit = int(pageToken.Limit) - offset = int(pageToken.Offset) - } else { - limit = int(request.PageSize) - } - if limit <= 0 { - limit = DefaultPageSize - } - limitPlusOne := limit + 1 - nestFind.Limit = &limitPlusOne - nestFind.Offset = &offset - nests, err := s.Store.ListNests(ctx, nestFind) if err != nil { return nil, status.Errorf(codes.Internal, "failed to list nests: %v", err) } nestMessages := []*v1pb.Nest{} - nextPageToken := "" - if len(nests) == limitPlusOne { - nests = nests[:limit] - nextPageToken, err = getPageToken(limit, offset+limit) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get next page token, error: %v", err) - } - } for _, nest := range nests { nestMessage, err := convertNestFromStore(nest) if err != nil { @@ -99,8 +73,7 @@ func (s *APIV1Service) ListNests(ctx context.Context, request *v1pb.ListNestsReq } response := &v1pb.ListNestsResponse{ - Nests: nestMessages, - NextPageToken: nextPageToken, + Nests: nestMessages, } return response, nil } From 076bd718a38419b4c2abb947a7314a5404d8ed86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Wed, 13 Nov 2024 20:16:14 +0100 Subject: [PATCH 24/34] feat(nest): remove and clean update timestamp logic --- server/router/api/v1/nest_service.go | 4 +-- store/db/mysql/nest.go | 39 +--------------------- store/db/postgres/nest.go | 42 ++---------------------- store/db/sqlite/nest.go | 42 ++---------------------- store/migration/mysql/dev/LATEST.sql | 1 - store/migration/mysql/prod/LATEST.sql | 1 - store/migration/postgres/dev/LATEST.sql | 1 - store/migration/postgres/prod/LATEST.sql | 1 - store/migration/sqlite/dev/LATEST.sql | 1 - store/migration/sqlite/prod/LATEST.sql | 1 - store/nest.go | 26 ++------------- 11 files changed, 8 insertions(+), 151 deletions(-) diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go index bcbb23f41fa9b..db7caa7e51db2 100644 --- a/server/router/api/v1/nest_service.go +++ b/server/router/api/v1/nest_service.go @@ -172,10 +172,8 @@ func (s *APIV1Service) UpdateNest(ctx context.Context, request *v1pb.UpdateNestR return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - currentTs := time.Now().Unix() update := &store.UpdateNest{ - ID: id, - UpdatedTs: ¤tTs, + ID: id, } for _, path := range request.UpdateMask.Paths { if path == "name" { diff --git a/store/db/mysql/nest.go b/store/db/mysql/nest.go index 403f52e9eae27..5f7f931dcc983 100644 --- a/store/db/mysql/nest.go +++ b/store/db/mysql/nest.go @@ -2,7 +2,6 @@ package mysql import ( "context" - "fmt" "strings" "github.com/pkg/errors" @@ -51,32 +50,10 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest if v := find.RowStatus; v != nil { where, args = append(where, "`nest`.`row_status` = ?"), append(args, *v) } - if v := find.CreatedTsBefore; v != nil { - where, args = append(where, "UNIX_TIMESTAMP(`nest`.`created_ts`) < ?"), append(args, *v) - } - if v := find.CreatedTsAfter; v != nil { - where, args = append(where, "UNIX_TIMESTAMP(`nest`.`created_ts`) > ?"), append(args, *v) - } - if v := find.UpdatedTsBefore; v != nil { - where, args = append(where, "UNIX_TIMESTAMP(`nest`.`updated_ts`) < ?"), append(args, *v) - } - if v := find.UpdatedTsAfter; v != nil { - where, args = append(where, "UNIX_TIMESTAMP(`nest`.`updated_ts`) > ?"), append(args, *v) - } orders := []string{} - if find.OrderByPinned { - orders = append(orders, "`pinned` DESC") - } order := "DESC" - if find.OrderByTimeAsc { - order = "ASC" - } - if find.OrderByUpdatedTs { - orders = append(orders, "`updated_ts` "+order) - } else { - orders = append(orders, "`created_ts` "+order) - } + orders = append(orders, "`created_ts` "+order) orders = append(orders, "`id` "+order) fields := []string{ @@ -84,7 +61,6 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest "`nest`.`name` AS `name`", "`nest`.`creator_id` AS `creator_id`", "UNIX_TIMESTAMP(`nest`.`created_ts`) AS `created_ts`", - "UNIX_TIMESTAMP(`nest`.`updated_ts`) AS `updated_ts`", "`nest`.`row_status` AS `row_status`", } @@ -92,12 +68,6 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest "WHERE " + strings.Join(where, " AND ") + " " + "HAVING " + strings.Join(having, " AND ") + " " + "ORDER BY " + strings.Join(orders, ", ") - if find.Limit != nil { - query = fmt.Sprintf("%s LIMIT %d", query, *find.Limit) - if find.Offset != nil { - query = fmt.Sprintf("%s OFFSET %d", query, *find.Offset) - } - } rows, err := d.db.QueryContext(ctx, query, args...) if err != nil { @@ -113,7 +83,6 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest &nest.Name, &nest.CreatorID, &nest.CreatedTs, - &nest.UpdatedTs, &nest.RowStatus, } if err := rows.Scan(dests...); err != nil { @@ -147,12 +116,6 @@ func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { if v := update.Name; v != nil { set, args = append(set, "`name` = ?"), append(args, *v) } - if v := update.CreatedTs; v != nil { - set, args = append(set, "`created_ts` = FROM_UNIXTIME(?)"), append(args, *v) - } - if v := update.UpdatedTs; v != nil { - set, args = append(set, "`updated_ts` = FROM_UNIXTIME(?)"), append(args, *v) - } if v := update.RowStatus; v != nil { set, args = append(set, "`row_status` = ?"), append(args, *v) } diff --git a/store/db/postgres/nest.go b/store/db/postgres/nest.go index 2fd740f612b87..f4e4103f25eb3 100644 --- a/store/db/postgres/nest.go +++ b/store/db/postgres/nest.go @@ -2,7 +2,6 @@ package postgres import ( "context" - "fmt" "strings" "github.com/pkg/errors" @@ -14,11 +13,10 @@ func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, e fields := []string{"name", "creator_id"} args := []any{create.Name, create.CreatorID} - stmt := "INSERT INTO nest (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts, updated_ts, row_status" + stmt := "INSERT INTO nest (" + strings.Join(fields, ", ") + ") VALUES (" + placeholders(len(args)) + ") RETURNING id, created_ts, row_status" if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( &create.ID, &create.CreatedTs, - &create.UpdatedTs, &create.RowStatus, ); err != nil { return nil, err @@ -42,32 +40,10 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest if v := find.RowStatus; v != nil { where, args = append(where, "nest.row_status = "+placeholder(len(args)+1)), append(args, *v) } - if v := find.CreatedTsBefore; v != nil { - where, args = append(where, "nest.created_ts < "+placeholder(len(args)+1)), append(args, *v) - } - if v := find.CreatedTsAfter; v != nil { - where, args = append(where, "nest.created_ts > "+placeholder(len(args)+1)), append(args, *v) - } - if v := find.UpdatedTsBefore; v != nil { - where, args = append(where, "nest.updated_ts < "+placeholder(len(args)+1)), append(args, *v) - } - if v := find.UpdatedTsAfter; v != nil { - where, args = append(where, "nest.updated_ts > "+placeholder(len(args)+1)), append(args, *v) - } orders := []string{} - if find.OrderByPinned { - orders = append(orders, "pinned DESC") - } order := "DESC" - if find.OrderByTimeAsc { - order = "ASC" - } - if find.OrderByUpdatedTs { - orders = append(orders, "updated_ts "+order) - } else { - orders = append(orders, "created_ts "+order) - } + orders = append(orders, "created_ts "+order) orders = append(orders, "id "+order) fields := []string{ @@ -75,7 +51,6 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest `nest.name AS name`, `nest.creator_id AS creator_id`, `nest.created_ts AS created_ts`, - `nest.updated_ts AS updated_ts`, `nest.row_status AS row_status`, } @@ -83,12 +58,6 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest FROM nest WHERE ` + strings.Join(where, " AND ") + ` ORDER BY ` + strings.Join(orders, ", ") - if find.Limit != nil { - query = fmt.Sprintf("%s LIMIT %d", query, *find.Limit) - if find.Offset != nil { - query = fmt.Sprintf("%s OFFSET %d", query, *find.Offset) - } - } rows, err := d.db.QueryContext(ctx, query, args...) if err != nil { @@ -104,7 +73,6 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest &nest.Name, &nest.CreatorID, &nest.CreatedTs, - &nest.UpdatedTs, &nest.RowStatus, } if err := rows.Scan(dests...); err != nil { @@ -138,12 +106,6 @@ func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { if v := update.Name; v != nil { set, args = append(set, "name = "+placeholder(len(args)+1)), append(args, *v) } - if v := update.CreatedTs; v != nil { - set, args = append(set, "created_ts = "+placeholder(len(args)+1)), append(args, *v) - } - if v := update.UpdatedTs; v != nil { - set, args = append(set, "updated_ts = "+placeholder(len(args)+1)), append(args, *v) - } if v := update.RowStatus; v != nil { set, args = append(set, "row_status = "+placeholder(len(args)+1)), append(args, *v) } diff --git a/store/db/sqlite/nest.go b/store/db/sqlite/nest.go index 18c05080c1822..4dafbb7c79de9 100644 --- a/store/db/sqlite/nest.go +++ b/store/db/sqlite/nest.go @@ -2,7 +2,6 @@ package sqlite import ( "context" - "fmt" "strings" "github.com/usememos/memos/store" @@ -13,11 +12,10 @@ func (d *DB) CreateNest(ctx context.Context, create *store.Nest) (*store.Nest, e placeholder := []string{"?", "?"} args := []any{create.Name, create.CreatorID} - stmt := "INSERT INTO `nest` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `updated_ts`, `row_status`" + stmt := "INSERT INTO `nest` (" + strings.Join(fields, ", ") + ") VALUES (" + strings.Join(placeholder, ", ") + ") RETURNING `id`, `created_ts`, `row_status`" if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( &create.ID, &create.CreatedTs, - &create.UpdatedTs, &create.RowStatus, ); err != nil { return nil, err @@ -41,32 +39,10 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest if v := find.RowStatus; v != nil { where, args = append(where, "`nest`.`row_status` = ?"), append(args, *v) } - if v := find.CreatedTsBefore; v != nil { - where, args = append(where, "`nest`.`created_ts` < ?"), append(args, *v) - } - if v := find.CreatedTsAfter; v != nil { - where, args = append(where, "`nest`.`created_ts` > ?"), append(args, *v) - } - if v := find.UpdatedTsBefore; v != nil { - where, args = append(where, "`nest`.`updated_ts` < ?"), append(args, *v) - } - if v := find.UpdatedTsAfter; v != nil { - where, args = append(where, "`nest`.`updated_ts` > ?"), append(args, *v) - } orderBy := []string{} - if find.OrderByPinned { - orderBy = append(orderBy, "`pinned` DESC") - } order := "DESC" - if find.OrderByTimeAsc { - order = "ASC" - } - if find.OrderByUpdatedTs { - orderBy = append(orderBy, "`updated_ts` "+order) - } else { - orderBy = append(orderBy, "`created_ts` "+order) - } + orderBy = append(orderBy, "`created_ts` "+order) orderBy = append(orderBy, "`id` "+order) fields := []string{ @@ -74,19 +50,12 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest "`nest`.`name` AS `name`", "`nest`.`creator_id` AS `creator_id`", "`nest`.`created_ts` AS `created_ts`", - "`nest`.`updated_ts` AS `updated_ts`", "`nest`.`row_status` AS `row_status`", } query := "SELECT " + strings.Join(fields, ", ") + "FROM `nest` " + "WHERE " + strings.Join(where, " AND ") + " " + "ORDER BY " + strings.Join(orderBy, ", ") - if find.Limit != nil { - query = fmt.Sprintf("%s LIMIT %d", query, *find.Limit) - if find.Offset != nil { - query = fmt.Sprintf("%s OFFSET %d", query, *find.Offset) - } - } rows, err := d.db.QueryContext(ctx, query, args...) if err != nil { @@ -102,7 +71,6 @@ func (d *DB) ListNests(ctx context.Context, find *store.FindNest) ([]*store.Nest &nest.Name, &nest.CreatorID, &nest.CreatedTs, - &nest.UpdatedTs, &nest.RowStatus, } if err := rows.Scan(dests...); err != nil { @@ -123,12 +91,6 @@ func (d *DB) UpdateNest(ctx context.Context, update *store.UpdateNest) error { if v := update.Name; v != nil { set, args = append(set, "`name` = ?"), append(args, *v) } - if v := update.CreatedTs; v != nil { - set, args = append(set, "`created_ts` = ?"), append(args, *v) - } - if v := update.UpdatedTs; v != nil { - set, args = append(set, "`updated_ts` = ?"), append(args, *v) - } if v := update.RowStatus; v != nil { set, args = append(set, "`row_status` = ?"), append(args, *v) } diff --git a/store/migration/mysql/dev/LATEST.sql b/store/migration/mysql/dev/LATEST.sql index 9bbf9ebd63fa9..2ca1faa6298b4 100644 --- a/store/migration/mysql/dev/LATEST.sql +++ b/store/migration/mysql/dev/LATEST.sql @@ -55,7 +55,6 @@ CREATE TABLE nest ( `name` VARCHAR(256) NOT NULL, `creator_id` INT NOT NULL, `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' ); diff --git a/store/migration/mysql/prod/LATEST.sql b/store/migration/mysql/prod/LATEST.sql index 9bbf9ebd63fa9..2ca1faa6298b4 100644 --- a/store/migration/mysql/prod/LATEST.sql +++ b/store/migration/mysql/prod/LATEST.sql @@ -55,7 +55,6 @@ CREATE TABLE nest ( `name` VARCHAR(256) NOT NULL, `creator_id` INT NOT NULL, `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - `updated_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' ); diff --git a/store/migration/postgres/dev/LATEST.sql b/store/migration/postgres/dev/LATEST.sql index 354f2400da82a..9f0ee410d6deb 100644 --- a/store/migration/postgres/dev/LATEST.sql +++ b/store/migration/postgres/dev/LATEST.sql @@ -55,7 +55,6 @@ CREATE TABLE nest ( name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), - updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), row_status TEXT NOT NULL DEFAULT 'NORMAL' ); diff --git a/store/migration/postgres/prod/LATEST.sql b/store/migration/postgres/prod/LATEST.sql index 354f2400da82a..9f0ee410d6deb 100644 --- a/store/migration/postgres/prod/LATEST.sql +++ b/store/migration/postgres/prod/LATEST.sql @@ -55,7 +55,6 @@ CREATE TABLE nest ( name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), - updated_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), row_status TEXT NOT NULL DEFAULT 'NORMAL' ); diff --git a/store/migration/sqlite/dev/LATEST.sql b/store/migration/sqlite/dev/LATEST.sql index 8f278e8dedef9..2cb25e0b746fc 100644 --- a/store/migration/sqlite/dev/LATEST.sql +++ b/store/migration/sqlite/dev/LATEST.sql @@ -58,7 +58,6 @@ CREATE TABLE nest ( name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), - updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' ); diff --git a/store/migration/sqlite/prod/LATEST.sql b/store/migration/sqlite/prod/LATEST.sql index f2a6eb3689ec4..72fc4293464b7 100644 --- a/store/migration/sqlite/prod/LATEST.sql +++ b/store/migration/sqlite/prod/LATEST.sql @@ -58,7 +58,6 @@ CREATE TABLE nest ( name TEXT NOT NULL, creator_id INTEGER NOT NULL, created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), - updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' ); diff --git a/store/nest.go b/store/nest.go index bd3652c899877..d3cf8b5518dc2 100644 --- a/store/nest.go +++ b/store/nest.go @@ -17,11 +17,6 @@ type Nest struct { RowStatus RowStatus CreatorID int32 CreatedTs int64 - UpdatedTs int64 - - // Domain specific fields - - // Composed fields } type FindNest struct { @@ -29,30 +24,13 @@ type FindNest struct { Name *string // Standard fields - RowStatus *RowStatus - CreatorID *int32 - CreatedTsAfter *int64 - CreatedTsBefore *int64 - UpdatedTsAfter *int64 - UpdatedTsBefore *int64 - - // Domain specific fields - - // Pagination - Limit *int - Offset *int - - // Ordering - OrderByUpdatedTs bool - OrderByPinned bool - OrderByTimeAsc bool + RowStatus *RowStatus + CreatorID *int32 } type UpdateNest struct { ID int32 Name *string - CreatedTs *int64 - UpdatedTs *int64 RowStatus *RowStatus } From 7b1a198ef4ac966f9935265e035f6c823f06dcff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Thu, 14 Nov 2024 00:48:27 +0100 Subject: [PATCH 25/34] feat(nest): fix fetch nests on sign in --- web/src/components/PasswordSignInForm.tsx | 4 +++- web/src/components/Settings/PreferencesSection.tsx | 5 +++-- web/src/layouts/CommonContextProvider.tsx | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web/src/components/PasswordSignInForm.tsx b/web/src/components/PasswordSignInForm.tsx index aba46cba666b5..d8ef1c5bb71a5 100644 --- a/web/src/components/PasswordSignInForm.tsx +++ b/web/src/components/PasswordSignInForm.tsx @@ -7,7 +7,7 @@ import { authServiceClient } from "@/grpcweb"; import useLoading from "@/hooks/useLoading"; import useNavigateTo from "@/hooks/useNavigateTo"; import { useCommonContext } from "@/layouts/CommonContextProvider"; -import { useUserStore } from "@/store/v1"; +import { useNestStore, useUserStore } from "@/store/v1"; import { useTranslate } from "@/utils/i18n"; const PasswordSignInForm = () => { @@ -15,6 +15,7 @@ const PasswordSignInForm = () => { const navigateTo = useNavigateTo(); const commonContext = useCommonContext(); const userStore = useUserStore(); + const nestStore = useNestStore(); const actionBtnLoadingState = useLoading(false); const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); @@ -55,6 +56,7 @@ const PasswordSignInForm = () => { actionBtnLoadingState.setLoading(); await authServiceClient.signIn({ username, password, neverExpire: remember }); await userStore.fetchCurrentUser(); + await nestStore.fetchNests(); navigateTo("/"); } catch (error: any) { console.error(error); diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx index 9ceb78883a83b..c7694eba2913b 100644 --- a/web/src/components/Settings/PreferencesSection.tsx +++ b/web/src/components/Settings/PreferencesSection.tsx @@ -48,10 +48,11 @@ const PreferencesSection = () => { ); }; - const handleDefaultNestChanged = async (value: string) => { + const handleDefaultNestChanged = async (nest: string) => { + commonContext.setNest(nest); await userStore.updateUserSetting( { - nest: value, + nest, }, ["nest"], ); diff --git a/web/src/layouts/CommonContextProvider.tsx b/web/src/layouts/CommonContextProvider.tsx index 07696044ed772..b641422a58d2b 100644 --- a/web/src/layouts/CommonContextProvider.tsx +++ b/web/src/layouts/CommonContextProvider.tsx @@ -39,6 +39,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { }); const [locale] = useLocalStorage("locale", "en"); const [appearance] = useLocalStorage("appearance", "system"); + const [nest] = useLocalStorage("nest", "none"); useEffect(() => { const initialWorkspace = async () => { @@ -55,7 +56,7 @@ const CommonContextProvider = ({ children }: { children: React.ReactNode }) => { setCommonContext({ locale: locale || workspaceGeneralSetting.customProfile?.locale || "en", appearance: appearance || workspaceGeneralSetting.customProfile?.appearance || "system", - nest: "none", + nest: nest || "none", profile: workspaceProfile, }); }; From 1a97d166a3acde0cae174089fc4c9159699ae828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Thu, 14 Nov 2024 00:58:29 +0100 Subject: [PATCH 26/34] feat(nest): fix tags in explore view --- web/src/store/v1/memoMetadata.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/store/v1/memoMetadata.ts b/web/src/store/v1/memoMetadata.ts index 46d5a4a1bb40e..79f2ee90024f6 100644 --- a/web/src/store/v1/memoMetadata.ts +++ b/web/src/store/v1/memoMetadata.ts @@ -30,7 +30,6 @@ export const useMemoMetadataStore = create( getState: () => get(), fetchMemoMetadata: async (params: { user?: User; location?: Location; nest: string }) => { const filters = [`row_status == "NORMAL"`]; - filters.push(`nest == "${params.nest}"`); if (get().nest != params.nest) { set({ nest: params.nest, dataMapByName: {} }); @@ -39,6 +38,8 @@ export const useMemoMetadataStore = create( if (params.user) { if (params.location?.pathname === Routes.EXPLORE) { filters.push(`visibilities == ["PUBLIC", "PROTECTED"]`); + } else { + filters.push(`nest == "${params.nest}"`); } filters.push(`creator == "${params.user.name}"`); } else { From d2b9bd883a4f2a56bf0056cc5e0fcd2bcc12fb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Thu, 14 Nov 2024 01:14:38 +0100 Subject: [PATCH 27/34] feat(nest): set default nest for all existing memos --- store/migration/mysql/prod/0.24/00__nests.sql | 14 +++++++++++++- store/migration/postgres/prod/0.24/00__nests.sql | 13 ++++++++++++- store/migration/sqlite/prod/0.24/00__nests.sql | 13 ++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/store/migration/mysql/prod/0.24/00__nests.sql b/store/migration/mysql/prod/0.24/00__nests.sql index 7bc622a9a20c7..11a0612531316 100644 --- a/store/migration/mysql/prod/0.24/00__nests.sql +++ b/store/migration/mysql/prod/0.24/00__nests.sql @@ -8,4 +8,16 @@ INSERT INTO SELECT 'Personal', id FROM - user; \ No newline at end of file + user; + +UPDATE + memo +SET + nest = ( + SELECT id + FROM nest + WHERE creator_id = memo.creator_id + LIMIT 1 + ) +WHERE + nest = 0; diff --git a/store/migration/postgres/prod/0.24/00__nests.sql b/store/migration/postgres/prod/0.24/00__nests.sql index a0b6b31800af0..330da71dce5ab 100644 --- a/store/migration/postgres/prod/0.24/00__nests.sql +++ b/store/migration/postgres/prod/0.24/00__nests.sql @@ -8,4 +8,15 @@ INSERT INTO SELECT 'Personal', id FROM - "user"; \ No newline at end of file + "user"; + +UPDATE + memo +SET + nest = ( + SELECT id + FROM nest + WHERE creator_id = memo.creator_id + ) +WHERE + nest = 0; \ No newline at end of file diff --git a/store/migration/sqlite/prod/0.24/00__nests.sql b/store/migration/sqlite/prod/0.24/00__nests.sql index 7eb2d8ab67bc9..db68d6c972c1d 100644 --- a/store/migration/sqlite/prod/0.24/00__nests.sql +++ b/store/migration/sqlite/prod/0.24/00__nests.sql @@ -8,4 +8,15 @@ INSERT INTO SELECT 'Personal', id FROM - user; \ No newline at end of file + user; + +UPDATE + memo +SET + nest = ( + SELECT id + FROM nest + WHERE creator_id = memo.creator_id + ) +WHERE + nest = 0; \ No newline at end of file From 96c6e1836d61701bdf0c7dc297d1f68556b4ef7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Thu, 14 Nov 2024 01:39:01 +0100 Subject: [PATCH 28/34] feat(nest): fix create table for migrations --- store/migration/mysql/prod/0.24/00__nests.sql | 8 ++++++++ store/migration/postgres/prod/0.24/00__nests.sql | 8 ++++++++ store/migration/sqlite/prod/0.24/00__nests.sql | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/store/migration/mysql/prod/0.24/00__nests.sql b/store/migration/mysql/prod/0.24/00__nests.sql index 11a0612531316..13f24ade8d383 100644 --- a/store/migration/mysql/prod/0.24/00__nests.sql +++ b/store/migration/mysql/prod/0.24/00__nests.sql @@ -3,6 +3,14 @@ ALTER TABLE ADD COLUMN nest INT NOT NULL DEFAULT 0; +CREATE TABLE nest ( + `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + `name` VARCHAR(256) NOT NULL, + `creator_id` INT NOT NULL, + `created_ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + `row_status` VARCHAR(256) NOT NULL DEFAULT 'NORMAL' +); + INSERT INTO nest (name, creator_id) SELECT diff --git a/store/migration/postgres/prod/0.24/00__nests.sql b/store/migration/postgres/prod/0.24/00__nests.sql index 330da71dce5ab..eefcd142b16d6 100644 --- a/store/migration/postgres/prod/0.24/00__nests.sql +++ b/store/migration/postgres/prod/0.24/00__nests.sql @@ -3,6 +3,14 @@ ALTER TABLE ADD COLUMN nest INTEGER NOT NULL DEFAULT 0; +CREATE TABLE nest ( + id SERIAL PRIMARY KEY, + name TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT EXTRACT(EPOCH FROM NOW()), + row_status TEXT NOT NULL DEFAULT 'NORMAL' +); + INSERT INTO nest (name, creator_id) SELECT diff --git a/store/migration/sqlite/prod/0.24/00__nests.sql b/store/migration/sqlite/prod/0.24/00__nests.sql index db68d6c972c1d..195cbb4093ac5 100644 --- a/store/migration/sqlite/prod/0.24/00__nests.sql +++ b/store/migration/sqlite/prod/0.24/00__nests.sql @@ -3,6 +3,14 @@ ALTER TABLE ADD COLUMN nest INTEGER NOT NULL DEFAULT 0; +CREATE TABLE nest ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL, + creator_id INTEGER NOT NULL, + created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')), + row_status TEXT NOT NULL CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL' +); + INSERT INTO nest (name, creator_id) SELECT From 44297d4e74824e131ecb8248c328148d438e2ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Thu, 14 Nov 2024 01:39:22 +0100 Subject: [PATCH 29/34] feat(nest): fix hide nest banner if no user is logged in --- web/src/components/Navigation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index 83e84a6219f79..7a08c5585618b 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -120,7 +120,7 @@ const Navigation = (props: Props) => { className={clsx("w-full h-full overflow-auto flex flex-col justify-start items-start py-4 md:pt-6 z-30 hide-scrollbar", className)} > - + {user?():(null)}
{navLinks.map((navLink) => ( Date: Thu, 14 Nov 2024 01:50:33 +0100 Subject: [PATCH 30/34] feat(nest): add default nest user setting --- store/migration/mysql/prod/0.24/00__nests.sql | 9 +++++++++ store/migration/postgres/prod/0.24/00__nests.sql | 11 ++++++++++- store/migration/sqlite/prod/0.24/00__nests.sql | 11 ++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/store/migration/mysql/prod/0.24/00__nests.sql b/store/migration/mysql/prod/0.24/00__nests.sql index 13f24ade8d383..49b23000f818b 100644 --- a/store/migration/mysql/prod/0.24/00__nests.sql +++ b/store/migration/mysql/prod/0.24/00__nests.sql @@ -29,3 +29,12 @@ SET ) WHERE nest = 0; + +INSERT INTO + user_setting (user_id, key, value) +SELECT + creator_id AS user_id, + 'NEST' AS key, + id AS value +FROM + nest; \ No newline at end of file diff --git a/store/migration/postgres/prod/0.24/00__nests.sql b/store/migration/postgres/prod/0.24/00__nests.sql index eefcd142b16d6..c0b092068f367 100644 --- a/store/migration/postgres/prod/0.24/00__nests.sql +++ b/store/migration/postgres/prod/0.24/00__nests.sql @@ -27,4 +27,13 @@ SET WHERE creator_id = memo.creator_id ) WHERE - nest = 0; \ No newline at end of file + nest = 0; + +INSERT INTO + user_setting (user_id, key, value) +SELECT + creator_id AS user_id, + 'NEST' AS key, + id::text AS value +FROM + nest; \ No newline at end of file diff --git a/store/migration/sqlite/prod/0.24/00__nests.sql b/store/migration/sqlite/prod/0.24/00__nests.sql index 195cbb4093ac5..840e76a46ff2e 100644 --- a/store/migration/sqlite/prod/0.24/00__nests.sql +++ b/store/migration/sqlite/prod/0.24/00__nests.sql @@ -27,4 +27,13 @@ SET WHERE creator_id = memo.creator_id ) WHERE - nest = 0; \ No newline at end of file + nest = 0; + +INSERT INTO + user_setting (user_id, key, value) +SELECT + creator_id AS user_id, + 'NEST' AS key, + id AS value +FROM + nest; From 5d802ca703bf563d9f2510b1bf6e1ebcf19dec24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Thu, 14 Nov 2024 02:22:14 +0100 Subject: [PATCH 31/34] feat(nest): fix eslint --- web/src/components/Navigation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index 7a08c5585618b..47e4a79d9bf74 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -120,7 +120,7 @@ const Navigation = (props: Props) => { className={clsx("w-full h-full overflow-auto flex flex-col justify-start items-start py-4 md:pt-6 z-30 hide-scrollbar", className)} > - {user?():(null)} + {user ? : null}
{navLinks.map((navLink) => ( Date: Thu, 14 Nov 2024 02:24:14 +0100 Subject: [PATCH 32/34] feat(nest): fix golangci --- server/router/api/v1/nest_service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go index db7caa7e51db2..435aad245c28c 100644 --- a/server/router/api/v1/nest_service.go +++ b/server/router/api/v1/nest_service.go @@ -44,7 +44,7 @@ func (s *APIV1Service) CreateNest(ctx context.Context, request *v1pb.CreateNestR return nestMessage, nil } -func (s *APIV1Service) ListNests(ctx context.Context, request *v1pb.ListNestsRequest) (*v1pb.ListNestsResponse, error) { +func (s *APIV1Service) ListNests(ctx context.Context, _ *v1pb.ListNestsRequest) (*v1pb.ListNestsResponse, error) { user, err := s.GetCurrentUser(ctx) if err != nil { return nil, status.Errorf(codes.Internal, "failed to get user") From 3ae560393ecb160446c207b54cc7a2f68cec5022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Fri, 15 Nov 2024 08:27:32 +0100 Subject: [PATCH 33/34] feat(nest): put migration in 0.23 directory --- .../mysql/prod/{0.24/00__nests.sql => 0.23/01__nests.sql} | 0 .../postgres/prod/{0.24/00__nests.sql => 0.23/01__nests.sql} | 0 .../sqlite/prod/{0.24/00__nests.sql => 0.23/01__nests.sql} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename store/migration/mysql/prod/{0.24/00__nests.sql => 0.23/01__nests.sql} (100%) rename store/migration/postgres/prod/{0.24/00__nests.sql => 0.23/01__nests.sql} (100%) rename store/migration/sqlite/prod/{0.24/00__nests.sql => 0.23/01__nests.sql} (100%) diff --git a/store/migration/mysql/prod/0.24/00__nests.sql b/store/migration/mysql/prod/0.23/01__nests.sql similarity index 100% rename from store/migration/mysql/prod/0.24/00__nests.sql rename to store/migration/mysql/prod/0.23/01__nests.sql diff --git a/store/migration/postgres/prod/0.24/00__nests.sql b/store/migration/postgres/prod/0.23/01__nests.sql similarity index 100% rename from store/migration/postgres/prod/0.24/00__nests.sql rename to store/migration/postgres/prod/0.23/01__nests.sql diff --git a/store/migration/sqlite/prod/0.24/00__nests.sql b/store/migration/sqlite/prod/0.23/01__nests.sql similarity index 100% rename from store/migration/sqlite/prod/0.24/00__nests.sql rename to store/migration/sqlite/prod/0.23/01__nests.sql From 6a463260e7d0e046f74fbe591989e213744d558e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20MANELLI?= Date: Sat, 16 Nov 2024 18:46:06 +0100 Subject: [PATCH 34/34] feat(nest): add first revision of delete nest functionality --- proto/api/v1/nest_service.proto | 7 +- proto/gen/api/v1/nest_service.pb.go | 121 +++++++++++++---------- proto/gen/api/v1/nest_service.pb.gw.go | 26 ++++- proto/gen/apidocs.swagger.yaml | 7 ++ server/router/api/v1/nest_service.go | 38 ++++++- web/src/components/DeleteNestPopover.tsx | 81 +++++++++++++++ web/src/components/NestBanner.tsx | 4 +- web/src/locales/en.json | 3 +- web/src/store/v1/nest.ts | 6 +- 9 files changed, 227 insertions(+), 66 deletions(-) create mode 100644 web/src/components/DeleteNestPopover.tsx diff --git a/proto/api/v1/nest_service.proto b/proto/api/v1/nest_service.proto index af1904e2ec572..4b8ecba5e8fce 100644 --- a/proto/api/v1/nest_service.proto +++ b/proto/api/v1/nest_service.proto @@ -43,8 +43,8 @@ service NestService { } // DeleteNest deletes a nest by id. rpc DeleteNest(DeleteNestRequest) returns (google.protobuf.Empty) { - option (google.api.http) = {delete: "/api/v1/{id=nests/*}"}; - option (google.api.method_signature) = "id"; + option (google.api.http) = {delete: "/api/v1/{id=nests/*}/moveto/{move_to=nests/*}"}; + option (google.api.method_signature) = "id,moveto"; } } @@ -93,4 +93,7 @@ message DeleteNestRequest { // Format: nests/{id} // id is the system generated unique identifier. string id = 1; + + // The nest id where to move the memos of the nest being deleted. + string move_to = 2; } diff --git a/proto/gen/api/v1/nest_service.pb.go b/proto/gen/api/v1/nest_service.pb.go index d6140f9c7f9c0..c7e04bd1d8a2b 100644 --- a/proto/gen/api/v1/nest_service.pb.go +++ b/proto/gen/api/v1/nest_service.pb.go @@ -371,6 +371,8 @@ type DeleteNestRequest struct { // Format: nests/{id} // id is the system generated unique identifier. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // The nest id where to move the memos of the nest being deleted. + MoveTo string `protobuf:"bytes,2,opt,name=move_to,json=moveTo,proto3" json:"move_to,omitempty"` } func (x *DeleteNestRequest) Reset() { @@ -410,6 +412,13 @@ func (x *DeleteNestRequest) GetId() string { return "" } +func (x *DeleteNestRequest) GetMoveTo() string { + if x != nil { + return x.MoveTo + } + return "" +} + var File_api_v1_nest_service_proto protoreflect.FileDescriptor var file_api_v1_nest_service_proto_rawDesc = []byte{ @@ -454,61 +463,65 @@ var file_api_v1_nest_service_proto_rawDesc = []byte{ 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x23, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, + 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x3c, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0x91, 0x05, 0x0a, 0x0b, 0x4e, 0x65, - 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, - 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, - 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x5e, - 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x21, 0xda, 0x41, 0x02, - 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x12, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x74, - 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, - 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x2b, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, - 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x6e, - 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x7d, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, - 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x3a, 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, - 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x21, 0x3a, 0x04, 0x6e, 0x65, 0x73, 0x74, 0x32, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, 0x2e, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, - 0x2f, 0x2a, 0x7d, 0x12, 0x68, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, - 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x21, 0xda, 0x41, 0x02, 0x69, - 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x2a, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, - 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa8, 0x01, - 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x42, 0x10, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, - 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, - 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, - 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, - 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x6f, 0x76, + 0x65, 0x5f, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x6f, 0x76, 0x65, + 0x54, 0x6f, 0x32, 0xb2, 0x05, 0x0a, 0x0b, 0x4e, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x12, 0x5e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, + 0x12, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x4e, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, + 0x74, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x12, + 0x1e, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1f, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x12, 0x5e, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4e, 0x65, + 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x12, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, + 0x4e, 0x65, 0x73, 0x74, 0x22, 0x21, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x16, 0x12, 0x14, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, + 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x74, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x65, + 0x73, 0x74, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x73, 0x74, 0x42, + 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, + 0x22, 0x2b, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x12, + 0x1c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x3a, 0x62, + 0x79, 0x2d, 0x6e, 0x61, 0x6d, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x7d, 0x0a, + 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4e, 0x65, 0x73, 0x74, + 0x22, 0x3a, 0xda, 0x41, 0x10, 0x6e, 0x65, 0x73, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, 0x3a, 0x04, 0x6e, 0x65, 0x73, + 0x74, 0x32, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x65, 0x73, 0x74, + 0x2e, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x88, 0x01, 0x0a, + 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x2e, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x4e, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, + 0x6d, 0x70, 0x74, 0x79, 0x22, 0x41, 0xda, 0x41, 0x09, 0x69, 0x64, 0x2c, 0x6d, 0x6f, 0x76, 0x65, + 0x74, 0x6f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x2a, 0x2d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x31, 0x2f, 0x7b, 0x69, 0x64, 0x3d, 0x6e, 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x6d, + 0x6f, 0x76, 0x65, 0x74, 0x6f, 0x2f, 0x7b, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x74, 0x6f, 0x3d, 0x6e, + 0x65, 0x73, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x42, 0xa8, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x4e, 0x65, + 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, + 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, + 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, + 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, + 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, + 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, + 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/gen/api/v1/nest_service.pb.gw.go b/proto/gen/api/v1/nest_service.pb.gw.go index aad76e601f8f0..b6cd77a241e9d 100644 --- a/proto/gen/api/v1/nest_service.pb.gw.go +++ b/proto/gen/api/v1/nest_service.pb.gw.go @@ -300,6 +300,16 @@ func request_NestService_DeleteNest_0(ctx context.Context, marshaler runtime.Mar return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } + val, ok = pathParams["move_to"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "move_to") + } + + protoReq.MoveTo, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "move_to", err) + } + msg, err := client.DeleteNest(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err @@ -326,6 +336,16 @@ func local_request_NestService_DeleteNest_0(ctx context.Context, marshaler runti return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) } + val, ok = pathParams["move_to"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "move_to") + } + + protoReq.MoveTo, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "move_to", err) + } + msg, err := server.DeleteNest(ctx, &protoReq) return msg, metadata, err @@ -471,7 +491,7 @@ func RegisterNestServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}/moveto/{move_to=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -645,7 +665,7 @@ func RegisterNestServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.NestService/DeleteNest", runtime.WithHTTPPathPattern("/api/v1/{id=nests/*}/moveto/{move_to=nests/*}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -675,7 +695,7 @@ var ( pattern_NestService_UpdateNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "nest.id"}, "")) - pattern_NestService_DeleteNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "nests", "id"}, "")) + pattern_NestService_DeleteNest_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3, 2, 4, 2, 2, 1, 0, 4, 2, 5, 5}, []string{"api", "v1", "nests", "id", "moveto", "move_to"}, "")) ) var ( diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index c477ccf2b1f7d..f29c4dc6e2ef2 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -841,6 +841,7 @@ paths: pattern: nests/[^/]+ tags: - NestService + /api/v1/{id}/moveto/{moveTo}: delete: summary: DeleteNest deletes a nest by id. operationId: NestService_DeleteNest @@ -864,6 +865,12 @@ paths: required: true type: string pattern: nests/[^/]+ + - name: moveTo + description: The nest id where to move the memos of the nest being deleted. + in: path + required: true + type: string + pattern: nests/[^/]+ tags: - NestService /api/v1/{inbox.name}: diff --git a/server/router/api/v1/nest_service.go b/server/router/api/v1/nest_service.go index 435aad245c28c..65c34bde98362 100644 --- a/server/router/api/v1/nest_service.go +++ b/server/router/api/v1/nest_service.go @@ -212,12 +212,12 @@ func (s *APIV1Service) DeleteNest(ctx context.Context, request *v1pb.DeleteNestR return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - id, err := ExtractNestIDFromName(request.Id) + nestID, err := ExtractNestIDFromName(request.Id) if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid nest name: %v", err) } nest, err := s.Store.GetNest(ctx, &store.FindNest{ - ID: &id, + ID: &nestID, }) if err != nil { return nil, err @@ -226,12 +226,42 @@ func (s *APIV1Service) DeleteNest(ctx context.Context, request *v1pb.DeleteNestR return nil, status.Errorf(codes.NotFound, "nest not found") } + newNestID, err := ExtractNestIDFromName(request.MoveTo) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid target nest name: %v", err) + } + newNest, err := s.Store.GetNest(ctx, &store.FindNest{ + ID: &newNestID, + }) + if err != nil { + return nil, err + } + if newNest == nil { + return nil, status.Errorf(codes.NotFound, "target nest not found") + } + // Only the creator or admin can update the nest. - if nest.CreatorID != user.ID && !isSuperUser(user) { + if (nest.CreatorID != user.ID || newNest.CreatorID != user.ID) && !isSuperUser(user) { return nil, status.Errorf(codes.PermissionDenied, "permission denied") } - if err = s.Store.DeleteNest(ctx, &store.DeleteNest{ID: id}); err != nil { + memos, err := s.Store.ListMemos(ctx, &store.FindMemo{ + CreatorID: &user.ID, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get nest memos") + } + for _, memo := range memos { + err := s.Store.UpdateMemo(ctx, &store.UpdateMemo{ + ID: memo.ID, + Nest: &newNestID, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to move memo") + } + } + + if err = s.Store.DeleteNest(ctx, &store.DeleteNest{ID: nestID}); err != nil { return nil, status.Errorf(codes.Internal, "failed to delete nest") } diff --git a/web/src/components/DeleteNestPopover.tsx b/web/src/components/DeleteNestPopover.tsx new file mode 100644 index 0000000000000..ea7d479b234ad --- /dev/null +++ b/web/src/components/DeleteNestPopover.tsx @@ -0,0 +1,81 @@ +import { Select, Option } from "@mui/joy"; +import { Button } from "@usememos/mui"; +import { TrashIcon } from "lucide-react"; +import { useState } from "react"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/Popover"; +import { useCommonContext } from "@/layouts/CommonContextProvider"; +import { useNestList, useNestStore, useUserStore } from "@/store/v1"; +import { useTranslate } from "@/utils/i18n"; +import NestIcon from "./NestIcon"; + +interface Props { + nest: string; +} + +const DeleteNestPopover = (props: Props) => { + const { nest } = props; + const t = useTranslate(); + const nestStore = useNestStore(); + const [popoverOpen, setPopoverOpen] = useState(false); + const [newNestID, setNewNestID] = useState(""); + const commonContext = useCommonContext(); + const nests = useNestList(); + const userStore = useUserStore(); + + const deleteNest = async () => { + if (nest == userStore.userSetting?.nest) { + await userStore.updateUserSetting( + { + nest: newNestID, + }, + ["nest"], + ); + } + await nestStore.deleteNest({ + id: nest, + moveTo: newNestID, + }); + await nestStore.fetchNests(); + commonContext.setNest(newNestID); + }; + + return ( + + + + + +
+ {t("nest.delete-nest-move-to-nest")} + +
+
+ +
+
+
+ ); +}; + +export default DeleteNestPopover; diff --git a/web/src/components/NestBanner.tsx b/web/src/components/NestBanner.tsx index 7dabcefeec844..4cd033a073e7e 100644 --- a/web/src/components/NestBanner.tsx +++ b/web/src/components/NestBanner.tsx @@ -4,6 +4,7 @@ import useCurrentUser from "@/hooks/useCurrentUser"; import { useCommonContext } from "@/layouts/CommonContextProvider"; import { useNestList, useNestStore } from "@/store/v1"; import AddNestPopover from "./AddNestPopover"; +import DeleteNestPopover from "./DeleteNestPopover"; import NestIcon from "./NestIcon"; interface Props { @@ -22,7 +23,7 @@ const NestBanner = (props: Props) => { }; return ( -
+
{ + {nests.length > 1 && }
); }; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 093a2b08bc457..c3f38f3c4d3c8 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -144,7 +144,8 @@ "search-placeholder": "Search content" }, "nest": { - "add-nest": "Add nest" + "add-nest": "Add nest", + "delete-nest-move-to-nest": "Move to nest" }, "resource": { "clear": "Clear", diff --git a/web/src/store/v1/nest.ts b/web/src/store/v1/nest.ts index 4a7c782260f5d..d40c8018f01f1 100644 --- a/web/src/store/v1/nest.ts +++ b/web/src/store/v1/nest.ts @@ -1,7 +1,8 @@ import { create } from "zustand"; import { combine } from "zustand/middleware"; import { nestServiceClient } from "@/grpcweb"; -import { CreateNestRequest, Nest, UpdateNestRequest } from "@/types/proto/api/v1/nest_service"; +import { CreateNestRequest, DeleteNestRequest, Nest, UpdateNestRequest } from "@/types/proto/api/v1/nest_service"; +import { Empty } from "@/types/proto/google/protobuf/empty"; interface State { nestMapByName: Record; @@ -40,6 +41,9 @@ export const useNestStore = create( nestMap[nest.id] = nest; return nest; }, + async deleteNest(delreq: DeleteNestRequest): Promise { + return await nestServiceClient.deleteNest(delreq); + }, })), );