Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Remove UserId type and change PrincipalId type from string to number
天舟15fbd74ea6f1
diff --git a/frontend/src/components/DatabaseListSidePanel.vue b/frontend/src/components/DatabaseListSidePanel.vueindex bef2a9047c..7fe53e4462 100644--- a/frontend/src/components/DatabaseListSidePanel.vue+++ b/frontend/src/components/DatabaseListSidePanel.vue@@ -42,7 +42,7 @@ export default {// Use this to make the list reactive when project is transferred.const databaseList = computed((): Database[] => {- return store.getters["database/databaseListByUserId"](+ return store.getters["database/databaseListByPrincipalId"](currentUser.value.id);});diff --git a/frontend/src/components/DatabaseSelect.vue b/frontend/src/components/DatabaseSelect.vueindex 42048ab715..29c0fbc304 100644--- a/frontend/src/components/DatabaseSelect.vue+++ b/frontend/src/components/DatabaseSelect.vue@@ -124,7 +124,7 @@ export default {props.instanceId);} else if (props.mode == "USER") {- list = store.getters["database/databaseListByUserId"](+ list = store.getters["database/databaseListByPrincipalId"](currentUser.value.id);if (diff --git a/frontend/src/store/modules/activity.ts b/frontend/src/store/modules/activity.tsindex 42329fae46..715ad9e5dc 100644--- a/frontend/src/store/modules/activity.ts+++ b/frontend/src/store/modules/activity.ts@@ -1,6 +1,6 @@import axios from "axios";import {- UserId,+ PrincipalId,IssueId,ActivityId,Activity,@@ -33,7 +33,7 @@ const state: () => ActivityState = () => ({const getters = {activityListByUser: (state: ActivityState) => (- userId: UserId+ userId: PrincipalId): Activity[] => {return state.activityListByUser.get(userId) || [];},@@ -45,7 +45,10 @@ const getters = {};const actions = {- async fetchActivityListForUser({ commit, rootGetters }: any, userId: UserId) {+ async fetchActivityListForUser(+ { commit, rootGetters }: any,+ userId: PrincipalId+ ) {const activityList = (await axios.get(`/api/activity`)).data.data.map((activity: ResourceObject) => {return convert(activity, rootGetters);@@ -143,7 +146,7 @@ const mutations = {userId,activityList,}: {- userId: UserId;+ userId: PrincipalId;activityList: Activity[];}) {@@ -156,7 +159,7 @@ const mutations = {issueId,activityList,}: {- issueId: UserId;+ issueId: PrincipalId;activityList: Activity[];}) {diff --git a/frontend/src/store/modules/bookmark.ts b/frontend/src/store/modules/bookmark.tsindex c255086c99..f5f552f22b 100644--- a/frontend/src/store/modules/bookmark.ts+++ b/frontend/src/store/modules/bookmark.ts@@ -1,6 +1,6 @@import axios from "axios";import {- UserId,+ PrincipalId,Bookmark,BookmarkNew,BookmarkState,@@ -30,12 +30,12 @@ const state: () => BookmarkState = () => ({const getters = {bookmarkListByUser: (state: BookmarkState) => (- userId: UserId+ userId: PrincipalId): Bookmark[] => {return state.bookmarkListByUser.get(userId) || [];},bookmarkByUserAndLink: (state: BookmarkState, getters: any) => (- userId: UserId,+ userId: PrincipalId,link: string): Bookmark => {const list = getters["bookmarkListByUser"](userId);@@ -47,13 +47,16 @@ const getters = {};const actions = {- async fetchBookmarkListByUser({ commit, rootGetters }: any, userId: UserId) {+ async fetchBookmarkListByUser(+ { commit, rootGetters }: any,+ userId: PrincipalId+ ) {const bookmarkList = (await axios.get(`/api/bookmark?user=${userId}`)).data.data.map((bookmark: ResourceObject) => {return convert(bookmark, rootGetters);});- commit("setBookmarkListByUserId", { userId, bookmarkList });+ commit("setBookmarkListByPrincipalId", { userId, bookmarkList });return bookmarkList;},@@ -83,13 +86,13 @@ const actions = {};const mutations = {- setBookmarkListByUserId(+ setBookmarkListByPrincipalId(state: BookmarkState,{userId,bookmarkList,}: {- userId: UserId;+ userId: PrincipalId;bookmarkList: Bookmark[];}) {diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.tsindex c088ea8a18..6079dd5419 100644--- a/frontend/src/store/modules/database.ts+++ b/frontend/src/store/modules/database.ts@@ -1,6 +1,6 @@import axios from "axios";import {- UserId,+ PrincipalId,Database,DatabaseNew,DatabaseId,@@ -112,8 +112,8 @@ const getters = {return state.databaseListByInstanceId.get(instanceId) || [];},- databaseListByUserId: (state: DatabaseState) => (- userId: UserId+ databaseListByPrincipalId: (state: DatabaseState) => (+ userId: PrincipalId): Database[] => {const list: Database[] = [];for (let [_, databaseList] of state.databaseListByInstanceId) {@@ -242,7 +242,10 @@ const actions = {return databaseList;},- async fetchDatabaseListByUser({ commit, rootGetters }: any, userId: UserId) {+ async fetchDatabaseListByUser(+ { commit, rootGetters }: any,+ userId: PrincipalId+ ) {const data = (await axios.get(`/api/database?user=${userId}&include=instance,project,project.projectMember`diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.tsindex b988737602..02cb4c8e47 100644--- a/frontend/src/store/modules/issue.ts+++ b/frontend/src/store/modules/issue.ts@@ -1,6 +1,6 @@import axios from "axios";import {- UserId,+ PrincipalId,IssueId,Issue,IssueNew,@@ -91,7 +91,7 @@ const state: () => IssueState = () => ({});const getters = {- issueListByUser: (state: IssueState) => (userId: UserId) => {+ issueListByUser: (state: IssueState) => (userId: PrincipalId) => {return state.issueListByUser.get(userId) || [];},@@ -105,7 +105,10 @@ const getters = {};const actions = {- async fetchIssueListForUser({ commit, rootGetters }: any, userId: UserId) {+ async fetchIssueListForUser(+ { commit, rootGetters }: any,+ userId: PrincipalId+ ) {const data = (await axios.get(`/api/issue?user=${userId}&include=project,pipeline,pipeline.stage,pipeline.task`@@ -243,7 +246,7 @@ const mutations = {userId,issueList,}: {- userId: UserId;+ userId: PrincipalId;issueList: Issue[];}) {diff --git a/frontend/src/store/modules/message.ts b/frontend/src/store/modules/message.tsindex 195a0d5945..b396743b6f 100644--- a/frontend/src/store/modules/message.ts+++ b/frontend/src/store/modules/message.ts@@ -1,6 +1,6 @@import axios from "axios";import {- UserId,+ PrincipalId,MessageId,Message,MessageNew,@@ -39,13 +39,18 @@ const state: () => MessageState = () => ({});const getters = {- messageListByUser: (state: MessageState) => (userId: UserId): Message[] => {+ messageListByUser: (state: MessageState) => (+ userId: PrincipalId+ ): Message[] => {return state.messageListByUser.get(userId) || [];},};const actions = {- async fetchMessageListByUser({ commit, rootGetters }: any, userId: UserId) {+ async fetchMessageListByUser(+ { commit, rootGetters }: any,+ userId: PrincipalId+ ) {const messageList = (await axios.get(`/api/message?user=${userId}`)).data.data.map((message: ResourceObject) => {@@ -88,7 +93,7 @@ const mutations = {userId,messageList,}: {- userId: UserId;+ userId: PrincipalId;messageList: Message[];}) {diff --git a/frontend/src/store/modules/project.ts b/frontend/src/store/modules/project.tsindex 50f688efc0..7b9922631b 100644--- a/frontend/src/store/modules/project.ts+++ b/frontend/src/store/modules/project.ts@@ -1,6 +1,6 @@import axios from "axios";import {- UserId,+ PrincipalId,ProjectId,Project,ProjectNew,@@ -116,7 +116,7 @@ const getters = {},projectListByUser: (state: ProjectState) => (- userId: UserId,+ userId: PrincipalId,rowStatusList?: RowStatus[]): Project[] => {const result: Project[] = [];@@ -163,7 +163,7 @@ const actions = {userId,rowStatusList,}: {- userId: UserId;+ userId: PrincipalId;rowStatusList?: RowStatus[];}) {diff --git a/frontend/src/types/id.ts b/frontend/src/types/id.tsindex 1e6f476351..391cb1cde4 100644--- a/frontend/src/types/id.ts+++ b/frontend/src/types/id.ts@@ -3,10 +3,7 @@export type ExecutionId = string;-export type UserId = string;--// For now, Principal is equal to UserId, in the future it may contain other id such as application, bot etc.-export type PrincipalId = UserId;+export type PrincipalId = number;export type MemberId = string;diff --git a/frontend/src/types/store.ts b/frontend/src/types/store.tsindex a07b5d54d9..e30ecf7ddb 100644--- a/frontend/src/types/store.ts+++ b/frontend/src/types/store.ts@@ -10,7 +10,7 @@ import {InstanceId,IssueId,ProjectId,- UserId,+ PrincipalId,} from "./id";import { Instance } from "./instance";import { Issue } from "./issue";@@ -38,23 +38,23 @@ export interface PrincipalState {}export interface BookmarkState {- bookmarkListByUser: Map<UserId, Bookmark[]>;+ bookmarkListByUser: Map<PrincipalId, Bookmark[]>;}export interface ActivityState {- activityListByUser: Map<UserId, Activity[]>;+ activityListByUser: Map<PrincipalId, Activity[]>;activityListByIssue: Map<IssueId, Activity[]>;}export interface MessageState {- messageListByUser: Map<UserId, Message[]>;+ messageListByUser: Map<PrincipalId, Message[]>;}export interface IssueState {// [NOTE] This is only used by the issue list view. We don't// update the entry here if any issue is changed (the updated issue only gets updated in issueById).// Instead, we always fetch the list every time we display the issue list view.- issueListByUser: Map<UserId, Issue[]>;+ issueListByUser: Map<PrincipalId, Issue[]>;issueById: Map<IssueId, Issue>;}