diff options
| author | Fuwn <[email protected]> | 2026-05-29 23:44:08 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-05-29 23:44:08 +0000 |
| commit | 49879c43ebd9f36ec19f4c02fa2b121314126286 (patch) | |
| tree | bbf1e42eba5996640ffcc7f44d07245cdf2c5e5c /src/graphql/user | |
| parent | chore(biome): scope linting to remove Svelte false positives (diff) | |
| download | due.moe-49879c43ebd9f36ec19f4c02fa2b121314126286.tar.xz due.moe-49879c43ebd9f36ec19f4c02fa2b121314126286.zip | |
Auto-fixed cosmetic findings (import ordering, obj["k"]->obj.k, optional
chaining, template literals, Date.now, parseInt radix, useless ternaries/
switch cases). Resolved the non-autofixable rest by hand:
- Senpy: static-only class -> object literal (no this/static reliance).
- app.html: var global shim -> window.global = window (keeps the shim,
drops the unused-var flag).
- biome-ignore with rationale for the logout document.cookie clear and the
holodule scrape non-null assertion.
Verified: biome check 0 diagnostics, svelte-check 0/0, 24/24 unit tests.
Diffstat (limited to 'src/graphql/user')
| -rw-r--r-- | src/graphql/user/index.ts | 2 | ||||
| -rw-r--r-- | src/graphql/user/resolvers.ts | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/graphql/user/index.ts b/src/graphql/user/index.ts index d5eef7f2..f0b5a602 100644 --- a/src/graphql/user/index.ts +++ b/src/graphql/user/index.ts @@ -1,4 +1,4 @@ -import typeDefs from "./schema.graphql?raw"; import { resolvers } from "./resolvers"; +import typeDefs from "./schema.graphql?raw"; export default { typeDefs, resolvers }; diff --git a/src/graphql/user/resolvers.ts b/src/graphql/user/resolvers.ts index 360d622b..905a2b4f 100644 --- a/src/graphql/user/resolvers.ts +++ b/src/graphql/user/resolvers.ts @@ -1,20 +1,18 @@ +import type { RequestEvent } from "@sveltejs/kit"; import { safeUserIdentity, type UserIdentity, } from "$lib/Data/AniList/identity"; import { addUserBadge, + type Badge as DatabaseBadge, getUserBadges, removeAllUserBadges, removeUserBadge, setShadowHidden, setShadowHiddenBadge, updateUserBadge, - type Badge as DatabaseBadge, } from "$lib/Database/SB/User/badges"; -import type { WithIndex } from "../$types"; -import type { Resolvers as RootResolvers, Badge } from "../$types"; -import type { RequestEvent } from "@sveltejs/kit"; import { getUserPreferences, setBiography, @@ -26,8 +24,9 @@ import { togglePinnedBadgeWallCategory, type UserPreferences, } from "$lib/Database/SB/User/preferences"; -import privilegedUser from "$lib/Utility/privilegedUser"; import { decodeAuthCookieOrNull } from "$lib/Effect/authCookie"; +import privilegedUser from "$lib/Utility/privilegedUser"; +import type { Badge, Resolvers as RootResolvers, WithIndex } from "../$types"; type Context = RequestEvent<Partial<Record<string, string>>, string | null>; type UserResolvers = Pick< @@ -188,15 +187,14 @@ export const resolvers: WithIndex<UserResolvers> = { .map(async (badge) => { await updateUserBadge(identity.id, badge.id as number, { ...badge, - hidden: + hidden: !( allBadges .filter((badge) => badge.category === category) .filter((badge) => badge.hidden).length > allBadges.filter((badge) => badge.category === category) .length / 2 - ? false - : true, + ), }); }), ); |