forked from mirror/misskey
antenna
This commit is contained in:
parent
df10aa40f4
commit
3bf7e4bf02
@ -1,15 +1,13 @@
|
|||||||
import { EntityRepository, Repository } from 'typeorm';
|
import { EntityRepository, Repository } from 'typeorm';
|
||||||
import { Antenna } from '@/models/entities/antenna';
|
import { Antenna } from '@/models/entities/antenna';
|
||||||
import { SchemaType } from '@/misc/schema';
|
import { Packed } from '@/misc/schema';
|
||||||
import { AntennaNotes, UserGroupJoinings } from '../index';
|
import { AntennaNotes, UserGroupJoinings } from '../index';
|
||||||
|
|
||||||
export type PackedAntenna = SchemaType<typeof packedAntennaSchema>;
|
|
||||||
|
|
||||||
@EntityRepository(Antenna)
|
@EntityRepository(Antenna)
|
||||||
export class AntennaRepository extends Repository<Antenna> {
|
export class AntennaRepository extends Repository<Antenna> {
|
||||||
public async pack(
|
public async pack(
|
||||||
src: Antenna['id'] | Antenna,
|
src: Antenna['id'] | Antenna,
|
||||||
): Promise<PackedAntenna> {
|
): Promise<Packed<'Antenna'>> {
|
||||||
const antenna = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
const antenna = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
||||||
|
|
||||||
const hasUnreadNote = (await AntennaNotes.findOne({ antennaId: antenna.id, read: false })) != null;
|
const hasUnreadNote = (await AntennaNotes.findOne({ antennaId: antenna.id, read: false })) != null;
|
||||||
|
Loading…
Reference in New Issue
Block a user