diff --git a/docs/apidocs.swagger.yaml b/docs/apidocs.swagger.yaml
index d42546f4..09722cfb 100644
--- a/docs/apidocs.swagger.yaml
+++ b/docs/apidocs.swagger.yaml
@@ -494,6 +494,27 @@ paths:
$ref: '#/definitions/v1Resource'
tags:
- ResourceService
+ /api/v1/resources:by-uid/{uid}:
+ get:
+ summary: GetResourceByUid returns a resource by uid.
+ operationId: ResourceService_GetResourceByUid
+ responses:
+ "200":
+ description: A successful response.
+ schema:
+ $ref: '#/definitions/v1Resource'
+ default:
+ description: An unexpected error response.
+ schema:
+ $ref: '#/definitions/googlerpcStatus'
+ parameters:
+ - name: uid
+ description: The uid of the resource.
+ in: path
+ required: true
+ type: string
+ tags:
+ - ResourceService
/api/v1/resources:search:
get:
summary: SearchResources searches memos.
diff --git a/proto/api/v1/resource_service.proto b/proto/api/v1/resource_service.proto
index 366af2f7..39b01285 100644
--- a/proto/api/v1/resource_service.proto
+++ b/proto/api/v1/resource_service.proto
@@ -33,6 +33,11 @@ service ResourceService {
option (google.api.http) = {get: "/api/v1/{name=resources/*}"};
option (google.api.method_signature) = "name";
}
+ // GetResourceByUid returns a resource by uid.
+ rpc GetResourceByUid(GetResourceByUidRequest) returns (Resource) {
+ option (google.api.http) = {get: "/api/v1/resources:by-uid/{uid}"};
+ option (google.api.method_signature) = "uid";
+ }
// GetResourceBinary returns a resource binary by name.
rpc GetResourceBinary(GetResourceBinaryRequest) returns (google.api.HttpBody) {
option (google.api.http) = {get: "/file/{name=resources/*}/{filename}"};
@@ -104,6 +109,11 @@ message GetResourceRequest {
string name = 1;
}
+message GetResourceByUidRequest {
+ // The uid of the resource.
+ string uid = 1;
+}
+
message GetResourceBinaryRequest {
// The name of the resource.
// Format: resources/{id}
diff --git a/proto/gen/api/v1/resource_service.pb.go b/proto/gen/api/v1/resource_service.pb.go
index 3e33a5be..c4010f21 100644
--- a/proto/gen/api/v1/resource_service.pb.go
+++ b/proto/gen/api/v1/resource_service.pb.go
@@ -418,6 +418,54 @@ func (x *GetResourceRequest) GetName() string {
return ""
}
+type GetResourceByUidRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The uid of the resource.
+ Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
+}
+
+func (x *GetResourceByUidRequest) Reset() {
+ *x = GetResourceByUidRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_api_v1_resource_service_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetResourceByUidRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetResourceByUidRequest) ProtoMessage() {}
+
+func (x *GetResourceByUidRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_api_v1_resource_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 GetResourceByUidRequest.ProtoReflect.Descriptor instead.
+func (*GetResourceByUidRequest) Descriptor() ([]byte, []int) {
+ return file_api_v1_resource_service_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *GetResourceByUidRequest) GetUid() string {
+ if x != nil {
+ return x.Uid
+ }
+ return ""
+}
+
type GetResourceBinaryRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -434,7 +482,7 @@ type GetResourceBinaryRequest struct {
func (x *GetResourceBinaryRequest) Reset() {
*x = GetResourceBinaryRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_resource_service_proto_msgTypes[7]
+ mi := &file_api_v1_resource_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -447,7 +495,7 @@ func (x *GetResourceBinaryRequest) String() string {
func (*GetResourceBinaryRequest) ProtoMessage() {}
func (x *GetResourceBinaryRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_resource_service_proto_msgTypes[7]
+ mi := &file_api_v1_resource_service_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -460,7 +508,7 @@ func (x *GetResourceBinaryRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetResourceBinaryRequest.ProtoReflect.Descriptor instead.
func (*GetResourceBinaryRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_resource_service_proto_rawDescGZIP(), []int{7}
+ return file_api_v1_resource_service_proto_rawDescGZIP(), []int{8}
}
func (x *GetResourceBinaryRequest) GetName() string {
@@ -489,7 +537,7 @@ type UpdateResourceRequest struct {
func (x *UpdateResourceRequest) Reset() {
*x = UpdateResourceRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_resource_service_proto_msgTypes[8]
+ mi := &file_api_v1_resource_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -502,7 +550,7 @@ func (x *UpdateResourceRequest) String() string {
func (*UpdateResourceRequest) ProtoMessage() {}
func (x *UpdateResourceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_resource_service_proto_msgTypes[8]
+ mi := &file_api_v1_resource_service_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -515,7 +563,7 @@ func (x *UpdateResourceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateResourceRequest.ProtoReflect.Descriptor instead.
func (*UpdateResourceRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_resource_service_proto_rawDescGZIP(), []int{8}
+ return file_api_v1_resource_service_proto_rawDescGZIP(), []int{9}
}
func (x *UpdateResourceRequest) GetResource() *Resource {
@@ -546,7 +594,7 @@ type DeleteResourceRequest struct {
func (x *DeleteResourceRequest) Reset() {
*x = DeleteResourceRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_api_v1_resource_service_proto_msgTypes[9]
+ mi := &file_api_v1_resource_service_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -559,7 +607,7 @@ func (x *DeleteResourceRequest) String() string {
func (*DeleteResourceRequest) ProtoMessage() {}
func (x *DeleteResourceRequest) ProtoReflect() protoreflect.Message {
- mi := &file_api_v1_resource_service_proto_msgTypes[9]
+ mi := &file_api_v1_resource_service_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -572,7 +620,7 @@ func (x *DeleteResourceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteResourceRequest.ProtoReflect.Descriptor instead.
func (*DeleteResourceRequest) Descriptor() ([]byte, []int) {
- return file_api_v1_resource_service_proto_rawDescGZIP(), []int{9}
+ return file_api_v1_resource_service_proto_rawDescGZIP(), []int{10}
}
func (x *DeleteResourceRequest) GetName() string {
@@ -641,92 +689,103 @@ var file_api_v1_resource_service_proto_rawDesc = []byte{
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0x28, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x22, 0x4a, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
- 0x65, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12,
- 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x88,
- 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
- 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f,
- 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d,
- 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
- 0x63, 0x65, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x2b, 0x0a, 0x15, 0x44, 0x65, 0x6c,
- 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x9a, 0x07, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75,
- 0x72, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x72, 0x0a, 0x0e, 0x43, 0x72,
- 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d,
- 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61,
+ 0x6d, 0x65, 0x22, 0x2b, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
+ 0x65, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a,
+ 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22,
+ 0x4a, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x69,
+ 0x6e, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x15,
+ 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52,
+ 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 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, 0x2b, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
+ 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
+ 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x32, 0x9b, 0x08, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+ 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x72, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f,
+ 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52,
+ 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
+ 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65,
+ 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x3a, 0x08,
+ 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
+ 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x73, 0x0a, 0x0d, 0x4c,
+ 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x22, 0x2e, 0x6d,
+ 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74,
+ 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
+ 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f,
+ 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
+ 0x12, 0x80, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x73, 0x12, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6d, 0x65, 0x6d,
+ 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
+ 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61, 0x70, 0x69, 0x2f,
+ 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x73, 0x65, 0x61,
+ 0x72, 0x63, 0x68, 0x12, 0x72, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x29, 0xda, 0x41,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x61, 0x70,
+ 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7f, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x52, 0x65,
+ 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x55, 0x69, 0x64, 0x12, 0x25, 0x2e, 0x6d, 0x65,
+ 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65,
+ 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x79, 0x55, 0x69, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76,
+ 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x2c, 0xda, 0x41, 0x03, 0x75,
+ 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
+ 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a, 0x62, 0x79, 0x2d, 0x75,
+ 0x69, 0x64, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x11, 0x47, 0x65, 0x74,
+ 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x12, 0x26,
+ 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
+ 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x3b, 0xda, 0x41,
+ 0x0d, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3,
+ 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,
+ 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x7b,
+ 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x9b, 0x01, 0x0a, 0x0e, 0x55, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d,
+ 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31,
- 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02,
- 0x1d, 0x3a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x11, 0x2f, 0x61, 0x70,
- 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x73,
- 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12,
- 0x22, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
- 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e,
- 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13,
- 0x12, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
- 0x63, 0x65, 0x73, 0x12, 0x80, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65,
- 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x24, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
- 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73,
- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e,
- 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61,
- 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
- 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x61,
- 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x3a,
- 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x72, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73,
- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70,
- 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
- 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22,
- 0x29, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a,
- 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65,
- 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x8e, 0x01, 0x0a, 0x11, 0x47,
- 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79,
- 0x12, 0x26, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e,
- 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x69, 0x6e, 0x61, 0x72,
- 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x3b,
- 0xda, 0x41, 0x0d, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65,
- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x12, 0x23, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x2f, 0x7b, 0x6e,
- 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d,
- 0x2f, 0x7b, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x9b, 0x01, 0x0a, 0x0e,
- 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23,
- 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70,
- 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e,
- 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x14,
- 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f,
- 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x3a, 0x08, 0x72, 0x65, 0x73, 0x6f,
- 0x75, 0x72, 0x63, 0x65, 0x32, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x72,
- 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73,
- 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x78, 0x0a, 0x0e, 0x44, 0x65, 0x6c,
- 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65,
- 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
- 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x29, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d,
- 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x2a, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31,
- 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73,
- 0x2f, 0x2a, 0x7d, 0x42, 0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f,
- 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x14, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72,
- 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
- 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65,
- 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69,
- 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73,
- 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c,
- 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41,
- 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
- 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a,
- 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x4c, 0xda, 0x41, 0x14, 0x72, 0x65,
+ 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61,
+ 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2f, 0x3a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x32, 0x23, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x72, 0x65, 0x73,
+ 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x78, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74,
+ 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x23, 0x2e, 0x6d, 0x65, 0x6d, 0x6f,
+ 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
+ 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x29, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82,
+ 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x2a, 0x1a, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x7b,
+ 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x2a,
+ 0x7d, 0x42, 0xac, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x14, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+ 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30,
+ 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65,
+ 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
+ 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x70, 0x69, 0x76, 0x31,
+ 0xa2, 0x02, 0x03, 0x4d, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41,
+ 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70,
+ 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x18, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69,
+ 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
+ 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31,
+ 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -741,7 +800,7 @@ func file_api_v1_resource_service_proto_rawDescGZIP() []byte {
return file_api_v1_resource_service_proto_rawDescData
}
-var file_api_v1_resource_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_api_v1_resource_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_api_v1_resource_service_proto_goTypes = []any{
(*Resource)(nil), // 0: memos.api.v1.Resource
(*CreateResourceRequest)(nil), // 1: memos.api.v1.CreateResourceRequest
@@ -750,37 +809,40 @@ var file_api_v1_resource_service_proto_goTypes = []any{
(*SearchResourcesRequest)(nil), // 4: memos.api.v1.SearchResourcesRequest
(*SearchResourcesResponse)(nil), // 5: memos.api.v1.SearchResourcesResponse
(*GetResourceRequest)(nil), // 6: memos.api.v1.GetResourceRequest
- (*GetResourceBinaryRequest)(nil), // 7: memos.api.v1.GetResourceBinaryRequest
- (*UpdateResourceRequest)(nil), // 8: memos.api.v1.UpdateResourceRequest
- (*DeleteResourceRequest)(nil), // 9: memos.api.v1.DeleteResourceRequest
- (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp
- (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask
- (*httpbody.HttpBody)(nil), // 12: google.api.HttpBody
- (*emptypb.Empty)(nil), // 13: google.protobuf.Empty
+ (*GetResourceByUidRequest)(nil), // 7: memos.api.v1.GetResourceByUidRequest
+ (*GetResourceBinaryRequest)(nil), // 8: memos.api.v1.GetResourceBinaryRequest
+ (*UpdateResourceRequest)(nil), // 9: memos.api.v1.UpdateResourceRequest
+ (*DeleteResourceRequest)(nil), // 10: memos.api.v1.DeleteResourceRequest
+ (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
+ (*fieldmaskpb.FieldMask)(nil), // 12: google.protobuf.FieldMask
+ (*httpbody.HttpBody)(nil), // 13: google.api.HttpBody
+ (*emptypb.Empty)(nil), // 14: google.protobuf.Empty
}
var file_api_v1_resource_service_proto_depIdxs = []int32{
- 10, // 0: memos.api.v1.Resource.create_time:type_name -> google.protobuf.Timestamp
+ 11, // 0: memos.api.v1.Resource.create_time:type_name -> google.protobuf.Timestamp
0, // 1: memos.api.v1.CreateResourceRequest.resource:type_name -> memos.api.v1.Resource
0, // 2: memos.api.v1.ListResourcesResponse.resources:type_name -> memos.api.v1.Resource
0, // 3: memos.api.v1.SearchResourcesResponse.resources:type_name -> memos.api.v1.Resource
0, // 4: memos.api.v1.UpdateResourceRequest.resource:type_name -> memos.api.v1.Resource
- 11, // 5: memos.api.v1.UpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 12, // 5: memos.api.v1.UpdateResourceRequest.update_mask:type_name -> google.protobuf.FieldMask
1, // 6: memos.api.v1.ResourceService.CreateResource:input_type -> memos.api.v1.CreateResourceRequest
2, // 7: memos.api.v1.ResourceService.ListResources:input_type -> memos.api.v1.ListResourcesRequest
4, // 8: memos.api.v1.ResourceService.SearchResources:input_type -> memos.api.v1.SearchResourcesRequest
6, // 9: memos.api.v1.ResourceService.GetResource:input_type -> memos.api.v1.GetResourceRequest
- 7, // 10: memos.api.v1.ResourceService.GetResourceBinary:input_type -> memos.api.v1.GetResourceBinaryRequest
- 8, // 11: memos.api.v1.ResourceService.UpdateResource:input_type -> memos.api.v1.UpdateResourceRequest
- 9, // 12: memos.api.v1.ResourceService.DeleteResource:input_type -> memos.api.v1.DeleteResourceRequest
- 0, // 13: memos.api.v1.ResourceService.CreateResource:output_type -> memos.api.v1.Resource
- 3, // 14: memos.api.v1.ResourceService.ListResources:output_type -> memos.api.v1.ListResourcesResponse
- 5, // 15: memos.api.v1.ResourceService.SearchResources:output_type -> memos.api.v1.SearchResourcesResponse
- 0, // 16: memos.api.v1.ResourceService.GetResource:output_type -> memos.api.v1.Resource
- 12, // 17: memos.api.v1.ResourceService.GetResourceBinary:output_type -> google.api.HttpBody
- 0, // 18: memos.api.v1.ResourceService.UpdateResource:output_type -> memos.api.v1.Resource
- 13, // 19: memos.api.v1.ResourceService.DeleteResource:output_type -> google.protobuf.Empty
- 13, // [13:20] is the sub-list for method output_type
- 6, // [6:13] is the sub-list for method input_type
+ 7, // 10: memos.api.v1.ResourceService.GetResourceByUid:input_type -> memos.api.v1.GetResourceByUidRequest
+ 8, // 11: memos.api.v1.ResourceService.GetResourceBinary:input_type -> memos.api.v1.GetResourceBinaryRequest
+ 9, // 12: memos.api.v1.ResourceService.UpdateResource:input_type -> memos.api.v1.UpdateResourceRequest
+ 10, // 13: memos.api.v1.ResourceService.DeleteResource:input_type -> memos.api.v1.DeleteResourceRequest
+ 0, // 14: memos.api.v1.ResourceService.CreateResource:output_type -> memos.api.v1.Resource
+ 3, // 15: memos.api.v1.ResourceService.ListResources:output_type -> memos.api.v1.ListResourcesResponse
+ 5, // 16: memos.api.v1.ResourceService.SearchResources:output_type -> memos.api.v1.SearchResourcesResponse
+ 0, // 17: memos.api.v1.ResourceService.GetResource:output_type -> memos.api.v1.Resource
+ 0, // 18: memos.api.v1.ResourceService.GetResourceByUid:output_type -> memos.api.v1.Resource
+ 13, // 19: memos.api.v1.ResourceService.GetResourceBinary:output_type -> google.api.HttpBody
+ 0, // 20: memos.api.v1.ResourceService.UpdateResource:output_type -> memos.api.v1.Resource
+ 14, // 21: memos.api.v1.ResourceService.DeleteResource:output_type -> google.protobuf.Empty
+ 14, // [14:22] is the sub-list for method output_type
+ 6, // [6:14] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
@@ -877,7 +939,7 @@ func file_api_v1_resource_service_proto_init() {
}
}
file_api_v1_resource_service_proto_msgTypes[7].Exporter = func(v any, i int) any {
- switch v := v.(*GetResourceBinaryRequest); i {
+ switch v := v.(*GetResourceByUidRequest); i {
case 0:
return &v.state
case 1:
@@ -889,7 +951,7 @@ func file_api_v1_resource_service_proto_init() {
}
}
file_api_v1_resource_service_proto_msgTypes[8].Exporter = func(v any, i int) any {
- switch v := v.(*UpdateResourceRequest); i {
+ switch v := v.(*GetResourceBinaryRequest); i {
case 0:
return &v.state
case 1:
@@ -901,6 +963,18 @@ func file_api_v1_resource_service_proto_init() {
}
}
file_api_v1_resource_service_proto_msgTypes[9].Exporter = func(v any, i int) any {
+ switch v := v.(*UpdateResourceRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_api_v1_resource_service_proto_msgTypes[10].Exporter = func(v any, i int) any {
switch v := v.(*DeleteResourceRequest); i {
case 0:
return &v.state
@@ -920,7 +994,7 @@ func file_api_v1_resource_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_api_v1_resource_service_proto_rawDesc,
NumEnums: 0,
- NumMessages: 10,
+ NumMessages: 11,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/gen/api/v1/resource_service.pb.gw.go b/proto/gen/api/v1/resource_service.pb.gw.go
index 5c358dce..bd479d92 100644
--- a/proto/gen/api/v1/resource_service.pb.gw.go
+++ b/proto/gen/api/v1/resource_service.pb.gw.go
@@ -163,6 +163,58 @@ func local_request_ResourceService_GetResource_0(ctx context.Context, marshaler
}
+func request_ResourceService_GetResourceByUid_0(ctx context.Context, marshaler runtime.Marshaler, client ResourceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq GetResourceByUidRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["uid"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
+ }
+
+ protoReq.Uid, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
+ }
+
+ msg, err := client.GetResourceByUid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_ResourceService_GetResourceByUid_0(ctx context.Context, marshaler runtime.Marshaler, server ResourceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq GetResourceByUidRequest
+ var metadata runtime.ServerMetadata
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["uid"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid")
+ }
+
+ protoReq.Uid, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err)
+ }
+
+ msg, err := server.GetResourceByUid(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
func request_ResourceService_GetResourceBinary_0(ctx context.Context, marshaler runtime.Marshaler, client ResourceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq GetResourceBinaryRequest
var metadata runtime.ServerMetadata
@@ -493,6 +545,31 @@ func RegisterResourceServiceHandlerServer(ctx context.Context, mux *runtime.Serv
})
+ mux.Handle("GET", pattern_ResourceService_GetResourceByUid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/memos.api.v1.ResourceService/GetResourceByUid", runtime.WithHTTPPathPattern("/api/v1/resources:by-uid/{uid}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_ResourceService_GetResourceByUid_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_ResourceService_GetResourceByUid_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("GET", pattern_ResourceService_GetResourceBinary_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -697,6 +774,28 @@ func RegisterResourceServiceHandlerClient(ctx context.Context, mux *runtime.Serv
})
+ mux.Handle("GET", pattern_ResourceService_GetResourceByUid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/memos.api.v1.ResourceService/GetResourceByUid", runtime.WithHTTPPathPattern("/api/v1/resources:by-uid/{uid}"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_ResourceService_GetResourceByUid_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_ResourceService_GetResourceByUid_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("GET", pattern_ResourceService_GetResourceBinary_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -775,6 +874,8 @@ var (
pattern_ResourceService_GetResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "resources", "name"}, ""))
+ pattern_ResourceService_GetResourceByUid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v1", "resources:by-uid", "uid"}, ""))
+
pattern_ResourceService_GetResourceBinary_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"file", "resources", "name", "filename"}, ""))
pattern_ResourceService_UpdateResource_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 2, 5, 3}, []string{"api", "v1", "resources", "resource.name"}, ""))
@@ -791,6 +892,8 @@ var (
forward_ResourceService_GetResource_0 = runtime.ForwardResponseMessage
+ forward_ResourceService_GetResourceByUid_0 = runtime.ForwardResponseMessage
+
forward_ResourceService_GetResourceBinary_0 = runtime.ForwardResponseMessage
forward_ResourceService_UpdateResource_0 = runtime.ForwardResponseMessage
diff --git a/proto/gen/api/v1/resource_service_grpc.pb.go b/proto/gen/api/v1/resource_service_grpc.pb.go
index 96808bb3..82352d37 100644
--- a/proto/gen/api/v1/resource_service_grpc.pb.go
+++ b/proto/gen/api/v1/resource_service_grpc.pb.go
@@ -25,6 +25,7 @@ const (
ResourceService_ListResources_FullMethodName = "/memos.api.v1.ResourceService/ListResources"
ResourceService_SearchResources_FullMethodName = "/memos.api.v1.ResourceService/SearchResources"
ResourceService_GetResource_FullMethodName = "/memos.api.v1.ResourceService/GetResource"
+ ResourceService_GetResourceByUid_FullMethodName = "/memos.api.v1.ResourceService/GetResourceByUid"
ResourceService_GetResourceBinary_FullMethodName = "/memos.api.v1.ResourceService/GetResourceBinary"
ResourceService_UpdateResource_FullMethodName = "/memos.api.v1.ResourceService/UpdateResource"
ResourceService_DeleteResource_FullMethodName = "/memos.api.v1.ResourceService/DeleteResource"
@@ -42,6 +43,8 @@ type ResourceServiceClient interface {
SearchResources(ctx context.Context, in *SearchResourcesRequest, opts ...grpc.CallOption) (*SearchResourcesResponse, error)
// GetResource returns a resource by name.
GetResource(ctx context.Context, in *GetResourceRequest, opts ...grpc.CallOption) (*Resource, error)
+ // GetResourceByUid returns a resource by uid.
+ GetResourceByUid(ctx context.Context, in *GetResourceByUidRequest, opts ...grpc.CallOption) (*Resource, error)
// GetResourceBinary returns a resource binary by name.
GetResourceBinary(ctx context.Context, in *GetResourceBinaryRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
// UpdateResource updates a resource.
@@ -98,6 +101,16 @@ func (c *resourceServiceClient) GetResource(ctx context.Context, in *GetResource
return out, nil
}
+func (c *resourceServiceClient) GetResourceByUid(ctx context.Context, in *GetResourceByUidRequest, opts ...grpc.CallOption) (*Resource, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(Resource)
+ err := c.cc.Invoke(ctx, ResourceService_GetResourceByUid_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *resourceServiceClient) GetResourceBinary(ctx context.Context, in *GetResourceBinaryRequest, opts ...grpc.CallOption) (*httpbody.HttpBody, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(httpbody.HttpBody)
@@ -140,6 +153,8 @@ type ResourceServiceServer interface {
SearchResources(context.Context, *SearchResourcesRequest) (*SearchResourcesResponse, error)
// GetResource returns a resource by name.
GetResource(context.Context, *GetResourceRequest) (*Resource, error)
+ // GetResourceByUid returns a resource by uid.
+ GetResourceByUid(context.Context, *GetResourceByUidRequest) (*Resource, error)
// GetResourceBinary returns a resource binary by name.
GetResourceBinary(context.Context, *GetResourceBinaryRequest) (*httpbody.HttpBody, error)
// UpdateResource updates a resource.
@@ -165,6 +180,9 @@ func (UnimplementedResourceServiceServer) SearchResources(context.Context, *Sear
func (UnimplementedResourceServiceServer) GetResource(context.Context, *GetResourceRequest) (*Resource, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetResource not implemented")
}
+func (UnimplementedResourceServiceServer) GetResourceByUid(context.Context, *GetResourceByUidRequest) (*Resource, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetResourceByUid not implemented")
+}
func (UnimplementedResourceServiceServer) GetResourceBinary(context.Context, *GetResourceBinaryRequest) (*httpbody.HttpBody, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetResourceBinary not implemented")
}
@@ -259,6 +277,24 @@ func _ResourceService_GetResource_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
+func _ResourceService_GetResourceByUid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetResourceByUidRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ResourceServiceServer).GetResourceByUid(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: ResourceService_GetResourceByUid_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ResourceServiceServer).GetResourceByUid(ctx, req.(*GetResourceByUidRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _ResourceService_GetResourceBinary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetResourceBinaryRequest)
if err := dec(in); err != nil {
@@ -336,6 +372,10 @@ var ResourceService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetResource",
Handler: _ResourceService_GetResource_Handler,
},
+ {
+ MethodName: "GetResourceByUid",
+ Handler: _ResourceService_GetResourceByUid_Handler,
+ },
{
MethodName: "GetResourceBinary",
Handler: _ResourceService_GetResourceBinary_Handler,
diff --git a/server/router/api/v1/resource_service.go b/server/router/api/v1/resource_service.go
index 19e6c6f8..52850f82 100644
--- a/server/router/api/v1/resource_service.go
+++ b/server/router/api/v1/resource_service.go
@@ -111,8 +111,8 @@ func (s *APIV1Service) SearchResources(ctx context.Context, request *v1pb.Search
return nil, status.Errorf(codes.InvalidArgument, "failed to parse filter: %v", err)
}
resourceFind := &store.FindResource{}
- if filter.UID != nil {
- resourceFind.UID = filter.UID
+ if filter.Filename != nil {
+ resourceFind.FilenameSearch = filter.Filename
}
user, err := s.GetCurrentUser(ctx)
if err != nil {
@@ -145,7 +145,19 @@ func (s *APIV1Service) GetResource(ctx context.Context, request *v1pb.GetResourc
if resource == nil {
return nil, status.Errorf(codes.NotFound, "resource not found")
}
+ return s.convertResourceFromStore(ctx, resource), nil
+}
+func (s *APIV1Service) GetResourceByUid(ctx context.Context, request *v1pb.GetResourceByUidRequest) (*v1pb.Resource, error) {
+ resource, err := s.Store.GetResource(ctx, &store.FindResource{
+ UID: &request.Uid,
+ })
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to get resource: %v", err)
+ }
+ if resource == nil {
+ return nil, status.Errorf(codes.NotFound, "resource not found")
+ }
return s.convertResourceFromStore(ctx, resource), nil
}
@@ -427,11 +439,11 @@ func replaceFilenameWithPathTemplate(path, filename string) string {
// SearchResourcesFilterCELAttributes are the CEL attributes for SearchResourcesFilter.
var SearchResourcesFilterCELAttributes = []cel.EnvOption{
- cel.Variable("uid", cel.StringType),
+ cel.Variable("filename", cel.StringType),
}
type SearchResourcesFilter struct {
- UID *string
+ Filename *string
}
func parseSearchResourcesFilter(expression string) (*SearchResourcesFilter, error) {
@@ -457,9 +469,9 @@ func findSearchResourcesField(callExpr *expr.Expr_Call, filter *SearchResourcesF
if len(callExpr.Args) == 2 {
idExpr := callExpr.Args[0].GetIdentExpr()
if idExpr != nil {
- if idExpr.Name == "uid" {
- uid := callExpr.Args[1].GetConstExpr().GetStringValue()
- filter.UID = &uid
+ if idExpr.Name == "filename" {
+ filename := callExpr.Args[1].GetConstExpr().GetStringValue()
+ filter.Filename = &filename
}
return
}
diff --git a/store/db/mysql/resource.go b/store/db/mysql/resource.go
index 689e846f..00486013 100644
--- a/store/db/mysql/resource.go
+++ b/store/db/mysql/resource.go
@@ -60,6 +60,9 @@ func (d *DB) ListResources(ctx context.Context, find *store.FindResource) ([]*st
if v := find.Filename; v != nil {
where, args = append(where, "`filename` = ?"), append(args, *v)
}
+ if v := find.FilenameSearch; v != nil {
+ where, args = append(where, "`filename` LIKE ?"), append(args, "%"+*v+"%")
+ }
if v := find.MemoID; v != nil {
where, args = append(where, "`memo_id` = ?"), append(args, *v)
}
diff --git a/store/db/postgres/resource.go b/store/db/postgres/resource.go
index ae38eddf..e577b7ae 100644
--- a/store/db/postgres/resource.go
+++ b/store/db/postgres/resource.go
@@ -51,6 +51,9 @@ func (d *DB) ListResources(ctx context.Context, find *store.FindResource) ([]*st
if v := find.Filename; v != nil {
where, args = append(where, "filename = "+placeholder(len(args)+1)), append(args, *v)
}
+ if v := find.FilenameSearch; v != nil {
+ where, args = append(where, "filename LIKE "+placeholder(len(args)+1)), append(args, fmt.Sprintf("%%%s%%", *v))
+ }
if v := find.MemoID; v != nil {
where, args = append(where, "memo_id = "+placeholder(len(args)+1)), append(args, *v)
}
diff --git a/store/db/sqlite/resource.go b/store/db/sqlite/resource.go
index 20507a80..6e16f28b 100644
--- a/store/db/sqlite/resource.go
+++ b/store/db/sqlite/resource.go
@@ -53,6 +53,9 @@ func (d *DB) ListResources(ctx context.Context, find *store.FindResource) ([]*st
if v := find.Filename; v != nil {
where, args = append(where, "`filename` = ?"), append(args, *v)
}
+ if v := find.FilenameSearch; v != nil {
+ where, args = append(where, "`filename` LIKE ?"), append(args, fmt.Sprintf("%%%s%%", *v))
+ }
if v := find.MemoID; v != nil {
where, args = append(where, "`memo_id` = ?"), append(args, *v)
}
diff --git a/store/resource.go b/store/resource.go
index c269394d..a8c5a7dc 100644
--- a/store/resource.go
+++ b/store/resource.go
@@ -43,6 +43,7 @@ type FindResource struct {
UID *string
CreatorID *int32
Filename *string
+ FilenameSearch *string
MemoID *int32
HasRelatedMemo bool
StorageType *storepb.ResourceStorageType
diff --git a/web/src/components/MemoContent/EmbeddedContent/EmbeddedResource.tsx b/web/src/components/MemoContent/EmbeddedContent/EmbeddedResource.tsx
index 82586e50..71b6139c 100644
--- a/web/src/components/MemoContent/EmbeddedContent/EmbeddedResource.tsx
+++ b/web/src/components/MemoContent/EmbeddedContent/EmbeddedResource.tsx
@@ -35,21 +35,21 @@ const getAdditionalClassNameWithParams = (params: URLSearchParams) => {
return additionalClassNames.join(" ");
};
-const EmbeddedResource = ({ resourceId, params: paramsStr }: Props) => {
+const EmbeddedResource = ({ resourceId: uid, params: paramsStr }: Props) => {
const loadingState = useLoading();
const resourceStore = useResourceStore();
- const resource = resourceStore.getResourceByName(resourceId);
+ const resource = resourceStore.getResourceByName(uid);
const params = new URLSearchParams(paramsStr);
useEffect(() => {
- resourceStore.searchResources(`uid == ${resourceId}`).finally(() => loadingState.setFinish());
- }, [resourceId]);
+ resourceStore.fetchResourceByUID(uid).finally(() => loadingState.setFinish());
+ }, [uid]);
if (loadingState.isLoading) {
return null;
}
if (!resource) {
- return ;
+ return ;
}
return (
diff --git a/web/src/store/v1/resource.ts b/web/src/store/v1/resource.ts
index e0378cbd..89e194f4 100644
--- a/web/src/store/v1/resource.ts
+++ b/web/src/store/v1/resource.ts
@@ -26,6 +26,15 @@ export const useResourceStore = create(
set({ resourceMapByName: resourceMap });
return resources;
},
+ fetchResourceByUID: async (uid: string) => {
+ const resource = await resourceServiceClient.getResourceByUid({
+ uid,
+ });
+ const resourceMap = get().resourceMapByName;
+ resourceMap[resource.name] = resource;
+ set({ resourceMapByName: resourceMap });
+ return resource;
+ },
getResourceByName: (name: string) => {
const resourceMap = get().resourceMapByName;
return Object.values(resourceMap).find((r) => r.name === name);