diff --git a/frontend/web/src/components/Header.tsx b/frontend/web/src/components/Header.tsx index 3fa48cc..556e28a 100644 --- a/frontend/web/src/components/Header.tsx +++ b/frontend/web/src/components/Header.tsx @@ -19,7 +19,7 @@ const Header: React.FC = () => { const [showAboutDialog, setShowAboutDialog] = useState(false); const profile = workspaceStore.profile; const isAdmin = currentUser.role === Role.ADMIN; - const shouldShowRouterSwitch = location.pathname === "/" || location.pathname === "/collections" || location.pathname === "/memos"; + const shouldShowRouterSwitch = location.pathname === "/" || location.pathname === "/collections"; const selectedSection = location.pathname === "/" ? "Shortcuts" : location.pathname === "/collections" ? "Collections" : "Memos"; const handleSignOutButtonClick = async () => { diff --git a/frontend/web/src/pages/MemoDashboard.tsx b/frontend/web/src/pages/MemoDashboard.tsx deleted file mode 100644 index 9492f57..0000000 --- a/frontend/web/src/pages/MemoDashboard.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { Button, Input } from "@mui/joy"; -import { useEffect, useState } from "react"; -import { useTranslation } from "react-i18next"; -import CollectionView from "@/components/CollectionView"; -import CreateCollectionDrawer from "@/components/CreateCollectionDrawer"; -import useCollectionStore from "@/stores/v1/collection"; -import FilterView from "../components/FilterView"; -import Icon from "../components/Icon"; -import useLoading from "../hooks/useLoading"; - -interface State { - showCreateCollectionDrawer: boolean; -} - -const MemoDashboard: React.FC = () => { - const { t } = useTranslation(); - const loadingState = useLoading(); - const collectionStore = useCollectionStore(); - const [state, setState] = useState({ - showCreateCollectionDrawer: false, - }); - const [search, setSearch] = useState(""); - const filteredCollections = collectionStore.getCollectionList().filter((collection) => { - return ( - collection.name.toLowerCase().includes(search.toLowerCase()) || - collection.title.toLowerCase().includes(search.toLowerCase()) || - collection.description.toLowerCase().includes(search.toLowerCase()) - ); - }); - - useEffect(() => { - Promise.all([collectionStore.fetchCollectionList()]).finally(() => { - loadingState.setFinish(); - }); - }, []); - - const setShowCreateCollectionDrawer = (show: boolean) => { - setState({ - ...state, - showCreateCollectionDrawer: show, - }); - }; - - return ( - <> -
-
-
- } - value={search} - onChange={(e) => setSearch(e.target.value)} - /> -
-
- -
-
- - {loadingState.isLoading ? ( -
- - {t("common.loading")} -
- ) : filteredCollections.length === 0 ? ( -
- -

No collections found.

-
- ) : ( -
- {filteredCollections.map((collection) => { - return ; - })} -
- )} -
- - {state.showCreateCollectionDrawer && ( - setShowCreateCollectionDrawer(false)} - onConfirm={() => setShowCreateCollectionDrawer(false)} - /> - )} - - ); -}; - -export default MemoDashboard; diff --git a/proto/api/v1/memo_service.proto b/proto/api/v1/memo_service.proto deleted file mode 100644 index ebd0fac..0000000 --- a/proto/api/v1/memo_service.proto +++ /dev/null @@ -1,103 +0,0 @@ -syntax = "proto3"; - -package slash.api.v1; - -import "api/v1/common.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "gen/api/v1"; - -service MemoService { - // ListMemos returns a list of memos. - rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) { - option (google.api.http) = {get: "/api/v1/memos"}; - } - // GetMemo returns a memo by id. - rpc GetMemo(GetMemoRequest) returns (GetMemoResponse) { - option (google.api.http) = {get: "/api/v1/memos/{id}"}; - option (google.api.method_signature) = "id"; - } - // CreateMemo creates a memo. - rpc CreateMemo(CreateMemoRequest) returns (CreateMemoResponse) { - option (google.api.http) = { - post: "/api/v1/memos" - body: "memo" - }; - } - // UpdateMemo updates a memo. - rpc UpdateMemo(UpdateMemoRequest) returns (UpdateMemoResponse) { - option (google.api.http) = { - put: "/api/v1/memos/{memo.id}" - body: "memo" - }; - option (google.api.method_signature) = "memo,update_mask"; - } - // DeleteMemo deletes a memo by id. - rpc DeleteMemo(DeleteMemoRequest) returns (DeleteMemoResponse) { - option (google.api.http) = {delete: "/api/v1/memos/{id}"}; - option (google.api.method_signature) = "id"; - } -} - -message Memo { - int32 id = 1; - - int32 creator_id = 2; - - google.protobuf.Timestamp created_time = 3; - - google.protobuf.Timestamp updated_time = 4; - - RowStatus row_status = 5; - - string name = 6; - - string title = 7; - - string content = 8; - - repeated string tags = 9; - - Visibility visibility = 10; -} - -message ListMemosRequest {} - -message ListMemosResponse { - repeated Memo memos = 1; -} - -message GetMemoRequest { - int32 id = 1; -} - -message GetMemoResponse { - Memo memo = 1; -} - -message CreateMemoRequest { - Memo memo = 1; -} - -message CreateMemoResponse { - Memo memo = 1; -} - -message UpdateMemoRequest { - Memo memo = 1; - - google.protobuf.FieldMask update_mask = 2; -} - -message UpdateMemoResponse { - Memo memo = 1; -} - -message DeleteMemoRequest { - int32 id = 1; -} - -message DeleteMemoResponse {} diff --git a/proto/gen/api/v1/README.md b/proto/gen/api/v1/README.md index 3ba7c0f..45e61f9 100644 --- a/proto/gen/api/v1/README.md +++ b/proto/gen/api/v1/README.md @@ -60,21 +60,6 @@ - [CollectionService](#slash-api-v1-CollectionService) -- [api/v1/memo_service.proto](#api_v1_memo_service-proto) - - [CreateMemoRequest](#slash-api-v1-CreateMemoRequest) - - [CreateMemoResponse](#slash-api-v1-CreateMemoResponse) - - [DeleteMemoRequest](#slash-api-v1-DeleteMemoRequest) - - [DeleteMemoResponse](#slash-api-v1-DeleteMemoResponse) - - [GetMemoRequest](#slash-api-v1-GetMemoRequest) - - [GetMemoResponse](#slash-api-v1-GetMemoResponse) - - [ListMemosRequest](#slash-api-v1-ListMemosRequest) - - [ListMemosResponse](#slash-api-v1-ListMemosResponse) - - [Memo](#slash-api-v1-Memo) - - [UpdateMemoRequest](#slash-api-v1-UpdateMemoRequest) - - [UpdateMemoResponse](#slash-api-v1-UpdateMemoResponse) - - - [MemoService](#slash-api-v1-MemoService) - - [api/v1/shortcut_service.proto](#api_v1_shortcut_service-proto) - [CreateShortcutRequest](#slash-api-v1-CreateShortcutRequest) - [CreateShortcutResponse](#slash-api-v1-CreateShortcutResponse) @@ -856,201 +841,6 @@ - -

Top

- -## api/v1/memo_service.proto - - - - - -### CreateMemoRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| memo | [Memo](#slash-api-v1-Memo) | | | - - - - - - - - -### CreateMemoResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| memo | [Memo](#slash-api-v1-Memo) | | | - - - - - - - - -### DeleteMemoRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [int32](#int32) | | | - - - - - - - - -### DeleteMemoResponse - - - - - - - - - -### GetMemoRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [int32](#int32) | | | - - - - - - - - -### GetMemoResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| memo | [Memo](#slash-api-v1-Memo) | | | - - - - - - - - -### ListMemosRequest - - - - - - - - - -### ListMemosResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| memos | [Memo](#slash-api-v1-Memo) | repeated | | - - - - - - - - -### Memo - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [int32](#int32) | | | -| creator_id | [int32](#int32) | | | -| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| updated_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | -| row_status | [RowStatus](#slash-api-v1-RowStatus) | | | -| name | [string](#string) | | | -| title | [string](#string) | | | -| content | [string](#string) | | | -| tags | [string](#string) | repeated | | -| visibility | [Visibility](#slash-api-v1-Visibility) | | | - - - - - - - - -### UpdateMemoRequest - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| memo | [Memo](#slash-api-v1-Memo) | | | -| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | | - - - - - - - - -### UpdateMemoResponse - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| memo | [Memo](#slash-api-v1-Memo) | | | - - - - - - - - - - - - - - -### MemoService - - -| Method Name | Request Type | Response Type | Description | -| ----------- | ------------ | ------------- | ------------| -| ListMemos | [ListMemosRequest](#slash-api-v1-ListMemosRequest) | [ListMemosResponse](#slash-api-v1-ListMemosResponse) | ListMemos returns a list of memos. | -| GetMemo | [GetMemoRequest](#slash-api-v1-GetMemoRequest) | [GetMemoResponse](#slash-api-v1-GetMemoResponse) | GetMemo returns a memo by id. | -| CreateMemo | [CreateMemoRequest](#slash-api-v1-CreateMemoRequest) | [CreateMemoResponse](#slash-api-v1-CreateMemoResponse) | CreateMemo creates a memo. | -| UpdateMemo | [UpdateMemoRequest](#slash-api-v1-UpdateMemoRequest) | [UpdateMemoResponse](#slash-api-v1-UpdateMemoResponse) | UpdateMemo updates a memo. | -| DeleteMemo | [DeleteMemoRequest](#slash-api-v1-DeleteMemoRequest) | [DeleteMemoResponse](#slash-api-v1-DeleteMemoResponse) | DeleteMemo deletes a memo by id. | - - - - -

Top

diff --git a/proto/gen/api/v1/memo_service.pb.go b/proto/gen/api/v1/memo_service.pb.go deleted file mode 100644 index 7594914..0000000 --- a/proto/gen/api/v1/memo_service.pb.go +++ /dev/null @@ -1,945 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: api/v1/memo_service.proto - -package apiv1 - -import ( - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - 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 Memo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - CreatorId int32 `protobuf:"varint,2,opt,name=creator_id,json=creatorId,proto3" json:"creator_id,omitempty"` - CreatedTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_time,json=createdTime,proto3" json:"created_time,omitempty"` - UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=updated_time,json=updatedTime,proto3" json:"updated_time,omitempty"` - RowStatus RowStatus `protobuf:"varint,5,opt,name=row_status,json=rowStatus,proto3,enum=slash.api.v1.RowStatus" json:"row_status,omitempty"` - Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` - Title string `protobuf:"bytes,7,opt,name=title,proto3" json:"title,omitempty"` - Content string `protobuf:"bytes,8,opt,name=content,proto3" json:"content,omitempty"` - Tags []string `protobuf:"bytes,9,rep,name=tags,proto3" json:"tags,omitempty"` - Visibility Visibility `protobuf:"varint,10,opt,name=visibility,proto3,enum=slash.api.v1.Visibility" json:"visibility,omitempty"` -} - -func (x *Memo) Reset() { - *x = Memo{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Memo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Memo) ProtoMessage() {} - -func (x *Memo) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Memo.ProtoReflect.Descriptor instead. -func (*Memo) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{0} -} - -func (x *Memo) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Memo) GetCreatorId() int32 { - if x != nil { - return x.CreatorId - } - return 0 -} - -func (x *Memo) GetCreatedTime() *timestamppb.Timestamp { - if x != nil { - return x.CreatedTime - } - return nil -} - -func (x *Memo) GetUpdatedTime() *timestamppb.Timestamp { - if x != nil { - return x.UpdatedTime - } - return nil -} - -func (x *Memo) GetRowStatus() RowStatus { - if x != nil { - return x.RowStatus - } - return RowStatus_ROW_STATUS_UNSPECIFIED -} - -func (x *Memo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Memo) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Memo) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *Memo) GetTags() []string { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Memo) GetVisibility() Visibility { - if x != nil { - return x.Visibility - } - return Visibility_VISIBILITY_UNSPECIFIED -} - -type ListMemosRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ListMemosRequest) Reset() { - *x = ListMemosRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListMemosRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemosRequest) ProtoMessage() {} - -func (x *ListMemosRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemosRequest.ProtoReflect.Descriptor instead. -func (*ListMemosRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{1} -} - -type ListMemosResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Memos []*Memo `protobuf:"bytes,1,rep,name=memos,proto3" json:"memos,omitempty"` -} - -func (x *ListMemosResponse) Reset() { - *x = ListMemosResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListMemosResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMemosResponse) ProtoMessage() {} - -func (x *ListMemosResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMemosResponse.ProtoReflect.Descriptor instead. -func (*ListMemosResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{2} -} - -func (x *ListMemosResponse) GetMemos() []*Memo { - if x != nil { - return x.Memos - } - return nil -} - -type GetMemoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *GetMemoRequest) Reset() { - *x = GetMemoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMemoRequest) ProtoMessage() {} - -func (x *GetMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMemoRequest.ProtoReflect.Descriptor instead. -func (*GetMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{3} -} - -func (x *GetMemoRequest) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -type GetMemoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` -} - -func (x *GetMemoResponse) Reset() { - *x = GetMemoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMemoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMemoResponse) ProtoMessage() {} - -func (x *GetMemoResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMemoResponse.ProtoReflect.Descriptor instead. -func (*GetMemoResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{4} -} - -func (x *GetMemoResponse) GetMemo() *Memo { - if x != nil { - return x.Memo - } - return nil -} - -type CreateMemoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` -} - -func (x *CreateMemoRequest) Reset() { - *x = CreateMemoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateMemoRequest) ProtoMessage() {} - -func (x *CreateMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateMemoRequest.ProtoReflect.Descriptor instead. -func (*CreateMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{5} -} - -func (x *CreateMemoRequest) GetMemo() *Memo { - if x != nil { - return x.Memo - } - return nil -} - -type CreateMemoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` -} - -func (x *CreateMemoResponse) Reset() { - *x = CreateMemoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreateMemoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreateMemoResponse) ProtoMessage() {} - -func (x *CreateMemoResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CreateMemoResponse.ProtoReflect.Descriptor instead. -func (*CreateMemoResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{6} -} - -func (x *CreateMemoResponse) GetMemo() *Memo { - if x != nil { - return x.Memo - } - return nil -} - -type UpdateMemoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` - UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` -} - -func (x *UpdateMemoRequest) Reset() { - *x = UpdateMemoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMemoRequest) ProtoMessage() {} - -func (x *UpdateMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMemoRequest.ProtoReflect.Descriptor instead. -func (*UpdateMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{7} -} - -func (x *UpdateMemoRequest) GetMemo() *Memo { - if x != nil { - return x.Memo - } - return nil -} - -func (x *UpdateMemoRequest) GetUpdateMask() *fieldmaskpb.FieldMask { - if x != nil { - return x.UpdateMask - } - return nil -} - -type UpdateMemoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` -} - -func (x *UpdateMemoResponse) Reset() { - *x = UpdateMemoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMemoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMemoResponse) ProtoMessage() {} - -func (x *UpdateMemoResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMemoResponse.ProtoReflect.Descriptor instead. -func (*UpdateMemoResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{8} -} - -func (x *UpdateMemoResponse) GetMemo() *Memo { - if x != nil { - return x.Memo - } - return nil -} - -type DeleteMemoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *DeleteMemoRequest) Reset() { - *x = DeleteMemoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteMemoRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteMemoRequest) ProtoMessage() {} - -func (x *DeleteMemoRequest) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteMemoRequest.ProtoReflect.Descriptor instead. -func (*DeleteMemoRequest) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{9} -} - -func (x *DeleteMemoRequest) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -type DeleteMemoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DeleteMemoResponse) Reset() { - *x = DeleteMemoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_api_v1_memo_service_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeleteMemoResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeleteMemoResponse) ProtoMessage() {} - -func (x *DeleteMemoResponse) ProtoReflect() protoreflect.Message { - mi := &file_api_v1_memo_service_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DeleteMemoResponse.ProtoReflect.Descriptor instead. -func (*DeleteMemoResponse) Descriptor() ([]byte, []int) { - return file_api_v1_memo_service_proto_rawDescGZIP(), []int{10} -} - -var File_api_v1_memo_service_proto protoreflect.FileDescriptor - -var file_api_v1_memo_service_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x73, 0x6c, 0x61, - 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x13, 0x61, 0x70, 0x69, 0x2f, 0x76, - 0x31, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 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, 0xfd, 0x02, 0x0a, 0x04, 0x4d, 0x65, 0x6d, - 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, - 0x12, 0x3d, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 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, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, - 0x3d, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 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, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x36, - 0x0a, 0x0a, 0x72, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x52, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x72, 0x6f, 0x77, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, - 0x74, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x38, - 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, - 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3d, 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, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x22, 0x20, 0x0a, 0x0e, 0x47, - 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x39, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x26, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, - 0x6d, 0x6f, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x3b, 0x0a, 0x11, 0x43, 0x72, 0x65, 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, 0x73, 0x6c, - 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, - 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x3c, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, - 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6d, - 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, - 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x04, 0x6d, - 0x65, 0x6d, 0x6f, 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, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x3c, 0x0a, - 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x23, 0x0a, 0x11, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc7, 0x04, 0x0a, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, - 0x6d, 0x6f, 0x73, 0x12, 0x1e, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x67, 0x0a, 0x07, 0x47, - 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1c, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x1f, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, - 0x12, 0x12, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, - 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, - 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x20, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6d, - 0x65, 0x6d, 0x6f, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, - 0x6f, 0x73, 0x12, 0x89, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, - 0x6f, 0x12, 0x1f, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x20, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0xda, 0x41, 0x10, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, - 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x1a, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, - 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x6d, 0x6f, 0x2e, 0x69, 0x64, 0x7d, 0x12, 0x70, - 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x73, - 0x6c, 0x61, 0x73, 0x68, 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, 0x20, 0x2e, - 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x1f, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, - 0x42, 0xae, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, - 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 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, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, - 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, - 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, - 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, - 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_api_v1_memo_service_proto_rawDescOnce sync.Once - file_api_v1_memo_service_proto_rawDescData = file_api_v1_memo_service_proto_rawDesc -) - -func file_api_v1_memo_service_proto_rawDescGZIP() []byte { - file_api_v1_memo_service_proto_rawDescOnce.Do(func() { - file_api_v1_memo_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v1_memo_service_proto_rawDescData) - }) - return file_api_v1_memo_service_proto_rawDescData -} - -var file_api_v1_memo_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_api_v1_memo_service_proto_goTypes = []interface{}{ - (*Memo)(nil), // 0: slash.api.v1.Memo - (*ListMemosRequest)(nil), // 1: slash.api.v1.ListMemosRequest - (*ListMemosResponse)(nil), // 2: slash.api.v1.ListMemosResponse - (*GetMemoRequest)(nil), // 3: slash.api.v1.GetMemoRequest - (*GetMemoResponse)(nil), // 4: slash.api.v1.GetMemoResponse - (*CreateMemoRequest)(nil), // 5: slash.api.v1.CreateMemoRequest - (*CreateMemoResponse)(nil), // 6: slash.api.v1.CreateMemoResponse - (*UpdateMemoRequest)(nil), // 7: slash.api.v1.UpdateMemoRequest - (*UpdateMemoResponse)(nil), // 8: slash.api.v1.UpdateMemoResponse - (*DeleteMemoRequest)(nil), // 9: slash.api.v1.DeleteMemoRequest - (*DeleteMemoResponse)(nil), // 10: slash.api.v1.DeleteMemoResponse - (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp - (RowStatus)(0), // 12: slash.api.v1.RowStatus - (Visibility)(0), // 13: slash.api.v1.Visibility - (*fieldmaskpb.FieldMask)(nil), // 14: google.protobuf.FieldMask -} -var file_api_v1_memo_service_proto_depIdxs = []int32{ - 11, // 0: slash.api.v1.Memo.created_time:type_name -> google.protobuf.Timestamp - 11, // 1: slash.api.v1.Memo.updated_time:type_name -> google.protobuf.Timestamp - 12, // 2: slash.api.v1.Memo.row_status:type_name -> slash.api.v1.RowStatus - 13, // 3: slash.api.v1.Memo.visibility:type_name -> slash.api.v1.Visibility - 0, // 4: slash.api.v1.ListMemosResponse.memos:type_name -> slash.api.v1.Memo - 0, // 5: slash.api.v1.GetMemoResponse.memo:type_name -> slash.api.v1.Memo - 0, // 6: slash.api.v1.CreateMemoRequest.memo:type_name -> slash.api.v1.Memo - 0, // 7: slash.api.v1.CreateMemoResponse.memo:type_name -> slash.api.v1.Memo - 0, // 8: slash.api.v1.UpdateMemoRequest.memo:type_name -> slash.api.v1.Memo - 14, // 9: slash.api.v1.UpdateMemoRequest.update_mask:type_name -> google.protobuf.FieldMask - 0, // 10: slash.api.v1.UpdateMemoResponse.memo:type_name -> slash.api.v1.Memo - 1, // 11: slash.api.v1.MemoService.ListMemos:input_type -> slash.api.v1.ListMemosRequest - 3, // 12: slash.api.v1.MemoService.GetMemo:input_type -> slash.api.v1.GetMemoRequest - 5, // 13: slash.api.v1.MemoService.CreateMemo:input_type -> slash.api.v1.CreateMemoRequest - 7, // 14: slash.api.v1.MemoService.UpdateMemo:input_type -> slash.api.v1.UpdateMemoRequest - 9, // 15: slash.api.v1.MemoService.DeleteMemo:input_type -> slash.api.v1.DeleteMemoRequest - 2, // 16: slash.api.v1.MemoService.ListMemos:output_type -> slash.api.v1.ListMemosResponse - 4, // 17: slash.api.v1.MemoService.GetMemo:output_type -> slash.api.v1.GetMemoResponse - 6, // 18: slash.api.v1.MemoService.CreateMemo:output_type -> slash.api.v1.CreateMemoResponse - 8, // 19: slash.api.v1.MemoService.UpdateMemo:output_type -> slash.api.v1.UpdateMemoResponse - 10, // 20: slash.api.v1.MemoService.DeleteMemo:output_type -> slash.api.v1.DeleteMemoResponse - 16, // [16:21] is the sub-list for method output_type - 11, // [11:16] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name -} - -func init() { file_api_v1_memo_service_proto_init() } -func file_api_v1_memo_service_proto_init() { - if File_api_v1_memo_service_proto != nil { - return - } - file_api_v1_common_proto_init() - if !protoimpl.UnsafeEnabled { - file_api_v1_memo_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Memo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMemosRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMemosResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMemoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMemoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateMemoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateMemoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMemoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMemoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteMemoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_api_v1_memo_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteMemoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_api_v1_memo_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 11, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_api_v1_memo_service_proto_goTypes, - DependencyIndexes: file_api_v1_memo_service_proto_depIdxs, - MessageInfos: file_api_v1_memo_service_proto_msgTypes, - }.Build() - File_api_v1_memo_service_proto = out.File - file_api_v1_memo_service_proto_rawDesc = nil - file_api_v1_memo_service_proto_goTypes = nil - file_api_v1_memo_service_proto_depIdxs = nil -} diff --git a/proto/gen/api/v1/memo_service.pb.gw.go b/proto/gen/api/v1/memo_service.pb.gw.go deleted file mode 100644 index 77ba880..0000000 --- a/proto/gen/api/v1/memo_service.pb.gw.go +++ /dev/null @@ -1,583 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: api/v1/memo_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_MemoService_ListMemos_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListMemosRequest - var metadata runtime.ServerMetadata - - msg, err := client.ListMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MemoService_ListMemos_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListMemosRequest - var metadata runtime.ServerMetadata - - msg, err := server.ListMemos(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MemoService_GetMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetMemoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Int32(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := client.GetMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MemoService_GetMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetMemoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Int32(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := server.GetMemo(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateMemoRequest - 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.Memo); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.CreateMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateMemoRequest - 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.Memo); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.CreateMemo(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_MemoService_UpdateMemo_0 = &utilities.DoubleArray{Encoding: map[string]int{"memo": 0, "id": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}} -) - -func request_MemoService_UpdateMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateMemoRequest - 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.Memo); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["memo.id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "memo.id") - } - - err = runtime.PopulateFieldFromPath(&protoReq, "memo.id", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "memo.id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_UpdateMemo_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.UpdateMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MemoService_UpdateMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq UpdateMemoRequest - 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.Memo); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["memo.id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "memo.id") - } - - err = runtime.PopulateFieldFromPath(&protoReq, "memo.id", val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "memo.id", err) - } - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_UpdateMemo_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.UpdateMemo(ctx, &protoReq) - return msg, metadata, err - -} - -func request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteMemoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Int32(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := client.DeleteMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq DeleteMemoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") - } - - protoReq.Id, err = runtime.Int32(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) - } - - msg, err := server.DeleteMemo(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterMemoServiceHandlerServer registers the http handlers for service MemoService to "mux". -// UnaryRPC :call MemoServiceServer 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 RegisterMemoServiceHandlerFromEndpoint instead. -func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MemoServiceServer) error { - - mux.Handle("GET", pattern_MemoService_ListMemos_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, "/slash.api.v1.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/v1/memos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_ListMemos_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_MemoService_ListMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_MemoService_GetMemo_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, "/slash.api.v1.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/v1/memos/{id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_GetMemo_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_MemoService_GetMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MemoService_CreateMemo_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, "/slash.api.v1.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/v1/memos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_CreateMemo_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_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("PUT", pattern_MemoService_UpdateMemo_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, "/slash.api.v1.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/v1/memos/{memo.id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_UpdateMemo_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_MemoService_UpdateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("DELETE", pattern_MemoService_DeleteMemo_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, "/slash.api.v1.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/v1/memos/{id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_MemoService_DeleteMemo_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_MemoService_DeleteMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterMemoServiceHandlerFromEndpoint is same as RegisterMemoServiceHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterMemoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.DialContext(ctx, endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterMemoServiceHandler(ctx, mux, conn) -} - -// RegisterMemoServiceHandler registers the http handlers for service MemoService to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterMemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterMemoServiceHandlerClient(ctx, mux, NewMemoServiceClient(conn)) -} - -// RegisterMemoServiceHandlerClient registers the http handlers for service MemoService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MemoServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MemoServiceClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "MemoServiceClient" to call the correct interceptors. -func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MemoServiceClient) error { - - mux.Handle("GET", pattern_MemoService_ListMemos_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, "/slash.api.v1.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/v1/memos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_ListMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MemoService_ListMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_MemoService_GetMemo_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, "/slash.api.v1.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/v1/memos/{id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_GetMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MemoService_GetMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_MemoService_CreateMemo_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, "/slash.api.v1.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/v1/memos")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_CreateMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("PUT", pattern_MemoService_UpdateMemo_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, "/slash.api.v1.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/v1/memos/{memo.id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_UpdateMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MemoService_UpdateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("DELETE", pattern_MemoService_DeleteMemo_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, "/slash.api.v1.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/v1/memos/{id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_MemoService_DeleteMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) - annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) - if err != nil { - runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) - return - } - - forward_MemoService_DeleteMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_MemoService_ListMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "memos"}, "")) - - pattern_MemoService_GetMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "memos", "id"}, "")) - - pattern_MemoService_CreateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "memos"}, "")) - - pattern_MemoService_UpdateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "memos", "memo.id"}, "")) - - pattern_MemoService_DeleteMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "memos", "id"}, "")) -) - -var ( - forward_MemoService_ListMemos_0 = runtime.ForwardResponseMessage - - forward_MemoService_GetMemo_0 = runtime.ForwardResponseMessage - - forward_MemoService_CreateMemo_0 = runtime.ForwardResponseMessage - - forward_MemoService_UpdateMemo_0 = runtime.ForwardResponseMessage - - forward_MemoService_DeleteMemo_0 = runtime.ForwardResponseMessage -) diff --git a/proto/gen/api/v1/memo_service_grpc.pb.go b/proto/gen/api/v1/memo_service_grpc.pb.go deleted file mode 100644 index 07605bf..0000000 --- a/proto/gen/api/v1/memo_service_grpc.pb.go +++ /dev/null @@ -1,267 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: api/v1/memo_service.proto - -package apiv1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - MemoService_ListMemos_FullMethodName = "/slash.api.v1.MemoService/ListMemos" - MemoService_GetMemo_FullMethodName = "/slash.api.v1.MemoService/GetMemo" - MemoService_CreateMemo_FullMethodName = "/slash.api.v1.MemoService/CreateMemo" - MemoService_UpdateMemo_FullMethodName = "/slash.api.v1.MemoService/UpdateMemo" - MemoService_DeleteMemo_FullMethodName = "/slash.api.v1.MemoService/DeleteMemo" -) - -// MemoServiceClient is the client API for MemoService 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 MemoServiceClient interface { - // ListMemos returns a list of memos. - ListMemos(ctx context.Context, in *ListMemosRequest, opts ...grpc.CallOption) (*ListMemosResponse, error) - // GetMemo returns a memo by id. - GetMemo(ctx context.Context, in *GetMemoRequest, opts ...grpc.CallOption) (*GetMemoResponse, error) - // CreateMemo creates a memo. - CreateMemo(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*CreateMemoResponse, error) - // UpdateMemo updates a memo. - UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*UpdateMemoResponse, error) - // DeleteMemo deletes a memo by id. - DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*DeleteMemoResponse, error) -} - -type memoServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewMemoServiceClient(cc grpc.ClientConnInterface) MemoServiceClient { - return &memoServiceClient{cc} -} - -func (c *memoServiceClient) ListMemos(ctx context.Context, in *ListMemosRequest, opts ...grpc.CallOption) (*ListMemosResponse, error) { - out := new(ListMemosResponse) - err := c.cc.Invoke(ctx, MemoService_ListMemos_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *memoServiceClient) GetMemo(ctx context.Context, in *GetMemoRequest, opts ...grpc.CallOption) (*GetMemoResponse, error) { - out := new(GetMemoResponse) - err := c.cc.Invoke(ctx, MemoService_GetMemo_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *memoServiceClient) CreateMemo(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*CreateMemoResponse, error) { - out := new(CreateMemoResponse) - err := c.cc.Invoke(ctx, MemoService_CreateMemo_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *memoServiceClient) UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*UpdateMemoResponse, error) { - out := new(UpdateMemoResponse) - err := c.cc.Invoke(ctx, MemoService_UpdateMemo_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *memoServiceClient) DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*DeleteMemoResponse, error) { - out := new(DeleteMemoResponse) - err := c.cc.Invoke(ctx, MemoService_DeleteMemo_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MemoServiceServer is the server API for MemoService service. -// All implementations must embed UnimplementedMemoServiceServer -// for forward compatibility -type MemoServiceServer interface { - // ListMemos returns a list of memos. - ListMemos(context.Context, *ListMemosRequest) (*ListMemosResponse, error) - // GetMemo returns a memo by id. - GetMemo(context.Context, *GetMemoRequest) (*GetMemoResponse, error) - // CreateMemo creates a memo. - CreateMemo(context.Context, *CreateMemoRequest) (*CreateMemoResponse, error) - // UpdateMemo updates a memo. - UpdateMemo(context.Context, *UpdateMemoRequest) (*UpdateMemoResponse, error) - // DeleteMemo deletes a memo by id. - DeleteMemo(context.Context, *DeleteMemoRequest) (*DeleteMemoResponse, error) - mustEmbedUnimplementedMemoServiceServer() -} - -// UnimplementedMemoServiceServer must be embedded to have forward compatible implementations. -type UnimplementedMemoServiceServer struct { -} - -func (UnimplementedMemoServiceServer) ListMemos(context.Context, *ListMemosRequest) (*ListMemosResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListMemos not implemented") -} -func (UnimplementedMemoServiceServer) GetMemo(context.Context, *GetMemoRequest) (*GetMemoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMemo not implemented") -} -func (UnimplementedMemoServiceServer) CreateMemo(context.Context, *CreateMemoRequest) (*CreateMemoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateMemo not implemented") -} -func (UnimplementedMemoServiceServer) UpdateMemo(context.Context, *UpdateMemoRequest) (*UpdateMemoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateMemo not implemented") -} -func (UnimplementedMemoServiceServer) DeleteMemo(context.Context, *DeleteMemoRequest) (*DeleteMemoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteMemo not implemented") -} -func (UnimplementedMemoServiceServer) mustEmbedUnimplementedMemoServiceServer() {} - -// UnsafeMemoServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MemoServiceServer will -// result in compilation errors. -type UnsafeMemoServiceServer interface { - mustEmbedUnimplementedMemoServiceServer() -} - -func RegisterMemoServiceServer(s grpc.ServiceRegistrar, srv MemoServiceServer) { - s.RegisterService(&MemoService_ServiceDesc, srv) -} - -func _MemoService_ListMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListMemosRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).ListMemos(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_ListMemos_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).ListMemos(ctx, req.(*ListMemosRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _MemoService_GetMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMemoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).GetMemo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_GetMemo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).GetMemo(ctx, req.(*GetMemoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _MemoService_CreateMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateMemoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).CreateMemo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_CreateMemo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).CreateMemo(ctx, req.(*CreateMemoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _MemoService_UpdateMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpdateMemoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).UpdateMemo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_UpdateMemo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).UpdateMemo(ctx, req.(*UpdateMemoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _MemoService_DeleteMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteMemoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MemoServiceServer).DeleteMemo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MemoService_DeleteMemo_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MemoServiceServer).DeleteMemo(ctx, req.(*DeleteMemoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// MemoService_ServiceDesc is the grpc.ServiceDesc for MemoService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var MemoService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slash.api.v1.MemoService", - HandlerType: (*MemoServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListMemos", - Handler: _MemoService_ListMemos_Handler, - }, - { - MethodName: "GetMemo", - Handler: _MemoService_GetMemo_Handler, - }, - { - MethodName: "CreateMemo", - Handler: _MemoService_CreateMemo_Handler, - }, - { - MethodName: "UpdateMemo", - Handler: _MemoService_UpdateMemo_Handler, - }, - { - MethodName: "DeleteMemo", - Handler: _MemoService_DeleteMemo_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "api/v1/memo_service.proto", -} diff --git a/proto/gen/store/README.md b/proto/gen/store/README.md index e13e66c..13c7cd6 100644 --- a/proto/gen/store/README.md +++ b/proto/gen/store/README.md @@ -14,9 +14,6 @@ - [store/collection.proto](#store_collection-proto) - [Collection](#slash-store-Collection) -- [store/memo.proto](#store_memo-proto) - - [Memo](#slash-store-Memo) - - [store/shortcut.proto](#store_shortcut-proto) - [OpenGraphMetadata](#slash-store-OpenGraphMetadata) - [Shortcut](#slash-store-Shortcut) @@ -171,46 +168,6 @@ - -

Top

- -## store/memo.proto - - - - - -### Memo - - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| id | [int32](#int32) | | | -| creator_id | [int32](#int32) | | | -| created_ts | [int64](#int64) | | | -| updated_ts | [int64](#int64) | | | -| row_status | [RowStatus](#slash-store-RowStatus) | | | -| name | [string](#string) | | | -| title | [string](#string) | | | -| content | [string](#string) | | | -| tags | [string](#string) | repeated | | -| visibility | [Visibility](#slash-store-Visibility) | | | - - - - - - - - - - - - - - -

Top

diff --git a/proto/gen/store/memo.pb.go b/proto/gen/store/memo.pb.go deleted file mode 100644 index 02538e5..0000000 --- a/proto/gen/store/memo.pb.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.31.0 -// protoc (unknown) -// source: store/memo.proto - -package store - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - 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 Memo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - CreatorId int32 `protobuf:"varint,2,opt,name=creator_id,json=creatorId,proto3" json:"creator_id,omitempty"` - CreatedTs int64 `protobuf:"varint,3,opt,name=created_ts,json=createdTs,proto3" json:"created_ts,omitempty"` - UpdatedTs int64 `protobuf:"varint,4,opt,name=updated_ts,json=updatedTs,proto3" json:"updated_ts,omitempty"` - RowStatus RowStatus `protobuf:"varint,5,opt,name=row_status,json=rowStatus,proto3,enum=slash.store.RowStatus" json:"row_status,omitempty"` - Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` - Title string `protobuf:"bytes,7,opt,name=title,proto3" json:"title,omitempty"` - Content string `protobuf:"bytes,8,opt,name=content,proto3" json:"content,omitempty"` - Tags []string `protobuf:"bytes,9,rep,name=tags,proto3" json:"tags,omitempty"` - Visibility Visibility `protobuf:"varint,10,opt,name=visibility,proto3,enum=slash.store.Visibility" json:"visibility,omitempty"` -} - -func (x *Memo) Reset() { - *x = Memo{} - if protoimpl.UnsafeEnabled { - mi := &file_store_memo_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Memo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Memo) ProtoMessage() {} - -func (x *Memo) ProtoReflect() protoreflect.Message { - mi := &file_store_memo_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Memo.ProtoReflect.Descriptor instead. -func (*Memo) Descriptor() ([]byte, []int) { - return file_store_memo_proto_rawDescGZIP(), []int{0} -} - -func (x *Memo) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *Memo) GetCreatorId() int32 { - if x != nil { - return x.CreatorId - } - return 0 -} - -func (x *Memo) GetCreatedTs() int64 { - if x != nil { - return x.CreatedTs - } - return 0 -} - -func (x *Memo) GetUpdatedTs() int64 { - if x != nil { - return x.UpdatedTs - } - return 0 -} - -func (x *Memo) GetRowStatus() RowStatus { - if x != nil { - return x.RowStatus - } - return RowStatus_ROW_STATUS_UNSPECIFIED -} - -func (x *Memo) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Memo) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Memo) GetContent() string { - if x != nil { - return x.Content - } - return "" -} - -func (x *Memo) GetTags() []string { - if x != nil { - return x.Tags - } - return nil -} - -func (x *Memo) GetVisibility() Visibility { - if x != nil { - return x.Visibility - } - return Visibility_VISIBILITY_UNSPECIFIED -} - -var File_store_memo_proto protoreflect.FileDescriptor - -var file_store_memo_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0b, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x1a, - 0x12, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x02, 0x0a, 0x04, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x0a, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x73, 0x12, 0x35, 0x0a, 0x0a, 0x72, 0x6f, 0x77, - 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, - 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x6f, 0x77, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x72, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x37, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, - 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x73, - 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x42, 0x9a, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x09, 0x4d, 0x65, 0x6d, 0x6f, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, - 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, - 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x73, 0x74, - 0x6f, 0x72, 0x65, 0xa2, 0x02, 0x03, 0x53, 0x53, 0x58, 0xaa, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, - 0x68, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x65, 0xca, 0x02, 0x0b, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, - 0x53, 0x74, 0x6f, 0x72, 0x65, 0xe2, 0x02, 0x17, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x53, 0x74, - 0x6f, 0x72, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x53, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_store_memo_proto_rawDescOnce sync.Once - file_store_memo_proto_rawDescData = file_store_memo_proto_rawDesc -) - -func file_store_memo_proto_rawDescGZIP() []byte { - file_store_memo_proto_rawDescOnce.Do(func() { - file_store_memo_proto_rawDescData = protoimpl.X.CompressGZIP(file_store_memo_proto_rawDescData) - }) - return file_store_memo_proto_rawDescData -} - -var file_store_memo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_store_memo_proto_goTypes = []interface{}{ - (*Memo)(nil), // 0: slash.store.Memo - (RowStatus)(0), // 1: slash.store.RowStatus - (Visibility)(0), // 2: slash.store.Visibility -} -var file_store_memo_proto_depIdxs = []int32{ - 1, // 0: slash.store.Memo.row_status:type_name -> slash.store.RowStatus - 2, // 1: slash.store.Memo.visibility:type_name -> slash.store.Visibility - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_store_memo_proto_init() } -func file_store_memo_proto_init() { - if File_store_memo_proto != nil { - return - } - file_store_common_proto_init() - if !protoimpl.UnsafeEnabled { - file_store_memo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Memo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_store_memo_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_store_memo_proto_goTypes, - DependencyIndexes: file_store_memo_proto_depIdxs, - MessageInfos: file_store_memo_proto_msgTypes, - }.Build() - File_store_memo_proto = out.File - file_store_memo_proto_rawDesc = nil - file_store_memo_proto_goTypes = nil - file_store_memo_proto_depIdxs = nil -} diff --git a/proto/store/memo.proto b/proto/store/memo.proto deleted file mode 100644 index a168e08..0000000 --- a/proto/store/memo.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; - -package slash.store; - -import "store/common.proto"; - -option go_package = "gen/store"; - -message Memo { - int32 id = 1; - - int32 creator_id = 2; - - int64 created_ts = 3; - - int64 updated_ts = 4; - - RowStatus row_status = 5; - - string name = 6; - - string title = 7; - - string content = 8; - - repeated string tags = 9; - - Visibility visibility = 10; -} diff --git a/server/route/api/v1/memo_service.go b/server/route/api/v1/memo_service.go deleted file mode 100644 index 464eed2..0000000 --- a/server/route/api/v1/memo_service.go +++ /dev/null @@ -1,196 +0,0 @@ -package v1 - -import ( - "context" - "strings" - "time" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/timestamppb" - - apiv1pb "github.com/yourselfhosted/slash/proto/gen/api/v1" - storepb "github.com/yourselfhosted/slash/proto/gen/store" - "github.com/yourselfhosted/slash/store" -) - -func (s *APIV2Service) ListMemos(ctx context.Context, _ *apiv1pb.ListMemosRequest) (*apiv1pb.ListMemosResponse, error) { - find := &store.FindMemo{} - memos, err := s.Store.ListMemos(ctx, find) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to fetch memo list, err: %v", err) - } - - composedMemos := []*apiv1pb.Memo{} - for _, memo := range memos { - composedMemo, err := s.convertMemoFromStorepb(ctx, memo) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) - } - composedMemos = append(composedMemos, composedMemo) - } - - response := &apiv1pb.ListMemosResponse{ - Memos: composedMemos, - } - return response, nil -} - -func (s *APIV2Service) GetMemo(ctx context.Context, request *apiv1pb.GetMemoRequest) (*apiv1pb.GetMemoResponse, error) { - memo, err := s.Store.GetMemo(ctx, &store.FindMemo{ - ID: &request.Id, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get memo by ID: %v", err) - } - if memo == nil { - return nil, status.Errorf(codes.NotFound, "memo not found") - } - - composedMemo, err := s.convertMemoFromStorepb(ctx, memo) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) - } - response := &apiv1pb.GetMemoResponse{ - Memo: composedMemo, - } - return response, nil -} - -func (s *APIV2Service) CreateMemo(ctx context.Context, request *apiv1pb.CreateMemoRequest) (*apiv1pb.CreateMemoResponse, error) { - user, err := getCurrentUser(ctx, s.Store) - if err != nil { - return nil, status.Errorf(codes.Unauthenticated, "failed to get current user: %v", err) - } - memoCreate := &storepb.Memo{ - CreatorId: user.ID, - Name: request.Memo.Name, - Title: request.Memo.Title, - Content: request.Memo.Content, - Tags: request.Memo.Tags, - Visibility: storepb.Visibility(request.Memo.Visibility), - } - memo, err := s.Store.CreateMemo(ctx, memoCreate) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to create memo, err: %v", err) - } - - composedMemo, err := s.convertMemoFromStorepb(ctx, memo) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) - } - response := &apiv1pb.CreateMemoResponse{ - Memo: composedMemo, - } - return response, nil -} - -func (s *APIV2Service) UpdateMemo(ctx context.Context, request *apiv1pb.UpdateMemoRequest) (*apiv1pb.UpdateMemoResponse, error) { - if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { - return nil, status.Errorf(codes.InvalidArgument, "updateMask is required") - } - - user, err := getCurrentUser(ctx, s.Store) - if err != nil { - return nil, status.Errorf(codes.Unauthenticated, "failed to get current user: %v", err) - } - currentUser, err := s.Store.GetUser(ctx, &store.FindUser{ - ID: &user.ID, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get current user, err: %v", err) - } - memo, err := s.Store.GetMemo(ctx, &store.FindMemo{ - ID: &request.Memo.Id, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get memo by ID: %v", err) - } - if memo == nil { - return nil, status.Errorf(codes.NotFound, "memo not found") - } - if memo.CreatorId != user.ID && currentUser.Role != store.RoleAdmin { - return nil, status.Errorf(codes.PermissionDenied, "Permission denied") - } - - update := &store.UpdateMemo{ - ID: memo.Id, - } - for _, path := range request.UpdateMask.Paths { - switch path { - case "name": - update.Name = &request.Memo.Name - case "title": - update.Title = &request.Memo.Title - case "content": - update.Content = &request.Memo.Content - case "tags": - tag := strings.Join(request.Memo.Tags, " ") - update.Tag = &tag - case "visibility": - visibility := store.Visibility(request.Memo.Visibility.String()) - update.Visibility = &visibility - } - } - memo, err = s.Store.UpdateMemo(ctx, update) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to update memo, err: %v", err) - } - - composedMemo, err := s.convertMemoFromStorepb(ctx, memo) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) - } - response := &apiv1pb.UpdateMemoResponse{ - Memo: composedMemo, - } - return response, nil -} - -func (s *APIV2Service) DeleteMemo(ctx context.Context, request *apiv1pb.DeleteMemoRequest) (*apiv1pb.DeleteMemoResponse, error) { - user, err := getCurrentUser(ctx, s.Store) - if err != nil { - return nil, status.Errorf(codes.Unauthenticated, "failed to get current user: %v", err) - } - currentUser, err := s.Store.GetUser(ctx, &store.FindUser{ - ID: &user.ID, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get current user, err: %v", err) - } - memo, err := s.Store.GetMemo(ctx, &store.FindMemo{ - ID: &request.Id, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to get memo by ID: %v", err) - } - if memo == nil { - return nil, status.Errorf(codes.NotFound, "memo not found") - } - if memo.CreatorId != user.ID && currentUser.Role != store.RoleAdmin { - return nil, status.Errorf(codes.PermissionDenied, "Permission denied") - } - - err = s.Store.DeleteMemo(ctx, &store.DeleteMemo{ - ID: memo.Id, - }) - if err != nil { - return nil, status.Errorf(codes.Internal, "failed to delete memo, err: %v", err) - } - response := &apiv1pb.DeleteMemoResponse{} - return response, nil -} - -func (*APIV2Service) convertMemoFromStorepb(_ context.Context, memo *storepb.Memo) (*apiv1pb.Memo, error) { - return &apiv1pb.Memo{ - Id: memo.Id, - CreatedTime: timestamppb.New(time.Unix(memo.CreatedTs, 0)), - UpdatedTime: timestamppb.New(time.Unix(memo.UpdatedTs, 0)), - CreatorId: memo.CreatorId, - Name: memo.Name, - Title: memo.Title, - Content: memo.Content, - Tags: memo.Tags, - Visibility: apiv1pb.Visibility(memo.Visibility), - }, nil -} diff --git a/server/route/api/v1/v1.go b/server/route/api/v1/v1.go index b499f7b..5d0a8ba 100644 --- a/server/route/api/v1/v1.go +++ b/server/route/api/v1/v1.go @@ -25,7 +25,6 @@ type APIV2Service struct { apiv1pb.UnimplementedUserSettingServiceServer apiv1pb.UnimplementedShortcutServiceServer apiv1pb.UnimplementedCollectionServiceServer - apiv1pb.UnimplementedMemoServiceServer Secret string Profile *profile.Profile @@ -60,7 +59,6 @@ func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store apiv1pb.RegisterUserSettingServiceServer(grpcServer, apiV2Service) apiv1pb.RegisterShortcutServiceServer(grpcServer, apiV2Service) apiv1pb.RegisterCollectionServiceServer(grpcServer, apiV2Service) - apiv1pb.RegisterMemoServiceServer(grpcServer, apiV2Service) reflection.Register(grpcServer) return apiV2Service @@ -105,9 +103,6 @@ func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error if err := apiv1pb.RegisterCollectionServiceHandler(context.Background(), gwMux, conn); err != nil { return err } - if err := apiv1pb.RegisterMemoServiceHandler(context.Background(), gwMux, conn); err != nil { - return err - } e.Any("/api/v1/*", echo.WrapHandler(gwMux)) // GRPC web proxy. diff --git a/store/db/postgres/memo.go b/store/db/postgres/memo.go deleted file mode 100644 index 3548b19..0000000 --- a/store/db/postgres/memo.go +++ /dev/null @@ -1,173 +0,0 @@ -package postgres - -import ( - "context" - "fmt" - "strings" - - "github.com/pkg/errors" - - storepb "github.com/yourselfhosted/slash/proto/gen/store" - "github.com/yourselfhosted/slash/store" -) - -func (d *DB) CreateMemo(ctx context.Context, create *storepb.Memo) (*storepb.Memo, error) { - set := []string{"creator_id", "name", "title", "content", "visibility", "tag"} - args := []any{create.CreatorId, create.Name, create.Title, create.Content, create.Visibility.String(), strings.Join(create.Tags, " ")} - - stmt := ` - INSERT INTO memo (` + strings.Join(set, ", ") + `) - VALUES (` + placeholders(len(args)) + `) - RETURNING id, created_ts, updated_ts, row_status - ` - - var rowStatus string - if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( - &create.Id, - &create.CreatedTs, - &create.UpdatedTs, - &rowStatus, - ); err != nil { - return nil, err - } - create.RowStatus = store.ConvertRowStatusStringToStorepb(rowStatus) - memo := create - return memo, nil -} - -func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) (*storepb.Memo, error) { - set, args := []string{}, []any{} - if update.RowStatus != nil { - set, args = append(set, "row_status = "+placeholder(len(args)+1)), append(args, update.RowStatus.String()) - } - if update.Name != nil { - set, args = append(set, "name = "+placeholder(len(args)+1)), append(args, *update.Name) - } - if update.Title != nil { - set, args = append(set, "title = "+placeholder(len(args)+1)), append(args, *update.Title) - } - if update.Content != nil { - set, args = append(set, "content = "+placeholder(len(args)+1)), append(args, *update.Content) - } - if update.Visibility != nil { - set, args = append(set, "visibility = "+placeholder(len(args)+1)), append(args, update.Visibility.String()) - } - if update.Tag != nil { - set, args = append(set, "tag = "+placeholder(len(args)+1)), append(args, *update.Tag) - } - if len(set) == 0 { - return nil, errors.New("no update specified") - } - - stmt := ` - UPDATE memo - SET ` + strings.Join(set, ", ") + ` - WHERE id = ` + placeholder(len(args)+1) + ` - RETURNING id, creator_id, created_ts, updated_ts, row_status, name, title, content, visibility, tag - ` - args = append(args, update.ID) - memo := &storepb.Memo{} - var rowStatus, visibility, tags string - if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( - &memo.Id, - &memo.CreatorId, - &memo.CreatedTs, - &memo.UpdatedTs, - &rowStatus, - &memo.Name, - &memo.Title, - &memo.Content, - &visibility, - &tags, - ); err != nil { - return nil, err - } - memo.RowStatus = store.ConvertRowStatusStringToStorepb(rowStatus) - memo.Visibility = convertVisibilityStringToStorepb(visibility) - memo.Tags = filterTags(strings.Split(tags, " ")) - return memo, nil -} - -func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*storepb.Memo, error) { - where, args := []string{"1 = 1"}, []any{} - if v := find.ID; v != nil { - where, args = append(where, "id = "+placeholder(len(args)+1)), append(args, *v) - } - if v := find.CreatorID; v != nil { - where, args = append(where, "creator_id = "+placeholder(len(args)+1)), append(args, *v) - } - if v := find.RowStatus; v != nil { - where, args = append(where, "row_status = "+placeholder(len(args)+1)), append(args, *v) - } - if v := find.Name; v != nil { - where, args = append(where, "name = "+placeholder(len(args)+1)), append(args, *v) - } - if v := find.VisibilityList; len(v) != 0 { - list := []string{} - for _, visibility := range v { - list, args = append(list, placeholder(len(args)+1)), append(args, visibility) - } - where = append(where, fmt.Sprintf("visibility IN (%s)", strings.Join(list, ","))) - } - if v := find.Tag; v != nil { - where, args = append(where, "tag LIKE "+placeholder(len(args)+1)), append(args, "%"+*v+"%") - } - - rows, err := d.db.QueryContext(ctx, ` - SELECT - id, - creator_id, - created_ts, - updated_ts, - row_status, - name, - title, - content, - visibility, - tag - FROM memo - WHERE `+strings.Join(where, " AND ")+` - ORDER BY created_ts DESC`, - args..., - ) - if err != nil { - return nil, err - } - defer rows.Close() - - list := make([]*storepb.Memo, 0) - for rows.Next() { - memo := &storepb.Memo{} - var rowStatus, visibility, tags string - if err := rows.Scan( - &memo.Id, - &memo.CreatorId, - &memo.CreatedTs, - &memo.UpdatedTs, - &rowStatus, - &memo.Name, - &memo.Title, - &memo.Content, - &visibility, - &tags, - ); err != nil { - return nil, err - } - memo.RowStatus = store.ConvertRowStatusStringToStorepb(rowStatus) - memo.Visibility = storepb.Visibility(storepb.Visibility_value[visibility]) - memo.Tags = filterTags(strings.Split(tags, " ")) - list = append(list, memo) - } - - if err := rows.Err(); err != nil { - return nil, err - } - return list, nil -} - -func (d *DB) DeleteMemo(ctx context.Context, delete *store.DeleteMemo) error { - if _, err := d.db.ExecContext(ctx, `DELETE FROM memo WHERE id = $1`, delete.ID); err != nil { - return err - } - return nil -} diff --git a/store/db/postgres/migration/dev/LATEST.sql b/store/db/postgres/migration/dev/LATEST.sql index 296f871..75e0683 100644 --- a/store/db/postgres/migration/dev/LATEST.sql +++ b/store/db/postgres/migration/dev/LATEST.sql @@ -74,19 +74,3 @@ CREATE TABLE collection ( ); CREATE INDEX idx_collection_name ON collection(name); - --- memo -CREATE TABLE memo ( - id SERIAL PRIMARY KEY, - creator_id INTEGER REFERENCES "user"(id) 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 CHECK (row_status IN ('NORMAL', 'ARCHIVED')) DEFAULT 'NORMAL', - name TEXT NOT NULL UNIQUE, - title TEXT NOT NULL DEFAULT '', - content TEXT NOT NULL DEFAULT '', - visibility TEXT NOT NULL CHECK (visibility IN ('PRIVATE', 'WORKSPACE', 'PUBLIC')) DEFAULT 'PRIVATE', - tag TEXT NOT NULL DEFAULT '' -); - -CREATE INDEX idx_memo_name ON memo(name); diff --git a/store/db/sqlite/memo.go b/store/db/sqlite/memo.go deleted file mode 100644 index 893a7d2..0000000 --- a/store/db/sqlite/memo.go +++ /dev/null @@ -1,182 +0,0 @@ -package sqlite - -import ( - "context" - "fmt" - "strings" - - "github.com/pkg/errors" - - storepb "github.com/yourselfhosted/slash/proto/gen/store" - "github.com/yourselfhosted/slash/store" -) - -func (d *DB) CreateMemo(ctx context.Context, create *storepb.Memo) (*storepb.Memo, error) { - set := []string{"creator_id", "name", "title", "content", "visibility", "tag"} - args := []any{create.CreatorId, create.Name, create.Title, create.Content, create.Visibility.String(), strings.Join(create.Tags, " ")} - - stmt := ` - INSERT INTO memo ( - ` + strings.Join(set, ", ") + ` - ) - VALUES (` + placeholders(len(args)) + `) - RETURNING id, created_ts, updated_ts, row_status - ` - - var rowStatus string - if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( - &create.Id, - &create.CreatedTs, - &create.UpdatedTs, - &rowStatus, - ); err != nil { - return nil, err - } - create.RowStatus = store.ConvertRowStatusStringToStorepb(rowStatus) - memo := create - return memo, nil -} - -func (d *DB) UpdateMemo(ctx context.Context, update *store.UpdateMemo) (*storepb.Memo, error) { - set, args := []string{}, []any{} - if update.RowStatus != nil { - set, args = append(set, "row_status = ?"), append(args, update.RowStatus.String()) - } - if update.Name != nil { - set, args = append(set, "name = ?"), append(args, *update.Name) - } - if update.Title != nil { - set, args = append(set, "title = ?"), append(args, *update.Title) - } - if update.Content != nil { - set, args = append(set, "content = ?"), append(args, *update.Content) - } - if update.Visibility != nil { - set, args = append(set, "visibility = ?"), append(args, update.Visibility.String()) - } - if update.Tag != nil { - set, args = append(set, "tag = ?"), append(args, *update.Tag) - } - if len(set) == 0 { - return nil, errors.New("no update specified") - } - args = append(args, update.ID) - - stmt := ` - UPDATE memo - SET - ` + strings.Join(set, ", ") + ` - WHERE - id = ? - RETURNING id, creator_id, created_ts, updated_ts, row_status, name, title, content, visibility, tag - ` - memo := &storepb.Memo{} - var rowStatus, visibility, tags string - if err := d.db.QueryRowContext(ctx, stmt, args...).Scan( - &memo.Id, - &memo.CreatorId, - &memo.CreatedTs, - &memo.UpdatedTs, - &rowStatus, - &memo.Name, - &memo.Title, - &memo.Content, - &visibility, - &tags, - ); err != nil { - return nil, err - } - memo.RowStatus = store.ConvertRowStatusStringToStorepb(rowStatus) - memo.Visibility = convertVisibilityStringToStorepb(visibility) - memo.Tags = filterTags(strings.Split(tags, " ")) - return memo, nil -} - -func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*storepb.Memo, error) { - where, args := []string{"1 = 1"}, []any{} - if v := find.ID; v != nil { - where, args = append(where, "id = ?"), append(args, *v) - } - if v := find.CreatorID; v != nil { - where, args = append(where, "creator_id = ?"), append(args, *v) - } - if v := find.RowStatus; v != nil { - where, args = append(where, "row_status = ?"), append(args, *v) - } - if v := find.Name; v != nil { - where, args = append(where, "name = ?"), append(args, *v) - } - if v := find.VisibilityList; len(v) != 0 { - list := []string{} - for _, visibility := range v { - list = append(list, fmt.Sprintf("$%d", len(args)+1)) - args = append(args, visibility) - } - where = append(where, fmt.Sprintf("visibility in (%s)", strings.Join(list, ","))) - } - if v := find.Tag; v != nil { - where, args = append(where, "tag LIKE ?"), append(args, "%"+*v+"%") - } - - rows, err := d.db.QueryContext(ctx, ` - SELECT - id, - creator_id, - created_ts, - updated_ts, - row_status, - name, - title, - content, - visibility, - tag - FROM memo - WHERE `+strings.Join(where, " AND ")+` - ORDER BY created_ts DESC`, - args..., - ) - if err != nil { - return nil, err - } - defer rows.Close() - - list := make([]*storepb.Memo, 0) - for rows.Next() { - memo := &storepb.Memo{} - var rowStatus, visibility, tags string - if err := rows.Scan( - &memo.Id, - &memo.CreatorId, - &memo.CreatedTs, - &memo.UpdatedTs, - &rowStatus, - &memo.Name, - &memo.Title, - &memo.Content, - &visibility, - &tags, - ); err != nil { - return nil, err - } - memo.RowStatus = store.ConvertRowStatusStringToStorepb(rowStatus) - memo.Visibility = storepb.Visibility(storepb.Visibility_value[visibility]) - memo.Tags = filterTags(strings.Split(tags, " ")) - list = append(list, memo) - } - - if err := rows.Err(); err != nil { - return nil, err - } - return list, nil -} - -func (d *DB) DeleteMemo(ctx context.Context, delete *store.DeleteMemo) error { - if _, err := d.db.ExecContext(ctx, `DELETE FROM memo WHERE id = ?`, delete.ID); err != nil { - return err - } - return nil -} - -func placeholders(n int) string { - return strings.Repeat("?,", n-1) + "?" -} diff --git a/store/db/sqlite/migration/dev/LATEST.sql b/store/db/sqlite/migration/dev/LATEST.sql index 844c561..3933460 100644 --- a/store/db/sqlite/migration/dev/LATEST.sql +++ b/store/db/sqlite/migration/dev/LATEST.sql @@ -74,19 +74,3 @@ CREATE TABLE collection ( ); CREATE INDEX idx_collection_name ON collection(name); - --- memo -CREATE TABLE memo ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - 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', - name TEXT NOT NULL UNIQUE, - title TEXT NOT NULL DEFAULT '', - content TEXT NOT NULL DEFAULT '', - visibility TEXT NOT NULL CHECK (visibility IN ('PRIVATE', 'WORKSPACE', 'PUBLIC')) DEFAULT 'PRIVATE', - tag TEXT NOT NULL DEFAULT '' -); - -CREATE INDEX idx_memo_name ON memo(name); diff --git a/store/db/sqlite/migrator.go b/store/db/sqlite/migrator.go index 779a150..cf494e0 100644 --- a/store/db/sqlite/migrator.go +++ b/store/db/sqlite/migrator.go @@ -77,7 +77,7 @@ func (d *DB) Migrate(ctx context.Context) error { if err != nil { return errors.Wrap(err, "failed to read raw database file") } - backupDBFilePath := fmt.Sprintf("%s/memos_%s_%d_backup.db", d.profile.Data, d.profile.Version, time.Now().Unix()) + backupDBFilePath := fmt.Sprintf("%s/slash_%s_%d_backup.db", d.profile.Data, d.profile.Version, time.Now().Unix()) if err := os.WriteFile(backupDBFilePath, rawBytes, 0644); err != nil { return errors.Wrap(err, "failed to write raw database file") } diff --git a/store/driver.go b/store/driver.go index b29656e..85b4807 100644 --- a/store/driver.go +++ b/store/driver.go @@ -29,12 +29,6 @@ type Driver interface { ListCollections(ctx context.Context, find *FindCollection) ([]*storepb.Collection, error) DeleteCollection(ctx context.Context, delete *DeleteCollection) error - // Memo model related methods. - CreateMemo(ctx context.Context, create *storepb.Memo) (*storepb.Memo, error) - UpdateMemo(ctx context.Context, update *UpdateMemo) (*storepb.Memo, error) - ListMemos(ctx context.Context, find *FindMemo) ([]*storepb.Memo, error) - DeleteMemo(ctx context.Context, delete *DeleteMemo) error - // Shortcut model related methods. CreateShortcut(ctx context.Context, create *storepb.Shortcut) (*storepb.Shortcut, error) UpdateShortcut(ctx context.Context, update *UpdateShortcut) (*storepb.Shortcut, error) diff --git a/store/memo.go b/store/memo.go deleted file mode 100644 index 4035f48..0000000 --- a/store/memo.go +++ /dev/null @@ -1,60 +0,0 @@ -package store - -import ( - "context" - - storepb "github.com/yourselfhosted/slash/proto/gen/store" -) - -type UpdateMemo struct { - ID int32 - RowStatus *RowStatus - Name *string - Title *string - Content *string - Visibility *Visibility - Tag *string -} - -type FindMemo struct { - ID *int32 - CreatorID *int32 - RowStatus *RowStatus - Name *string - VisibilityList []Visibility - Tag *string -} - -type DeleteMemo struct { - ID int32 -} - -func (s *Store) CreateMemo(ctx context.Context, create *storepb.Memo) (*storepb.Memo, error) { - return s.driver.CreateMemo(ctx, create) -} - -func (s *Store) UpdateMemo(ctx context.Context, update *UpdateMemo) (*storepb.Memo, error) { - return s.driver.UpdateMemo(ctx, update) -} - -func (s *Store) ListMemos(ctx context.Context, find *FindMemo) ([]*storepb.Memo, error) { - return s.driver.ListMemos(ctx, find) -} - -func (s *Store) GetMemo(ctx context.Context, find *FindMemo) (*storepb.Memo, error) { - memos, err := s.ListMemos(ctx, find) - if err != nil { - return nil, err - } - - if len(memos) == 0 { - return nil, nil - } - - memo := memos[0] - return memo, nil -} - -func (s *Store) DeleteMemo(ctx context.Context, delete *DeleteMemo) error { - return s.driver.DeleteMemo(ctx, delete) -} diff --git a/test/store/memo_test.go b/test/store/memo_test.go deleted file mode 100644 index 7acdb4c..0000000 --- a/test/store/memo_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package teststore - -import ( - "context" - "testing" - - "github.com/stretchr/testify/require" - - storepb "github.com/yourselfhosted/slash/proto/gen/store" - "github.com/yourselfhosted/slash/store" -) - -func TestMemoStore(t *testing.T) { - ctx := context.Background() - ts := NewTestingStore(ctx, t) - user, err := createTestingAdminUser(ctx, ts) - require.NoError(t, err) - - memo, err := ts.CreateMemo(ctx, &storepb.Memo{ - CreatorId: user.ID, - Name: "test", - Title: "Test Memo", - Content: "This is a test memo.", - Visibility: storepb.Visibility_PRIVATE, - Tags: []string{"test", "memo"}, - }) - require.NoError(t, err) - - memos, err := ts.ListMemos(ctx, &store.FindMemo{ - CreatorID: &user.ID, - }) - require.NoError(t, err) - require.Equal(t, 1, len(memos)) - require.Equal(t, memo, memos[0]) - - newContent := "Updated content." - updatedMemo, err := ts.UpdateMemo(ctx, &store.UpdateMemo{ - ID: memo.Id, - Content: &newContent, - }) - require.NoError(t, err) - require.Equal(t, newContent, updatedMemo.Content) - - tag := "test" - memo, err = ts.GetMemo(ctx, &store.FindMemo{ - Tag: &tag, - }) - require.NoError(t, err) - - err = ts.DeleteMemo(ctx, &store.DeleteMemo{ - ID: memo.Id, - }) - require.NoError(t, err) - - memos, err = ts.ListMemos(ctx, &store.FindMemo{ - CreatorID: &user.ID, - }) - require.NoError(t, err) - require.Equal(t, 0, len(memos)) -} diff --git a/test/store/store.go b/test/store/store.go index 12ef436..3c5b570 100644 --- a/test/store/store.go +++ b/test/store/store.go @@ -8,7 +8,7 @@ import ( "github.com/yourselfhosted/slash/server/profile" "github.com/yourselfhosted/slash/store" "github.com/yourselfhosted/slash/store/db" - test "github.com/yourselfhosted/slash/test" + "github.com/yourselfhosted/slash/test" ) func NewTestingStore(ctx context.Context, t *testing.T) *store.Store { @@ -35,8 +35,7 @@ func resetTestingDB(ctx context.Context, profile *profile.Profile, dbDriver stor DROP TABLE IF EXISTS user_setting CASCADE; DROP TABLE IF EXISTS shortcut CASCADE; DROP TABLE IF EXISTS activity CASCADE; - DROP TABLE IF EXISTS collection CASCADE; - DROP TABLE IF EXISTS memo CASCADE;`) + DROP TABLE IF EXISTS collection CASCADE;`) if err != nil { fmt.Printf("failed to reset testing db, error: %+v\n", err) panic(err)