mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-28 06:08:13 -05:00
Delete also map pool maps when group is deleted
This commit is contained in:
@@ -18,6 +18,11 @@ const deleteGroupStm = sql.prepare(/* sql */ `
|
||||
where "Group"."id" = @groupId
|
||||
`);
|
||||
|
||||
const deleteGroupMapsStm = sql.prepare(/* sql */ `
|
||||
delete from "MapPoolMap"
|
||||
where "groupId" = @groupId
|
||||
`);
|
||||
|
||||
export const leaveGroup = sql.transaction(
|
||||
({
|
||||
groupId,
|
||||
@@ -40,6 +45,7 @@ export const leaveGroup = sql.transaction(
|
||||
deleteGroupMemberStm.run({ groupId, userId });
|
||||
} else {
|
||||
deleteGroupStm.run({ groupId });
|
||||
deleteGroupMapsStm.run({ groupId });
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,6 +5,11 @@ const deleteGroupStm = sql.prepare(/* sql */ `
|
||||
where "Group"."id" = @groupId
|
||||
`);
|
||||
|
||||
const deleteGroupMapsStm = sql.prepare(/* sql */ `
|
||||
delete from "MapPoolMap"
|
||||
where "groupId" = @groupId
|
||||
`);
|
||||
|
||||
const addGroupMemberStm = sql.prepare(/* sql */ `
|
||||
insert into "GroupMember" ("groupId", "userId", "role")
|
||||
values (@groupId, @userId, @role)
|
||||
@@ -27,6 +32,7 @@ export const morphGroups = sql.transaction(
|
||||
newMembers: number[];
|
||||
}) => {
|
||||
deleteGroupStm.run({ groupId: otherGroupId });
|
||||
deleteGroupMapsStm.run({ groupId: otherGroupId });
|
||||
|
||||
deleteLikesStm.run({ groupId: survivingGroupId });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user