async detail(id: number) { return await this.handBookRepository.findOne({ select: ['id', 'name', 'introduce', 'summary', 'authorIntro', 'price', 'completionAt', 'isAllDone', 'coverURL', 'isAgree'], where: { id, }, }); }
async findOne(options): Promise<User> { const user = await this.userRepository.findOne({ select: options.select, where: options.where, }); return user; }
async searchCategoryByName(keyword: string) { return await this.categoryRepository.findOne({ select: { id: true, name: true, }, where: { name: keyword, }, }); }
async findSettings(userID: number) { const settings = await this.settingsRepository.findOne({ where: { userID }, }); return settings; }
async isExist(id: number): Promise<boolean> { const boilingPoint = await this.boilingPointRepository.findOne({ id, }, { select: ['id'], }); return boilingPoint !== null; }
async isChapterExist(id: number): Promise<boolean> { const chapter = await this.chapterRepository.findOne({ select: ['id'], where: { id, }, }); return chapter !== null; }
async basic(id: number): Promise<BoilingPointTopic> { return await this.topicRepository.findOne({ where: { id, }, }); }
async isExist(id: number): Promise<boolean> { const article = await this.articleRepository.findOne({ id, }, { select: ['id'], }); return article !== null; }
async findOne(options): Promise<BoilingPoint> { return await this.boilingPointRepository.findOne({ select: options.select, where: options.where, }); }
async detail(id: number) { return await this.crawlerArticleRepository.findOne({ where: { id }, }); }
async isExist(id: number) { const user = await this.userRepository.findOne({ id, }, { select: ['id'], }); return user !== null; }
async isOwner(id: number, userID) { const handbook = await this.handBookRepository.findOne({ select: ['id'], where: { id, userID, }, }); return !!handbook; }
async isUserNameExist(username: string) { const user: User | undefined = await this.userRepository.findOne({ select: ['id'], where: { username, }, }); return !!user; }
async findUser(where, select) { const user = await this.userRepository.findOne({ select, where, }); return user; }
async isChapterInBook(chapterID: number, bookID: number) { const chapter = await this.chapterRepository.findOne({ select: { id: true, }, where: { id: chapterID, bookID, }, }); return !!chapter; }