lint
This commit is contained in:
@@ -73,7 +73,10 @@ export class BlogController {
|
||||
|
||||
/** @todo 对文章可读性进行更详细的判定 */
|
||||
|
||||
if (!blog.permissions.includes(BlogPermission.Public) && !blog.permissions.includes(BlogPermission.ByPassword)) {
|
||||
if (
|
||||
!blog.permissions.includes(BlogPermission.Public) &&
|
||||
!blog.permissions.includes(BlogPermission.ByPassword)
|
||||
) {
|
||||
throw new BadRequestException('文章不存在或未公开');
|
||||
}
|
||||
|
||||
|
||||
@@ -104,30 +104,36 @@ export class BlogService {
|
||||
},
|
||||
});
|
||||
|
||||
return comments.map(comment => {
|
||||
const { blog, user, ...rest } = comment;
|
||||
return comments.map((comment) => {
|
||||
const { user, ...rest } = comment;
|
||||
delete rest.blog;
|
||||
return {
|
||||
...rest,
|
||||
user: user ? {
|
||||
user: user
|
||||
? {
|
||||
userId: user.userId,
|
||||
username: user.username,
|
||||
nickname: user.nickname,
|
||||
} : null,
|
||||
}
|
||||
})
|
||||
: null,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async createComment(comment: Partial<BlogComment>) {
|
||||
const newComment = this.blogCommentRepository.create(comment);
|
||||
const savedComment = await this.blogCommentRepository.save(newComment, {});
|
||||
const { blog, user, ...commentWithoutBlog } = savedComment;
|
||||
const { user, ...commentWithoutBlog } = savedComment;
|
||||
delete commentWithoutBlog.blog;
|
||||
return {
|
||||
...commentWithoutBlog,
|
||||
user: user ? {
|
||||
user: user
|
||||
? {
|
||||
userId: user.userId,
|
||||
username: user.username,
|
||||
nickname: user.nickname,
|
||||
} : null,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { useOssSts } from "@/hooks/oss/use-oss-sts";
|
||||
import { StsToken } from "@/lib/api/oss";
|
||||
import OSS from "ali-oss";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export function useOssStore(options: { onStsTokenDataChanged?: (data: StsToken | undefined) => void; } = {}) {
|
||||
@@ -10,7 +9,6 @@ export function useOssStore(options: { onStsTokenDataChanged?: (data: StsToken |
|
||||
options.onStsTokenDataChanged?.(stsTokenData);
|
||||
}, [stsTokenData]);
|
||||
|
||||
/** @todo */
|
||||
const refresh = async () => {
|
||||
await mutate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user