@GrpcMethod('LiveService', 'FindOne') async findOne({slug}: { slug }, metadata: any) { const obj = await this.repoService.liveRepository.findOneOrFail({where: {slug}}); delete obj.password; return obj; }
@GrpcMethod('LiveService', 'Validate') async validate({slug, password}: { slug, password }, metadata: any) { const obj = await this.repoService.liveRepository.findOne({where: {slug}}); if (!obj || !obj.comparePassword(password)) { throw new Error('Not authorized'); } delete obj.password; return obj; }