mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
fix: moderation/projects endpoint slow (#6639)
* fix: moderation/projects endpoint slow * fix: re-add tech rev toggle off by default * fix: i18n * prepare --------- Co-authored-by: aecsocket <43144841+aecsocket@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,34 @@ export class LabrinthModerationInternalModule extends AbstractModule {
|
||||
return 'labrinth_moderation_internal'
|
||||
}
|
||||
|
||||
public async getProjects(
|
||||
params: Labrinth.Moderation.Internal.ProjectsRequest = {},
|
||||
): Promise<Labrinth.Moderation.Internal.ProjectsResponse> {
|
||||
return this.client.request<Labrinth.Moderation.Internal.ProjectsResponse>(
|
||||
'/moderation/projects',
|
||||
{
|
||||
api: 'labrinth',
|
||||
version: 'internal',
|
||||
method: 'GET',
|
||||
params,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
public async getProjectIds(
|
||||
params: Omit<Labrinth.Moderation.Internal.ProjectsRequest, 'count' | 'offset'> = {},
|
||||
): Promise<Labrinth.Moderation.Internal.ProjectIdsResponse> {
|
||||
return this.client.request<Labrinth.Moderation.Internal.ProjectIdsResponse>(
|
||||
'/moderation/projects/ids',
|
||||
{
|
||||
api: 'labrinth',
|
||||
version: 'internal',
|
||||
method: 'GET',
|
||||
params,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
public async acquireLock(
|
||||
projectId: string,
|
||||
): Promise<Labrinth.Moderation.Internal.LockAcquireResponse> {
|
||||
|
||||
@@ -1914,6 +1914,57 @@ export namespace Labrinth {
|
||||
|
||||
export namespace Moderation {
|
||||
export namespace Internal {
|
||||
export type Ownership =
|
||||
| {
|
||||
kind: 'user'
|
||||
id: string
|
||||
name: string
|
||||
icon_url: string | null
|
||||
}
|
||||
| {
|
||||
kind: 'organization'
|
||||
id: string
|
||||
name: string
|
||||
icon_url: string | null
|
||||
}
|
||||
|
||||
export type ProjectsSort = 'oldest' | 'newest' | 'most_external_deps' | 'least_external_deps'
|
||||
|
||||
export type ProjectsRequest = {
|
||||
count?: number
|
||||
offset?: number
|
||||
has_external_dependencies?: boolean
|
||||
exclude_technical_review?: boolean
|
||||
query?: string
|
||||
project_type?: string
|
||||
sort?: ProjectsSort
|
||||
}
|
||||
|
||||
export type QueueProject = {
|
||||
id: string
|
||||
slug: string | null
|
||||
name: string
|
||||
summary: string
|
||||
icon_url: string | null
|
||||
status: Projects.v2.ProjectStatus
|
||||
requested_status: Projects.v2.ProjectStatus | null
|
||||
queued: string | null
|
||||
published: string
|
||||
updated: string
|
||||
project_types: string[]
|
||||
ownership: Ownership
|
||||
external_dependencies_count: number
|
||||
}
|
||||
|
||||
export type ProjectsResponse = {
|
||||
total: number
|
||||
projects: QueueProject[]
|
||||
}
|
||||
|
||||
export type ProjectIdsResponse = {
|
||||
ids: string[]
|
||||
}
|
||||
|
||||
export type LockedByUser = {
|
||||
id: string
|
||||
username: string
|
||||
|
||||
Reference in New Issue
Block a user