fix: исправить типизацию, добавить SEO метатеги, исправить API Rules PB

- Добавлены типы PostVotes, VoteStats, Comment, Consultation, PostResponse
- Заменены все any на конкретные типы
- Исправлены catch (error: any) -> catch (error: unknown)
- Добавлены og: и twitter: метатеги в Layout
- Исправлены API Rules в PocketBase (posts, reviews, post_votes)
This commit is contained in:
Web-serfer 2026-05-06 22:33:44 +05:00
parent 2f57bf91ef
commit b5d2174fdf
20 changed files with 110 additions and 41 deletions

View file

@ -60,13 +60,12 @@ export async function getPostVotes(postId: string): Promise<VoteStats> {
}
export async function getPostVotesStats(postId: string): Promise<{ likes: number; dislikes: number }> {
// Получаем данные из коллекции голосов
const votes = await pb.collection('post_votes').getList(1, 1000, {
filter: `post="${postId}"`,
});
const likes = votes.items.filter((v: any) => v.vote_type === 'like').length;
const dislikes = votes.items.filter((v: any) => v.vote_type === 'dislike').length;
const likes = votes.items.filter((v) => v.vote_type === 'like').length;
const dislikes = votes.items.filter((v) => v.vote_type === 'dislike').length;
return { likes, dislikes };
}