Skip to content

Commit

Permalink
fix: bump mongodb to 6.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Aug 15, 2022
1 parent cc9ef4d commit 245de94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion libs/db/src/db.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export class DbService {
@InjectModel(PageModel)
private readonly pageModel: ReturnModelType<typeof PageModel>
) {}


// @ts-ignore
public getModelByRefType(type: "Post"): ReturnModelType<typeof PostModel>;
public getModelByRefType(type: "post"): ReturnModelType<typeof PostModel>;
public getModelByRefType(type: "Page"): ReturnModelType<typeof PageModel>;
Expand Down
13 changes: 6 additions & 7 deletions src/modules/comments/comments.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class CommentService {
private readonly configs: ConfigsService,
private readonly userService: UserService,
private readonly toolsService: ToolsService
) {}
) { }

public get model() {
return this.commentModel;
Expand All @@ -35,9 +35,9 @@ export class CommentService {
): ReturnModelType<typeof PostModel | typeof PageModel, BeAnObject> {
switch (refType) {
case CommentType.Post:
return this.dbService.getModelByRefType("post");
return this.dbService.getModelByRefType("post") as any;
case CommentType.Page:
return this.dbService.getModelByRefType("page");
return this.dbService.getModelByRefType("page") as any;
default:
throw new Error("refType is not supported");
}
Expand Down Expand Up @@ -222,10 +222,9 @@ export class CommentService {
.getIp(ip, 3000)
.then(
(res) =>
`${
res.province && res.province !== res.cityName
? `${res.province}`
: ""
`${res.province && res.province !== res.cityName
? `${res.province}`
: ""
}${res.cityName ? `${res.cityName}` : ""}` || undefined
)
.catch(() => undefined);
Expand Down
4 changes: 2 additions & 2 deletions src/modules/post/post.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class PostService {
process.nextTick(async () => {
// 异步更新缓存
await Promise.all([
this.imageService.recordImageMeta(this.model as MongooseModel<PostModel>, res._id)
this.imageService.recordImageMeta(this.model, res._id)
]);
});
return res;
Expand Down Expand Up @@ -228,7 +228,7 @@ export class PostService {

process.nextTick(async () => {
await Promise.all([
this.imageService.recordImageMeta(this.model as MongooseModel<PostModel>, id)
this.imageService.recordImageMeta(this.model, id)
]);
});

Expand Down

0 comments on commit 245de94

Please sign in to comment.