diff --git a/src/models/repositories/user-list.ts b/src/models/repositories/user-list.ts index fbf81b8886..e591794b8b 100644 --- a/src/models/repositories/user-list.ts +++ b/src/models/repositories/user-list.ts @@ -1,6 +1,7 @@ import { EntityRepository, Repository } from 'typeorm'; import { UserList } from '../entities/user-list'; import { ensure } from '../../prelude/ensure'; +import { UserListJoinings } from '..'; @EntityRepository(UserList) export class UserListRepository extends Repository { @@ -9,9 +10,14 @@ export class UserListRepository extends Repository { ) { const userList = typeof src === 'object' ? src : await this.findOne(src).then(ensure); + const users = await UserListJoinings.find({ + userListId: userList.id + }); + return { id: userList.id, - name: userList.name + name: userList.name, + userIds: users.map(x => x.userId) }; } }