forked from mirrors/misskey
* feat(db): マイグレーションを追加 * feat(backend): カラムの定義を追加 * wip * feat: フラグを設定出来るように * feat: /notesエンドポイントを対応 * feat: websocketを対応 * test: テストを追加 * docs: CHANGELOGを更新 * docs: CHANGELOGの追加場所を修正 * chore: api.jsonを更新 * docs(CHANGELOG): General欄に移動 * docs: フォーマットを揃える * chore: クエリを削除 * revert: 英訳を消す * chore: note.channelを追加するところを変える * docs: CHANGELOGを更新する * docs(CHANGELOG): 2025.3.2に移動 * chore: changelogを下に移動 * ci: CI再実行用の空コミット --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
import { DI } from '@/di-symbols.js';
|
|
import type { AntennasRepository } from '@/models/_.js';
|
|
import type { Packed } from '@/misc/json-schema.js';
|
|
import type { MiAntenna } from '@/models/Antenna.js';
|
|
import { bindThis } from '@/decorators.js';
|
|
import { IdService } from '@/core/IdService.js';
|
|
|
|
@Injectable()
|
|
export class AntennaEntityService {
|
|
constructor(
|
|
@Inject(DI.antennasRepository)
|
|
private antennasRepository: AntennasRepository,
|
|
|
|
private idService: IdService,
|
|
) {
|
|
}
|
|
|
|
@bindThis
|
|
public async pack(
|
|
src: MiAntenna['id'] | MiAntenna,
|
|
): Promise<Packed<'Antenna'>> {
|
|
const antenna = typeof src === 'object' ? src : await this.antennasRepository.findOneByOrFail({ id: src });
|
|
|
|
return {
|
|
id: antenna.id,
|
|
createdAt: this.idService.parse(antenna.id).date.toISOString(),
|
|
name: antenna.name,
|
|
keywords: antenna.keywords,
|
|
excludeKeywords: antenna.excludeKeywords,
|
|
src: antenna.src,
|
|
userListId: antenna.userListId,
|
|
users: antenna.users,
|
|
caseSensitive: antenna.caseSensitive,
|
|
localOnly: antenna.localOnly,
|
|
excludeBots: antenna.excludeBots,
|
|
withReplies: antenna.withReplies,
|
|
withFile: antenna.withFile,
|
|
hideNotesInSensitiveChannel: antenna.hideNotesInSensitiveChannel,
|
|
isActive: antenna.isActive,
|
|
hasUnreadNote: false, // TODO
|
|
notify: false, // 後方互換性のため
|
|
};
|
|
}
|
|
}
|