RealTime Action (Server)
This commit is contained in:
@@ -601,4 +601,19 @@ public class ChannelDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<UUID> getChannelSubscriberUUIDs(UUID channelId) {
|
||||
List<UUID> subscriberIds = new ArrayList<>();
|
||||
try (Connection conn = ConnectionDb.connect();
|
||||
PreparedStatement stmt = conn.prepareStatement("SELECT user_id FROM channel_subscribers WHERE channel_id = ?")) {
|
||||
stmt.setObject(1, channelId);
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
subscriberIds.add(UUID.fromString(rs.getString("user_id")));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return subscriberIds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,15 @@ public class ContactDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<UUID> getContactUUIDs(UUID userId) {
|
||||
List<Contact> contacts = getContacts(userId);
|
||||
List<UUID> contactIds = new ArrayList<>();
|
||||
for (Contact c : contacts) {
|
||||
contactIds.add(c.getContact_id());
|
||||
}
|
||||
return contactIds;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean removeContact(UUID user_id, UUID contact_id) {
|
||||
|
||||
@@ -600,4 +600,19 @@ public class GroupDatabase {
|
||||
}
|
||||
|
||||
|
||||
public static List<UUID> getGroupMemberUUIDs(UUID groupId) {
|
||||
List<UUID> memberIds = new ArrayList<>();
|
||||
try (Connection conn = ConnectionDb.connect();
|
||||
PreparedStatement stmt = conn.prepareStatement("SELECT user_id FROM group_members WHERE group_id = ?")) {
|
||||
stmt.setObject(1, groupId);
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
memberIds.add(UUID.fromString(rs.getString("user_id")));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return memberIds;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user