Mark-Lasfar commited on
Commit ·
d606181
1
Parent(s): b21014d
Add GraphQL
Browse files- graphql/resolvers.js +12 -7
graphql/resolvers.js
CHANGED
|
@@ -263,15 +263,20 @@ const resolvers = {
|
|
| 263 |
},
|
| 264 |
|
| 265 |
hasStory: async (parent) => {
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
}
|
| 274 |
|
|
|
|
| 275 |
},
|
| 276 |
// ============================================
|
| 277 |
// 🔹 COMMENT RESOLVERS - ✅ الحل النهائي
|
|
|
|
| 263 |
},
|
| 264 |
|
| 265 |
hasStory: async (parent) => {
|
| 266 |
+
try {
|
| 267 |
+
const now = new Date();
|
| 268 |
+
const storyCount = await Story.countDocuments({
|
| 269 |
+
userId: parent._id,
|
| 270 |
+
expiresAt: { $gt: now }
|
| 271 |
+
});
|
| 272 |
+
return storyCount > 0;
|
| 273 |
+
} catch (error) {
|
| 274 |
+
console.error('hasStory error:', error);
|
| 275 |
+
return false;
|
| 276 |
+
}
|
| 277 |
}
|
| 278 |
|
| 279 |
+
|
| 280 |
},
|
| 281 |
// ============================================
|
| 282 |
// 🔹 COMMENT RESOLVERS - ✅ الحل النهائي
|