diff --git a/src/graphql/resolvers/Query.js b/src/graphql/resolvers/Query.js index df0edbb2..a42c5263 100644 --- a/src/graphql/resolvers/Query.js +++ b/src/graphql/resolvers/Query.js @@ -1,5 +1,6 @@ import UserArticleLink from 'src/database/models/userArticleLink'; import UserSettings from 'src/database/models/userSettings'; +import AppVariable from 'src/database/models/appVariable'; import { groupEventQueue, expiredGroupEventQueue } from 'src/lib/queues'; import { processConnection } from '../utils/connection'; @@ -26,4 +27,10 @@ export default { orderBy, }); }, + + async isMgpAwardee(root, args, { userId }) { + const awardees = (await AppVariable.get('mgpAwardees')) || []; + + return awardees.includes(userId); + }, }; diff --git a/src/graphql/typeDefs.graphql b/src/graphql/typeDefs.graphql index 7fa2dc03..a24b848d 100644 --- a/src/graphql/typeDefs.graphql +++ b/src/graphql/typeDefs.graphql @@ -16,6 +16,8 @@ type Query { # Get user's notification setting setting: UserSetting @auth(check: ["userId"]) + + isMgpAwardee: Boolean @auth(check: ["userId"]) } type Mutation { diff --git a/src/liff/pages/MgpAwardee.svelte b/src/liff/pages/MgpAwardee.svelte index 5e88bbfa..d8a58fd3 100644 --- a/src/liff/pages/MgpAwardee.svelte +++ b/src/liff/pages/MgpAwardee.svelte @@ -1,6 +1,20 @@ 得獎者@Cofacts x 第四屆 MyGoPen 謠言惑眾獎 -