1 Commits

Author SHA1 Message Date
182cfb3c41 feat(guild): GET /channels/:id/members
List explicit channel members (userIds) for the split members sidebar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 15:00:24 +01:00
2 changed files with 15 additions and 0 deletions

View File

@@ -34,6 +34,13 @@ export class ChannelsController {
);
}
@Get(':id/members')
members(@Req() req: AuthedRequest, @Param('id') channelId: string) {
const userId = req.userId ?? '';
if (!userId) throw new UnauthorizedException('missing user');
return this.channelsService.channelMembers(channelId);
}
@Post(':id/join')
join(@Req() req: AuthedRequest, @Param('id') channelId: string) {
const userId = req.userId ?? '';

View File

@@ -56,6 +56,14 @@ export class ChannelsService {
.map((c) => ({ ...c, isMember: memberChannelIds.has(c.id) }));
}
async channelMembers(channelId: string): Promise<{ userId: string }[]> {
const rows = await this.memberRepo.find({
where: { channelId },
order: { createdAt: 'ASC' },
});
return rows.map((r) => ({ userId: r.userId }));
}
async joinChannel(channelId: string, userId: string) {
const channel = await this.channelRepo.findOne({ where: { id: channelId } });
if (!channel) throw new NotFoundException('channel not found');