refactor: 型合わせ

This commit is contained in:
Kisaragi Marine 2024-07-18 21:13:55 +09:00
parent 67072e3ca6
commit c22dd6358b
No known key found for this signature in database
GPG Key ID: C6631564CD2110E4

View File

@ -1,3 +1,13 @@
import type {
AbuseReportNotificationRecipient, Ad,
Announcement,
EmojiDetailed, InviteCode,
MetaDetailed,
Note,
Role, SystemWebhook, UserLite
} from "./autogen/models.js";
import { operations } from './autogen/types.js';
export const notificationTypes = ['note', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app', 'roleAssigned', 'achievementEarned'] as const; export const notificationTypes = ['note', 'follow', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote', 'pollEnded', 'receiveFollowRequest', 'followRequestAccepted', 'groupInvited', 'app', 'roleAssigned', 'achievementEarned'] as const;
export const noteVisibilities = ['public', 'home', 'followers', 'specified'] as const; export const noteVisibilities = ['public', 'home', 'followers', 'specified'] as const;
@ -135,12 +145,18 @@ export const moderationLogTypes = [
'unsetUserBanner', 'unsetUserBanner',
] as const; ] as const;
type AvatarDecoration = UserLite['avatarDecorations'][number];
type ReceivedAbuseReport = {
reportId: AbuseReportNotificationRecipient['id'];
report: operations['admin___abuse-user-reports']['responses'][200]['content']['application/json'];
forwarded: boolean;
};
export type ModerationLogPayloads = { export type ModerationLogPayloads = {
updateServerSettings: { updateServerSettings: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any before: MetaDetailed | null;
before: any | null; after: MetaDetailed | null;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
after: any | null;
}; };
suspend: { suspend: {
userId: string; userId: string;
@ -161,17 +177,16 @@ export type ModerationLogPayloads = {
}; };
addCustomEmoji: { addCustomEmoji: {
emojiId: string; emojiId: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any emoji: EmojiDetailed;
emoji: any;
}; };
updateCustomEmoji: { updateCustomEmoji: {
emojiId: string; emojiId: string;
before: any; before: EmojiDetailed;
after: any; after: EmojiDetailed;
}; };
deleteCustomEmoji: { deleteCustomEmoji: {
emojiId: string; emojiId: string;
emoji: any; emoji: EmojiDetailed;
}; };
assignRole: { assignRole: {
userId: string; userId: string;
@ -190,16 +205,16 @@ export type ModerationLogPayloads = {
}; };
createRole: { createRole: {
roleId: string; roleId: string;
role: any; role: Role;
}; };
updateRole: { updateRole: {
roleId: string; roleId: string;
before: any; before: Role;
after: any; after: Role;
}; };
deleteRole: { deleteRole: {
roleId: string; roleId: string;
role: any; role: Role;
}; };
clearQueue: Record<string, never>; clearQueue: Record<string, never>;
promoteQueue: Record<string, never>; promoteQueue: Record<string, never>;
@ -214,39 +229,39 @@ export type ModerationLogPayloads = {
noteUserId: string; noteUserId: string;
noteUserUsername: string; noteUserUsername: string;
noteUserHost: string | null; noteUserHost: string | null;
note: any; note: Note;
}; };
createGlobalAnnouncement: { createGlobalAnnouncement: {
announcementId: string; announcementId: string;
announcement: any; announcement: Announcement;
}; };
createUserAnnouncement: { createUserAnnouncement: {
announcementId: string; announcementId: string;
announcement: any; announcement: Announcement;
userId: string; userId: string;
userUsername: string; userUsername: string;
userHost: string | null; userHost: string | null;
}; };
updateGlobalAnnouncement: { updateGlobalAnnouncement: {
announcementId: string; announcementId: string;
before: any; before: Announcement;
after: any; after: Announcement;
}; };
updateUserAnnouncement: { updateUserAnnouncement: {
announcementId: string; announcementId: string;
before: any; before: Announcement;
after: any; after: Announcement;
userId: string; userId: string;
userUsername: string; userUsername: string;
userHost: string | null; userHost: string | null;
}; };
deleteGlobalAnnouncement: { deleteGlobalAnnouncement: {
announcementId: string; announcementId: string;
announcement: any; announcement: Announcement;
}; };
deleteUserAnnouncement: { deleteUserAnnouncement: {
announcementId: string; announcementId: string;
announcement: any; announcement: Announcement;
userId: string; userId: string;
userUsername: string; userUsername: string;
userHost: string | null; userHost: string | null;
@ -284,37 +299,37 @@ export type ModerationLogPayloads = {
}; };
resolveAbuseReport: { resolveAbuseReport: {
reportId: string; reportId: string;
report: any; report: ReceivedAbuseReport;
forwarded: boolean; forwarded: boolean;
}; };
createInvitation: { createInvitation: {
invitations: any[]; invitations: InviteCode[];
}; };
createAd: { createAd: {
adId: string; adId: string;
ad: any; ad: Ad;
}; };
updateAd: { updateAd: {
adId: string; adId: string;
before: any; before: Ad;
after: any; after: Ad;
}; };
deleteAd: { deleteAd: {
adId: string; adId: string;
ad: any; ad: Ad;
}; };
createAvatarDecoration: { createAvatarDecoration: {
avatarDecorationId: string; avatarDecorationId: string;
avatarDecoration: any; avatarDecoration: AvatarDecoration;
}; };
updateAvatarDecoration: { updateAvatarDecoration: {
avatarDecorationId: string; avatarDecorationId: string;
before: any; before: AvatarDecoration;
after: any; after: AvatarDecoration;
}; };
deleteAvatarDecoration: { deleteAvatarDecoration: {
avatarDecorationId: string; avatarDecorationId: string;
avatarDecoration: any; avatarDecoration: AvatarDecoration;
}; };
unsetUserAvatar: { unsetUserAvatar: {
userId: string; userId: string;
@ -330,28 +345,28 @@ export type ModerationLogPayloads = {
}; };
createSystemWebhook: { createSystemWebhook: {
systemWebhookId: string; systemWebhookId: string;
webhook: any; webhook: SystemWebhook;
}; };
updateSystemWebhook: { updateSystemWebhook: {
systemWebhookId: string; systemWebhookId: string;
before: any; before: SystemWebhook;
after: any; after: SystemWebhook;
}; };
deleteSystemWebhook: { deleteSystemWebhook: {
systemWebhookId: string; systemWebhookId: string;
webhook: any; webhook: SystemWebhook;
}; };
createAbuseReportNotificationRecipient: { createAbuseReportNotificationRecipient: {
recipientId: string; recipientId: string;
recipient: any; recipient: AbuseReportNotificationRecipient;
}; };
updateAbuseReportNotificationRecipient: { updateAbuseReportNotificationRecipient: {
recipientId: string; recipientId: string;
before: any; before: AbuseReportNotificationRecipient;
after: any; after: AbuseReportNotificationRecipient;
}; };
deleteAbuseReportNotificationRecipient: { deleteAbuseReportNotificationRecipient: {
recipientId: string; recipientId: string;
recipient: any; recipient: AbuseReportNotificationRecipient;
}; };
}; };