Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Repoint mock api from /api to /mock

天舟83f4abac7f26
diff --git a/frontend/src/miragejs/routes/index.js b/frontend/src/miragejs/routes/index.js
index 14a9b807d3..cf7bc1b78e 100644
--- a/frontend/src/miragejs/routes/index.js
+++ b/frontend/src/miragejs/routes/index.js
@@ -28,11 +28,11 @@ export default function routes() {
// By default development environment has a 400ms delay.
this.timing = 0;
- this.namespace = "api";
+ this.namespace = "mock";
// Ping
this.get("/ping", function () {
- return new Response(200, {}, "pong");
+ return new Response(200, {}, "pong from mirage mock");
});
// Principal
diff --git a/frontend/src/store/modules/activity.ts b/frontend/src/store/modules/activity.ts
index 42329fae46..820b1a4c93 100644
--- a/frontend/src/store/modules/activity.ts
+++ b/frontend/src/store/modules/activity.ts
@@ -46,7 +46,7 @@ const getters = {
const actions = {
async fetchActivityListForUser({ commit, rootGetters }: any, userId: UserId) {
- const activityList = (await axios.get(`/api/activity`)).data.data.map(
+ const activityList = (await axios.get(`/mock/activity`)).data.data.map(
(activity: ResourceObject) => {
return convert(activity, rootGetters);
}
@@ -61,7 +61,7 @@ const actions = {
issueId: IssueId
) {
const activityList = (
- await axios.get(`/api/activity?container=${issueId}`)
+ await axios.get(`/mock/activity?container=${issueId}`)
).data.data.map((activity: ResourceObject) => {
return convert(activity, rootGetters);
});
@@ -76,7 +76,7 @@ const actions = {
) {
const createdActivity: Activity = convert(
(
- await axios.post(`/api/activity`, {
+ await axios.post(`/mock/activity`, {
data: {
type: "activitynew",
attributes: newActivity,
@@ -112,7 +112,7 @@ const actions = {
};
const updatedActivity = convert(
(
- await axios.patch(`/api/activity/${activityId}`, {
+ await axios.patch(`/mock/activity/${activityId}`, {
data: {
type: "activitypatch",
attributes: activityPatch,
@@ -128,7 +128,7 @@ const actions = {
},
async deleteActivity({ dispatch }: any, activity: Activity) {
- await axios.delete(`/api/activity/${activity.id}`);
+ await axios.delete(`/mock/activity/${activity.id}`);
if (activity.actionType.startsWith("bb.issue.")) {
dispatch("fetchActivityListForIssue", activity.containerId);
diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.ts
index d3066b9798..26ad8468ac 100644
--- a/frontend/src/store/modules/auth.ts
+++ b/frontend/src/store/modules/auth.ts
@@ -42,7 +42,7 @@ const actions = {
async login({ commit, rootGetters }: any, loginInfo: LoginInfo) {
const loggedInUser = convert(
(
- await axios.post("/api/auth/login", {
+ await axios.post("/mock/auth/login", {
data: { type: "loginInfo", attributes: loginInfo },
})
).data.data,
@@ -56,7 +56,7 @@ const actions = {
async signup({ commit, dispatch, rootGetters }: any, signupInfo: SignupInfo) {
const newUser = (
- await axios.post("/api/auth/signup", {
+ await axios.post("/mock/auth/signup", {
data: { type: "signupInfo", attributes: signupInfo },
})
).data.data;
@@ -78,7 +78,7 @@ const actions = {
activateInfo: ActivateInfo
) {
const activatedUser = (
- await axios.post("/api/auth/activate", {
+ await axios.post("/mock/auth/activate", {
data: { type: "activateInfo", attributes: activateInfo },
})
).data.data;
diff --git a/frontend/src/store/modules/bookmark.ts b/frontend/src/store/modules/bookmark.ts
index c255086c99..ed13ff47e1 100644
--- a/frontend/src/store/modules/bookmark.ts
+++ b/frontend/src/store/modules/bookmark.ts
@@ -49,7 +49,7 @@ const getters = {
const actions = {
async fetchBookmarkListByUser({ commit, rootGetters }: any, userId: UserId) {
const bookmarkList = (
- await axios.get(`/api/bookmark?user=${userId}`)
+ await axios.get(`/mock/bookmark?user=${userId}`)
).data.data.map((bookmark: ResourceObject) => {
return convert(bookmark, rootGetters);
});
@@ -60,7 +60,7 @@ const actions = {
async createBookmark({ commit, rootGetters }: any, newBookmark: BookmarkNew) {
const createdBookmark = convert(
(
- await axios.post(`/api/bookmark`, {
+ await axios.post(`/mock/bookmark`, {
data: {
type: "bookmark",
attributes: newBookmark,
@@ -76,7 +76,7 @@ const actions = {
},
async deleteBookmark({ commit }: any, bookmark: Bookmark) {
- await axios.delete(`/api/bookmark/${bookmark.id}`);
+ await axios.delete(`/mock/bookmark/${bookmark.id}`);
commit("deleteBookmark", bookmark);
},
diff --git a/frontend/src/store/modules/dataSource.ts b/frontend/src/store/modules/dataSource.ts
index f2dc48dfaa..f54a2c0986 100644
--- a/frontend/src/store/modules/dataSource.ts
+++ b/frontend/src/store/modules/dataSource.ts
@@ -114,7 +114,7 @@ const actions = {
) {
const data = (
await axios.get(
- `/api/database/${databaseId}/datasource/${dataSourceId}?include=database,instance`
+ `/mock/database/${databaseId}/datasource/${dataSourceId}?include=database,instance`
)
).data;
const dataSource = convert(data.data, data.included, rootGetters);
@@ -133,7 +133,7 @@ const actions = {
) {
const data = (
await axios.post(
- `/api/database/${newDataSource.databaseId}/datasource?include=database,instance`,
+ `/mock/database/${newDataSource.databaseId}/datasource?include=database,instance`,
{
data: {
type: "dataSourcenew",
@@ -173,7 +173,7 @@ const actions = {
) {
const data = (
await axios.patch(
- `/api/database/${databaseId}/datasource/${dataSourceId}?include=database,instance`,
+ `/mock/database/${databaseId}/datasource/${dataSourceId}?include=database,instance`,
{
data: {
type: "data-source-patch",
@@ -203,7 +203,7 @@ const actions = {
}: { databaseId: DatabaseId; dataSourceId: DataSourceId }
) {
await axios.delete(
- `/api/database/${databaseId}/datasource/${dataSourceId}`
+ `/mock/database/${databaseId}/datasource/${dataSourceId}`
);
commit("deleteDataSourceById", dataSourceId);
@@ -226,7 +226,7 @@ const actions = {
) {
const data = (
await axios.post(
- `/api/database/${databaseId}/datasource/${dataSourceId}/member?include=database,instance`,
+ `/mock/database/${databaseId}/datasource/${dataSourceId}/member?include=database,instance`,
{
data: {
type: "dataSourceMember",
@@ -263,7 +263,7 @@ const actions = {
) {
const data = (
await axios.delete(
- `/api/database/${databaseId}/datasource/${dataSourceId}/member/${memberId}?include=database,instance`
+ `/mock/database/${databaseId}/datasource/${dataSourceId}/member/${memberId}?include=database,instance`
)
).data;
// It's patching the data source and returns the updated data source
diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.ts
index c088ea8a18..ce18ce25d4 100644
--- a/frontend/src/store/modules/database.ts
+++ b/frontend/src/store/modules/database.ts
@@ -194,7 +194,7 @@ const actions = {
// return it unconditionally.
const data = (
await axios.get(
- `/api/database?include=instance,project,project.projectMember`
+ `/mock/database?include=instance,project,project.projectMember`
)
).data;
const databaseList = data.data.map((database: ResourceObject) => {
@@ -212,7 +212,7 @@ const actions = {
) {
const data = (
await axios.get(
- `/api/database?instance=${instanceId}&include=instance,project,project.projectMember`
+ `/mock/database?instance=${instanceId}&include=instance,project,project.projectMember`
)
).data;
const databaseList = data.data.map((database: ResourceObject) => {
@@ -230,7 +230,7 @@ const actions = {
) {
const data = (
await axios.get(
- `/api/database?project=${projectId}&include=instance,project,project.projectMember`
+ `/mock/database?project=${projectId}&include=instance,project,project.projectMember`
)
).data;
const databaseList = data.data.map((database: ResourceObject) => {
@@ -245,7 +245,7 @@ const actions = {
async fetchDatabaseListByUser({ commit, rootGetters }: any, userId: UserId) {
const data = (
await axios.get(
- `/api/database?user=${userId}&include=instance,project,project.projectMember`
+ `/mock/database?user=${userId}&include=instance,project,project.projectMember`
)
).data;
const databaseList = data.data.map((database: ResourceObject) => {
@@ -265,7 +265,7 @@ const actions = {
// database of this particular environment.
const data = (
await axios.get(
- `/api/database?environment=${environmentId}&include=instance,project,project.projectMember`
+ `/mock/database?environment=${environmentId}&include=instance,project,project.projectMember`
)
).data;
const databaseList = data.data.map((database: ResourceObject) => {
@@ -285,8 +285,8 @@ const actions = {
}: { databaseId: DatabaseId; instanceId?: InstanceId }
) {
const url = instanceId
- ? `/api/instance/${instanceId}/database/${databaseId}?include=instance,project,project.projectMember,dataSource`
- : `/api/database/${databaseId}?include=instance,project,project.projectMember,dataSource`;
+ ? `/mock/instance/${instanceId}/database/${databaseId}?include=instance,project,project.projectMember,dataSource`
+ : `/mock/database/${databaseId}?include=instance,project,project.projectMember,dataSource`;
const data = (await axios.get(url)).data;
const database = convert(data.data, data.included, rootGetters);
@@ -300,7 +300,7 @@ const actions = {
async createDatabase({ commit, rootGetters }: any, newDatabase: DatabaseNew) {
const data = (
await axios.post(
- `/api/database?include=instance,project,project.projectMember`,
+ `/mock/database?include=instance,project,project.projectMember`,
{
data: {
type: "databasenew",
@@ -338,7 +338,7 @@ const actions = {
) {
const data = (
await axios.patch(
- `/api/database/${databaseId}?include=instance,project,project.projectMember`,
+ `/mock/database/${databaseId}?include=instance,project,project.projectMember`,
{
data: {
type: "databasepatch",
diff --git a/frontend/src/store/modules/environment.ts b/frontend/src/store/modules/environment.ts
index 300bbcbeb5..d0764dd0a0 100644
--- a/frontend/src/store/modules/environment.ts
+++ b/frontend/src/store/modules/environment.ts
@@ -67,7 +67,7 @@ const actions = {
rowStatusList?: RowStatus[]
) {
const path =
- "/api/environment" +
+ "/mock/environment" +
(rowStatusList ? "?rowstatus=" + rowStatusList.join(",") : "");
const environmentList = (await axios.get(path)).data.data.map(
(env: ResourceObject) => {
@@ -86,7 +86,7 @@ const actions = {
) {
const createdEnvironment = convert(
(
- await axios.post(`/api/environment`, {
+ await axios.post(`/mock/environment`, {
data: {
type: "environment",
attributes: newEnvironment,
@@ -118,7 +118,7 @@ const actions = {
rowValueList: orderedEnvironmentList.map((_, index) => [index]),
};
const environmentList = (
- await axios.patch(`/api/environment/batch`, {
+ await axios.patch(`/mock/environment/batch`, {
data: {
attributes: batchUpdate,
type: "batchupdate",
@@ -145,7 +145,7 @@ const actions = {
) {
const updatedEnvironment = convert(
(
- await axios.patch(`/api/environment/${environmentId}`, {
+ await axios.patch(`/mock/environment/${environmentId}`, {
data: {
type: "environmentpatch",
attributes: environmentPatch,
@@ -164,7 +164,7 @@ const actions = {
{ commit }: { state: EnvironmentState; commit: any },
id: EnvironmentId
) {
- await axios.delete(`/api/environment/${id}`);
+ await axios.delete(`/mock/environment/${id}`);
commit("deleteEnvironmentById", id);
},
diff --git a/frontend/src/store/modules/instance.ts b/frontend/src/store/modules/instance.ts
index 3ee59ee896..91f564b00f 100644
--- a/frontend/src/store/modules/instance.ts
+++ b/frontend/src/store/modules/instance.ts
@@ -126,7 +126,7 @@ const actions = {
rowStatusList?: RowStatus[]
) {
const path =
- "/api/instance" +
+ "/mock/instance" +
(rowStatusList ? "?rowstatus=" + rowStatusList.join(",") : "");
const data = (await axios.get(path)).data;
const instanceList = data.data.map((instance: ResourceObject) => {
@@ -145,7 +145,7 @@ const actions = {
// Data source contains sensitive info such as username, password so
// we only fetch if requesting the specific instance id
const data = (
- await axios.get(`/api/instance/${instanceId}?include=dataSource`)
+ await axios.get(`/mock/instance/${instanceId}?include=dataSource`)
).data;
const instance = convert(data.data, data.included, rootGetters);
@@ -158,7 +158,7 @@ const actions = {
async createInstance({ commit, rootGetters }: any, newInstance: InstanceNew) {
const data = (
- await axios.post(`/api/instance?include=dataSource`, {
+ await axios.post(`/mock/instance?include=dataSource`, {
data: {
type: "instancenew",
attributes: newInstance,
@@ -186,7 +186,7 @@ const actions = {
}
) {
const data = (
- await axios.patch(`/api/instance/${instanceId}?include=dataSource`, {
+ await axios.patch(`/mock/instance/${instanceId}?include=dataSource`, {
data: {
type: "instancepatch",
attributes: instancePatch,
@@ -207,7 +207,7 @@ const actions = {
{ commit }: { state: InstanceState; commit: any },
instanceId: InstanceId
) {
- await axios.delete(`/api/instance/${instanceId}`);
+ await axios.delete(`/mock/instance/${instanceId}`);
commit("deleteInstanceById", instanceId);
},
diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.ts
index 5306ca349f..110ebefb75 100644
--- a/frontend/src/store/modules/issue.ts
+++ b/frontend/src/store/modules/issue.ts
@@ -108,7 +108,7 @@ const actions = {
async fetchIssueListForUser({ commit, rootGetters }: any, userId: UserId) {
const data = (
await axios.get(
- `/api/issue?user=${userId}&include=project,pipeline,pipeline.stage,pipeline.task`
+ `/mock/issue?user=${userId}&include=project,pipeline,pipeline.stage,pipeline.task`
)
).data;
const issueList = data.data.map((issue: ResourceObject) => {
@@ -123,7 +123,7 @@ const actions = {
async fetchIssueListForProject({ rootGetters }: any, projectId: ProjectId) {
const data = (
await axios.get(
- `/api/issue?project=${projectId}&include=project,pipeline,pipeline.stage,pipeline.task`
+ `/mock/issue?project=${projectId}&include=project,pipeline,pipeline.stage,pipeline.task`
)
).data;
const issueList = data.data.map((issue: ResourceObject) => {
@@ -137,7 +137,7 @@ const actions = {
async fetchIssueById({ commit, rootGetters }: any, issueId: IssueId) {
const data = (
await axios.get(
- `/api/issue/${issueId}?include=project,pipeline,pipeline.stage,pipeline.task`
+ `/mock/issue/${issueId}?include=project,pipeline,pipeline.stage,pipeline.task`
)
).data;
const issue = convert(data.data, data.included, rootGetters);
@@ -151,7 +151,7 @@ const actions = {
async createIssue({ commit, rootGetters }: any, newIssue: IssueNew) {
const data = (
await axios.post(
- `/api/issue?include=project,pipeline,pipeline.stage,pipeline.task`,
+ `/mock/issue?include=project,pipeline,pipeline.stage,pipeline.task`,
{
data: {
type: "issuenew",
@@ -182,7 +182,7 @@ const actions = {
) {
const data = (
await axios.patch(
- `/api/issue/${issueId}?include=project,pipeline,pipeline.stage,pipeline.task`,
+ `/mock/issue/${issueId}?include=project,pipeline,pipeline.stage,pipeline.task`,
{
data: {
type: "issuepatch",
@@ -215,7 +215,7 @@ const actions = {
) {
const data = (
await axios.patch(
- `/api/issue/${issueId}/status?include=project,pipeline,pipeline.stage,pipeline.task`,
+ `/mock/issue/${issueId}/status?include=project,pipeline,pipeline.stage,pipeline.task`,
{
data: {
type: "issuestatuspatch",
diff --git a/frontend/src/store/modules/member.ts b/frontend/src/store/modules/member.ts
index b5b1aec0e4..54b53f0306 100644
--- a/frontend/src/store/modules/member.ts
+++ b/frontend/src/store/modules/member.ts
@@ -49,7 +49,7 @@ const getters = {
const actions = {
async fetchMemberList({ commit, rootGetters }: any) {
- const memberList = (await axios.get(`/api/member`)).data.data.map(
+ const memberList = (await axios.get(`/mock/member`)).data.data.map(
(member: ResourceObject) => {
return convert(member, rootGetters);
}
@@ -63,7 +63,7 @@ const actions = {
async createdMember({ commit, rootGetters }: any, newMember: MemberNew) {
const createdMember = convert(
(
- await axios.post(`/api/member`, {
+ await axios.post(`/mock/member`, {
data: {
type: "membernew",
attributes: newMember,
@@ -84,7 +84,7 @@ const actions = {
) {
const updatedMember = convert(
(
- await axios.patch(`/api/member/${id}`, {
+ await axios.patch(`/mock/member/${id}`, {
data: {
type: "memberpatch",
attributes: memberPatch,
@@ -103,7 +103,7 @@ const actions = {
{ state, commit }: { state: MemberState; commit: any },
id: MemberId
) {
- await axios.delete(`/api/member/${id}`);
+ await axios.delete(`/mock/member/${id}`);
const newList = state.memberList.filter((item: Member) => {
return item.id != id;
diff --git a/frontend/src/store/modules/message.ts b/frontend/src/store/modules/message.ts
index 195a0d5945..f25f34b720 100644
--- a/frontend/src/store/modules/message.ts
+++ b/frontend/src/store/modules/message.ts
@@ -47,7 +47,7 @@ const getters = {
const actions = {
async fetchMessageListByUser({ commit, rootGetters }: any, userId: UserId) {
const messageList = (
- await axios.get(`/api/message?user=${userId}`)
+ await axios.get(`/mock/message?user=${userId}`)
).data.data.map((message: ResourceObject) => {
return convert(message, rootGetters);
});
@@ -65,7 +65,7 @@ const actions = {
) {
const updatedMessage = convert(
(
- await axios.patch(`/api/message/${messageId}`, {
+ await axios.patch(`/mock/message/${messageId}`, {
data: {
type: "messagepatch",
attributes: messagePatch,
diff --git a/frontend/src/store/modules/pipeline.ts b/frontend/src/store/modules/pipeline.ts
index d6c9c3e2e0..1ebfbc3400 100644
--- a/frontend/src/store/modules/pipeline.ts
+++ b/frontend/src/store/modules/pipeline.ts
@@ -86,7 +86,7 @@ const getters = {
}
) {
const data = (
- await axios.patch(`/api/pipeline/${pipelineId}/status`, {
+ await axios.patch(`/mock/pipeline/${pipelineId}/status`, {
data: {
type: "pipelinestatuspatch",
attributes: pipelineStatusPatch,
diff --git a/frontend/src/store/modules/principal.ts b/frontend/src/store/modules/principal.ts
index 361535f508..ccbac782e4 100644
--- a/frontend/src/store/modules/principal.ts
+++ b/frontend/src/store/modules/principal.ts
@@ -72,7 +72,7 @@ const getters = {
const actions = {
async fetchPrincipalList({ state, commit, rootGetters }: any) {
- const userList: ResourceObject[] = (await axios.get(`/api/principal`)).data
+ const userList: ResourceObject[] = (await axios.get(`/mock/principal`)).data
.data;
// Dealing with bootstraping here. The system bot is the first user and we
@@ -101,7 +101,7 @@ const actions = {
principalId: PrincipalId
) {
const principal = convert(
- (await axios.get(`/api/principal/${principalId}`)).data.data,
+ (await axios.get(`/mock/principal/${principalId}`)).data.data,
rootGetters
);
@@ -117,7 +117,7 @@ const actions = {
) {
const createdPrincipal = convert(
(
- await axios.post(`/api/principal`, {
+ await axios.post(`/mock/principal`, {
data: {
type: "principalnew",
attributes: {
@@ -149,7 +149,7 @@ const actions = {
) {
const updatedPrincipal = convert(
(
- await axios.patch(`/api/principal/${principalId}`, {
+ await axios.patch(`/mock/principal/${principalId}`, {
data: {
type: "principalpatch",
attributes: principalPatch,
diff --git a/frontend/src/store/modules/project.ts b/frontend/src/store/modules/project.ts
index 50f688efc0..ddbccf8e32 100644
--- a/frontend/src/store/modules/project.ts
+++ b/frontend/src/store/modules/project.ts
@@ -148,7 +148,7 @@ const getters = {
const actions = {
async fetchProjectList({ commit, rootGetters }: any) {
- const data = (await axios.get(`/api/project?include=projectMember`)).data;
+ const data = (await axios.get(`/mock/project?include=projectMember`)).data;
const projectList = data.data.map((project: ResourceObject) => {
return convert(project, data.included, rootGetters);
});
@@ -168,7 +168,7 @@ const actions = {
}
) {
const path =
- `/api/project?user=${userId}` +
+ `/mock/project?user=${userId}` +
(rowStatusList ? "&rowstatus=" + rowStatusList.join(",") : "");
const data = (await axios.get(`${path}&include=projectMember`)).data;
const projectList = data.data.map((project: ResourceObject) => {
@@ -181,7 +181,7 @@ const actions = {
async fetchProjectById({ commit, rootGetters }: any, projectId: ProjectId) {
const data = (
- await axios.get(`/api/project/${projectId}?include=projectMember`)
+ await axios.get(`/mock/project/${projectId}?include=projectMember`)
).data;
const project = convert(data.data, data.included, rootGetters);
@@ -194,7 +194,7 @@ const actions = {
async createProject({ commit, rootGetters }: any, newProject: ProjectNew) {
const data = (
- await axios.post(`/api/project?include=projectMember`, {
+ await axios.post(`/mock/project?include=projectMember`, {
data: {
type: "projectnew",
attributes: newProject,
@@ -222,7 +222,7 @@ const actions = {
}
) {
const data = (
- await axios.patch(`/api/project/${projectId}?include=projectMember`, {
+ await axios.patch(`/mock/project/${projectId}?include=projectMember`, {
data: {
type: "projectpatch",
attributes: projectPatch,
@@ -251,7 +251,7 @@ const actions = {
projectMember: ProjectMemberNew;
}
) {
- await axios.post(`/api/project/${projectId}/member`, {
+ await axios.post(`/mock/project/${projectId}/member`, {
data: {
type: "projectmembernew",
attributes: projectMember,
@@ -275,7 +275,7 @@ const actions = {
projectMemberPatch: ProjectMemberPatch;
}
) {
- await axios.patch(`/api/project/${projectId}/member/${memberId}`, {
+ await axios.patch(`/mock/project/${projectId}/member/${memberId}`, {
data: {
type: "projectmemberpatch",
attributes: projectMemberPatch,
@@ -288,7 +288,9 @@ const actions = {
},
async deleteMember({ dispatch }: any, member: ProjectMember) {
- await axios.delete(`/api/project/${member.project.id}/member/${member.id}`);
+ await axios.delete(
+ `/mock/project/${member.project.id}/member/${member.id}`
+ );
const updatedProject = await dispatch(
"fetchProjectById",
diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.ts
index 5fa80cb866..ffbd1242ed 100644
--- a/frontend/src/store/modules/task.ts
+++ b/frontend/src/store/modules/task.ts
@@ -90,7 +90,7 @@ const actions = {
) {
// TODO: Returns the updated pipeline and update the issue.
const data = (
- await axios.patch(`/api/pipeline/${pipelineId}/task/${taskId}/status`, {
+ await axios.patch(`/mock/pipeline/${pipelineId}/task/${taskId}/status`, {
data: {
type: "taskstatuspatch",
attributes: taskStatusPatch,