import { EntityRepository , Repository } from 'typeorm' ; import LoginEntity , { LoginType } from '@/entity/login' ; export interface LoginInfo { id : string ; password : string ; type ? : string ; } @ EntityRepository ( LoginEntity ) class LoginRepository extends Repository < LoginEntity > { async findById ( id , type = LoginType . Own ) { const account = await this . findOne ( { where : { id , type } } ) ; return account ; } async findByIdx ( idx ) { const account = await this . findOne ( { where : { idx } } ) ; return account ; } async removeByIdx ( idx ) { const login = await this . findByIdx ( idx ) ; if ( login ) { await this . remove ( login ) ; } } } export default LoginRepository ;