diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index 6697e2d09d..fe642a9ddd 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -88,10 +88,21 @@ export const paramDef = { sinceDate: { type: 'integer' }, untilDate: { type: 'integer' }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, - birthday: { ...birthdaySchema, nullable: true }, - query: { type: 'string', nullable: true }, }, }, + { + oneOf: [{ + type: 'object', + properties: { + query: { type: 'string' }, + }, + }, { + type: 'object', + properties: { + birthday: { ...birthdaySchema, nullable: true }, + }, + }], + }, ], } as const; @@ -151,7 +162,7 @@ export default class extends Endpoint { // eslint- .innerJoinAndSelect('following.followee', 'followee'); // query takes priority over birthday - if (ps.query) { + if ('query' in ps && ps.query != null) { const searchQuery = ps.query; const isUsername = searchQuery.startsWith('@') && !searchQuery.includes(' ') && searchQuery.indexOf('@', 1) === -1; @@ -164,7 +175,7 @@ export default class extends Endpoint { // eslint- qb.orWhere('followee.usernameLower LIKE :username', { username: '%' + sqlLikeEscape(searchQuery.toLowerCase()) + '%' }); } })); - } else if (ps.birthday) { + } else if ('birthday' in ps && ps.birthday != null) { try { const birthday = ps.birthday.substring(5, 10); const birthdayUserQuery = this.userProfilesRepository.createQueryBuilder('user_profile'); diff --git a/packages/misskey-js/src/autogen/types.ts b/packages/misskey-js/src/autogen/types.ts index 254f1bcd73..90e723684f 100644 --- a/packages/misskey-js/src/autogen/types.ts +++ b/packages/misskey-js/src/autogen/types.ts @@ -34848,9 +34848,11 @@ export interface operations { untilDate?: number; /** @default 10 */ limit?: number; + } & ({ + query?: string; + } | { birthday?: string | null; - query?: string | null; - }; + }); }; }; responses: {