1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-10 03:44:06 +02:00
This commit is contained in:
syuilo
2024-01-18 20:03:15 +09:00
parent 7ca93893ca
commit 58f4d5d790
13 changed files with 805 additions and 6 deletions

View File

@@ -0,0 +1,48 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { DI } from '@/di-symbols.js';
import { ReversiMatchingEntityService } from '@/core/entities/ReversiMatchingEntityService.js';
import type { ReversiMatchingsRepository } from '@/models/_.js';
export const meta = {
requireCredential: true,
kind: 'read:account',
res: {
type: 'array',
optional: false, nullable: false,
items: { ref: 'ReversiMatching' },
},
} as const;
export const paramDef = {
type: 'object',
properties: {
userId: { type: 'string', format: 'misskey:id' },
},
required: ['userId'],
} as const;
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
constructor(
@Inject(DI.reversiMatchingsRepository)
private reversiMatchingsRepository: ReversiMatchingsRepository,
private reversiMatchingEntityService: ReversiMatchingEntityService,
) {
super(meta, paramDef, async (ps, me) => {
const invitations = await this.reversiMatchingsRepository.findBy({
childId: me.id,
});
return await this.reversiMatchingEntityService.packMany(invitations, me);
});
}
}