monkeeShark/src/models/repositories/user-list.ts
syuilo 987168b863
strictNullChecks (#4666)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip
2019-04-13 01:43:22 +09:00

17 lines
458 B
TypeScript

import { EntityRepository, Repository } from 'typeorm';
import { UserList } from '../entities/user-list';
import { ensure } from '../../prelude/ensure';
@EntityRepository(UserList)
export class UserListRepository extends Repository<UserList> {
public async pack(
src: UserList['id'] | UserList,
) {
const userList = typeof src === 'object' ? src : await this.findOne(src).then(ensure);
return {
id: userList.id,
name: userList.name
};
}
}