rhythia-api 127.0.0 → 129.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,6 @@ import { SSPMParser } from "../utils/star-calc/sspmParser";
5
5
  import { supabase } from "../utils/supabase";
6
6
  import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
7
7
  import { rateMap } from "../utils/star-calc";
8
- import sharp from "sharp";
9
8
  const s3Client = new S3Client({
10
9
  region: "auto",
11
10
  endpoint: "https://s3.eu-central-003.backblazeb2.com",
@@ -55,7 +54,7 @@ export async function handler({
55
54
 
56
55
  let buffer = Buffer.from([]);
57
56
  try {
58
- buffer = await sharp(parsedData.cover)
57
+ buffer = await require("sharp")(parsedData.cover)
59
58
  .resize(250)
60
59
  .jpeg({ mozjpeg: true })
61
60
  .toBuffer();
@@ -9,7 +9,6 @@ export const Schema = {
9
9
  }),
10
10
  output: z.object({
11
11
  error: z.string().optional(),
12
- total: z.number(),
13
12
  leaderboard: z
14
13
  .array(
15
14
  z.object({
@@ -42,23 +41,17 @@ export async function handler(
42
41
  }
43
42
 
44
43
  export async function getLeaderboard(badge: string) {
45
- const countQuery = await supabase
46
- .from("profiles")
47
- .select("ban", { count: "exact", head: true })
48
- .neq("ban", "excluded")
49
- .ilike("badges", `%${badge}%`);
50
-
51
44
  let { data: queryData, error } = await supabase
52
45
  .from("profiles")
53
46
  .select("*")
54
- .neq("ban", "excluded")
55
- .ilike("badges", `%${badge}%`)
56
- .order("skill_points", { ascending: false })
57
- .range(0, 200);
47
+ .neq("ban", "excluded");
48
+
49
+ const users = queryData?.filter((e) =>
50
+ ((e.badges || []) as string[]).includes(badge)
51
+ );
58
52
 
59
53
  return {
60
- total: countQuery.count || 0,
61
- leaderboard: queryData?.map((user) => ({
54
+ leaderboard: users?.map((user) => ({
62
55
  flag: user.flag,
63
56
  id: user.id,
64
57
  play_count: user.play_count,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "127.0.0",
3
+ "version": "129.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",