Mark-Lasfar commited on
Commit ·
308b25e
1
Parent(s): af4a262
Add GraphQL
Browse files- graphql/resolvers.js +24 -0
graphql/resolvers.js
CHANGED
|
@@ -952,6 +952,14 @@ const Query = {
|
|
| 952 |
canCreateStore: !!(storeSettings?.enabled),
|
| 953 |
canCreateProducts: !!(subscription?.planId?.features?.storeEnabled)
|
| 954 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 955 |
|
| 956 |
return user;
|
| 957 |
},
|
|
@@ -995,6 +1003,14 @@ const Query = {
|
|
| 995 |
user.followersCount = followersCount || 0;
|
| 996 |
user.followingCount = followingCount || 0;
|
| 997 |
user.postsCount = postsCount || 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 998 |
|
| 999 |
return user;
|
| 1000 |
},
|
|
@@ -1063,6 +1079,14 @@ const Query = {
|
|
| 1063 |
user.followersCount = followersCount || 0;
|
| 1064 |
user.followingCount = followingCount || 0;
|
| 1065 |
user.postsCount = postsCount || 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1066 |
|
| 1067 |
return user;
|
| 1068 |
},
|
|
|
|
| 952 |
canCreateStore: !!(storeSettings?.enabled),
|
| 953 |
canCreateProducts: !!(subscription?.planId?.features?.storeEnabled)
|
| 954 |
};
|
| 955 |
+
|
| 956 |
+
// ✅ حساب hasStory
|
| 957 |
+
const now = new Date();
|
| 958 |
+
const storyCount = await Story.countDocuments({
|
| 959 |
+
userId: user._id,
|
| 960 |
+
expiresAt: { $gt: now }
|
| 961 |
+
});
|
| 962 |
+
user.hasStory = storyCount > 0;
|
| 963 |
|
| 964 |
return user;
|
| 965 |
},
|
|
|
|
| 1003 |
user.followersCount = followersCount || 0;
|
| 1004 |
user.followingCount = followingCount || 0;
|
| 1005 |
user.postsCount = postsCount || 0;
|
| 1006 |
+
|
| 1007 |
+
// ✅ حساب hasStory
|
| 1008 |
+
const now = new Date();
|
| 1009 |
+
const storyCount = await Story.countDocuments({
|
| 1010 |
+
userId: user._id,
|
| 1011 |
+
expiresAt: { $gt: now }
|
| 1012 |
+
});
|
| 1013 |
+
user.hasStory = storyCount > 0;
|
| 1014 |
|
| 1015 |
return user;
|
| 1016 |
},
|
|
|
|
| 1079 |
user.followersCount = followersCount || 0;
|
| 1080 |
user.followingCount = followingCount || 0;
|
| 1081 |
user.postsCount = postsCount || 0;
|
| 1082 |
+
|
| 1083 |
+
// ✅ حساب hasStory
|
| 1084 |
+
const now = new Date();
|
| 1085 |
+
const storyCount = await Story.countDocuments({
|
| 1086 |
+
userId: user._id,
|
| 1087 |
+
expiresAt: { $gt: now }
|
| 1088 |
+
});
|
| 1089 |
+
user.hasStory = storyCount > 0;
|
| 1090 |
|
| 1091 |
return user;
|
| 1092 |
},
|