mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 01:30:23 +01:00
antenna
This commit is contained in:
parent
df10aa40f4
commit
3bf7e4bf02
1 changed files with 2 additions and 4 deletions
|
@ -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 a new issue