Skip to content

Commit

Permalink
hotfix: repository DI symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
SWREI committed Aug 11, 2024
1 parent 1345d0e commit f82a59d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const meta = {

requireCredential: true,
requireAdmin: true,
secure: true,
kind: 'write:admin:federation',

errors: {
Expand All @@ -41,6 +42,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
constructor(
@Inject(DI.instancesRepository)
private instancesRepository: InstancesRepository,

@Inject(DI.followingsRepository)
private followingsRepository: FollowingsRepository,

private utilityService: UtilityService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,27 @@

import { Inject, Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import type { FollowingsRepository, UsersRepository } from '@/models/_.js';
import type { FollowingsRepository, InstancesRepository, UsersRepository } from '@/models/_.js';
import { DI } from '@/di-symbols.js';
import { QueueService } from '@/core/QueueService.js';
import { ApiError } from '@/server/api/error.js';
import { UtilityService } from '@/core/UtilityService.js';

export const meta = {
tags: ['admin'],

requireCredential: true,
requireAdmin: true,
secure: true,
kind: 'write:admin:federation',

errors: {
instanceNotFound: {
message: 'Instance with that hostname is not found.',
code: 'INSTANCE_NOT_FOUND',
id: '82791415-ae4b-4e82-bffe-e3dbc4322a0a',
},
},
} as const;

export const paramDef = {
Expand All @@ -34,9 +45,19 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
@Inject(DI.notesRepository)
private followingsRepository: FollowingsRepository,

@Inject(DI.instancesRepository)
private instancesRepository: InstancesRepository,

private queueService: QueueService,
private utilityService: UtilityService,
) {
super(meta, paramDef, async (ps, me) => {
const instance = await this.instancesRepository.findOneBy({ host: this.utilityService.toPuny(ps.host) });

if (instance == null) {
throw new ApiError(meta.errors.instanceNotFound);
}

const followings = await this.followingsRepository.findBy({
followerHost: ps.host,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ export const paramDef = {
required: ['userId'],
} as const;

// eslint-disable-next-line import/no-default-export
@Injectable()
export default class extends Endpoint<typeof meta, typeof paramDef> {
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
constructor(
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,
Expand Down
2 changes: 2 additions & 0 deletions packages/misskey-js/src/autogen/apiClientJSDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ declare module '../api.js' {
/**
* No description provided.
*
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
* **Credential required**: *Yes* / **Permission**: *write:admin:federation*
*/
request<E extends 'admin/federation/refresh-remote-instance-metadata', P extends Endpoints[E]['req']>(
Expand All @@ -525,6 +526,7 @@ declare module '../api.js' {
/**
* No description provided.
*
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
* **Credential required**: *Yes* / **Permission**: *write:admin:federation*
*/
request<E extends 'admin/federation/remove-all-following', P extends Endpoints[E]['req']>(
Expand Down
4 changes: 4 additions & 0 deletions packages/misskey-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ export type paths = {
* admin/federation/refresh-remote-instance-metadata
* @description No description provided.
*
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
* **Credential required**: *Yes* / **Permission**: *write:admin:federation*
*/
post: operations['admin___federation___refresh-remote-instance-metadata'];
Expand All @@ -442,6 +443,7 @@ export type paths = {
* admin/federation/remove-all-following
* @description No description provided.
*
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
* **Credential required**: *Yes* / **Permission**: *write:admin:federation*
*/
post: operations['admin___federation___remove-all-following'];
Expand Down Expand Up @@ -8074,6 +8076,7 @@ export type operations = {
* admin/federation/refresh-remote-instance-metadata
* @description No description provided.
*
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
* **Credential required**: *Yes* / **Permission**: *write:admin:federation*
*/
'admin___federation___refresh-remote-instance-metadata': {
Expand Down Expand Up @@ -8125,6 +8128,7 @@ export type operations = {
* admin/federation/remove-all-following
* @description No description provided.
*
* **Internal Endpoint**: This endpoint is an API for the misskey mainframe and is not intended for use by third parties.
* **Credential required**: *Yes* / **Permission**: *write:admin:federation*
*/
'admin___federation___remove-all-following': {
Expand Down

0 comments on commit f82a59d

Please sign in to comment.