Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Support /bookmark endpoint
天舟bc78338703f3
diff --git a/backend/api/bookmark.go b/backend/api/bookmark.gonew file mode 100644index 0000000000..cba0c23600--- /dev/null+++ b/backend/api/bookmark.go@@ -0,0 +1,54 @@+package api++import "context"++type Bookmark struct {+ ID int `jsonapi:"primary,bookmark"`++ // Standard fields+ CreatorId int+ Creator *Principal `jsonapi:"attr,creator"`+ CreatedTs int64 `jsonapi:"attr,createdTs"`+ UpdaterId int+ Updater *Principal `jsonapi:"attr,updater"`+ UpdatedTs int64 `jsonapi:"attr,updatedTs"`+ WorkspaceId int++ // Domain specific fields+ Name string `jsonapi:"attr,name"`+ Link string `jsonapi:"attr,link"`+}++type BookmarkCreate struct {+ // Standard fields+ // Value is assigned from the jwt subject field passed by the client.+ CreatorId int+ WorkspaceId int++ // Domain specific fields+ Name string `jsonapi:"attr,name"`+ Link string `jsonapi:"attr,link"`+}++type BookmarkFind struct {+ ID *int++ // Standard fields+ CreatorId *int+ WorkspaceId *int+}++type BookmarkDelete struct {+ ID int++ // Standard fields+ // Value is assigned from the jwt subject field passed by the client.+ DeleterId int+}++type BookmarkService interface {+ CreateBookmark(ctx context.Context, create *BookmarkCreate) (*Bookmark, error)+ FindBookmarkList(ctx context.Context, find *BookmarkFind) ([]*Bookmark, error)+ FindBookmark(ctx context.Context, find *BookmarkFind) (*Bookmark, error)+ DeleteBookmark(ctx context.Context, delete *BookmarkDelete) error+}diff --git a/backend/cmd/echo/main.go b/backend/cmd/echo/main.goindex 8c3fe02388..45ae46b70a 100644--- a/backend/cmd/echo/main.go+++ b/backend/cmd/echo/main.go@@ -52,6 +52,7 @@ func (m *Main) Run() error {server.StageService = store.NewStageService(m.l, db)server.TaskService = store.NewTaskService(m.l, db)server.ActivityService = store.NewActivityService(m.l, db)+ server.BookmarkService = store.NewBookmarkService(m.l, db)m.server = serverif err := server.Run(); err != nil {diff --git a/backend/server/acl.go b/backend/server/acl.goindex 2c33157613..2d72fbd5e6 100644--- a/backend/server/acl.go+++ b/backend/server/acl.go@@ -14,7 +14,7 @@ import ("github.com/labstack/echo/v4")-func ACLMiddleware(l *bytebase.Logger, m api.MemberService, a api.ActivityService, ce *casbin.Enforcer, next echo.HandlerFunc) echo.HandlerFunc {+func ACLMiddleware(l *bytebase.Logger, s *Server, ce *casbin.Enforcer, next echo.HandlerFunc) echo.HandlerFunc {return func(c echo.Context) error {// Skips auth end pointif strings.HasPrefix(c.Path(), "/api/auth") {@@ -29,7 +29,7 @@ func ACLMiddleware(l *bytebase.Logger, m api.MemberService, a api.ActivityServicWorkspaceId: &workspaceId,PrincipalId: &principalId,}- member, err := m.FindMember(context.Background(), memberFind)+ member, err := s.MemberService.FindMember(context.Background(), memberFind)if err != nil {if bytebase.ErrorCode(err) == bytebase.ENOTFOUND {return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("User ID is not a member: %d", principalId))@@ -58,7 +58,7 @@ func ACLMiddleware(l *bytebase.Logger, m api.MemberService, a api.ActivityServicactivityFind := &api.ActivityFind{ID: &activityId,}- activity, err := a.FindActivity(context.Background(), activityFind)+ activity, err := s.ActivityService.FindActivity(context.Background(), activityFind)if err != nil {if bytebase.ErrorCode(err) == bytebase.ENOTFOUND {return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Activity ID not found: %d", activityId))@@ -69,6 +69,27 @@ func ACLMiddleware(l *bytebase.Logger, m api.MemberService, a api.ActivityServicmethod = method + "_SELF"}}+ } else if strings.HasPrefix(c.Path(), "/api/bookmark") {+ bookmarkIdStr := c.Param("bookmarkId")+ if bookmarkIdStr != "" {+ bookmarkId, err := strconv.Atoi(bookmarkIdStr)+ if err != nil {+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Bookmark ID is not a number: %s", bookmarkIdStr))+ }+ bookmarkFind := &api.BookmarkFind{+ ID: &bookmarkId,+ }+ bookmark, err := s.BookmarkService.FindBookmark(context.Background(), bookmarkFind)+ if err != nil {+ if bytebase.ErrorCode(err) == bytebase.ENOTFOUND {+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Bookmark ID not found: %d", bookmarkId))+ }+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)+ }+ if bookmark.CreatorId == principalId {+ method = method + "_SELF"+ }+ }}}diff --git a/backend/server/acl_casbin_policy_dba.csv b/backend/server/acl_casbin_policy_dba.csvindex 2c836bdf9b..4ae9d0e592 100644--- a/backend/server/acl_casbin_policy_dba.csv+++ b/backend/server/acl_casbin_policy_dba.csv@@ -28,4 +28,7 @@ p, DBA, /issue/{id}/status, PATCHp, DBA, /activity, POSTp, DBA, /activity, GETp, DBA, /activity/{id}, PATCH_SELF-p, DBA, /activity/{id}, DELETE_SELF\ No newline at end of file+p, DBA, /activity/{id}, DELETE_SELF+p, DBA, /bookmark, POST+p, DBA, /bookmark, GET+p, DBA, /bookmark/{id}, DELETE_SELF\ No newline at end of filediff --git a/backend/server/acl_casbin_policy_developer.csv b/backend/server/acl_casbin_policy_developer.csvindex f62935d3de..ff3d6b1a1d 100644--- a/backend/server/acl_casbin_policy_developer.csv+++ b/backend/server/acl_casbin_policy_developer.csv@@ -24,3 +24,6 @@ p, DEVELOPER, /activity, POSTp, DEVELOPER, /activity, GETp, DEVELOPER, /activity/{id}, PATCH_SELFp, DEVELOPER, /activity/{id}, DELETE_SELF+p, DEVELOPER, /bookmark, POST+p, DEVELOPER, /bookmark, GET+p, DEVELOPER, /bookmark/{id}, DELETE_SELFdiff --git a/backend/server/acl_casbin_policy_owner.csv b/backend/server/acl_casbin_policy_owner.csvindex 322dbb7106..172137d9d8 100644--- a/backend/server/acl_casbin_policy_owner.csv+++ b/backend/server/acl_casbin_policy_owner.csv@@ -33,3 +33,6 @@ p, OWNER, /activity, POSTp, OWNER, /activity, GETp, OWNER, /activity/{id}, PATCH_SELFp, OWNER, /activity/{id}, DELETE_SELF+p, OWNER, /bookmark, POST+p, OWNER, /bookmark, GET+p, OWNER, /bookmark/{id}, DELETE_SELFdiff --git a/backend/server/bookmark.go b/backend/server/bookmark.gonew file mode 100644index 0000000000..eae689763e--- /dev/null+++ b/backend/server/bookmark.go@@ -0,0 +1,106 @@+package server++import (+ "context"+ "fmt"+ "net/http"+ "strconv"++ "github.com/bytebase/bytebase"+ "github.com/bytebase/bytebase/api"+ "github.com/google/jsonapi"+ "github.com/labstack/echo/v4"+)++func (s *Server) registerBookmarkRoutes(g *echo.Group) {+ g.POST("/bookmark", func(c echo.Context) error {+ bookmarkCreate := &api.BookmarkCreate{WorkspaceId: api.DEFAULT_WORKPSACE_ID}+ if err := jsonapi.UnmarshalPayload(c.Request().Body, bookmarkCreate); err != nil {+ return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create bookmark request").SetInternal(err)+ }++ bookmarkCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)++ bookmark, err := s.BookmarkService.CreateBookmark(context.Background(), bookmarkCreate)+ if err != nil {+ if bytebase.ErrorCode(err) == bytebase.ECONFLICT {+ return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Bookmark already exists: %s", bookmarkCreate.Link))+ }+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create bookmark").SetInternal(err)+ }++ if err := s.ComposeBookmarkRelationship(context.Background(), bookmark, c.Get(getIncludeKey()).([]string)); err != nil {+ return err+ }++ c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)+ if err := jsonapi.MarshalPayload(c.Response().Writer, bookmark); err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal create bookmark response").SetInternal(err)+ }+ return nil+ })++ g.GET("/bookmark", func(c echo.Context) error {+ workspaceId := api.DEFAULT_WORKPSACE_ID+ creatorId := c.Get(GetPrincipalIdContextKey()).(int)+ bookmarkFind := &api.BookmarkFind{+ WorkspaceId: &workspaceId,+ CreatorId: &creatorId,+ }+ list, err := s.BookmarkService.FindBookmarkList(context.Background(), bookmarkFind)+ if err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch bookmark list").SetInternal(err)+ }++ for _, bookmark := range list {+ if err := s.ComposeBookmarkRelationship(context.Background(), bookmark, c.Get(getIncludeKey()).([]string)); err != nil {+ return err+ }+ }++ c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)+ if err := jsonapi.MarshalPayload(c.Response().Writer, list); 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 {+ 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)+ }++ bookmarkDelete := &api.BookmarkDelete{+ ID: id,+ DeleterId: c.Get(GetPrincipalIdContextKey()).(int),+ }+ err = s.BookmarkService.DeleteBookmark(context.Background(), bookmarkDelete)+ if err != nil {+ if bytebase.ErrorCode(err) == bytebase.ENOTFOUND {+ 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+ })+}++func (s *Server) ComposeBookmarkRelationship(ctx context.Context, bookmark *api.Bookmark, includeList []string) error {+ var err error++ bookmark.Creator, err = s.ComposePrincipalById(ctx, bookmark.CreatorId, includeList)+ if err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch creator for bookmark ID: %v", bookmark.ID)).SetInternal(err)+ }++ bookmark.Updater, err = s.ComposePrincipalById(context.Background(), bookmark.UpdaterId, includeList)+ if err != nil {+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch updater for bookmark ID: %v", bookmark.ID)).SetInternal(err)+ }++ return nil+}diff --git a/backend/server/server.go b/backend/server/server.goindex 7c07d8078e..5ddb482ba0 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -34,6 +34,7 @@ type Server struct {StageService api.StageServiceTaskService api.TaskServiceActivityService api.ActivityService+ BookmarkService api.BookmarkServicee *echo.Echo}@@ -115,7 +116,7 @@ func NewServer(logger *bytebase.Logger) *Server {e.Logger.Fatal(err)}g.Use(func(next echo.HandlerFunc) echo.HandlerFunc {- return ACLMiddleware(logger, s.MemberService, s.ActivityService, ce, next)+ return ACLMiddleware(logger, s, ce, next)})s.registerDebugRoutes(g)@@ -129,6 +130,7 @@ func NewServer(logger *bytebase.Logger) *Server {s.registerDatabaseRoutes(g)s.registerIssueRoutes(g)s.registerActivityRoutes(g)+ s.registerBookmarkRoutes(g)return s}diff --git a/backend/store/bookmark.go b/backend/store/bookmark.gonew file mode 100644index 0000000000..b545cae992--- /dev/null+++ b/backend/store/bookmark.go@@ -0,0 +1,221 @@+package store++import (+ "context"+ "fmt"+ "strings"++ "github.com/bytebase/bytebase"+ "github.com/bytebase/bytebase/api"+)++var (+ _ api.BookmarkService = (*BookmarkService)(nil)+)++// BookmarkService represents a service for managing bookmark.+type BookmarkService struct {+ l *bytebase.Logger+ db *DB+}++// NewBookmarkService returns a new instance of BookmarkService.+func NewBookmarkService(logger *bytebase.Logger, db *DB) *BookmarkService {+ return &BookmarkService{l: logger, db: db}+}++// CreateBookmark creates a new bookmark.+func (s *BookmarkService) CreateBookmark(ctx context.Context, create *api.BookmarkCreate) (*api.Bookmark, error) {+ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return nil, FormatError(err)+ }+ defer tx.Rollback()++ bookmark, err := createBookmark(ctx, tx, create)+ if err != nil {+ return nil, err+ }++ if err := tx.Commit(); err != nil {+ return nil, FormatError(err)+ }++ return bookmark, nil+}++// FindBookmarkList retrieves a list of bookmarks based on find.+func (s *BookmarkService) FindBookmarkList(ctx context.Context, find *api.BookmarkFind) ([]*api.Bookmark, error) {+ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return nil, FormatError(err)+ }+ defer tx.Rollback()++ list, err := findBookmarkList(ctx, tx, find)+ if err != nil {+ return []*api.Bookmark{}, err+ }++ return list, nil+}++// FindBookmark retrieves a single bookmark based on find.+// Returns ENOTFOUND if no matching record.+// Returns the first matching one and prints a warning if finding more than 1 matching records.+func (s *BookmarkService) FindBookmark(ctx context.Context, find *api.BookmarkFind) (*api.Bookmark, error) {+ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return nil, FormatError(err)+ }+ defer tx.Rollback()++ list, err := findBookmarkList(ctx, tx, find)+ if err != nil {+ return nil, err+ } else if len(list) == 0 {+ return nil, &bytebase.Error{Code: bytebase.ENOTFOUND, Message: fmt.Sprintf("bookmark not found: %v", find)}+ } else if len(list) > 1 {+ s.l.Warnf("found %d activities with filter %v, expect 1. ", len(list), find)+ }+ return list[0], nil+}++// DeleteBookmark deletes an existing bookmark by ID.+// Returns ENOTFOUND if bookmark does not exist.+func (s *BookmarkService) DeleteBookmark(ctx context.Context, delete *api.BookmarkDelete) error {+ tx, err := s.db.BeginTx(ctx, nil)+ if err != nil {+ return FormatError(err)+ }+ defer tx.Rollback()++ err = deleteBookmark(ctx, tx, delete)+ if err != nil {+ return FormatError(err)+ }++ if err := tx.Commit(); err != nil {+ return FormatError(err)+ }++ return nil+}++// createBookmark creates a new bookmark.+func createBookmark(ctx context.Context, tx *Tx, create *api.BookmarkCreate) (*api.Bookmark, error) {+ // Insert row into database.+ row, err := tx.QueryContext(ctx, `+ INSERT INTO bookmark (+ creator_id,+ updater_id,+ workspace_id,+ name,+ link+ )+ VALUES (?, ?, ?, ?, ?)+ RETURNING id, creator_id, created_ts, updater_id, updated_ts, workspace_id, name, link+ `,+ create.CreatorId,+ create.CreatorId,+ create.WorkspaceId,+ create.Name,+ create.Link,+ )++ if err != nil {+ return nil, FormatError(err)+ }+ defer row.Close()++ row.Next()+ var bookmark api.Bookmark+ if err := row.Scan(+ &bookmark.ID,+ &bookmark.CreatorId,+ &bookmark.CreatedTs,+ &bookmark.UpdaterId,+ &bookmark.UpdatedTs,+ &bookmark.WorkspaceId,+ &bookmark.Name,+ &bookmark.Link,+ ); err != nil {+ return nil, FormatError(err)+ }++ return &bookmark, nil+}++func findBookmarkList(ctx context.Context, tx *Tx, find *api.BookmarkFind) (_ []*api.Bookmark, err error) {+ // Build WHERE clause.+ where, args := []string{"1 = 1"}, []interface{}{}+ if v := find.ID; v != nil {+ where, args = append(where, "id = ?"), append(args, *v)+ }+ if v := find.CreatorId; v != nil {+ where, args = append(where, "creator_id = ?"), append(args, *v)+ }+ if v := find.WorkspaceId; v != nil {+ where, args = append(where, "workspace_id = ?"), append(args, *v)+ }++ rows, err := tx.QueryContext(ctx, `+ SELECT+ id,+ creator_id,+ created_ts,+ updater_id,+ updated_ts,+ workspace_id,+ name,+ link+ FROM bookmark+ WHERE `+strings.Join(where, " AND "),+ args...,+ )+ if err != nil {+ return nil, FormatError(err)+ }+ defer rows.Close()++ // Iterate over result set and deserialize rows into list.+ list := make([]*api.Bookmark, 0)+ for rows.Next() {+ var bookmark api.Bookmark+ if err := rows.Scan(+ &bookmark.ID,+ &bookmark.CreatorId,+ &bookmark.CreatedTs,+ &bookmark.UpdaterId,+ &bookmark.UpdatedTs,+ &bookmark.WorkspaceId,+ &bookmark.Name,+ &bookmark.Link,+ ); err != nil {+ return nil, FormatError(err)+ }++ list = append(list, &bookmark)+ }+ if err := rows.Err(); err != nil {+ return nil, FormatError(err)+ }++ return list, nil+}++// deleteBookmark permanently deletes a bookmark by ID.+func deleteBookmark(ctx context.Context, tx *Tx, delete *api.BookmarkDelete) error {+ // Remove row from database.+ result, err := tx.ExecContext(ctx, `DELETE FROM bookmark WHERE id = ?`, delete.ID)+ if err != nil {+ return FormatError(err)+ }++ rows, _ := result.RowsAffected()+ if rows == 0 {+ return &bytebase.Error{Code: bytebase.ENOTFOUND, Message: fmt.Sprintf("bookmark ID not found: %d", delete.ID)}+ }++ return nil+}diff --git a/backend/store/migration/0001_init_schema.down.sql b/backend/store/migration/0001_init_schema.down.sqlindex 805403defc..b9fcb9f17a 100644--- a/backend/store/migration/0001_init_schema.down.sql+++ b/backend/store/migration/0001_init_schema.down.sql@@ -1,3 +1,5 @@+DROP TABLE bookmark;+DROP TABLE activity;DROP TABLE issue;diff --git a/backend/store/migration/0001_init_schema.up.sql b/backend/store/migration/0001_init_schema.up.sqlindex bf6623e84f..6ee33a2284 100644--- a/backend/store/migration/0001_init_schema.up.sql+++ b/backend/store/migration/0001_init_schema.up.sql@@ -578,4 +578,38 @@ SETWHERErowid = old.rowid;+END;++-- bookmark table stores the bookmark for the user+CREATE TABLE bookmark (+ id INTEGER PRIMARY KEY AUTOINCREMENT,+ row_status TEXT NOT NULL CHECK (+ row_status IN ('NORMAL', 'ARCHIVED', 'PENDING_DELETE')+ ) DEFAULT 'NORMAL',+ creator_id INTEGER NOT NULL REFERENCES principal (id),+ created_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),+ updater_id INTEGER NOT NULL REFERENCES principal (id),+ updated_ts BIGINT NOT NULL DEFAULT (strftime('%s', 'now')),+ workspace_id INTEGER NOT NULL REFERENCES workspace (id),+ name TEXT NOT NULL,+ link TEXT NOT NULL,+ UNIQUE(workspace_id, creator_id, link)+);++INSERT INTO+ sqlite_sequence (name, seq)+VALUES+ ('bookmark', 1000);++CREATE TRIGGER IF NOT EXISTS `trigger_update_bookmark_modification_time`+AFTER+UPDATE+ ON `bookmark` FOR EACH ROW BEGIN+UPDATE+ `bookmark`+SET+ updated_ts = (strftime('%s', 'now'))+WHERE+ rowid = old.rowid;+END;\ No newline at end of filediff --git a/backend/store/seed/0140_bookmark.sql b/backend/store/seed/0140_bookmark.sqlnew file mode 100644index 0000000000..e69de29bb2diff --git a/backend/store/sqlite.go b/backend/store/sqlite.goindex 7e3eb9e10e..68f902e181 100644--- a/backend/store/sqlite.go+++ b/backend/store/sqlite.go@@ -249,6 +249,8 @@ func FormatError(err error) error {return bytebase.Errorf(bytebase.ECONFLICT, "email already exists")case "UNIQUE constraint failed: environment.name":return bytebase.Errorf(bytebase.ECONFLICT, "name already exists")+ case "UNIQUE constraint failed: bookmark.workspace_id, bookmark.creator_id, bookmark.link":+ return bytebase.Errorf(bytebase.ECONFLICT, "bookmark already exists")default:return err}diff --git a/frontend/src/components/BookmarkListSidePanel.vue b/frontend/src/components/BookmarkListSidePanel.vueindex ec6840834c..961fcf7a1b 100644--- a/frontend/src/components/BookmarkListSidePanel.vue+++ b/frontend/src/components/BookmarkListSidePanel.vue@@ -27,6 +27,7 @@ export default {const currentUser = computed(() => store.getters["auth/currentUser"]());const prepareBookmarkList = () => {+ console.log("prepareBookmarkList");store.dispatch("bookmark/fetchBookmarkListByUser", currentUser.value.id).catch((error) => {diff --git a/frontend/src/main.ts b/frontend/src/main.tsindex 9586327bf1..32be937991 100644--- a/frontend/src/main.ts+++ b/frontend/src/main.ts@@ -105,7 +105,8 @@ axios.interceptors.request.use((request) => {!request.url!.startsWith("/api/instance") &&!request.url!.startsWith("/api/database") &&!request.url!.startsWith("/api/issue") &&- !request.url!.startsWith("/api/activity"))+ !request.url!.startsWith("/api/activity") &&+ !request.url!.startsWith("/api/bookmar"))) {request.url = request.url!.replace("/api", "/mock");}diff --git a/frontend/src/store/modules/bookmark.ts b/frontend/src/store/modules/bookmark.tsindex 3b67955b98..46e7d5da96 100644--- a/frontend/src/store/modules/bookmark.ts+++ b/frontend/src/store/modules/bookmark.ts@@ -6,18 +6,15 @@ import {BookmarkState,ResourceObject,unknown,+ Principal,} from "../../types";function convert(bookmark: ResourceObject, rootGetters: any): Bookmark {- const creator = rootGetters["principal/principalById"](- bookmark.attributes.creatorId- );- const updater = rootGetters["principal/principalById"](- bookmark.attributes.updaterId- );+ const creator = bookmark.attributes.creator as Principal;+ const updater = bookmark.attributes.updater as Principal;return {- ...(bookmark.attributes as Omit<Bookmark, "id" | "creator">),+ ...(bookmark.attributes as Omit<Bookmark, "id" | "creator" | "updater">),id: bookmark.id,creator,updater,