mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-22 11:05:09 -05:00
United groups to the top Closes #768
This commit is contained in:
@@ -138,13 +138,17 @@ export function uniteGroups({
|
||||
removeCaptainsFromOther,
|
||||
unitedGroupIsRanked,
|
||||
}: UniteGroupsArgs) {
|
||||
const survivingGroupUpdatedTimestamps = {
|
||||
lastActionAt: new Date(),
|
||||
createdAt: new Date(),
|
||||
};
|
||||
|
||||
return db.$transaction([
|
||||
db.lfgGroupMember.updateMany({
|
||||
where: { groupId: otherGroupId },
|
||||
data: {
|
||||
groupId: survivingGroupId,
|
||||
captain: removeCaptainsFromOther ? false : undefined,
|
||||
// TODO: also reset message
|
||||
},
|
||||
}),
|
||||
db.lfgGroup.delete({ where: { id: otherGroupId } }),
|
||||
@@ -157,8 +161,8 @@ export function uniteGroups({
|
||||
where: { id: survivingGroupId },
|
||||
data:
|
||||
typeof unitedGroupIsRanked === "boolean"
|
||||
? { ranked: unitedGroupIsRanked, lastActionAt: new Date() }
|
||||
: { lastActionAt: new Date() },
|
||||
? { ranked: unitedGroupIsRanked, ...survivingGroupUpdatedTimestamps }
|
||||
: survivingGroupUpdatedTimestamps,
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user