feat(诸子列传): 查询其他好友数据

This commit is contained in:
luying
2023-07-12 20:25:45 +08:00
parent 1eb6f76cce
commit b6cd9e6784
5 changed files with 17 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
/**
* 诸子百家
@@ -28,8 +28,8 @@ export default class AuthorBook extends BaseModel {
@prop({ required: true, default: [], type: Author, _id: false })
authors: Author[];
public static async findByRoleId(roleId: string) {
let result: AuthorBookType[] = await AuthorBookModel.find({ roleId }).select('-_id -roleId').lean();
public static async findByRoleId(roleId: string, select = '-_id') {
let result: AuthorBookType[] = await AuthorBookModel.find({ roleId }).select(select).lean();
return result;
}

View File

@@ -216,6 +216,7 @@ export class HeroDetailParam {
scroll: number;
teraph: number;
}
authorBooks: { bookId: number, progress: number }[] = [];
constructor(hero: HeroType) {
this.roleId = hero.roleId;
@@ -263,4 +264,8 @@ export class HeroDetailParam {
setArtifact(artifact: ArtifactModelType) {
this.artifacts.push({ artifactId: artifact.artifactId, lv: artifact.lv });
}
setAuthorBook(authorBooks: { bookId: number, progress: number }[]) {
this.authorBooks = authorBooks;
}
}