note-reaction

This commit is contained in:
tamaina 2021-09-12 22:34:27 +09:00
parent a97fb08af0
commit 1f82a98384
1 changed files with 2 additions and 4 deletions

View File

@ -1,18 +1,16 @@
import { EntityRepository, Repository } from 'typeorm'; import { EntityRepository, Repository } from 'typeorm';
import { NoteReaction } from '@/models/entities/note-reaction'; import { NoteReaction } from '@/models/entities/note-reaction';
import { Users } from '../index'; import { Users } from '../index';
import { SchemaType } from '@/misc/schema'; import { Packed } from '@/misc/schema';
import { convertLegacyReaction } from '@/misc/reaction-lib'; import { convertLegacyReaction } from '@/misc/reaction-lib';
import { User } from '@/models/entities/user'; import { User } from '@/models/entities/user';
export type PackedNoteReaction = SchemaType<typeof packedNoteReactionSchema>;
@EntityRepository(NoteReaction) @EntityRepository(NoteReaction)
export class NoteReactionRepository extends Repository<NoteReaction> { export class NoteReactionRepository extends Repository<NoteReaction> {
public async pack( public async pack(
src: NoteReaction['id'] | NoteReaction, src: NoteReaction['id'] | NoteReaction,
me?: { id: User['id'] } | null | undefined me?: { id: User['id'] } | null | undefined
): Promise<PackedNoteReaction> { ): Promise<Packed<'NoteReaction'>> {
const reaction = typeof src === 'object' ? src : await this.findOneOrFail(src); const reaction = typeof src === 'object' ? src : await this.findOneOrFail(src);
return { return {