diff --git a/src/graphql/resolvers/Query.js b/src/graphql/resolvers/Query.js
index df0edbb2..5761b133 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,11 @@ export default {
orderBy,
});
},
+
+ async isMgpAwardee(root, args, { userId }) {
+ const awardees = ((await AppVariable.get('mgpAwardees')) || '')
+ .trim()
+ .split('\n');
+ 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..5c25a8d5 100644
--- a/src/liff/pages/MgpAwardee.svelte
+++ b/src/liff/pages/MgpAwardee.svelte
@@ -1,6 +1,20 @@
正在檢查您是否為得獎者⋯⋯
+{:else if state === 'INVALID'} +您並非得獎者,無法查看此頁面。
+{:else} + +{/if}