3
_User
Default user class by Parse.com
tweet
objectId<string>
tweet<string>
tweetBy<string><Pointer _User>
createdAt<Date>
updatedAt<Date>
follow
objectId<string>
following<string><Pointer _User>
followedBy<string>
createdAt<Date>
updatedAt<Date>
Table data
------------------------------------------------------------------------
- _User -
------------------------------------------------------------------------
| objectId | username | password | email | createdAt | updatedAt |
------------------------------------------------------------------------
| z12ttttt | Matt | hidden | [email protected] |random time|random time|
| z12zzzzz | Jobs | hidden | [email protected] |random time|random time|
| z12bbbbb | Ballu | hidden | [email protected] |random time|random time|
| z12aaaaa | Stephin | hidden | [email protected] |random time|random time|
------------------------------------------------------------------------
-----------------------------------------------------------
- tweet -
-----------------------------------------------------------
| objectId | tweet | tweetBy | createdAt | updatedAt |
-----------------------------------------------------------
| blabla | Head Pain | z12ttttt |random time|random time|
| blab12 | Back Pain | z12ttttt |random time|random time|
| blab23 | Sleepy | z12ttttt |random time|random time|
| blab90 | Head Pain | z12zzzzz |random time|random time|
| blab90 | lets Dance| z12bbbbb |random time|random time|
| blab90 | lets jump | z12aaaaa |random time|random time|
-----------------------------------------------------------
-------------------------------------------------------------
- follow -
-------------------------------------------------------------
| objectId | following | followedBy | createdAt | updatedAt |
-------------------------------------------------------------
| blabla | z12ttttt | z12zzzzz |random time|random time|
| blabla | z12bbbbb | z12zzzzz |random time|random time|
-------------------------------------------------------------
所需的輸出:
CURENT用戶z12zzzzz即喬布斯
由於喬布斯是繼馬特和Ballu只有他們的鳴叫將顯示
--------------------------------------------
Matt (3min ago)
Head Pain
--------------------------------------------
Matt (4min ago)
Back Pain
--------------------------------------------
Matt (5min ago)
Sleepy
--------------------------------------------
Ballu (5min ago)
lets Dance
--------------------------------------------
我的問題就在這裏是讓用戶被關注,但不是他們推崇的推文
var username = window.localStorage.getItem('ls_username');
var Follow = Parse.Object.extend("follow");
var follow = new Parse.Query(Follow);
follow.equalTo('followedBy', username);
follow.include("following");
follow.include("tweet");
follow.include('tweet.tweetBy');
follow.find().then(function(results){
console.log(results);
var contentHtml = '';
for(i in results){
var object = results[i];
// Display individual tweets with their respected usernames
// Display only tweets of people being followed by currentuser
}
$('#globalTweets').html(contentHtml);
});
是的,這是 – Tabby
它的工作,但沒有任何用戶名的問題))。(我做'的console.log(微博)'存在tweetBy – Tabby
沒有數據請參閱編輯。使用包括在tweetQuery到獲取創作推文的相關用戶,你可以在任何指針列上使用這個想法。 – danh