feat: Instance grouping and user count

This commit is contained in:
2026-06-28 03:49:50 +07:00
parent 2dd6931425
commit 387fa18927
11 changed files with 281 additions and 25 deletions
+20
View File
@@ -8,12 +8,14 @@ import type {
User,
CurrentUser,
LimitedUserFriend,
Instance as SdkInstance,
} from "vrchat";
import type { TrustRank, UserProfile, UserStatus } from "../../shared/types/user";
import type { CurrentUserSummary } from "../../shared/types/auth";
import type { ReleaseStatus, World, WorldPlatforms } from "../../shared/types/world";
import type { Avatar } from "../../shared/types/avatar";
import type { Group } from "../../shared/types/group";
import type { Instance } from "../../shared/types/instance";
interface RawUser {
id: string;
@@ -194,6 +196,24 @@ export function toWorld(raw: RawWorld): World {
};
}
export function toInstance(raw: SdkInstance): Instance {
return {
id: raw.id,
location: raw.location,
worldId: raw.worldId,
instanceId: raw.instanceId,
type: raw.type,
region: raw.region ?? undefined,
ownerId: raw.ownerId ?? undefined,
userCount: raw.userCount ?? 0,
capacity: raw.capacity ?? raw.recommendedCapacity ?? 0,
recommendedCapacity: raw.recommendedCapacity,
full: raw.full ?? false,
queueEnabled: raw.queueEnabled ?? false,
queueSize: raw.queueSize ?? 0,
};
}
export function toGroup(raw: LimitedUserGroups | RepresentedGroup): Group {
return {
id: raw.groupId ?? "",