From 8c72e011d26e38c779c26e20e4754502e56e3c0f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 13 Apr 2019 17:26:38 +0900 Subject: [PATCH] Fix bug --- src/models/repositories/user-list.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/models/repositories/user-list.ts b/src/models/repositories/user-list.ts index fbf81b888..e591794b8 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) }; } }