Sharkey/packages/backend/src/server/api/endpoints/i/get-word-muted-notes-count.ts

34 lines
568 B
TypeScript
Raw Normal View History

import define from '../../define';
import { MutedNotes } from '@/models/index';
export const meta = {
tags: ['account'],
requireCredential: true as const,
kind: 'read:account',
params: {
},
res: {
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
count: {
type: 'number' as const,
2021-12-09 15:58:30 +01:00
optional: false as const, nullable: false as const,
},
},
},
};
export default define(meta, async (ps, user) => {
return {
count: await MutedNotes.count({
userId: user.id,
2021-12-09 15:58:30 +01:00
reason: 'word',
}),
};
});