Skip to content

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

fix: do not use upsert for group (#15040)

ecmadaoa7328f49b105
diff --git a/frontend/src/components/User/Settings/CreateGroupDrawer.vue b/frontend/src/components/User/Settings/CreateGroupDrawer.vue
index 1166cb0a79..ecd8735dd9 100644
--- a/frontend/src/components/User/Settings/CreateGroupDrawer.vue
+++ b/frontend/src/components/User/Settings/CreateGroupDrawer.vue
@@ -337,7 +337,11 @@ const tryCreateOrUpdateGroup = async () => {
state.isRequesting = true;
try {
- await groupStore.upsertGroup(validGroup.value);
+ if (isCreating.value) {
+ await groupStore.createGroup(validGroup.value);
+ } else {
+ await groupStore.updateGroup(validGroup.value);
+ }
pushNotification({
module: "bytebase",
style: "SUCCESS",
diff --git a/frontend/src/store/modules/v1/group.ts b/frontend/src/store/modules/v1/group.ts
index 09966e128b..23d10bf881 100644
--- a/frontend/src/store/modules/v1/group.ts
+++ b/frontend/src/store/modules/v1/group.ts
@@ -71,11 +71,20 @@ export const useGroupStore = defineStore("group", () => {
groupMapByName.delete(name);
};
- const upsertGroup = async (group: Group) => {
+ const createGroup = async (group: Group) => {
+ const resp = await groupServiceClient.createGroup({
+ group,
+ groupEmail: extractGroupEmail(group.name),
+ });
+ groupMapByName.set(resp.name, resp);
+ return resp;
+ };
+
+ const updateGroup = async (group: Group) => {
const updated = await groupServiceClient.updateGroup({
group,
updateMask: ["title", "description", "members"],
- allowMissing: true,
+ allowMissing: false,
});
groupMapByName.set(updated.name, updated);
return updated;
@@ -88,6 +97,7 @@ export const useGroupStore = defineStore("group", () => {
getGroupByIdentifier,
getOrFetchGroupByEmail,
deleteGroup,
- upsertGroup,
+ updateGroup,
+ createGroup,
};
});