28 01 25
додела запрос связи с друзьями тест весь проходит
This commit is contained in:
parent
84bef3365e
commit
bf4cecde05
@ -20,10 +20,9 @@ import java.sql.ResultSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetFriendsLists — получить 3 списка (для того что бы построить граф связей друзей пользователя):
|
* GetFriendsLists — получить 2 списка:
|
||||||
* - out_friends: кому login поставил FRIEND
|
* - out_friends: кому login поставил FRIEND
|
||||||
* - in_friends: кто поставил FRIEND этому login
|
* - in_friends: кто поставил FRIEND этому login
|
||||||
* - mutual_friends: FRIEND в обе стороны
|
|
||||||
*
|
*
|
||||||
* ВАЖНО:
|
* ВАЖНО:
|
||||||
* - login в запросе может быть любым регистром
|
* - login в запросе может быть любым регистром
|
||||||
@ -70,10 +69,9 @@ public class Net_GetFriendsLists_Handler implements JsonMessageHandler {
|
|||||||
|
|
||||||
int relType = (int) MsgSubType.CONNECTION_FRIEND;
|
int relType = (int) MsgSubType.CONNECTION_FRIEND;
|
||||||
|
|
||||||
// 2) Три списка (все логины канонические)
|
// 2) Два списка (логины канонические)
|
||||||
List<String> outFriends = dao.listOutgoingByRelTypeCanonical(c, canonicalLogin, relType);
|
List<String> outFriends = dao.listOutgoingByRelTypeCanonical(c, canonicalLogin, relType);
|
||||||
List<String> inFriends = dao.listIncomingByRelTypeCanonical(c, canonicalLogin, relType);
|
List<String> inFriends = dao.listIncomingByRelTypeCanonical(c, canonicalLogin, relType);
|
||||||
List<String> mutual = dao.listMutualByRelTypeCanonical(c, canonicalLogin, relType);
|
|
||||||
|
|
||||||
Net_GetFriendsLists_Response resp = new Net_GetFriendsLists_Response();
|
Net_GetFriendsLists_Response resp = new Net_GetFriendsLists_Response();
|
||||||
resp.setOp(req.getOp());
|
resp.setOp(req.getOp());
|
||||||
@ -83,7 +81,6 @@ public class Net_GetFriendsLists_Handler implements JsonMessageHandler {
|
|||||||
resp.setLogin(canonicalLogin);
|
resp.setLogin(canonicalLogin);
|
||||||
resp.setOut_friends(outFriends);
|
resp.setOut_friends(outFriends);
|
||||||
resp.setIn_friends(inFriends);
|
resp.setIn_friends(inFriends);
|
||||||
resp.setMutual_friends(mutual);
|
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,8 +15,7 @@ import java.util.List;
|
|||||||
* "payload": {
|
* "payload": {
|
||||||
* "login": "Anya", // канонический регистр из БД
|
* "login": "Anya", // канонический регистр из БД
|
||||||
* "out_friends": ["Bob", "Kate"], // кому login поставил FRIEND
|
* "out_friends": ["Bob", "Kate"], // кому login поставил FRIEND
|
||||||
* "in_friends": ["Alex", "Kate"], // кто поставил FRIEND login
|
* "in_friends": ["Alex", "Kate"] // кто поставил FRIEND login
|
||||||
* "mutual_friends": ["Kate"] // взаимные (два направления)
|
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
@ -26,7 +25,6 @@ public class Net_GetFriendsLists_Response extends Net_Response {
|
|||||||
|
|
||||||
private List<String> out_friends = new ArrayList<>();
|
private List<String> out_friends = new ArrayList<>();
|
||||||
private List<String> in_friends = new ArrayList<>();
|
private List<String> in_friends = new ArrayList<>();
|
||||||
private List<String> mutual_friends = new ArrayList<>();
|
|
||||||
|
|
||||||
public String getLogin() { return login; }
|
public String getLogin() { return login; }
|
||||||
public void setLogin(String login) { this.login = login; }
|
public void setLogin(String login) { this.login = login; }
|
||||||
@ -36,7 +34,4 @@ public class Net_GetFriendsLists_Response extends Net_Response {
|
|||||||
|
|
||||||
public List<String> getIn_friends() { return in_friends; }
|
public List<String> getIn_friends() { return in_friends; }
|
||||||
public void setIn_friends(List<String> in_friends) { this.in_friends = in_friends; }
|
public void setIn_friends(List<String> in_friends) { this.in_friends = in_friends; }
|
||||||
|
|
||||||
public List<String> getMutual_friends() { return mutual_friends; }
|
|
||||||
public void setMutual_friends(List<String> mutual_friends) { this.mutual_friends = mutual_friends; }
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user