Mark-Lasfar commited on
Commit ยท
c6ec071
1
Parent(s): 6eca6cc
Add GraphQL
Browse files- graphql/resolvers.js +15 -0
graphql/resolvers.js
CHANGED
|
@@ -396,6 +396,21 @@ const resolvers = {
|
|
| 396 |
if (typeof parent.sectionOrder === 'object') return Object.values(parent.sectionOrder);
|
| 397 |
return [];
|
| 398 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 399 |
|
| 400 |
// โ
ุงูุญููู ุงููู ู
ูุฑูุถ ุชููู Objects
|
| 401 |
sectionNames: (parent) => parent.sectionNames || {},
|
|
|
|
| 396 |
if (typeof parent.sectionOrder === 'object') return Object.values(parent.sectionOrder);
|
| 397 |
return [];
|
| 398 |
},
|
| 399 |
+
|
| 400 |
+
hasStory: async (parent, args, context) => {
|
| 401 |
+
// ูู ุงูู Profile ุฌุงู ู
ู Userุ ุงุณุชุฎุฏู
ุงูู userId
|
| 402 |
+
const userId = parent._id || parent.userId;
|
| 403 |
+
if (!userId) return false;
|
| 404 |
+
try {
|
| 405 |
+
const count = await Story.countDocuments({
|
| 406 |
+
userId: userId,
|
| 407 |
+
expiresAt: { $gt: new Date() }
|
| 408 |
+
});
|
| 409 |
+
return count > 0;
|
| 410 |
+
} catch (error) {
|
| 411 |
+
return false;
|
| 412 |
+
}
|
| 413 |
+
},
|
| 414 |
|
| 415 |
// โ
ุงูุญููู ุงููู ู
ูุฑูุถ ุชููู Objects
|
| 416 |
sectionNames: (parent) => parent.sectionNames || {},
|