feat: allow bulk deleting attribution groups for moderators (#6839)

* feat: allow bulk deleting attribution groups for moderators

* prepr
This commit is contained in:
aecsocket
2026-07-24 13:42:36 +00:00
committed by GitHub
parent e58af98f21
commit a6d9bb7b3e
13 changed files with 302 additions and 46 deletions
@@ -65,17 +65,34 @@ export class LabrinthAttributionInternalModule extends AbstractModule {
}
/**
* Delete an attribution group and all files inside it.
* DELETE /_internal/attribution/group/{group_id}
* Delete attribution groups and all files inside them.
* DELETE /_internal/attribution/group
*
* @param groupId - The base62 attribution group id (as returned from listProjectAttribution).
* @param groupIds - The base62 attribution group ids (as returned from listProjectAttribution).
*/
public async deleteGroup(groupId: string): Promise<void> {
const numericId = decodeBase62Id(groupId)
return this.client.request<void>(`/attribution/group/${numericId}`, {
public async deleteGroups(groupIds: string[]): Promise<void> {
const body: Labrinth.Attribution.Internal.DeleteGroupsRequest = { groups: groupIds }
return this.client.request<void>('/attribution/group', {
api: 'labrinth',
version: 'internal',
method: 'DELETE',
body,
})
}
/**
* Delete all attribution groups and files for a project.
* DELETE /_internal/attribution/all-groups
*/
public async deleteAllGroups(projectId: string): Promise<void> {
const body: Labrinth.Attribution.Internal.DeleteAllGroupsRequest = {
project_id: projectId,
}
return this.client.request<void>('/attribution/all-groups', {
api: 'labrinth',
version: 'internal',
method: 'DELETE',
body,
})
}
@@ -397,6 +397,14 @@ export namespace Labrinth {
attribution: AttributionResolution
}
export type DeleteGroupsRequest = {
groups: string[]
}
export type DeleteAllGroupsRequest = {
project_id: string
}
export type AssignRequest = {
sha1: string
target_group_id: number