aboutsummaryrefslogtreecommitdiff
path: root/src/graphql/user/resolvers.ts
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-11-18 19:34:30 -0800
committerFuwn <[email protected]>2024-11-18 19:34:36 -0800
commit43ecb0640c085971a77f243d72b9d62d961feecd (patch)
tree1907adb4220b1a4df1b958b848317b5dcc1cacb3 /src/graphql/user/resolvers.ts
parentfix(CleanAnimeList): completed total chapter count calculation (diff)
downloaddue.moe-43ecb0640c085971a77f243d72b9d62d961feecd.tar.xz
due.moe-43ecb0640c085971a77f243d72b9d62d961feecd.zip
refactor(authorised): move authorised user functionality to module
Diffstat (limited to 'src/graphql/user/resolvers.ts')
-rw-r--r--src/graphql/user/resolvers.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/graphql/user/resolvers.ts b/src/graphql/user/resolvers.ts
index 731b5f94..30f48cd1 100644
--- a/src/graphql/user/resolvers.ts
+++ b/src/graphql/user/resolvers.ts
@@ -10,7 +10,6 @@ import {
} from '$lib/Database/SB/User/badges';
import type { WithIndex } from '../$types';
import type { Resolvers, Badge } from './$types';
-import authorisedJson from '$lib/Data/Static/authorised.json';
import type { RequestEvent } from '@sveltejs/kit';
import {
getUserPreferences,
@@ -23,6 +22,7 @@ import {
togglePinnedBadgeWallCategory,
type UserPreferences
} from '$lib/Database/SB/User/preferences';
+import privilegedUser from '$lib/Utility/privilegedUser';
type Context = RequestEvent<Partial<Record<string, string>>, string | null>;
@@ -49,7 +49,7 @@ const authenticatedBadgesOperation = async (
if (identity instanceof Error) return [];
- const authorised = authorisedJson.includes(identity.id);
+ const authorised = privilegedUser(identity.id)
await operation(identity, authorised);
@@ -71,7 +71,7 @@ const authenticatedPreferencesOperation = async (
if (identity instanceof Error) return [];
- const authorised = authorisedJson.includes(identity.id);
+ const authorised = privilegedUser(identity.id)
return {
id: identity.id,
@@ -129,7 +129,7 @@ export const resolvers: WithIndex<Resolvers> = {
allBadges
.filter((badge) => badge.category === category)
.filter((badge) => badge.hidden).length >
- allBadges.filter((badge) => badge.category === category).length / 2
+ allBadges.filter((badge) => badge.category === category).length / 2
? false
: true
});