Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: migrate bookmark to v1 (#6618)
ecmadao07a962cebcbe
diff --git a/backend/api/v1/bookmark_service.go b/backend/api/v1/bookmark_service.goindex 8c646c0452..b1530267d6 100644--- a/backend/api/v1/bookmark_service.go+++ b/backend/api/v1/bookmark_service.go@@ -30,44 +30,29 @@ func NewBookmarkService(store *store.Store) *BookmarkService {// CreateBookmark creates a new bookmark.func (s *BookmarkService) CreateBookmark(ctx context.Context, request *v1pb.CreateBookmarkRequest) (*v1pb.Bookmark, error) {currentPincipalUID := ctx.Value(common.PrincipalIDContextKey).(int)- princialUID, err := getUserID(request.Parent)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, "Invalid parent: %v", err)- }- if princialUID != currentPincipalUID {- return nil, status.Errorf(codes.PermissionDenied, "Permission denied")- }if request.Bookmark == nil {return nil, status.Errorf(codes.InvalidArgument, "Missing bookmark")}- bookmark, err := s.store.CreateBookmarkV2(ctx, convertToStoreBookmark(request.Bookmark), princialUID)+ bookmark, err := s.store.CreateBookmarkV2(ctx, convertToStoreBookmark(request.Bookmark), currentPincipalUID)if err != nil {return nil, status.Errorf(codes.Internal, "Failed to create bookmark: %v", err)}- return convertToAPIBookmark(bookmark, princialUID), nil+ return convertToAPIBookmark(bookmark), nil}// ListBookmarks lists bookmarks.-func (s *BookmarkService) ListBookmarks(ctx context.Context, request *v1pb.ListBookmarksRequest) (*v1pb.ListBookmarksResponse, error) {+func (s *BookmarkService) ListBookmarks(ctx context.Context, _ *v1pb.ListBookmarksRequest) (*v1pb.ListBookmarksResponse, error) {currentPincipalUID := ctx.Value(common.PrincipalIDContextKey).(int)- princialUID, err := getUserID(request.Parent)- if err != nil {- return nil, status.Errorf(codes.InvalidArgument, "Invalid parent: %v", err)- }- if princialUID != currentPincipalUID {- return nil, status.Errorf(codes.PermissionDenied, "Permission denied")- }-- bookmarkList, err := s.store.ListBookmarkV2(ctx, princialUID)+ bookmarkList, err := s.store.ListBookmarkV2(ctx, currentPincipalUID)if err != nil {return nil, status.Errorf(codes.Internal, "Failed to list bookmarks: %v", err)}var bookmarks []*v1pb.Bookmarkfor _, bookmark := range bookmarkList {- bookmarks = append(bookmarks, convertToAPIBookmark(bookmark, princialUID))+ bookmarks = append(bookmarks, convertToAPIBookmark(bookmark))}return &v1pb.ListBookmarksResponse{@@ -78,15 +63,15 @@ func (s *BookmarkService) ListBookmarks(ctx context.Context, request *v1pb.ListB// DeleteBookmark deletes a bookmark.func (s *BookmarkService) DeleteBookmark(ctx context.Context, request *v1pb.DeleteBookmarkRequest) (*emptypb.Empty, error) {currentPincipalUID := ctx.Value(common.PrincipalIDContextKey).(int)- principalUID, bookmarkUID, err := getUserBookmarkID(request.Name)+ bookmarkUID, err := getBookmarkID(request.Name)if err != nil {return nil, status.Errorf(codes.InvalidArgument, "Invalid book mark name: %v", err)}- if principalUID != currentPincipalUID {- return nil, status.Errorf(codes.PermissionDenied, "Permission denied")- }- if err := s.store.DeleteBookmarkV2(ctx, bookmarkUID); err != nil {+ if err := s.store.DeleteBookmarkV2(ctx, &store.DeleteBookmarkMessage{+ UID: bookmarkUID,+ CreatorUID: currentPincipalUID,+ }); err != nil {if common.ErrorCode(err) == common.NotFound {return nil, status.Errorf(codes.NotFound, "Bookmark not found: %v", err)}@@ -103,9 +88,9 @@ func convertToStoreBookmark(request *v1pb.Bookmark) *store.BookmarkMessage {}}-func convertToAPIBookmark(bookmark *store.BookmarkMessage, principalUID int) *v1pb.Bookmark {+func convertToAPIBookmark(bookmark *store.BookmarkMessage) *v1pb.Bookmark {return &v1pb.Bookmark{- Name: fmt.Sprintf("%s%d/%s%d", userNamePrefix, principalUID, bookmarkPrefix, bookmark.ID),+ Name: fmt.Sprintf("%s%d", bookmarkPrefix, bookmark.UID),Title: bookmark.Name,Link: bookmark.Link,}diff --git a/backend/api/v1/common.go b/backend/api/v1/common.goindex 8429ee69bb..ed9171f0ad 100644--- a/backend/api/v1/common.go+++ b/backend/api/v1/common.go@@ -230,32 +230,12 @@ func getIdentityProviderID(name string) (string, error) {return tokens[0], nil}-func getUserBookmarkID(name string) (int, int, error) {- tokens, err := getNameParentTokens(name, userNamePrefix, bookmarkPrefix)- if err != nil {- return 0, 0, err- }- userID, err := strconv.Atoi(tokens[0])- if err != nil {- return 0, 0, errors.Errorf("invalid user ID %q", tokens[0])- }- bookmarkID, err := strconv.Atoi(tokens[1])- if err != nil {- return 0, 0, errors.Errorf("invalid bookmark ID %q", tokens[1])- }- return userID, bookmarkID, nil+func getBookmarkID(name string) (int, error) {+ return getUIDFromName(name, bookmarkPrefix)}func getExternalVersionControlID(name string) (int, error) {- tokens, err := getNameParentTokens(name, externalVersionControlPrefix)- if err != nil {- return 0, err- }- externalVersionControlID, err := strconv.Atoi(tokens[0])- if err != nil {- return 0, errors.Errorf("invalid external version control ID %q", tokens[0])- }- return externalVersionControlID, nil+ return getUIDFromName(name, externalVersionControlPrefix)}func getRiskID(name string) (int64, error) {diff --git a/backend/server/acl.go b/backend/server/acl.goindex eafaaed344..0bb079241f 100644--- a/backend/server/acl.go+++ b/backend/server/acl.go@@ -288,13 +288,6 @@ func isGettingSelf(_ context.Context, c echo.Context, _ *Server, curPrincipalIDreturn false, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("User ID is not a number: %s", c.Param("userID"))).SetInternal(err)}- return userID == curPrincipalID, nil- } else if strings.HasPrefix(path, "/bookmark/user") {- userID, err := strconv.Atoi(c.Param("userID"))- if err != nil {- return false, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("User ID is not a number: %s", c.Param("userID"))).SetInternal(err)- }-return userID == curPrincipalID, nil}@@ -325,23 +318,6 @@ func isUpdatingSelf(ctx context.Context, c echo.Context, s *Server, curPrincipalreturn activity.CreatorID == curPrincipalID, nil}- } else if strings.HasPrefix(path, "/bookmark") {- if bookmarkIDStr := c.Param("bookmarkID"); bookmarkIDStr != "" {- bookmarkID, err := strconv.Atoi(bookmarkIDStr)- if err != nil {- return false, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Bookmark ID is not a number: %s"+bookmarkIDStr)).SetInternal(err)- }-- bookmark, err := s.store.GetBookmarkV2(ctx, bookmarkID)- if err != nil {- return false, echo.NewHTTPError(http.StatusInternalServerError, defaultErrMsg).SetInternal(err)- }- if bookmark == nil {- return false, echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Bookmark ID not found: %d", bookmarkID)).SetInternal(err)- }-- return bookmark.CreatorUID == curPrincipalID, nil- }} else if strings.HasPrefix(path, "/inbox") {if inboxIDStr := c.Param("inboxID"); inboxIDStr != "" {inboxID, err := strconv.Atoi(inboxIDStr)diff --git a/backend/server/acl_casbin_policy_dba.csv b/backend/server/acl_casbin_policy_dba.csvindex ef9660d6f6..c5934559ef 100644--- a/backend/server/acl_casbin_policy_dba.csv+++ b/backend/server/acl_casbin_policy_dba.csv@@ -78,9 +78,6 @@ p, DBA, /activity/{activityID}, PATCH_SELFp, DBA, /inbox/user/{userID}, GET_SELFp, DBA, /inbox/user/{userID}/summary, GET_SELFp, DBA, /inbox/{inboxID}, PATCH_SELF-p, DBA, /bookmark, POST-p, DBA, /bookmark/user/{userID}, GET_SELF-p, DBA, /bookmark/{bookmarkID}, DELETE_SELFp, DBA, /pipeline/{pipelineID}/stage/{stageID}/status, PATCHp, DBA, /pipeline/{pipelineID}/task/all, PATCHp, DBA, /pipeline/{pipelineID}/task/{taskID}, PATCHdiff --git a/backend/server/acl_casbin_policy_developer.csv b/backend/server/acl_casbin_policy_developer.csvindex f792e7efc5..09146a6c7e 100644--- a/backend/server/acl_casbin_policy_developer.csv+++ b/backend/server/acl_casbin_policy_developer.csv@@ -66,9 +66,6 @@ p, DEVELOPER, /activity/{activityID}, PATCH_SELFp, DEVELOPER, /inbox/user/{userID}, GET_SELFp, DEVELOPER, /inbox/user/{userID}/summary, GET_SELFp, DEVELOPER, /inbox/{inboxID}, PATCH_SELF-p, DEVELOPER, /bookmark, POST-p, DEVELOPER, /bookmark/user/{userID}, GET_SELF-p, DEVELOPER, /bookmark/{bookmarkID}, DELETE_SELFp, DEVELOPER, /pipeline/{pipelineID}/stage/{stageID}/status, PATCHp, DEVELOPER, /pipeline/{pipelineID}/task/all, PATCHp, DEVELOPER, /pipeline/{pipelineID}/task/{taskID}, PATCHdiff --git a/backend/server/acl_casbin_policy_owner.csv b/backend/server/acl_casbin_policy_owner.csvindex f8596053d8..b1db06cf1b 100644--- a/backend/server/acl_casbin_policy_owner.csv+++ b/backend/server/acl_casbin_policy_owner.csv@@ -81,9 +81,6 @@ p, OWNER, /activity/{activityID}, PATCH_SELFp, OWNER, /inbox/user/{userID}, GET_SELFp, OWNER, /inbox/user/{userID}/summary, GET_SELFp, OWNER, /inbox/{inboxID}, PATCH_SELF-p, OWNER, /bookmark, POST-p, OWNER, /bookmark/user/{userID}, GET_SELF-p, OWNER, /bookmark/{bookmarkID}, DELETE_SELFp, OWNER, /pipeline/{pipelineID}/stage/{stageID}/status, PATCHp, OWNER, /pipeline/{pipelineID}/task/all, PATCHp, OWNER, /pipeline/{pipelineID}/task/{taskID}, PATCHdiff --git a/backend/server/bookmark.go b/backend/server/bookmark.godeleted file mode 100644index 473b5edd8d..0000000000--- a/backend/server/bookmark.go+++ /dev/null@@ -1,84 +0,0 @@-package server--import (- "fmt"- "net/http"- "strconv"-- "github.com/google/jsonapi"- "github.com/labstack/echo/v4"-- "github.com/bytebase/bytebase/backend/common"- api "github.com/bytebase/bytebase/backend/legacyapi"- "github.com/bytebase/bytebase/backend/store"-)--func (s *Server) registerBookmarkRoutes(g *echo.Group) {- g.POST("/bookmark", func(c echo.Context) error {- ctx := c.Request().Context()- bookmarkCreate := &api.BookmarkCreate{}- if err := jsonapi.UnmarshalPayload(c.Request().Body, bookmarkCreate); err != nil {- return echo.NewHTTPError(http.StatusBadRequest, "Malformed create bookmark request").SetInternal(err)- }-- bookmark, err := s.store.CreateBookmarkV2(ctx, &store.BookmarkMessage{- Name: bookmarkCreate.Name,- Link: bookmarkCreate.Link,- }, c.Get(getPrincipalIDContextKey()).(int))- if err != nil {- if common.ErrorCode(err) == common.Conflict {- return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Bookmark already exists: %s", bookmarkCreate.Link))- }- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create bookmark").SetInternal(err)- }-- c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, bookmark.ToAPIBookmark()); err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create bookmark response").SetInternal(err)- }- return nil- })-- g.GET("/bookmark/user/:userID", func(c echo.Context) error {- ctx := c.Request().Context()- userID, err := strconv.Atoi(c.Param("userID"))- if err != nil {- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("User ID is not a number: %s", c.Param("userID"))).SetInternal(err)- }-- bookmarkList, err := s.store.ListBookmarkV2(ctx, userID)- if err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch bookmark list").SetInternal(err)- }-- var apiBookmarks []*api.Bookmark- for _, bookmark := range bookmarkList {- apiBookmarks = append(apiBookmarks, bookmark.ToAPIBookmark())- }-- c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, apiBookmarks); err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal bookmark list response").SetInternal(err)- }- return nil- })-- g.DELETE("/bookmark/:bookmarkID", func(c echo.Context) error {- ctx := c.Request().Context()- id, err := strconv.Atoi(c.Param("bookmarkID"))- if err != nil {- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("bookmarkID"))).SetInternal(err)- }-- if err := s.store.DeleteBookmarkV2(ctx, id); err != nil {- if common.ErrorCode(err) == common.NotFound {- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Bookmark ID not found: %d", id))- }- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete bookmark ID: %v", id)).SetInternal(err)- }-- c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- c.Response().WriteHeader(http.StatusOK)- return nil- })-}diff --git a/backend/server/server.go b/backend/server/server.goindex f76f121f8c..2932e1dc81 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -518,7 +518,6 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {s.registerStageRoutes(apiGroup)s.registerActivityRoutes(apiGroup)s.registerInboxRoutes(apiGroup)- s.registerBookmarkRoutes(apiGroup)s.registerSQLRoutes(apiGroup)s.registerAnomalyRoutes(apiGroup)@@ -602,6 +601,7 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {v1pb.RegisterSheetServiceServer(s.grpcServer, v1.NewSheetService(s.store))v1pb.RegisterCelServiceServer(s.grpcServer, v1.NewCelService())v1pb.RegisterLoggingServiceServer(s.grpcServer, v1.NewLoggingService(s.store))+ v1pb.RegisterBookmarkServiceServer(s.grpcServer, v1.NewBookmarkService(s.store))reflection.Register(s.grpcServer)// REST gateway proxy.@@ -665,6 +665,9 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {if err := v1pb.RegisterLoggingServiceHandler(ctx, mux, grpcConn); err != nil {return nil, err}+ if err := v1pb.RegisterBookmarkServiceHandler(ctx, mux, grpcConn); err != nil {+ return nil, err+ }e.Any("/v1/*", echo.WrapHandler(mux))// GRPC web proxy.options := []grpcweb.Option{diff --git a/backend/store/bookmark.go b/backend/store/bookmark.goindex e0f5d02aee..2aad6eb0bc 100644--- a/backend/store/bookmark.go+++ b/backend/store/bookmark.go@@ -9,7 +9,6 @@ import ("github.com/pkg/errors""github.com/bytebase/bytebase/backend/common"- api "github.com/bytebase/bytebase/backend/legacyapi")// BookmarkMessage is the message for bookmark.@@ -22,28 +21,19 @@ type BookmarkMessage struct {// Output only fields.//- // ID is the unique ID of the bookmark.- ID int+ // UID is the unique ID of the bookmark.+ UID int// CreatorUID is the unique ID of the creator.CreatorUID int}-// listBookmarkMessage is the message for listing bookmarks.-type listBookmarkMessage struct {- // id is the unique ID of the bookmark.- id *int- // creatorUID is the unique ID of the creator.- creatorUID *int-}+// DeleteBookmarkMessage is the message to delete a bookmark.+type DeleteBookmarkMessage struct {+ // UID is the unique ID of the bookmark.+ UID int-// ToAPIBookmark converts a BookmarkMessage to an API Bookmark.-func (b *BookmarkMessage) ToAPIBookmark() *api.Bookmark {- return &api.Bookmark{- ID: b.ID,- CreatorID: b.CreatorUID,- Name: b.Name,- Link: b.Link,- }+ // CreatorUID is the unique ID of the creator.+ CreatorUID int}// CreateBookmarkV2 creates a new bookmark.@@ -72,7 +62,7 @@ func (s *Store) CreateBookmarkV2(ctx context.Context, create *BookmarkMessage, pcreate.Name,create.Link,).Scan(- &bookmark.ID,+ &bookmark.UID,&bookmark.Name,&bookmark.CreatorUID,&bookmark.Link,@@ -97,7 +87,7 @@ func (s *Store) ListBookmarkV2(ctx context.Context, principalUID int) ([]*Bookmareturn nil, errors.Wrapf(err, "failed to begin transaction")}- bookmarks, err := s.listBookmarkImplV2(ctx, tx, &listBookmarkMessage{creatorUID: &principalUID})+ bookmarks, err := s.listBookmarkImplV2(ctx, tx, principalUID)if err != nil {return nil, errors.Wrapf(err, "failed to list bookmarks")}@@ -109,36 +99,12 @@ func (s *Store) ListBookmarkV2(ctx context.Context, principalUID int) ([]*Bookmareturn bookmarks, nil}-// GetBookmarkV2 gets a bookmark by ID.-func (s *Store) GetBookmarkV2(ctx context.Context, bookmarkUID int) (*BookmarkMessage, error) {- tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})- if err != nil {- return nil, errors.Wrapf(err, "failed to begin transaction")- }- defer tx.Rollback()-- bookmarks, err := s.listBookmarkImplV2(ctx, tx, &listBookmarkMessage{id: &bookmarkUID})- if err != nil {- return nil, err- }- if len(bookmarks) == 0 {- return nil, nil- }- if len(bookmarks) > 1 {- return nil, errors.Errorf("find %d bookmarks for bookmark ID %d", len(bookmarks), bookmarkUID)- }-- if err := tx.Commit(); err != nil {- return nil, errors.Wrapf(err, "failed to commit transaction")- }- return bookmarks[0], nil-}-// DeleteBookmarkV2 try to delete a bookmark.-func (s *Store) DeleteBookmarkV2(ctx context.Context, bookmarkUID int) error {+func (s *Store) DeleteBookmarkV2(ctx context.Context, delete *DeleteBookmarkMessage) error {var args []anyvar where []string- where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, bookmarkUID)+ where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, delete.UID)+ where, args = append(where, fmt.Sprintf("creator_id = $%d", len(args)+1)), append(args, delete.CreatorUID)query := fmt.Sprintf(`DELETE FROM bookmark WHERE %s@@ -152,11 +118,11 @@ func (s *Store) DeleteBookmarkV2(ctx context.Context, bookmarkUID int) error {result, err := tx.ExecContext(ctx, query, args...)if err != nil {- return errors.Wrapf(err, "failed to delete bookmark of principal id %d", bookmarkUID)+ return errors.Wrapf(err, "failed to delete bookmark %v", delete)}rows, _ := result.RowsAffected()if rows == 0 {- return &common.Error{Code: common.NotFound, Err: errors.Errorf("bookmark ID not found: %d", bookmarkUID)}+ return &common.Error{Code: common.NotFound, Err: errors.Errorf("bookmark not found: %v", delete)}}if err := tx.Commit(); err != nil {@@ -166,14 +132,9 @@ func (s *Store) DeleteBookmarkV2(ctx context.Context, bookmarkUID int) error {return nil}-func (*Store) listBookmarkImplV2(ctx context.Context, tx *Tx, list *listBookmarkMessage) ([]*BookmarkMessage, error) {+func (*Store) listBookmarkImplV2(ctx context.Context, tx *Tx, creatorUID int) ([]*BookmarkMessage, error) {where, args := []string{"TRUE"}, []any{}- if v := list.creatorUID; v != nil {- where, args = append(where, fmt.Sprintf("creator_id = $%d", len(args)+1)), append(args, *v)- }- if v := list.id; v != nil {- where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v)- }+ where, args = append(where, fmt.Sprintf("creator_id = $%d", len(args)+1)), append(args, creatorUID)query := fmt.Sprintf(`SELECT@@ -186,7 +147,7 @@ func (*Store) listBookmarkImplV2(ctx context.Context, tx *Tx, list *listBookmarkrows, err := tx.QueryContext(ctx, query, args...)if err != nil {- return nil, errors.Wrapf(err, "failed to query bookmark of %v", list)+ return nil, errors.Wrapf(err, "failed to query bookmark for user %v", creatorUID)}defer rows.Close()@@ -195,18 +156,18 @@ func (*Store) listBookmarkImplV2(ctx context.Context, tx *Tx, list *listBookmarkfor rows.Next() {var bookmark BookmarkMessageif err := rows.Scan(- &bookmark.ID,+ &bookmark.UID,&bookmark.CreatorUID,&bookmark.Name,&bookmark.Link,); err != nil {- return nil, errors.Wrapf(err, "failed to scan bookmark of %v", list)+ return nil, errors.Wrapf(err, "failed to scan bookmark for user %v", creatorUID)}bookmarks = append(bookmarks, &bookmark)}if err := rows.Err(); err != nil {- return nil, errors.Wrapf(err, "failed to iterate bookmark of %v", list)+ return nil, errors.Wrapf(err, "failed to iterate bookmark for user %v", creatorUID)}return bookmarks, nildiff --git a/frontend/src/components/BookmarkListSidePanel.vue b/frontend/src/components/BookmarkListSidePanel.vueindex c0db3cef83..5a85a3b274 100644--- a/frontend/src/components/BookmarkListSidePanel.vue+++ b/frontend/src/components/BookmarkListSidePanel.vue@@ -4,7 +4,7 @@:title="$t('common.bookmarks')":item-list="bookmarkList.map((item) => {- return { id: item.id.toString(), name: item.name, link: item.link };+ return { id: item.name, name: item.title, link: item.link };})":allow-delete="true"@@ -13,61 +13,50 @@/></template>-<script lang="ts">-import { computed, defineComponent, watchEffect } from "vue";+<script lang="ts" setup>+import { computed, watchEffect } from "vue";import { UNKNOWN_ID } from "../types";import { Action, defineAction, useRegisterActions } from "@bytebase/vue-kbar";import { useRouter } from "vue-router";import { useI18n } from "vue-i18n";-import { useBookmarkStore, useCurrentUser } from "@/store";--export default defineComponent({- name: "BookmarkListSidePanel",- setup() {- const { t } = useI18n();- const router = useRouter();- const bookmarkStore = useBookmarkStore();-- const currentUser = useCurrentUser();-- const prepareBookmarkList = () => {- // It will also be called when user logout- if (currentUser.value.id != UNKNOWN_ID) {- bookmarkStore.fetchBookmarkListByUser(currentUser.value.id);- }- };-- watchEffect(prepareBookmarkList);-- const bookmarkList = computed(() =>- bookmarkStore.bookmarkListByUser(currentUser.value.id)- );-- const deleteIndex = (index: number) => {- bookmarkStore.deleteBookmark(bookmarkList.value[index]);- };-- const kbarActions = computed((): Action[] => {- const actions = bookmarkList.value.map((item: any) =>- defineAction({- // here `id` looks like "bb.bookmark.12345"- id: `bb.bookmark.${item.id}`,- section: t("common.bookmarks"),- name: item.name,- keywords: "bookmark",- perform: () => {- router.push({ path: item.link });- },- })- );- return actions;- });- useRegisterActions(kbarActions);-- return {- bookmarkList,- deleteIndex,- };- },+import { useBookmarkV1Store, useCurrentUser } from "@/store";+import { Bookmark } from "@/types/proto/v1/bookmark_service";++const { t } = useI18n();+const router = useRouter();+const bookmarkV1Store = useBookmarkV1Store();++const currentUser = useCurrentUser();++const prepareBookmarkList = async () => {+ // It will also be called when user logout+ if (currentUser.value.id != UNKNOWN_ID) {+ await bookmarkV1Store.fetchBookmarkList();+ }+};++watchEffect(prepareBookmarkList);++const bookmarkList = computed(() => bookmarkV1Store.getBookmarkList());++const deleteIndex = (index: number) => {+ bookmarkV1Store.deleteBookmark(bookmarkList.value[index].name);+};++const kbarActions = computed((): Action[] => {+ const actions = bookmarkList.value.map((item: Bookmark) =>+ defineAction({+ // here `id` looks like "bb.bookmark.12345"+ id: `bb.bookmark.${item.name}`,+ section: t("common.bookmarks"),+ name: item.title,+ keywords: "bookmark",+ perform: () => {+ router.push({ path: item.link });+ },+ })+ );+ return actions;});+useRegisterActions(kbarActions);</script>diff --git a/frontend/src/components/Breadcrumb.vue b/frontend/src/components/Breadcrumb.vueindex fd7c8e2fc3..15e5295c22 100644--- a/frontend/src/components/Breadcrumb.vue+++ b/frontend/src/components/Breadcrumb.vue@@ -66,16 +66,16 @@ import { useRouter } from "vue-router";import { useI18n } from "vue-i18n";import { useTitle } from "@vueuse/core";-import { Bookmark, UNKNOWN_ID, BookmarkCreate, RouteMapList } from "../types";+import { RouteMapList } from "../types";import { databaseV1Slug, idFromSlug } from "../utils";import {- useCurrentUser,useRouterStore,- useBookmarkStore,+ useBookmarkV1Store,useProjectV1Store,useDatabaseV1Store,} from "@/store";import HelpTriggerIcon from "@/components/HelpTriggerIcon.vue";+import { Bookmark } from "@/types/proto/v1/bookmark_service";interface BreadcrumbItem {name: string;@@ -92,9 +92,8 @@ export default defineComponent({const routerStore = useRouterStore();const currentRoute = useRouter().currentRoute;const { t } = useI18n();- const bookmarkStore = useBookmarkStore();+ const bookmarkV1Store = useBookmarkV1Store();- const currentUser = useCurrentUser();const projectV1Store = useProjectV1Store();const documentTitle = useTitle(null, { observe: true });@@ -112,16 +111,11 @@ export default defineComponent({routeHelpNameMapList.value = await res.json();});- const bookmark: ComputedRef<Bookmark> = computed(() =>- bookmarkStore.bookmarkByUserAndLink(- currentUser.value.id,- currentRoute.value.path- )+ const bookmark: ComputedRef<Bookmark | undefined> = computed(() =>+ bookmarkV1Store.findBookmarkByLink(currentRoute.value.path));- const isBookmarked: ComputedRef<boolean> = computed(- () => bookmark.value.id != UNKNOWN_ID- );+ const isBookmarked: ComputedRef<boolean> = computed(() => !!bookmark.value);const allowBookmark = computed(() => currentRoute.value.meta.allowBookmark);@@ -260,14 +254,13 @@ export default defineComponent({});const toggleBookmark = () => {- if (isBookmarked.value) {- bookmarkStore.deleteBookmark(bookmark.value);+ if (bookmark.value) {+ bookmarkV1Store.deleteBookmark(bookmark.value.name);} else {- const newBookmark: BookmarkCreate = {- name: breadcrumbList.value[breadcrumbList.value.length - 1].name,+ bookmarkV1Store.createBookmark({+ title: breadcrumbList.value[breadcrumbList.value.length - 1].name,link: currentRoute.value.path,- };- bookmarkStore.createBookmark(newBookmark);+ });}};diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.tsindex 46e863f841..48cecb1ecd 100644--- a/frontend/src/grpcweb/index.ts+++ b/frontend/src/grpcweb/index.ts@@ -26,6 +26,7 @@ import { SubscriptionServiceDefinition } from "@/types/proto/v1/subscription_serimport { ActuatorServiceDefinition } from "@/types/proto/v1/actuator_service";import { ExternalVersionControlServiceDefinition } from "@/types/proto/v1/externalvs_service";import { LoggingServiceDefinition } from "@/types/proto/v1/logging_service";+import { BookmarkServiceDefinition } from "@/types/proto/v1/bookmark_service";// Create each grpc service client.// Reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md@@ -148,6 +149,11 @@ export const loggingServiceClient = clientFactory.create(channel);+export const bookmarkServiceClient = clientFactory.create(+ BookmarkServiceDefinition,+ channel+);+// e.g. How to use `authServiceClient`?//// await authServiceClient.login({diff --git a/frontend/src/store/modules/bookmark.ts b/frontend/src/store/modules/bookmark.tsdeleted file mode 100644index 344ec6c27f..0000000000--- a/frontend/src/store/modules/bookmark.ts+++ /dev/null@@ -1,93 +0,0 @@-import { defineStore } from "pinia";-import axios from "axios";-import {- PrincipalId,- Bookmark,- BookmarkCreate,- BookmarkState,- ResourceObject,- unknown,-} from "@/types";--function convert(bookmark: ResourceObject): Bookmark {- return {- ...(bookmark.attributes as Omit<Bookmark, "id">),- id: parseInt(bookmark.id),- };-}--export const useBookmarkStore = defineStore("bookmark", {- state: (): BookmarkState => ({- bookmarkList: new Map(),- }),-- actions: {- async fetchBookmarkListByUser(userId: PrincipalId) {- // API only returns bookmark for the requesting user.- // User info is retrieved from the context.- const data = (await axios.get(`/api/bookmark/user/${userId}`)).data;- const bookmarkList = data.data.map((bookmark: ResourceObject) => {- return convert(bookmark);- });- this.setBookmarkListByPrincipalId({ userId, bookmarkList });- return bookmarkList;- },-- async createBookmark(newBookmark: BookmarkCreate) {- const data = (- await axios.post(`/api/bookmark`, {- data: {- type: "bookmark",- attributes: newBookmark,- },- })- ).data;- const createdBookmark = convert(data.data);- this.appendBookmark(createdBookmark);-- return createdBookmark;- },-- setBookmarkListByPrincipalId({- userId,- bookmarkList,- }: {- userId: PrincipalId;- bookmarkList: Bookmark[];- }) {- this.bookmarkList.set(userId, bookmarkList);- },-- appendBookmark(bookmark: Bookmark) {- const list = this.bookmarkList.get(bookmark.creatorID);- if (list) {- list.push(bookmark);- } else {- this.bookmarkList.set(bookmark.creatorID, [bookmark]);- }- },-- async deleteBookmark(bookmark: Bookmark) {- await axios.delete(`/api/bookmark/${bookmark.id}`);-- const list = this.bookmarkList.get(bookmark.creatorID);- if (list) {- const i = list.findIndex((item: Bookmark) => item.id == bookmark.id);- if (i != -1) {- list.splice(i, 1);- }- }- },-- bookmarkListByUser(userId: PrincipalId): Bookmark[] {- return this.bookmarkList.get(userId) || [];- },- bookmarkByUserAndLink(userId: PrincipalId, link: string): Bookmark {- const list = this.bookmarkListByUser(userId);- return (- list.find((item: Bookmark) => item.link == link) ||- (unknown("BOOKMARK") as Bookmark)- );- },- },-});diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.tsindex c97800f3cf..0dfb2e6fc3 100644--- a/frontend/src/store/modules/index.ts+++ b/frontend/src/store/modules/index.ts@@ -1,7 +1,6 @@export * from "./activity";export * from "./anomaly";export * from "./auth";-export * from "./bookmark";export * from "./command";export * from "./database";export * from "./dataSource";diff --git a/frontend/src/store/modules/v1/bookmark.ts b/frontend/src/store/modules/v1/bookmark.tsnew file mode 100644index 0000000000..7eca92083e--- /dev/null+++ b/frontend/src/store/modules/v1/bookmark.ts@@ -0,0 +1,58 @@+import { defineStore } from "pinia";+import { reactive } from "vue";++import { bookmarkServiceClient } from "@/grpcweb";+import { Bookmark } from "@/types/proto/v1/bookmark_service";++export const useBookmarkV1Store = defineStore("bookmark_v1", () => {+ const bookmarkList = reactive<Bookmark[]>([]);++ const fetchBookmarkList = async () => {+ const resp = await bookmarkServiceClient.listBookmarks({});+ for (const bookmark of resp.bookmarks) {+ bookmarkList.push(bookmark);+ }+ return bookmarkList;+ };++ const getBookmarkList = () => {+ return bookmarkList;+ };++ const createBookmark = async ({+ title,+ link,+ }: {+ title: string;+ link: string;+ }) => {+ const bookmark = await bookmarkServiceClient.createBookmark({+ bookmark: {+ title,+ link,+ },+ });+ bookmarkList.push(bookmark);+ return bookmark;+ };++ const deleteBookmark = async (name: string) => {+ await bookmarkServiceClient.deleteBookmark({+ name,+ });+ const index = bookmarkList.findIndex((b) => b.name === name);+ bookmarkList.splice(index, 1);+ };++ const findBookmarkByLink = (link: string) => {+ return bookmarkList.find((b) => b.link === link);+ };++ return {+ getBookmarkList,+ fetchBookmarkList,+ createBookmark,+ deleteBookmark,+ findBookmarkByLink,+ };+});diff --git a/frontend/src/store/modules/v1/index.ts b/frontend/src/store/modules/v1/index.tsindex 18b2b95b59..73a78e38ab 100644--- a/frontend/src/store/modules/v1/index.ts+++ b/frontend/src/store/modules/v1/index.ts@@ -18,3 +18,4 @@ export * from "./vcs";export * from "./changeHistory";export * from "./dbSchema";export * from "./activity";+export * from "./bookmark";diff --git a/frontend/src/types/bookmark.ts b/frontend/src/types/bookmark.tsdeleted file mode 100644index 72a7ed12d6..0000000000--- a/frontend/src/types/bookmark.ts+++ /dev/null@@ -1,18 +0,0 @@-import { BookmarkId, PrincipalId } from "./id";--export type Bookmark = {- id: BookmarkId;-- // Standard fields- creatorID: PrincipalId;-- // Domain specific fields- name: string;- link: string;-};--export type BookmarkCreate = {- // Domain specific fields- name: string;- link: string;-};diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.tsindex 7755ebb0c2..88d8d17095 100644--- a/frontend/src/types/common.ts+++ b/frontend/src/types/common.ts@@ -1,6 +1,5 @@import { Anomaly } from "./anomaly";import { BackupSetting } from "./backup";-import { Bookmark } from "./bookmark";import { EMPTY_ID, UNKNOWN_ID } from "./const";import { Database } from "./database";import { DataSource } from "./dataSource";@@ -94,7 +93,6 @@ export type ResourceType =| "TASK"| "ACTIVITY"| "INBOX"- | "BOOKMARK"| "VCS"| "REPOSITORY"| "ANOMALY"@@ -118,7 +116,6 @@ interface ResourceMaker {(type: "TASK_PROGRESS"): TaskProgress;(type: "TASK"): Task;(type: "INBOX"): Inbox;- (type: "BOOKMARK"): Bookmark;(type: "VCS"): VCS;(type: "ANOMALY"): Anomaly;(type: "SQL_REVIEW"): SQLReviewPolicy;@@ -298,13 +295,6 @@ const makeUnknown = (type: ResourceType) => {status: "READ",};- const UNKNOWN_BOOKMARK: Bookmark = {- id: UNKNOWN_ID,- creatorID: UNKNOWN_ID,- name: "",- link: "",- };-const UNKNOWN_VCS: VCS = {id: UNKNOWN_ID,name: "",@@ -364,8 +354,6 @@ const makeUnknown = (type: ResourceType) => {return UNKNOWN_TASK;case "INBOX":return UNKNOWN_INBOX;- case "BOOKMARK":- return UNKNOWN_BOOKMARK;case "VCS":return UNKNOWN_VCS;case "ANOMALY":@@ -549,13 +537,6 @@ const makeEmpty = (type: ResourceType) => {status: "READ",};- const EMPTY_BOOKMARK: Bookmark = {- id: EMPTY_ID,- creatorID: EMPTY_ID,- name: "",- link: "",- };-const EMPTY_VCS: VCS = {id: EMPTY_ID,name: "",@@ -615,8 +596,6 @@ const makeEmpty = (type: ResourceType) => {return EMPTY_TASK;case "INBOX":return EMPTY_INBOX;- case "BOOKMARK":- return EMPTY_BOOKMARK;case "VCS":return EMPTY_VCS;case "ANOMALY":diff --git a/frontend/src/types/id.ts b/frontend/src/types/id.tsindex 34096b75c5..8c950aba1d 100644--- a/frontend/src/types/id.ts+++ b/frontend/src/types/id.ts@@ -12,8 +12,6 @@ export type MemberId = IdType;export type SettingId = IdType;-export type BookmarkId = IdType;-export type PolicyId = IdType;export type ProjectId = IdType;diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.tsindex 9d626c1d56..eac01145e3 100644--- a/frontend/src/types/index.ts+++ b/frontend/src/types/index.ts@@ -4,7 +4,6 @@ export * from "./anomaly";export * from "./auditLog";export * from "./auth";export * from "./backup";-export * from "./bookmark";export * from "./common";export * from "./const";export * from "./database";diff --git a/frontend/src/types/proto/v1/bookmark_service.ts b/frontend/src/types/proto/v1/bookmark_service.tsindex 9f8c583d75..54a19cd6a5 100644--- a/frontend/src/types/proto/v1/bookmark_service.ts+++ b/frontend/src/types/proto/v1/bookmark_service.ts@@ -6,11 +6,6 @@ import { Empty } from "../google/protobuf/empty";export const protobufPackage = "bytebase.v1";export interface CreateBookmarkRequest {- /**- * The parent resource of the bookmark.- * Format: users/{user}, user is a server-generated unique IDs.- */- parent: string;/** The bookmark to create. */bookmark?: Bookmark;}@@ -18,17 +13,12 @@ export interface CreateBookmarkRequest {export interface DeleteBookmarkRequest {/*** The name of the bookmark to delete.- * Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.+ * Format: bookmarks/{bookmark}*/name: string;}export interface ListBookmarksRequest {- /**- * The parent resource of the bookmark.- * Format: users/{user}, user is a server-generated unique ID.- */- parent: string;/*** Not used. The maximum number of bookmarks to return. The service may return fewer than* this value.@@ -59,7 +49,7 @@ export interface ListBookmarksResponse {export interface Bookmark {/*** The name of the bookmark.- * Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.+ * Format: bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.*/name: string;/** The title of the bookmark. */@@ -74,16 +64,13 @@ export interface Bookmark {}function createBaseCreateBookmarkRequest(): CreateBookmarkRequest {- return { parent: "", bookmark: undefined };+ return { bookmark: undefined };}export const CreateBookmarkRequest = {encode(message: CreateBookmarkRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.parent !== "") {- writer.uint32(10).string(message.parent);- }if (message.bookmark !== undefined) {- Bookmark.encode(message.bookmark, writer.uint32(18).fork()).ldelim();+ Bookmark.encode(message.bookmark, writer.uint32(10).fork()).ldelim();}return writer;},@@ -100,13 +87,6 @@ export const CreateBookmarkRequest = {break;}- message.parent = reader.string();- continue;- case 2:- if (tag !== 18) {- break;- }-message.bookmark = Bookmark.decode(reader, reader.uint32());continue;}@@ -119,15 +99,11 @@ export const CreateBookmarkRequest = {},fromJSON(object: any): CreateBookmarkRequest {- return {- parent: isSet(object.parent) ? String(object.parent) : "",- bookmark: isSet(object.bookmark) ? Bookmark.fromJSON(object.bookmark) : undefined,- };+ return { bookmark: isSet(object.bookmark) ? Bookmark.fromJSON(object.bookmark) : undefined };},toJSON(message: CreateBookmarkRequest): unknown {const obj: any = {};- message.parent !== undefined && (obj.parent = message.parent);message.bookmark !== undefined && (obj.bookmark = message.bookmark ? Bookmark.toJSON(message.bookmark) : undefined);return obj;},@@ -138,7 +114,6 @@ export const CreateBookmarkRequest = {fromPartial(object: DeepPartial<CreateBookmarkRequest>): CreateBookmarkRequest {const message = createBaseCreateBookmarkRequest();- message.parent = object.parent ?? "";message.bookmark = (object.bookmark !== undefined && object.bookmark !== null)? Bookmark.fromPartial(object.bookmark): undefined;@@ -203,19 +178,16 @@ export const DeleteBookmarkRequest = {};function createBaseListBookmarksRequest(): ListBookmarksRequest {- return { parent: "", pageSize: 0, pageToken: "" };+ return { pageSize: 0, pageToken: "" };}export const ListBookmarksRequest = {encode(message: ListBookmarksRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {- if (message.parent !== "") {- writer.uint32(10).string(message.parent);- }if (message.pageSize !== 0) {- writer.uint32(16).int32(message.pageSize);+ writer.uint32(8).int32(message.pageSize);}if (message.pageToken !== "") {- writer.uint32(26).string(message.pageToken);+ writer.uint32(18).string(message.pageToken);}return writer;},@@ -228,21 +200,14 @@ export const ListBookmarksRequest = {const tag = reader.uint32();switch (tag >>> 3) {case 1:- if (tag !== 10) {- break;- }-- message.parent = reader.string();- continue;- case 2:- if (tag !== 16) {+ if (tag !== 8) {break;}message.pageSize = reader.int32();continue;- case 3:- if (tag !== 26) {+ case 2:+ if (tag !== 18) {break;}@@ -259,7 +224,6 @@ export const ListBookmarksRequest = {fromJSON(object: any): ListBookmarksRequest {return {- parent: isSet(object.parent) ? String(object.parent) : "",pageSize: isSet(object.pageSize) ? Number(object.pageSize) : 0,pageToken: isSet(object.pageToken) ? String(object.pageToken) : "",};@@ -267,7 +231,6 @@ export const ListBookmarksRequest = {toJSON(message: ListBookmarksRequest): unknown {const obj: any = {};- message.parent !== undefined && (obj.parent = message.parent);message.pageSize !== undefined && (obj.pageSize = Math.round(message.pageSize));message.pageToken !== undefined && (obj.pageToken = message.pageToken);return obj;@@ -279,7 +242,6 @@ export const ListBookmarksRequest = {fromPartial(object: DeepPartial<ListBookmarksRequest>): ListBookmarksRequest {const message = createBaseListBookmarksRequest();- message.parent = object.parent ?? "";message.pageSize = object.pageSize ?? 0;message.pageToken = object.pageToken ?? "";return message;@@ -459,10 +421,10 @@ export const BookmarkServiceDefinition = {responseStream: false,options: {_unknownFields: {- 8410: [new Uint8Array([15, 112, 97, 114, 101, 110, 116, 44, 98, 111, 111, 107, 109, 97, 114, 107])],+ 8410: [new Uint8Array([0])],578365826: [new Uint8Array([- 42,+ 25,58,8,98,@@ -474,28 +436,11 @@ export const BookmarkServiceDefinition = {114,107,34,- 30,+ 13,47,118,49,47,- 123,- 112,- 97,- 114,- 101,- 110,- 116,- 61,- 117,- 115,- 101,- 114,- 115,- 47,- 42,- 125,- 47,98,111,111,@@ -522,9 +467,9 @@ export const BookmarkServiceDefinition = {8410: [new Uint8Array([4, 110, 97, 109, 101])],578365826: [new Uint8Array([- 32,+ 24,42,- 30,+ 22,47,118,49,@@ -535,14 +480,6 @@ export const BookmarkServiceDefinition = {109,101,61,- 117,- 115,- 101,- 114,- 115,- 47,- 42,- 47,98,111,111,@@ -560,7 +497,7 @@ export const BookmarkServiceDefinition = {},},},- /** ListBookmark lists bookmarks. */+ /** ListBookmarks lists bookmarks. */listBookmarks: {name: "ListBookmarks",requestType: ListBookmarksRequest,@@ -569,44 +506,8 @@ export const BookmarkServiceDefinition = {responseStream: false,options: {_unknownFields: {- 8410: [new Uint8Array([6, 112, 97, 114, 101, 110, 116])],- 578365826: [- new Uint8Array([- 32,- 18,- 30,- 47,- 118,- 49,- 47,- 123,- 112,- 97,- 114,- 101,- 110,- 116,- 61,- 117,- 115,- 101,- 114,- 115,- 47,- 42,- 125,- 47,- 98,- 111,- 111,- 107,- 109,- 97,- 114,- 107,- 115,- ]),- ],+ 8410: [new Uint8Array([0])],+ 578365826: [new Uint8Array([15, 18, 13, 47, 118, 49, 47, 98, 111, 111, 107, 109, 97, 114, 107, 115])],},},},@@ -618,7 +519,7 @@ export interface BookmarkServiceImplementation<CallContextExt = {}> {createBookmark(request: CreateBookmarkRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Bookmark>>;/** DeleteBookmark deletes a bookmark. */deleteBookmark(request: DeleteBookmarkRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Empty>>;- /** ListBookmark lists bookmarks. */+ /** ListBookmarks lists bookmarks. */listBookmarks(request: ListBookmarksRequest,context: CallContext & CallContextExt,@@ -633,7 +534,7 @@ export interface BookmarkServiceClient<CallOptionsExt = {}> {): Promise<Bookmark>;/** DeleteBookmark deletes a bookmark. */deleteBookmark(request: DeepPartial<DeleteBookmarkRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;- /** ListBookmark lists bookmarks. */+ /** ListBookmarks lists bookmarks. */listBookmarks(request: DeepPartial<ListBookmarksRequest>,options?: CallOptions & CallOptionsExt,diff --git a/frontend/src/types/store.ts b/frontend/src/types/store.tsindex cc8d3d8fa4..8b4f857349 100644--- a/frontend/src/types/store.ts+++ b/frontend/src/types/store.ts@@ -1,6 +1,5 @@import { MigrationHistoryId, QueryHistory, OnboardingGuideType } from ".";import { Backup } from "./backup";-import { Bookmark } from "./bookmark";import { Command } from "./common";import { Database } from "./database";import { DataSource } from "./dataSource";@@ -30,10 +29,6 @@ export interface PrincipalState {principalList: Principal[];}-export interface BookmarkState {- bookmarkList: Map<PrincipalId, Bookmark[]>;-}-export interface InboxState {inboxListByUser: Map<PrincipalId, Inbox[]>;inboxSummaryByUser: Map<PrincipalId, InboxSummary>;diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 58d769c25e..c6dd38d9a3 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -1236,7 +1236,7 @@ The user's `name` field is used to identify the user to update. Format: user| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the bookmark. Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs. |+| name | [string](#string) | | The name of the bookmark. Format: bookmarks/{bookmark}, user and bookmark are server-generated unique IDs. || title | [string](#string) | | The title of the bookmark. || link | [string](#string) | | The resource link of the bookmark. Only support issue link for now. Format: Issue: /issue/slug(issue_name)-{issue_uid} Example: /issue/start-here-add-email-column-to-employee-table-101 |@@ -1253,7 +1253,6 @@ The user's `name` field is used to identify the user to update. Format: user| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource of the bookmark. Format: users/{user}, user is a server-generated unique IDs. || bookmark | [Bookmark](#bytebase-v1-Bookmark) | | The bookmark to create. |@@ -1269,7 +1268,7 @@ The user's `name` field is used to identify the user to update. Format: user| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| name | [string](#string) | | The name of the bookmark to delete. Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs. |+| name | [string](#string) | | The name of the bookmark to delete. Format: bookmarks/{bookmark} |@@ -1284,7 +1283,6 @@ The user's `name` field is used to identify the user to update. Format: user| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| parent | [string](#string) | | The parent resource of the bookmark. Format: users/{user}, user is a server-generated unique ID. || page_size | [int32](#int32) | | Not used. The maximum number of bookmarks to return. The service may return fewer than this value. If unspecified, at most 50 bookmarks will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. || page_token | [string](#string) | | Not used. A page token, received from a previous `ListBookmarks` call. Provide this to retrieve the subsequent page.@@ -1326,7 +1324,7 @@ When paginating, all other parameters provided to `ListBookmarks` must match the| ----------- | ------------ | ------------- | ------------|| CreateBookmark | [CreateBookmarkRequest](#bytebase-v1-CreateBookmarkRequest) | [Bookmark](#bytebase-v1-Bookmark) | CreateBookmark creates a new bookmark. || DeleteBookmark | [DeleteBookmarkRequest](#bytebase-v1-DeleteBookmarkRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | DeleteBookmark deletes a bookmark. |-| ListBookmarks | [ListBookmarksRequest](#bytebase-v1-ListBookmarksRequest) | [ListBookmarksResponse](#bytebase-v1-ListBookmarksResponse) | ListBookmark lists bookmarks. |+| ListBookmarks | [ListBookmarksRequest](#bytebase-v1-ListBookmarksRequest) | [ListBookmarksResponse](#bytebase-v1-ListBookmarksResponse) | ListBookmarks lists bookmarks. |diff --git a/proto/generated-go/v1/bookmark_service.pb.go b/proto/generated-go/v1/bookmark_service.pb.goindex 26101d80ae..7f2e9c7db9 100644--- a/proto/generated-go/v1/bookmark_service.pb.go+++ b/proto/generated-go/v1/bookmark_service.pb.go@@ -27,11 +27,8 @@ type CreateBookmarkRequest struct {sizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields- // The parent resource of the bookmark.- // Format: users/{user}, user is a server-generated unique IDs.- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`// The bookmark to create.- Bookmark *Bookmark `protobuf:"bytes,2,opt,name=bookmark,proto3" json:"bookmark,omitempty"`+ Bookmark *Bookmark `protobuf:"bytes,1,opt,name=bookmark,proto3" json:"bookmark,omitempty"`}func (x *CreateBookmarkRequest) Reset() {@@ -66,13 +63,6 @@ func (*CreateBookmarkRequest) Descriptor() ([]byte, []int) {return file_v1_bookmark_service_proto_rawDescGZIP(), []int{0}}-func (x *CreateBookmarkRequest) GetParent() string {- if x != nil {- return x.Parent- }- return ""-}-func (x *CreateBookmarkRequest) GetBookmark() *Bookmark {if x != nil {return x.Bookmark@@ -86,7 +76,7 @@ type DeleteBookmarkRequest struct {unknownFields protoimpl.UnknownFields// The name of the bookmark to delete.- // Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.+ // Format: bookmarks/{bookmark}Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`}@@ -134,20 +124,17 @@ type ListBookmarksRequest struct {sizeCache protoimpl.SizeCacheunknownFields protoimpl.UnknownFields- // The parent resource of the bookmark.- // Format: users/{user}, user is a server-generated unique ID.- Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`// Not used. The maximum number of bookmarks to return. The service may return fewer than// this value.// If unspecified, at most 50 bookmarks will be returned.// The maximum value is 1000; values above 1000 will be coerced to 1000.- PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`+ PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`// Not used. A page token, received from a previous `ListBookmarks` call.// Provide this to retrieve the subsequent page.//// When paginating, all other parameters provided to `ListBookmarks` must match// the call that provided the page token.- PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`+ PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`}func (x *ListBookmarksRequest) Reset() {@@ -182,13 +169,6 @@ func (*ListBookmarksRequest) Descriptor() ([]byte, []int) {return file_v1_bookmark_service_proto_rawDescGZIP(), []int{2}}-func (x *ListBookmarksRequest) GetParent() string {- if x != nil {- return x.Parent- }- return ""-}-func (x *ListBookmarksRequest) GetPageSize() int32 {if x != nil {return x.PageSize@@ -267,7 +247,7 @@ type Bookmark struct {unknownFields protoimpl.UnknownFields// The name of the bookmark.- // Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.+ // Format: bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`// The title of the bookmark.Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`@@ -343,23 +323,20 @@ var file_v1_bookmark_service_proto_rawDesc = []byte{0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x66, 0x69, 0x65, 0x6c,0x64, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,- 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x67, 0x0a,+ 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4f, 0x0a,0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x52,- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,- 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x36,- 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,- 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42,- 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x08, 0x62, 0x6f,- 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x30, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,- 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,- 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0,- 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6a, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74,- 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,- 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,- 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65,- 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67,+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61,+ 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x42,+ 0x03, 0xe0, 0x41, 0x02, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x30,+ 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b,+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,+ 0x22, 0x52, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b,+ 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65,+ 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67,0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f,- 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54,+ 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54,0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x74, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b,0x6d, 0x61, 0x72, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a,0x09, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,@@ -373,35 +350,31 @@ var file_v1_bookmark_service_proto_rawDesc = []byte{0x19, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03,0xe0, 0x41, 0x02, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x17, 0x0a, 0x04, 0x6c, 0x69,0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6c,- 0x69, 0x6e, 0x6b, 0x32, 0xaa, 0x03, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b,- 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x8f, 0x01, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61,+ 0x69, 0x6e, 0x6b, 0x32, 0xe9, 0x02, 0x0a, 0x0f, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b,+ 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74,+ 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65,+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x6f,+ 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e,+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f, 0x6b,+ 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x22, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x3a,+ 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x62,+ 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x73, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65,0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x22, 0x2e, 0x62, 0x79, 0x74,- 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42,- 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15,- 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x6f,- 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x42, 0xda, 0x41, 0x0f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,- 0x2c, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2a, 0x3a,- 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b,- 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f,- 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x7b, 0x0a, 0x0e, 0x44, 0x65, 0x6c,- 0x65, 0x74, 0x65, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x22, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,- 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 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, 0x2d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65,- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x2a, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d,- 0x65, 0x3d, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61,- 0x72, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x87, 0x01, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x42,- 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x6d,- 0x61, 0x72, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x62, 0x79,- 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f,- 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,- 0x2f, 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20,- 0x12, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x75, 0x73,- 0x65, 0x72, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73,- 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f,- 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42,+ 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,+ 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x25, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82,+ 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x2a, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65,+ 0x3d, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x70, 0x0a,+ 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x21,+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,+ 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,+ 0x74, 0x1a, 0x22, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,+ 0x4c, 0x69, 0x73, 0x74, 0x42, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x52, 0x65, 0x73,+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0xda, 0x41, 0x00, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f,+ 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x42,+ 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f,+ 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,}var (diff --git a/proto/generated-go/v1/bookmark_service.pb.gw.go b/proto/generated-go/v1/bookmark_service.pb.gw.goindex bd4976d0e1..2d348c7fbc 100644--- a/proto/generated-go/v1/bookmark_service.pb.gw.go+++ b/proto/generated-go/v1/bookmark_service.pb.gw.go@@ -43,23 +43,6 @@ func request_BookmarkService_CreateBookmark_0(ctx context.Context, marshaler runreturn nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}- var (- val string- ok bool- err error- _ = err- )-- val, ok = pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }-- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }-msg, err := client.CreateBookmark(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))return msg, metadata, err@@ -77,23 +60,6 @@ func local_request_BookmarkService_CreateBookmark_0(ctx context.Context, marshalreturn nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}- var (- val string- ok bool- err error- _ = err- )-- val, ok = pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }-- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }-msg, err := server.CreateBookmark(ctx, &protoReq)return msg, metadata, err@@ -152,30 +118,13 @@ func local_request_BookmarkService_DeleteBookmark_0(ctx context.Context, marshal}var (- filter_BookmarkService_ListBookmarks_0 = &utilities.DoubleArray{Encoding: map[string]int{"parent": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}}+ filter_BookmarkService_ListBookmarks_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)})func request_BookmarkService_ListBookmarks_0(ctx context.Context, marshaler runtime.Marshaler, client BookmarkServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {var protoReq ListBookmarksRequestvar metadata runtime.ServerMetadata- var (- val string- ok bool- err error- _ = err- )-- val, ok = pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }-- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }-if err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}@@ -192,23 +141,6 @@ func local_request_BookmarkService_ListBookmarks_0(ctx context.Context, marshalevar protoReq ListBookmarksRequestvar metadata runtime.ServerMetadata- var (- val string- ok bool- err error- _ = err- )-- val, ok = pathParams["parent"]- if !ok {- return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")- }-- protoReq.Parent, err = runtime.String(val)- if err != nil {- return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)- }-if err := req.ParseForm(); err != nil {return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)}@@ -235,7 +167,7 @@ func RegisterBookmarkServiceHandlerServer(ctx context.Context, mux *runtime.ServinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.BookmarkService/CreateBookmark", runtime.WithHTTPPathPattern("/v1/{parent=users/*}/bookmarks"))+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.BookmarkService/CreateBookmark", runtime.WithHTTPPathPattern("/v1/bookmarks"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -260,7 +192,7 @@ func RegisterBookmarkServiceHandlerServer(ctx context.Context, mux *runtime.ServinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.BookmarkService/DeleteBookmark", runtime.WithHTTPPathPattern("/v1/{name=users/*/bookmarks/*}"))+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.BookmarkService/DeleteBookmark", runtime.WithHTTPPathPattern("/v1/{name=bookmarks/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -285,7 +217,7 @@ func RegisterBookmarkServiceHandlerServer(ctx context.Context, mux *runtime.ServinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.BookmarkService/ListBookmarks", runtime.WithHTTPPathPattern("/v1/{parent=users/*}/bookmarks"))+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.BookmarkService/ListBookmarks", runtime.WithHTTPPathPattern("/v1/bookmarks"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -349,7 +281,7 @@ func RegisterBookmarkServiceHandlerClient(ctx context.Context, mux *runtime.ServinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.BookmarkService/CreateBookmark", runtime.WithHTTPPathPattern("/v1/{parent=users/*}/bookmarks"))+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.BookmarkService/CreateBookmark", runtime.WithHTTPPathPattern("/v1/bookmarks"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -371,7 +303,7 @@ func RegisterBookmarkServiceHandlerClient(ctx context.Context, mux *runtime.ServinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.BookmarkService/DeleteBookmark", runtime.WithHTTPPathPattern("/v1/{name=users/*/bookmarks/*}"))+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.BookmarkService/DeleteBookmark", runtime.WithHTTPPathPattern("/v1/{name=bookmarks/*}"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -393,7 +325,7 @@ func RegisterBookmarkServiceHandlerClient(ctx context.Context, mux *runtime.ServinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)var err errorvar annotatedContext context.Context- annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.BookmarkService/ListBookmarks", runtime.WithHTTPPathPattern("/v1/{parent=users/*}/bookmarks"))+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.BookmarkService/ListBookmarks", runtime.WithHTTPPathPattern("/v1/bookmarks"))if err != nil {runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)return@@ -413,11 +345,11 @@ func RegisterBookmarkServiceHandlerClient(ctx context.Context, mux *runtime.Serv}var (- pattern_BookmarkService_CreateBookmark_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "users", "parent", "bookmarks"}, ""))+ pattern_BookmarkService_CreateBookmark_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "bookmarks"}, ""))- pattern_BookmarkService_DeleteBookmark_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "users", "bookmarks", "name"}, ""))+ pattern_BookmarkService_DeleteBookmark_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v1", "bookmarks", "name"}, ""))- pattern_BookmarkService_ListBookmarks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "users", "parent", "bookmarks"}, ""))+ pattern_BookmarkService_ListBookmarks_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "bookmarks"}, "")))var (diff --git a/proto/generated-go/v1/bookmark_service_grpc.pb.go b/proto/generated-go/v1/bookmark_service_grpc.pb.goindex 52c1153fbe..6ea4d174ef 100644--- a/proto/generated-go/v1/bookmark_service_grpc.pb.go+++ b/proto/generated-go/v1/bookmark_service_grpc.pb.go@@ -33,7 +33,7 @@ type BookmarkServiceClient interface {CreateBookmark(ctx context.Context, in *CreateBookmarkRequest, opts ...grpc.CallOption) (*Bookmark, error)// DeleteBookmark deletes a bookmark.DeleteBookmark(ctx context.Context, in *DeleteBookmarkRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)- // ListBookmark lists bookmarks.+ // ListBookmarks lists bookmarks.ListBookmarks(ctx context.Context, in *ListBookmarksRequest, opts ...grpc.CallOption) (*ListBookmarksResponse, error)}@@ -80,7 +80,7 @@ type BookmarkServiceServer interface {CreateBookmark(context.Context, *CreateBookmarkRequest) (*Bookmark, error)// DeleteBookmark deletes a bookmark.DeleteBookmark(context.Context, *DeleteBookmarkRequest) (*emptypb.Empty, error)- // ListBookmark lists bookmarks.+ // ListBookmarks lists bookmarks.ListBookmarks(context.Context, *ListBookmarksRequest) (*ListBookmarksResponse, error)mustEmbedUnimplementedBookmarkServiceServer()}diff --git a/proto/v1/bookmark_service.proto b/proto/v1/bookmark_service.protoindex 2bed6a2f0b..7c3faf54c7 100644--- a/proto/v1/bookmark_service.proto+++ b/proto/v1/bookmark_service.proto@@ -13,57 +13,49 @@ service BookmarkService {// CreateBookmark creates a new bookmark.rpc CreateBookmark(CreateBookmarkRequest) returns (Bookmark) {option (google.api.http) = {- post: "/v1/{parent=users/*}/bookmarks"+ post: "/v1/bookmarks"body: "bookmark"};- option (google.api.method_signature) = "parent,bookmark";+ option (google.api.method_signature) = "";}// DeleteBookmark deletes a bookmark.rpc DeleteBookmark(DeleteBookmarkRequest) returns (google.protobuf.Empty) {- option (google.api.http) = {delete: "/v1/{name=users/*/bookmarks/*}"};+ option (google.api.http) = {delete: "/v1/{name=bookmarks/*}"};option (google.api.method_signature) = "name";}- // ListBookmark lists bookmarks.+ // ListBookmarks lists bookmarks.rpc ListBookmarks(ListBookmarksRequest) returns (ListBookmarksResponse) {- option (google.api.http) = {get: "/v1/{parent=users/*}/bookmarks"};- option (google.api.method_signature) = "parent";+ option (google.api.http) = {get: "/v1/bookmarks"};+ option (google.api.method_signature) = "";}}message CreateBookmarkRequest {- // The parent resource of the bookmark.- // Format: users/{user}, user is a server-generated unique IDs.- string parent = 1;-// The bookmark to create.- Bookmark bookmark = 2 [(google.api.field_behavior) = REQUIRED];+ Bookmark bookmark = 1 [(google.api.field_behavior) = REQUIRED];}message DeleteBookmarkRequest {// The name of the bookmark to delete.- // Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.+ // Format: bookmarks/{bookmark}string name = 1 [(google.api.field_behavior) = REQUIRED];}message ListBookmarksRequest {- // The parent resource of the bookmark.- // Format: users/{user}, user is a server-generated unique ID.- string parent = 1;-// Not used. The maximum number of bookmarks to return. The service may return fewer than// this value.// If unspecified, at most 50 bookmarks will be returned.// The maximum value is 1000; values above 1000 will be coerced to 1000.- int32 page_size = 2;+ int32 page_size = 1;// Not used. A page token, received from a previous `ListBookmarks` call.// Provide this to retrieve the subsequent page.//// When paginating, all other parameters provided to `ListBookmarks` must match// the call that provided the page token.- string page_token = 3;+ string page_token = 2;}message ListBookmarksResponse {@@ -77,7 +69,7 @@ message ListBookmarksResponse {message Bookmark {// The name of the bookmark.- // Format: users/{user}/bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.+ // Format: bookmarks/{bookmark}, user and bookmark are server-generated unique IDs.string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];// The title of the bookmark.