add index route info, make it fetch per hour instead of every user, add health route, update to latest biome config aswell as logger

This commit is contained in:
creations 2025-06-04 15:47:51 -04:00
parent 8cfa75ec57
commit 75d3dab85e
Signed by: creations
GPG key ID: 8F553AA4320FC711
21 changed files with 943 additions and 364 deletions

67
types/badge.d.ts vendored
View file

@ -20,3 +20,70 @@ type badgeURLMap = {
badge: (id: string) => string;
});
};
interface VencordEquicordData {
[userId: string]: Array<{
tooltip: string;
badge: string;
}>;
}
interface NekocordData {
users: {
[userId: string]: {
badges: string[];
};
};
badges: {
[badgeId: string]: {
name: string;
image: string;
};
};
}
interface ReviewDbData
extends Array<{
discordID: string;
name: string;
icon: string;
}> {}
type BadgeServiceData = VencordEquicordData | NekocordData | ReviewDbData;
interface BadgeService {
service: string;
url:
| string
| ((
userId: string,
) => string | { user: string; badge: (id: string) => string });
}
interface VencordBadgeItem {
tooltip: string;
badge: string;
}
interface NekocordBadgeInfo {
name: string;
image: string;
}
interface ReviewDbBadgeItem {
discordID: string;
name: string;
icon: string;
}
interface EnmityBadgeItem {
name: string;
url: {
dark: string;
};
}
interface DiscordUserData {
avatar: string;
flags: number;
}

14
types/bun.d.ts vendored
View file

@ -1,14 +1,8 @@
import type { Server } from "bun";
type Query = Record<string, string>;
type Params = Record<string, string>;
declare global {
type BunServer = Server;
interface ExtendedRequest extends Request {
startPerf: number;
query: Query;
params: Params;
}
interface ExtendedRequest extends Request {
startPerf: number;
query: Query;
params: Params;
}

17
types/health.d.ts vendored Normal file
View file

@ -0,0 +1,17 @@
interface CacheInfo {
timestamp: string | null;
age: string;
}
interface HealthResponse {
status: "ok" | "degraded";
timestamp: string;
uptime: number;
services: {
redis: "ok" | "error" | "unknown";
};
cache: {
lastFetched: Record<string, CacheInfo> | { error: string };
nextUpdate: string | null;
};
}

9
types/logger.d.ts vendored
View file

@ -1,9 +0,0 @@
type ILogMessagePart = { value: string; color: string };
type ILogMessageParts = {
level: ILogMessagePart;
filename: ILogMessagePart;
readableTimestamp: ILogMessagePart;
message: ILogMessagePart;
[key: string]: ILogMessagePart;
};