From 053da10e94c2412f58215116a958c0922261a610 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 20 Sep 2023 11:33:36 +0900 Subject: refactor(backend): update directory structure for models --- packages/backend/src/core/AccountMoveService.ts | 2 +- packages/backend/src/core/AccountUpdateService.ts | 2 +- packages/backend/src/core/AchievementService.ts | 2 +- packages/backend/src/core/AnnouncementService.ts | 2 +- packages/backend/src/core/AntennaService.ts | 6 +- packages/backend/src/core/CacheService.ts | 2 +- packages/backend/src/core/ClipService.ts | 2 +- .../backend/src/core/CreateSystemUserService.ts | 8 +- packages/backend/src/core/CustomEmojiService.ts | 4 +- packages/backend/src/core/DriveService.ts | 6 +- .../backend/src/core/FederatedInstanceService.ts | 2 +- .../src/core/FetchInstanceMetadataService.ts | 2 +- packages/backend/src/core/GlobalEventService.ts | 8 +- packages/backend/src/core/HashtagService.ts | 4 +- packages/backend/src/core/InstanceActorService.ts | 2 +- packages/backend/src/core/MetaService.ts | 2 +- packages/backend/src/core/MfmService.ts | 2 +- packages/backend/src/core/ModerationLogService.ts | 2 +- packages/backend/src/core/NoteCreateService.ts | 18 +- packages/backend/src/core/NoteDeleteService.ts | 4 +- packages/backend/src/core/NotePiningService.ts | 6 +- packages/backend/src/core/NoteReadService.ts | 4 +- packages/backend/src/core/NotificationService.ts | 4 +- packages/backend/src/core/PollService.ts | 2 +- packages/backend/src/core/ProxyAccountService.ts | 2 +- packages/backend/src/core/QueryService.ts | 2 +- packages/backend/src/core/QueueService.ts | 4 +- packages/backend/src/core/ReactionService.ts | 6 +- packages/backend/src/core/RelayService.ts | 4 +- .../backend/src/core/RemoteUserResolveService.ts | 2 +- packages/backend/src/core/RoleService.ts | 4 +- packages/backend/src/core/S3Service.ts | 2 +- packages/backend/src/core/SearchService.ts | 2 +- packages/backend/src/core/SignupService.ts | 8 +- packages/backend/src/core/UserBlockingService.ts | 4 +- packages/backend/src/core/UserFollowingService.ts | 2 +- packages/backend/src/core/UserKeypairService.ts | 4 +- packages/backend/src/core/UserListService.ts | 6 +- packages/backend/src/core/UserMutingService.ts | 2 +- packages/backend/src/core/UserSuspendService.ts | 2 +- packages/backend/src/core/WebhookService.ts | 2 +- .../src/core/activitypub/ApAudienceService.ts | 2 +- .../src/core/activitypub/ApDbResolverService.ts | 6 +- .../core/activitypub/ApDeliverManagerService.ts | 2 +- .../backend/src/core/activitypub/ApInboxService.ts | 2 +- .../backend/src/core/activitypub/ApMfmService.ts | 2 +- .../src/core/activitypub/ApRendererService.ts | 20 +- .../src/core/activitypub/ApRequestService.ts | 2 +- .../src/core/activitypub/ApResolverService.ts | 2 +- .../src/core/activitypub/models/ApImageService.ts | 4 +- .../src/core/activitypub/models/ApNoteService.ts | 8 +- .../src/core/activitypub/models/ApPersonService.ts | 12 +- .../core/activitypub/models/ApQuestionService.ts | 2 +- .../backend/src/core/chart/charts/active-users.ts | 2 +- packages/backend/src/core/chart/charts/drive.ts | 2 +- packages/backend/src/core/chart/charts/instance.ts | 4 +- packages/backend/src/core/chart/charts/notes.ts | 2 +- .../src/core/chart/charts/per-user-drive.ts | 2 +- .../src/core/chart/charts/per-user-following.ts | 2 +- .../src/core/chart/charts/per-user-notes.ts | 4 +- .../backend/src/core/chart/charts/per-user-pv.ts | 2 +- .../src/core/chart/charts/per-user-reactions.ts | 4 +- packages/backend/src/core/chart/charts/users.ts | 2 +- .../core/entities/AbuseUserReportEntityService.ts | 2 +- .../src/core/entities/AntennaEntityService.ts | 2 +- .../backend/src/core/entities/AppEntityService.ts | 4 +- .../src/core/entities/AuthSessionEntityService.ts | 4 +- .../src/core/entities/BlockingEntityService.ts | 4 +- .../src/core/entities/ChannelEntityService.ts | 6 +- .../backend/src/core/entities/ClipEntityService.ts | 4 +- .../src/core/entities/DriveFileEntityService.ts | 4 +- .../src/core/entities/DriveFolderEntityService.ts | 4 +- .../src/core/entities/EmojiEntityService.ts | 4 +- .../src/core/entities/FlashEntityService.ts | 6 +- .../src/core/entities/FlashLikeEntityService.ts | 6 +- .../core/entities/FollowRequestEntityService.ts | 6 +- .../src/core/entities/FollowingEntityService.ts | 6 +- .../src/core/entities/GalleryLikeEntityService.ts | 4 +- .../src/core/entities/GalleryPostEntityService.ts | 6 +- .../src/core/entities/HashtagEntityService.ts | 4 +- .../src/core/entities/InstanceEntityService.ts | 4 +- .../src/core/entities/InviteCodeEntityService.ts | 4 +- .../core/entities/ModerationLogEntityService.ts | 4 +- .../src/core/entities/MutingEntityService.ts | 6 +- .../backend/src/core/entities/NoteEntityService.ts | 6 +- .../src/core/entities/NoteFavoriteEntityService.ts | 6 +- .../src/core/entities/NoteReactionEntityService.ts | 6 +- .../src/core/entities/NotificationEntityService.ts | 4 +- .../backend/src/core/entities/PageEntityService.ts | 8 +- .../src/core/entities/PageLikeEntityService.ts | 6 +- .../src/core/entities/RenoteMutingEntityService.ts | 6 +- .../backend/src/core/entities/RoleEntityService.ts | 4 +- .../src/core/entities/SigninEntityService.ts | 4 +- .../backend/src/core/entities/UserEntityService.ts | 4 +- .../src/core/entities/UserListEntityService.ts | 4 +- packages/backend/src/misc/check-word-mute.ts | 4 +- packages/backend/src/misc/is-quote.ts | 2 +- packages/backend/src/models/AbuseUserReport.ts | 84 ++++ packages/backend/src/models/AccessToken.ts | 95 +++++ packages/backend/src/models/Ad.ts | 74 ++++ packages/backend/src/models/Announcement.ts | 95 +++++ packages/backend/src/models/AnnouncementRead.ts | 41 ++ packages/backend/src/models/Antenna.ts | 101 +++++ packages/backend/src/models/App.ts | 65 +++ packages/backend/src/models/AuthSession.ts | 48 +++ packages/backend/src/models/Blocking.ts | 47 +++ packages/backend/src/models/Channel.ts | 102 +++++ packages/backend/src/models/ChannelFavorite.ts | 46 ++ packages/backend/src/models/ChannelFollowing.ts | 48 +++ packages/backend/src/models/Clip.ts | 55 +++ packages/backend/src/models/ClipFavorite.ts | 38 ++ packages/backend/src/models/ClipNote.ts | 42 ++ packages/backend/src/models/DriveFile.ts | 197 +++++++++ packages/backend/src/models/DriveFolder.ts | 54 +++ packages/backend/src/models/Emoji.ts | 84 ++++ packages/backend/src/models/Flash.ts | 73 ++++ packages/backend/src/models/FlashLike.ts | 38 ++ packages/backend/src/models/FollowRequest.ts | 90 ++++ packages/backend/src/models/Following.ts | 87 ++++ packages/backend/src/models/GalleryLike.ts | 38 ++ packages/backend/src/models/GalleryPost.ts | 84 ++++ packages/backend/src/models/Hashtag.ts | 92 ++++ packages/backend/src/models/Instance.ts | 147 +++++++ packages/backend/src/models/Meta.ts | 469 +++++++++++++++++++++ packages/backend/src/models/ModerationLog.ts | 37 ++ packages/backend/src/models/MutedNote.ts | 53 +++ packages/backend/src/models/Muting.ts | 53 +++ packages/backend/src/models/Note.ts | 258 ++++++++++++ packages/backend/src/models/NoteFavorite.ts | 40 ++ packages/backend/src/models/NoteReaction.ts | 49 +++ packages/backend/src/models/NoteThreadMuting.ts | 37 ++ packages/backend/src/models/NoteUnread.ts | 68 +++ packages/backend/src/models/Notification.ts | 71 ++++ packages/backend/src/models/Page.ts | 126 ++++++ packages/backend/src/models/PageLike.ts | 38 ++ .../backend/src/models/PasswordResetRequest.ts | 35 ++ packages/backend/src/models/Poll.ts | 77 ++++ packages/backend/src/models/PollVote.ts | 45 ++ packages/backend/src/models/PromoNote.ts | 33 ++ packages/backend/src/models/PromoRead.ts | 40 ++ packages/backend/src/models/RegistrationTicket.ts | 65 +++ packages/backend/src/models/RegistryItem.ts | 63 +++ packages/backend/src/models/Relay.ts | 24 ++ packages/backend/src/models/RenoteMuting.ts | 47 +++ .../backend/src/models/RetentionAggregation.ts | 46 ++ packages/backend/src/models/Role.ts | 183 ++++++++ packages/backend/src/models/RoleAssignment.ts | 53 +++ packages/backend/src/models/Signin.ts | 40 ++ packages/backend/src/models/SwSubscription.ts | 47 +++ packages/backend/src/models/UsedUsername.ts | 25 ++ packages/backend/src/models/User.ts | 283 +++++++++++++ packages/backend/src/models/UserIp.ts | 28 ++ packages/backend/src/models/UserKeypair.ts | 38 ++ packages/backend/src/models/UserList.ts | 44 ++ packages/backend/src/models/UserListFavorite.ts | 38 ++ packages/backend/src/models/UserListJoining.ts | 47 +++ packages/backend/src/models/UserMemo.ts | 47 +++ packages/backend/src/models/UserNotePining.ts | 40 ++ packages/backend/src/models/UserPending.ts | 37 ++ packages/backend/src/models/UserProfile.ts | 259 ++++++++++++ packages/backend/src/models/UserPublickey.ts | 39 ++ packages/backend/src/models/UserSecurityKey.ts | 76 ++++ packages/backend/src/models/Webhook.ts | 78 ++++ packages/backend/src/models/_.ts | 130 +++--- .../backend/src/models/entities/AbuseUserReport.ts | 84 ---- .../backend/src/models/entities/AccessToken.ts | 95 ----- packages/backend/src/models/entities/Ad.ts | 74 ---- .../backend/src/models/entities/Announcement.ts | 95 ----- .../src/models/entities/AnnouncementRead.ts | 41 -- packages/backend/src/models/entities/Antenna.ts | 101 ----- packages/backend/src/models/entities/App.ts | 65 --- .../backend/src/models/entities/AuthSession.ts | 48 --- packages/backend/src/models/entities/Blocking.ts | 47 --- packages/backend/src/models/entities/Channel.ts | 102 ----- .../backend/src/models/entities/ChannelFavorite.ts | 46 -- .../src/models/entities/ChannelFollowing.ts | 48 --- packages/backend/src/models/entities/Clip.ts | 55 --- .../backend/src/models/entities/ClipFavorite.ts | 38 -- packages/backend/src/models/entities/ClipNote.ts | 42 -- packages/backend/src/models/entities/DriveFile.ts | 197 --------- .../backend/src/models/entities/DriveFolder.ts | 54 --- packages/backend/src/models/entities/Emoji.ts | 84 ---- packages/backend/src/models/entities/Flash.ts | 73 ---- packages/backend/src/models/entities/FlashLike.ts | 38 -- .../backend/src/models/entities/FollowRequest.ts | 90 ---- packages/backend/src/models/entities/Following.ts | 87 ---- .../backend/src/models/entities/GalleryLike.ts | 38 -- .../backend/src/models/entities/GalleryPost.ts | 84 ---- packages/backend/src/models/entities/Hashtag.ts | 92 ---- packages/backend/src/models/entities/Instance.ts | 147 ------- packages/backend/src/models/entities/Meta.ts | 469 --------------------- .../backend/src/models/entities/ModerationLog.ts | 37 -- packages/backend/src/models/entities/MutedNote.ts | 53 --- packages/backend/src/models/entities/Muting.ts | 53 --- packages/backend/src/models/entities/Note.ts | 258 ------------ .../backend/src/models/entities/NoteFavorite.ts | 40 -- .../backend/src/models/entities/NoteReaction.ts | 49 --- .../src/models/entities/NoteThreadMuting.ts | 37 -- packages/backend/src/models/entities/NoteUnread.ts | 68 --- .../backend/src/models/entities/Notification.ts | 71 ---- packages/backend/src/models/entities/Page.ts | 126 ------ packages/backend/src/models/entities/PageLike.ts | 38 -- .../src/models/entities/PasswordResetRequest.ts | 35 -- packages/backend/src/models/entities/Poll.ts | 77 ---- packages/backend/src/models/entities/PollVote.ts | 45 -- packages/backend/src/models/entities/PromoNote.ts | 33 -- packages/backend/src/models/entities/PromoRead.ts | 40 -- .../src/models/entities/RegistrationTicket.ts | 65 --- .../backend/src/models/entities/RegistryItem.ts | 63 --- packages/backend/src/models/entities/Relay.ts | 24 -- .../backend/src/models/entities/RenoteMuting.ts | 47 --- .../src/models/entities/RetentionAggregation.ts | 46 -- packages/backend/src/models/entities/Role.ts | 183 -------- .../backend/src/models/entities/RoleAssignment.ts | 53 --- packages/backend/src/models/entities/Signin.ts | 40 -- .../backend/src/models/entities/SwSubscription.ts | 47 --- .../backend/src/models/entities/UsedUsername.ts | 25 -- packages/backend/src/models/entities/User.ts | 283 ------------- packages/backend/src/models/entities/UserIp.ts | 28 -- .../backend/src/models/entities/UserKeypair.ts | 38 -- packages/backend/src/models/entities/UserList.ts | 44 -- .../src/models/entities/UserListFavorite.ts | 38 -- .../backend/src/models/entities/UserListJoining.ts | 47 --- packages/backend/src/models/entities/UserMemo.ts | 47 --- .../backend/src/models/entities/UserNotePining.ts | 40 -- .../backend/src/models/entities/UserPending.ts | 37 -- .../backend/src/models/entities/UserProfile.ts | 259 ------------ .../backend/src/models/entities/UserPublickey.ts | 39 -- .../backend/src/models/entities/UserSecurityKey.ts | 76 ---- packages/backend/src/models/entities/Webhook.ts | 78 ---- packages/backend/src/models/id.ts | 9 - packages/backend/src/models/util/id.ts | 9 + packages/backend/src/postgres.ts | 130 +++--- .../processors/DeleteAccountProcessorService.ts | 4 +- .../queue/processors/DeliverProcessorService.ts | 2 +- .../processors/ExportFavoritesProcessorService.ts | 4 +- .../processors/ExportFollowingProcessorService.ts | 2 +- .../processors/ExportNotesProcessorService.ts | 4 +- .../src/queue/processors/InboxProcessorService.ts | 4 +- .../processors/RelationshipProcessorService.ts | 2 +- packages/backend/src/queue/types.ts | 8 +- .../backend/src/server/ActivityPubServerService.ts | 6 +- .../backend/src/server/WellKnownServerService.ts | 2 +- packages/backend/src/server/api/ApiCallService.ts | 4 +- .../backend/src/server/api/AuthenticateService.ts | 6 +- packages/backend/src/server/api/GetterService.ts | 4 +- .../backend/src/server/api/SigninApiService.ts | 2 +- packages/backend/src/server/api/SigninService.ts | 2 +- .../backend/src/server/api/SignupApiService.ts | 2 +- .../src/server/api/StreamingApiServerService.ts | 2 +- packages/backend/src/server/api/endpoint-base.ts | 4 +- .../server/api/endpoints/admin/accounts/create.ts | 2 +- .../api/endpoints/admin/announcements/list.ts | 2 +- .../src/server/api/endpoints/admin/emoji/copy.ts | 2 +- .../src/server/api/endpoints/admin/emoji/list.ts | 2 +- .../src/server/api/endpoints/admin/suspend-user.ts | 2 +- .../src/server/api/endpoints/admin/update-meta.ts | 2 +- .../backend/src/server/api/endpoints/ap/show.ts | 4 +- .../src/server/api/endpoints/channels/create.ts | 2 +- .../src/server/api/endpoints/drive/files/show.ts | 2 +- .../server/api/endpoints/gallery/posts/create.ts | 4 +- .../server/api/endpoints/gallery/posts/update.ts | 2 +- .../src/server/api/endpoints/hashtags/trend.ts | 2 +- .../backend/src/server/api/endpoints/i/move.ts | 2 +- .../src/server/api/endpoints/i/notifications.ts | 2 +- .../backend/src/server/api/endpoints/i/update.ts | 6 +- .../src/server/api/endpoints/i/webhooks/create.ts | 2 +- .../src/server/api/endpoints/i/webhooks/update.ts | 2 +- .../src/server/api/endpoints/notes/conversation.ts | 2 +- .../src/server/api/endpoints/notes/create.ts | 8 +- .../src/server/api/endpoints/notes/polls/vote.ts | 2 +- .../src/server/api/endpoints/notes/reactions.ts | 2 +- .../src/server/api/endpoints/pages/create.ts | 2 +- .../backend/src/server/api/endpoints/pages/show.ts | 2 +- .../src/server/api/endpoints/pinned-users.ts | 2 +- .../src/server/api/endpoints/renote-mute/create.ts | 2 +- .../src/server/api/endpoints/username/available.ts | 2 +- .../endpoints/users/lists/create-from-public.ts | 2 +- .../src/server/api/endpoints/users/lists/create.ts | 2 +- .../endpoints/users/search-by-username-and-host.ts | 2 +- .../src/server/api/endpoints/users/search.ts | 2 +- .../backend/src/server/api/endpoints/users/show.ts | 2 +- .../backend/src/server/api/stream/Connection.ts | 4 +- .../src/server/api/stream/channels/user-list.ts | 2 +- packages/backend/src/server/api/stream/types.ts | 26 +- .../src/server/oauth/OAuth2ProviderService.ts | 4 +- packages/backend/src/server/web/FeedService.ts | 2 +- packages/backend/test/e2e/note.ts | 2 +- packages/backend/test/e2e/streaming.ts | 2 +- packages/backend/test/unit/activitypub.ts | 2 +- 290 files changed, 5574 insertions(+), 5574 deletions(-) create mode 100644 packages/backend/src/models/AbuseUserReport.ts create mode 100644 packages/backend/src/models/AccessToken.ts create mode 100644 packages/backend/src/models/Ad.ts create mode 100644 packages/backend/src/models/Announcement.ts create mode 100644 packages/backend/src/models/AnnouncementRead.ts create mode 100644 packages/backend/src/models/Antenna.ts create mode 100644 packages/backend/src/models/App.ts create mode 100644 packages/backend/src/models/AuthSession.ts create mode 100644 packages/backend/src/models/Blocking.ts create mode 100644 packages/backend/src/models/Channel.ts create mode 100644 packages/backend/src/models/ChannelFavorite.ts create mode 100644 packages/backend/src/models/ChannelFollowing.ts create mode 100644 packages/backend/src/models/Clip.ts create mode 100644 packages/backend/src/models/ClipFavorite.ts create mode 100644 packages/backend/src/models/ClipNote.ts create mode 100644 packages/backend/src/models/DriveFile.ts create mode 100644 packages/backend/src/models/DriveFolder.ts create mode 100644 packages/backend/src/models/Emoji.ts create mode 100644 packages/backend/src/models/Flash.ts create mode 100644 packages/backend/src/models/FlashLike.ts create mode 100644 packages/backend/src/models/FollowRequest.ts create mode 100644 packages/backend/src/models/Following.ts create mode 100644 packages/backend/src/models/GalleryLike.ts create mode 100644 packages/backend/src/models/GalleryPost.ts create mode 100644 packages/backend/src/models/Hashtag.ts create mode 100644 packages/backend/src/models/Instance.ts create mode 100644 packages/backend/src/models/Meta.ts create mode 100644 packages/backend/src/models/ModerationLog.ts create mode 100644 packages/backend/src/models/MutedNote.ts create mode 100644 packages/backend/src/models/Muting.ts create mode 100644 packages/backend/src/models/Note.ts create mode 100644 packages/backend/src/models/NoteFavorite.ts create mode 100644 packages/backend/src/models/NoteReaction.ts create mode 100644 packages/backend/src/models/NoteThreadMuting.ts create mode 100644 packages/backend/src/models/NoteUnread.ts create mode 100644 packages/backend/src/models/Notification.ts create mode 100644 packages/backend/src/models/Page.ts create mode 100644 packages/backend/src/models/PageLike.ts create mode 100644 packages/backend/src/models/PasswordResetRequest.ts create mode 100644 packages/backend/src/models/Poll.ts create mode 100644 packages/backend/src/models/PollVote.ts create mode 100644 packages/backend/src/models/PromoNote.ts create mode 100644 packages/backend/src/models/PromoRead.ts create mode 100644 packages/backend/src/models/RegistrationTicket.ts create mode 100644 packages/backend/src/models/RegistryItem.ts create mode 100644 packages/backend/src/models/Relay.ts create mode 100644 packages/backend/src/models/RenoteMuting.ts create mode 100644 packages/backend/src/models/RetentionAggregation.ts create mode 100644 packages/backend/src/models/Role.ts create mode 100644 packages/backend/src/models/RoleAssignment.ts create mode 100644 packages/backend/src/models/Signin.ts create mode 100644 packages/backend/src/models/SwSubscription.ts create mode 100644 packages/backend/src/models/UsedUsername.ts create mode 100644 packages/backend/src/models/User.ts create mode 100644 packages/backend/src/models/UserIp.ts create mode 100644 packages/backend/src/models/UserKeypair.ts create mode 100644 packages/backend/src/models/UserList.ts create mode 100644 packages/backend/src/models/UserListFavorite.ts create mode 100644 packages/backend/src/models/UserListJoining.ts create mode 100644 packages/backend/src/models/UserMemo.ts create mode 100644 packages/backend/src/models/UserNotePining.ts create mode 100644 packages/backend/src/models/UserPending.ts create mode 100644 packages/backend/src/models/UserProfile.ts create mode 100644 packages/backend/src/models/UserPublickey.ts create mode 100644 packages/backend/src/models/UserSecurityKey.ts create mode 100644 packages/backend/src/models/Webhook.ts delete mode 100644 packages/backend/src/models/entities/AbuseUserReport.ts delete mode 100644 packages/backend/src/models/entities/AccessToken.ts delete mode 100644 packages/backend/src/models/entities/Ad.ts delete mode 100644 packages/backend/src/models/entities/Announcement.ts delete mode 100644 packages/backend/src/models/entities/AnnouncementRead.ts delete mode 100644 packages/backend/src/models/entities/Antenna.ts delete mode 100644 packages/backend/src/models/entities/App.ts delete mode 100644 packages/backend/src/models/entities/AuthSession.ts delete mode 100644 packages/backend/src/models/entities/Blocking.ts delete mode 100644 packages/backend/src/models/entities/Channel.ts delete mode 100644 packages/backend/src/models/entities/ChannelFavorite.ts delete mode 100644 packages/backend/src/models/entities/ChannelFollowing.ts delete mode 100644 packages/backend/src/models/entities/Clip.ts delete mode 100644 packages/backend/src/models/entities/ClipFavorite.ts delete mode 100644 packages/backend/src/models/entities/ClipNote.ts delete mode 100644 packages/backend/src/models/entities/DriveFile.ts delete mode 100644 packages/backend/src/models/entities/DriveFolder.ts delete mode 100644 packages/backend/src/models/entities/Emoji.ts delete mode 100644 packages/backend/src/models/entities/Flash.ts delete mode 100644 packages/backend/src/models/entities/FlashLike.ts delete mode 100644 packages/backend/src/models/entities/FollowRequest.ts delete mode 100644 packages/backend/src/models/entities/Following.ts delete mode 100644 packages/backend/src/models/entities/GalleryLike.ts delete mode 100644 packages/backend/src/models/entities/GalleryPost.ts delete mode 100644 packages/backend/src/models/entities/Hashtag.ts delete mode 100644 packages/backend/src/models/entities/Instance.ts delete mode 100644 packages/backend/src/models/entities/Meta.ts delete mode 100644 packages/backend/src/models/entities/ModerationLog.ts delete mode 100644 packages/backend/src/models/entities/MutedNote.ts delete mode 100644 packages/backend/src/models/entities/Muting.ts delete mode 100644 packages/backend/src/models/entities/Note.ts delete mode 100644 packages/backend/src/models/entities/NoteFavorite.ts delete mode 100644 packages/backend/src/models/entities/NoteReaction.ts delete mode 100644 packages/backend/src/models/entities/NoteThreadMuting.ts delete mode 100644 packages/backend/src/models/entities/NoteUnread.ts delete mode 100644 packages/backend/src/models/entities/Notification.ts delete mode 100644 packages/backend/src/models/entities/Page.ts delete mode 100644 packages/backend/src/models/entities/PageLike.ts delete mode 100644 packages/backend/src/models/entities/PasswordResetRequest.ts delete mode 100644 packages/backend/src/models/entities/Poll.ts delete mode 100644 packages/backend/src/models/entities/PollVote.ts delete mode 100644 packages/backend/src/models/entities/PromoNote.ts delete mode 100644 packages/backend/src/models/entities/PromoRead.ts delete mode 100644 packages/backend/src/models/entities/RegistrationTicket.ts delete mode 100644 packages/backend/src/models/entities/RegistryItem.ts delete mode 100644 packages/backend/src/models/entities/Relay.ts delete mode 100644 packages/backend/src/models/entities/RenoteMuting.ts delete mode 100644 packages/backend/src/models/entities/RetentionAggregation.ts delete mode 100644 packages/backend/src/models/entities/Role.ts delete mode 100644 packages/backend/src/models/entities/RoleAssignment.ts delete mode 100644 packages/backend/src/models/entities/Signin.ts delete mode 100644 packages/backend/src/models/entities/SwSubscription.ts delete mode 100644 packages/backend/src/models/entities/UsedUsername.ts delete mode 100644 packages/backend/src/models/entities/User.ts delete mode 100644 packages/backend/src/models/entities/UserIp.ts delete mode 100644 packages/backend/src/models/entities/UserKeypair.ts delete mode 100644 packages/backend/src/models/entities/UserList.ts delete mode 100644 packages/backend/src/models/entities/UserListFavorite.ts delete mode 100644 packages/backend/src/models/entities/UserListJoining.ts delete mode 100644 packages/backend/src/models/entities/UserMemo.ts delete mode 100644 packages/backend/src/models/entities/UserNotePining.ts delete mode 100644 packages/backend/src/models/entities/UserPending.ts delete mode 100644 packages/backend/src/models/entities/UserProfile.ts delete mode 100644 packages/backend/src/models/entities/UserPublickey.ts delete mode 100644 packages/backend/src/models/entities/UserSecurityKey.ts delete mode 100644 packages/backend/src/models/entities/Webhook.ts delete mode 100644 packages/backend/src/models/id.ts create mode 100644 packages/backend/src/models/util/id.ts (limited to 'packages') diff --git a/packages/backend/src/core/AccountMoveService.ts b/packages/backend/src/core/AccountMoveService.ts index c19f0427e0..ec1d013922 100644 --- a/packages/backend/src/core/AccountMoveService.ts +++ b/packages/backend/src/core/AccountMoveService.ts @@ -8,7 +8,7 @@ import { IsNull, In, MoreThan, Not } from 'typeorm'; import { bindThis } from '@/decorators.js'; import { DI } from '@/di-symbols.js'; -import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/User.js'; import type { BlockingsRepository, FollowingsRepository, InstancesRepository, MutingsRepository, UserListJoiningsRepository, UsersRepository } from '@/models/_.js'; import type { RelationshipJobData, ThinUser } from '@/queue/types.js'; diff --git a/packages/backend/src/core/AccountUpdateService.ts b/packages/backend/src/core/AccountUpdateService.ts index 5a571c66cd..664700ea6b 100644 --- a/packages/backend/src/core/AccountUpdateService.ts +++ b/packages/backend/src/core/AccountUpdateService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { UsersRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { RelayService } from '@/core/RelayService.js'; import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerService.js'; diff --git a/packages/backend/src/core/AchievementService.ts b/packages/backend/src/core/AchievementService.ts index 87cc12bad0..1b8718335b 100644 --- a/packages/backend/src/core/AchievementService.ts +++ b/packages/backend/src/core/AchievementService.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UserProfilesRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import { NotificationService } from '@/core/NotificationService.js'; diff --git a/packages/backend/src/core/AnnouncementService.ts b/packages/backend/src/core/AnnouncementService.ts index fbe073cb76..70f37516a4 100644 --- a/packages/backend/src/core/AnnouncementService.ts +++ b/packages/backend/src/core/AnnouncementService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Brackets } from 'typeorm'; import { DI } from '@/di-symbols.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import type { AnnouncementReadsRepository, AnnouncementsRepository, MiAnnouncement, MiAnnouncementRead } from '@/models/_.js'; import { bindThis } from '@/decorators.js'; import { Packed } from '@/misc/json-schema.js'; diff --git a/packages/backend/src/core/AntennaService.ts b/packages/backend/src/core/AntennaService.ts index 03715a4a84..a7e74eeef0 100644 --- a/packages/backend/src/core/AntennaService.ts +++ b/packages/backend/src/core/AntennaService.ts @@ -5,9 +5,9 @@ import { Inject, Injectable } from '@nestjs/common'; import * as Redis from 'ioredis'; -import type { MiAntenna } from '@/models/entities/Antenna.js'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiAntenna } from '@/models/Antenna.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiUser } from '@/models/User.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import * as Acct from '@/misc/acct.js'; import type { Packed } from '@/misc/json-schema.js'; diff --git a/packages/backend/src/core/CacheService.ts b/packages/backend/src/core/CacheService.ts index 7073667211..6ca684d53c 100644 --- a/packages/backend/src/core/CacheService.ts +++ b/packages/backend/src/core/CacheService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import * as Redis from 'ioredis'; import type { BlockingsRepository, ChannelFollowingsRepository, FollowingsRepository, MutingsRepository, RenoteMutingsRepository, MiUserProfile, UserProfilesRepository, UsersRepository } from '@/models/_.js'; import { MemoryKVCache, RedisKVCache } from '@/misc/cache.js'; -import type { MiLocalUser, MiUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiUser } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/ClipService.ts b/packages/backend/src/core/ClipService.ts index 27f3013d4a..ff3a2b48e5 100644 --- a/packages/backend/src/core/ClipService.ts +++ b/packages/backend/src/core/ClipService.ts @@ -11,7 +11,7 @@ import { bindThis } from '@/decorators.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import { RoleService } from '@/core/RoleService.js'; import { IdService } from '@/core/IdService.js'; -import type { MiLocalUser } from '@/models/entities/User.js'; +import type { MiLocalUser } from '@/models/User.js'; @Injectable() export class ClipService { diff --git a/packages/backend/src/core/CreateSystemUserService.ts b/packages/backend/src/core/CreateSystemUserService.ts index 7f57128bae..3419d0b497 100644 --- a/packages/backend/src/core/CreateSystemUserService.ts +++ b/packages/backend/src/core/CreateSystemUserService.ts @@ -8,11 +8,11 @@ import { Inject, Injectable } from '@nestjs/common'; import bcrypt from 'bcryptjs'; import { IsNull, DataSource } from 'typeorm'; import { genRsaKeyPair } from '@/misc/gen-key-pair.js'; -import { MiUser } from '@/models/entities/User.js'; -import { MiUserProfile } from '@/models/entities/UserProfile.js'; +import { MiUser } from '@/models/User.js'; +import { MiUserProfile } from '@/models/UserProfile.js'; import { IdService } from '@/core/IdService.js'; -import { MiUserKeypair } from '@/models/entities/UserKeypair.js'; -import { MiUsedUsername } from '@/models/entities/UsedUsername.js'; +import { MiUserKeypair } from '@/models/UserKeypair.js'; +import { MiUsedUsername } from '@/models/UsedUsername.js'; import { DI } from '@/di-symbols.js'; import generateNativeUserToken from '@/misc/generate-native-user-token.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/CustomEmojiService.ts b/packages/backend/src/core/CustomEmojiService.ts index df5368272a..aa5490eba7 100644 --- a/packages/backend/src/core/CustomEmojiService.ts +++ b/packages/backend/src/core/CustomEmojiService.ts @@ -10,8 +10,8 @@ import { DI } from '@/di-symbols.js'; import { IdService } from '@/core/IdService.js'; import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiEmoji } from '@/models/entities/Emoji.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiEmoji } from '@/models/Emoji.js'; import type { EmojisRepository, MiRole } from '@/models/_.js'; import { bindThis } from '@/decorators.js'; import { MemoryKVCache, RedisSingleCache } from '@/misc/cache.js'; diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index cdd3f78ca3..e015d3dc41 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -14,9 +14,9 @@ import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, UsersRepository, DriveFoldersRepository, UserProfilesRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; import Logger from '@/logger.js'; -import type { MiRemoteUser, MiUser } from '@/models/entities/User.js'; +import type { MiRemoteUser, MiUser } from '@/models/User.js'; import { MetaService } from '@/core/MetaService.js'; -import { MiDriveFile } from '@/models/entities/DriveFile.js'; +import { MiDriveFile } from '@/models/DriveFile.js'; import { IdService } from '@/core/IdService.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import { FILE_TYPE_BROWSERSAFE } from '@/const.js'; @@ -27,7 +27,7 @@ import { VideoProcessingService } from '@/core/VideoProcessingService.js'; import { ImageProcessingService } from '@/core/ImageProcessingService.js'; import type { IImage } from '@/core/ImageProcessingService.js'; import { QueueService } from '@/core/QueueService.js'; -import type { MiDriveFolder } from '@/models/entities/DriveFolder.js'; +import type { MiDriveFolder } from '@/models/DriveFolder.js'; import { createTemp } from '@/misc/create-temp.js'; import DriveChart from '@/core/chart/charts/drive.js'; import PerUserDriveChart from '@/core/chart/charts/per-user-drive.js'; diff --git a/packages/backend/src/core/FederatedInstanceService.ts b/packages/backend/src/core/FederatedInstanceService.ts index ce75f48007..61806583c6 100644 --- a/packages/backend/src/core/FederatedInstanceService.ts +++ b/packages/backend/src/core/FederatedInstanceService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import * as Redis from 'ioredis'; import type { InstancesRepository } from '@/models/_.js'; -import type { MiInstance } from '@/models/entities/Instance.js'; +import type { MiInstance } from '@/models/Instance.js'; import { MemoryKVCache, RedisKVCache } from '@/misc/cache.js'; import { IdService } from '@/core/IdService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/core/FetchInstanceMetadataService.ts b/packages/backend/src/core/FetchInstanceMetadataService.ts index 4563006f68..682acef15b 100644 --- a/packages/backend/src/core/FetchInstanceMetadataService.ts +++ b/packages/backend/src/core/FetchInstanceMetadataService.ts @@ -8,7 +8,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { JSDOM } from 'jsdom'; import tinycolor from 'tinycolor2'; import * as Redis from 'ioredis'; -import type { MiInstance } from '@/models/entities/Instance.js'; +import type { MiInstance } from '@/models/Instance.js'; import type Logger from '@/logger.js'; import { DI } from '@/di-symbols.js'; import { LoggerService } from '@/core/LoggerService.js'; diff --git a/packages/backend/src/core/GlobalEventService.ts b/packages/backend/src/core/GlobalEventService.ts index 7c811b7ae9..4bc4f54c21 100644 --- a/packages/backend/src/core/GlobalEventService.ts +++ b/packages/backend/src/core/GlobalEventService.ts @@ -5,10 +5,10 @@ import { Inject, Injectable } from '@nestjs/common'; import * as Redis from 'ioredis'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiUserList } from '@/models/entities/UserList.js'; -import type { MiAntenna } from '@/models/entities/Antenna.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiUserList } from '@/models/UserList.js'; +import type { MiAntenna } from '@/models/Antenna.js'; import type { StreamChannels, AdminStreamTypes, diff --git a/packages/backend/src/core/HashtagService.ts b/packages/backend/src/core/HashtagService.ts index 4e8763935a..c72c7460ff 100644 --- a/packages/backend/src/core/HashtagService.ts +++ b/packages/backend/src/core/HashtagService.ts @@ -5,10 +5,10 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import { IdService } from '@/core/IdService.js'; -import type { MiHashtag } from '@/models/entities/Hashtag.js'; +import type { MiHashtag } from '@/models/Hashtag.js'; import type { HashtagsRepository } from '@/models/_.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/InstanceActorService.ts b/packages/backend/src/core/InstanceActorService.ts index 3f237f14e4..b40fd46291 100644 --- a/packages/backend/src/core/InstanceActorService.ts +++ b/packages/backend/src/core/InstanceActorService.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { IsNull } from 'typeorm'; -import type { MiLocalUser } from '@/models/entities/User.js'; +import type { MiLocalUser } from '@/models/User.js'; import type { UsersRepository } from '@/models/_.js'; import { MemorySingleCache } from '@/misc/cache.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/core/MetaService.ts b/packages/backend/src/core/MetaService.ts index 42ce4de432..00e1e3c1fc 100644 --- a/packages/backend/src/core/MetaService.ts +++ b/packages/backend/src/core/MetaService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DataSource } from 'typeorm'; import * as Redis from 'ioredis'; import { DI } from '@/di-symbols.js'; -import { MiMeta } from '@/models/entities/Meta.js'; +import { MiMeta } from '@/models/Meta.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { bindThis } from '@/decorators.js'; import { StreamMessages } from '@/server/api/stream/types.js'; diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts index b6f84da475..b275d1b142 100644 --- a/packages/backend/src/core/MfmService.ts +++ b/packages/backend/src/core/MfmService.ts @@ -10,7 +10,7 @@ import { Window } from 'happy-dom'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import { intersperse } from '@/misc/prelude/array.js'; -import type { IMentionedRemoteUsers } from '@/models/entities/Note.js'; +import type { IMentionedRemoteUsers } from '@/models/Note.js'; import { bindThis } from '@/decorators.js'; import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js'; import type * as mfm from 'mfm-js'; diff --git a/packages/backend/src/core/ModerationLogService.ts b/packages/backend/src/core/ModerationLogService.ts index 4ec88041b8..b0e5b794d0 100644 --- a/packages/backend/src/core/ModerationLogService.ts +++ b/packages/backend/src/core/ModerationLogService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { ModerationLogsRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { IdService } from '@/core/IdService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index dbba602d0d..4b0d818862 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -12,22 +12,22 @@ import RE2 from 're2'; import { extractMentions } from '@/misc/extract-mentions.js'; import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js'; import { extractHashtags } from '@/misc/extract-hashtags.js'; -import type { IMentionedRemoteUsers } from '@/models/entities/Note.js'; -import { MiNote } from '@/models/entities/Note.js'; +import type { IMentionedRemoteUsers } from '@/models/Note.js'; +import { MiNote } from '@/models/Note.js'; import type { ChannelsRepository, InstancesRepository, MutedNotesRepository, MutingsRepository, NotesRepository, NoteThreadMutingsRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiApp } from '@/models/entities/App.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiApp } from '@/models/App.js'; import { concat } from '@/misc/prelude/array.js'; import { IdService } from '@/core/IdService.js'; -import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; -import type { IPoll } from '@/models/entities/Poll.js'; -import { MiPoll } from '@/models/entities/Poll.js'; +import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js'; +import type { IPoll } from '@/models/Poll.js'; +import { MiPoll } from '@/models/Poll.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import { checkWordMute } from '@/misc/check-word-mute.js'; -import type { MiChannel } from '@/models/entities/Channel.js'; +import type { MiChannel } from '@/models/Channel.js'; import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import { MemorySingleCache } from '@/misc/cache.js'; -import type { MiUserProfile } from '@/models/entities/UserProfile.js'; +import type { MiUserProfile } from '@/models/UserProfile.js'; import { RelayService } from '@/core/RelayService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/core/NoteDeleteService.ts b/packages/backend/src/core/NoteDeleteService.ts index 2b51aa76f8..69fff36a02 100644 --- a/packages/backend/src/core/NoteDeleteService.ts +++ b/packages/backend/src/core/NoteDeleteService.ts @@ -5,8 +5,8 @@ import { Brackets, In } from 'typeorm'; import { Injectable, Inject } from '@nestjs/common'; -import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; -import type { MiNote, IMentionedRemoteUsers } from '@/models/entities/Note.js'; +import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js'; +import type { MiNote, IMentionedRemoteUsers } from '@/models/Note.js'; import type { InstancesRepository, NotesRepository, UsersRepository } from '@/models/_.js'; import { RelayService } from '@/core/RelayService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; diff --git a/packages/backend/src/core/NotePiningService.ts b/packages/backend/src/core/NotePiningService.ts index a7646e9968..147554ee9a 100644 --- a/packages/backend/src/core/NotePiningService.ts +++ b/packages/backend/src/core/NotePiningService.ts @@ -7,10 +7,10 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NotesRepository, UserNotePiningsRepository, UsersRepository } from '@/models/_.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; import { IdService } from '@/core/IdService.js'; -import type { MiUserNotePining } from '@/models/entities/UserNotePining.js'; +import type { MiUserNotePining } from '@/models/UserNotePining.js'; import { RelayService } from '@/core/RelayService.js'; import type { Config } from '@/config.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; diff --git a/packages/backend/src/core/NoteReadService.ts b/packages/backend/src/core/NoteReadService.ts index f99aa20970..422e0192cf 100644 --- a/packages/backend/src/core/NoteReadService.ts +++ b/packages/backend/src/core/NoteReadService.ts @@ -7,9 +7,9 @@ import { setTimeout } from 'node:timers/promises'; import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import { In } from 'typeorm'; import { DI } from '@/di-symbols.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import { IdService } from '@/core/IdService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import type { NoteUnreadsRepository, MutingsRepository, NoteThreadMutingsRepository } from '@/models/_.js'; diff --git a/packages/backend/src/core/NotificationService.ts b/packages/backend/src/core/NotificationService.ts index d82ebe0092..258ae44f7d 100644 --- a/packages/backend/src/core/NotificationService.ts +++ b/packages/backend/src/core/NotificationService.ts @@ -9,8 +9,8 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import { In } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { UsersRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNotification } from '@/models/entities/Notification.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNotification } from '@/models/Notification.js'; import { bindThis } from '@/decorators.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { PushNotificationService } from '@/core/PushNotificationService.js'; diff --git a/packages/backend/src/core/PollService.ts b/packages/backend/src/core/PollService.ts index d5e9ab9723..940aa98347 100644 --- a/packages/backend/src/core/PollService.ts +++ b/packages/backend/src/core/PollService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NotesRepository, UsersRepository, PollsRepository, PollVotesRepository, MiUser } from '@/models/_.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import { RelayService } from '@/core/RelayService.js'; import { IdService } from '@/core/IdService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; diff --git a/packages/backend/src/core/ProxyAccountService.ts b/packages/backend/src/core/ProxyAccountService.ts index dfe546b54c..b1bc60701b 100644 --- a/packages/backend/src/core/ProxyAccountService.ts +++ b/packages/backend/src/core/ProxyAccountService.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository } from '@/models/_.js'; -import type { MiLocalUser } from '@/models/entities/User.js'; +import type { MiLocalUser } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; import { MetaService } from '@/core/MetaService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/QueryService.ts b/packages/backend/src/core/QueryService.ts index c064732c7d..9145726f86 100644 --- a/packages/backend/src/core/QueryService.ts +++ b/packages/backend/src/core/QueryService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Brackets, ObjectLiteral } from 'typeorm'; import { DI } from '@/di-symbols.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import type { UserProfilesRepository, FollowingsRepository, ChannelFollowingsRepository, MutedNotesRepository, BlockingsRepository, NoteThreadMutingsRepository, MutingsRepository, RenoteMutingsRepository } from '@/models/_.js'; import { bindThis } from '@/decorators.js'; import type { SelectQueryBuilder } from 'typeorm'; diff --git a/packages/backend/src/core/QueueService.ts b/packages/backend/src/core/QueueService.ts index 310d5e5d9c..d8c7250034 100644 --- a/packages/backend/src/core/QueueService.ts +++ b/packages/backend/src/core/QueueService.ts @@ -6,8 +6,8 @@ import { randomUUID } from 'node:crypto'; import { Inject, Injectable } from '@nestjs/common'; import type { IActivity } from '@/core/activitypub/type.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiWebhook, webhookEventTypes } from '@/models/entities/Webhook.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiWebhook, webhookEventTypes } from '@/models/Webhook.js'; import type { Config } from '@/config.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts index 04c58b9773..d9bde502c8 100644 --- a/packages/backend/src/core/ReactionService.ts +++ b/packages/backend/src/core/ReactionService.ts @@ -7,10 +7,10 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { EmojisRepository, NoteReactionsRepository, UsersRepository, NotesRepository } from '@/models/_.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; -import type { MiRemoteUser, MiUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiRemoteUser, MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; import { IdService } from '@/core/IdService.js'; -import type { MiNoteReaction } from '@/models/entities/NoteReaction.js'; +import type { MiNoteReaction } from '@/models/NoteReaction.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { NotificationService } from '@/core/NotificationService.js'; diff --git a/packages/backend/src/core/RelayService.ts b/packages/backend/src/core/RelayService.ts index 12a477a3b9..7171bf84c5 100644 --- a/packages/backend/src/core/RelayService.ts +++ b/packages/backend/src/core/RelayService.ts @@ -5,11 +5,11 @@ import { Inject, Injectable } from '@nestjs/common'; import { IsNull } from 'typeorm'; -import type { MiLocalUser, MiUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiUser } from '@/models/User.js'; import type { RelaysRepository, UsersRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; import { MemorySingleCache } from '@/misc/cache.js'; -import type { MiRelay } from '@/models/entities/Relay.js'; +import type { MiRelay } from '@/models/Relay.js'; import { QueueService } from '@/core/QueueService.js'; import { CreateSystemUserService } from '@/core/CreateSystemUserService.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; diff --git a/packages/backend/src/core/RemoteUserResolveService.ts b/packages/backend/src/core/RemoteUserResolveService.ts index 4d90c075b0..75c5f14aa4 100644 --- a/packages/backend/src/core/RemoteUserResolveService.ts +++ b/packages/backend/src/core/RemoteUserResolveService.ts @@ -9,7 +9,7 @@ import chalk from 'chalk'; import { IsNull } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { UsersRepository } from '@/models/_.js'; -import type { MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiRemoteUser } from '@/models/User.js'; import type { Config } from '@/config.js'; import type Logger from '@/logger.js'; import { UtilityService } from '@/core/UtilityService.js'; diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts index aeb2a7e64d..518f283695 100644 --- a/packages/backend/src/core/RoleService.ts +++ b/packages/backend/src/core/RoleService.ts @@ -8,12 +8,12 @@ import * as Redis from 'ioredis'; import { In } from 'typeorm'; import type { MiRole, MiRoleAssignment, RoleAssignmentsRepository, RolesRepository, UsersRepository } from '@/models/_.js'; import { MemoryKVCache, MemorySingleCache } from '@/misc/cache.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import { MetaService } from '@/core/MetaService.js'; import { CacheService } from '@/core/CacheService.js'; -import type { RoleCondFormulaValue } from '@/models/entities/Role.js'; +import type { RoleCondFormulaValue } from '@/models/Role.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { StreamMessages } from '@/server/api/stream/types.js'; import { IdService } from '@/core/IdService.js'; diff --git a/packages/backend/src/core/S3Service.ts b/packages/backend/src/core/S3Service.ts index 4cd81b1b71..df0991539d 100644 --- a/packages/backend/src/core/S3Service.ts +++ b/packages/backend/src/core/S3Service.ts @@ -10,7 +10,7 @@ import { Injectable } from '@nestjs/common'; import { DeleteObjectCommand, S3Client } from '@aws-sdk/client-s3'; import { Upload } from '@aws-sdk/lib-storage'; import { NodeHttpHandler, NodeHttpHandlerOptions } from '@smithy/node-http-handler'; -import type { MiMeta } from '@/models/entities/Meta.js'; +import type { MiMeta } from '@/models/Meta.js'; import { HttpRequestService } from '@/core/HttpRequestService.js'; import { bindThis } from '@/decorators.js'; import type { DeleteObjectCommandInput, PutObjectCommandInput } from '@aws-sdk/client-s3'; diff --git a/packages/backend/src/core/SearchService.ts b/packages/backend/src/core/SearchService.ts index 39b6a708c4..3ef321dd32 100644 --- a/packages/backend/src/core/SearchService.ts +++ b/packages/backend/src/core/SearchService.ts @@ -8,7 +8,7 @@ import { In } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import { bindThis } from '@/decorators.js'; -import { MiNote } from '@/models/entities/Note.js'; +import { MiNote } from '@/models/Note.js'; import { MiUser } from '@/models/_.js'; import type { NotesRepository } from '@/models/_.js'; import { sqlLikeEscape } from '@/misc/sql-like-escape.js'; diff --git a/packages/backend/src/core/SignupService.ts b/packages/backend/src/core/SignupService.ts index 467b93677b..dfec0cfcfe 100644 --- a/packages/backend/src/core/SignupService.ts +++ b/packages/backend/src/core/SignupService.ts @@ -9,11 +9,11 @@ import bcrypt from 'bcryptjs'; import { DataSource, IsNull } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { UsedUsernamesRepository, UsersRepository } from '@/models/_.js'; -import { MiUser } from '@/models/entities/User.js'; -import { MiUserProfile } from '@/models/entities/UserProfile.js'; +import { MiUser } from '@/models/User.js'; +import { MiUserProfile } from '@/models/UserProfile.js'; import { IdService } from '@/core/IdService.js'; -import { MiUserKeypair } from '@/models/entities/UserKeypair.js'; -import { MiUsedUsername } from '@/models/entities/UsedUsername.js'; +import { MiUserKeypair } from '@/models/UserKeypair.js'; +import { MiUsedUsername } from '@/models/UsedUsername.js'; import generateUserToken from '@/misc/generate-native-user-token.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/UserBlockingService.ts b/packages/backend/src/core/UserBlockingService.ts index 2d329a719e..37031e341e 100644 --- a/packages/backend/src/core/UserBlockingService.ts +++ b/packages/backend/src/core/UserBlockingService.ts @@ -6,8 +6,8 @@ import { Inject, Injectable, OnModuleInit } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; import { IdService } from '@/core/IdService.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiBlocking } from '@/models/entities/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiBlocking } from '@/models/Blocking.js'; import { QueueService } from '@/core/QueueService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/core/UserFollowingService.ts b/packages/backend/src/core/UserFollowingService.ts index 3b96eb480a..5b2b0205d9 100644 --- a/packages/backend/src/core/UserFollowingService.ts +++ b/packages/backend/src/core/UserFollowingService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable, OnModuleInit, forwardRef } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; import { IsNull } from 'typeorm'; -import type { MiLocalUser, MiPartialLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiPartialLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; import { QueueService } from '@/core/QueueService.js'; import PerUserFollowingChart from '@/core/chart/charts/per-user-following.js'; diff --git a/packages/backend/src/core/UserKeypairService.ts b/packages/backend/src/core/UserKeypairService.ts index 31555ba224..425a97f3f1 100644 --- a/packages/backend/src/core/UserKeypairService.ts +++ b/packages/backend/src/core/UserKeypairService.ts @@ -5,10 +5,10 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import * as Redis from 'ioredis'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import type { UserKeypairsRepository } from '@/models/_.js'; import { RedisKVCache } from '@/misc/cache.js'; -import type { MiUserKeypair } from '@/models/entities/UserKeypair.js'; +import type { MiUserKeypair } from '@/models/UserKeypair.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/UserListService.ts b/packages/backend/src/core/UserListService.ts index 8b1985c95d..a71d50bba5 100644 --- a/packages/backend/src/core/UserListService.ts +++ b/packages/backend/src/core/UserListService.ts @@ -5,9 +5,9 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UserListJoiningsRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiUserList } from '@/models/entities/UserList.js'; -import type { MiUserListJoining } from '@/models/entities/UserListJoining.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiUserList } from '@/models/UserList.js'; +import type { MiUserListJoining } from '@/models/UserListJoining.js'; import { IdService } from '@/core/IdService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/core/UserMutingService.ts b/packages/backend/src/core/UserMutingService.ts index 52346ffe15..2387c9d648 100644 --- a/packages/backend/src/core/UserMutingService.ts +++ b/packages/backend/src/core/UserMutingService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { In } from 'typeorm'; import type { MutingsRepository, MiMuting } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import { CacheService } from '@/core/CacheService.js'; diff --git a/packages/backend/src/core/UserSuspendService.ts b/packages/backend/src/core/UserSuspendService.ts index 914a1d7dfb..8940a142d1 100644 --- a/packages/backend/src/core/UserSuspendService.ts +++ b/packages/backend/src/core/UserSuspendService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Not, IsNull } from 'typeorm'; import type { FollowingsRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { QueueService } from '@/core/QueueService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/core/WebhookService.ts b/packages/backend/src/core/WebhookService.ts index c673562aa8..1344f0ac97 100644 --- a/packages/backend/src/core/WebhookService.ts +++ b/packages/backend/src/core/WebhookService.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import * as Redis from 'ioredis'; import type { WebhooksRepository } from '@/models/_.js'; -import type { MiWebhook } from '@/models/entities/Webhook.js'; +import type { MiWebhook } from '@/models/Webhook.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import { StreamMessages } from '@/server/api/stream/types.js'; diff --git a/packages/backend/src/core/activitypub/ApAudienceService.ts b/packages/backend/src/core/activitypub/ApAudienceService.ts index f3432f8334..440852bdf3 100644 --- a/packages/backend/src/core/activitypub/ApAudienceService.ts +++ b/packages/backend/src/core/activitypub/ApAudienceService.ts @@ -5,7 +5,7 @@ import { Injectable } from '@nestjs/common'; import promiseLimit from 'promise-limit'; -import type { MiRemoteUser, MiUser } from '@/models/entities/User.js'; +import type { MiRemoteUser, MiUser } from '@/models/User.js'; import { concat, unique } from '@/misc/prelude/array.js'; import { bindThis } from '@/decorators.js'; import { getApIds } from './type.js'; diff --git a/packages/backend/src/core/activitypub/ApDbResolverService.ts b/packages/backend/src/core/activitypub/ApDbResolverService.ts index 711cfbe5d8..995c5dcd5f 100644 --- a/packages/backend/src/core/activitypub/ApDbResolverService.ts +++ b/packages/backend/src/core/activitypub/ApDbResolverService.ts @@ -8,11 +8,11 @@ import { DI } from '@/di-symbols.js'; import type { NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; import { MemoryKVCache } from '@/misc/cache.js'; -import type { MiUserPublickey } from '@/models/entities/UserPublickey.js'; +import type { MiUserPublickey } from '@/models/UserPublickey.js'; import { CacheService } from '@/core/CacheService.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import { bindThis } from '@/decorators.js'; -import { MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; +import { MiLocalUser, MiRemoteUser } from '@/models/User.js'; import { getApId } from './type.js'; import { ApPersonService } from './models/ApPersonService.js'; import type { IObject } from './type.js'; diff --git a/packages/backend/src/core/activitypub/ApDeliverManagerService.ts b/packages/backend/src/core/activitypub/ApDeliverManagerService.ts index 4557a9114a..81003bcf1c 100644 --- a/packages/backend/src/core/activitypub/ApDeliverManagerService.ts +++ b/packages/backend/src/core/activitypub/ApDeliverManagerService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { IsNull, Not } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { FollowingsRepository } from '@/models/_.js'; -import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/User.js'; import { QueueService } from '@/core/QueueService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts index c47c72fda2..b921ee7454 100644 --- a/packages/backend/src/core/activitypub/ApInboxService.ts +++ b/packages/backend/src/core/activitypub/ApInboxService.ts @@ -26,7 +26,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { QueueService } from '@/core/QueueService.js'; import type { UsersRepository, NotesRepository, FollowingsRepository, AbuseUserReportsRepository, FollowRequestsRepository } from '@/models/_.js'; import { bindThis } from '@/decorators.js'; -import type { MiRemoteUser } from '@/models/entities/User.js'; +import type { MiRemoteUser } from '@/models/User.js'; import { getApHrefNullable, getApId, getApIds, getApType, isAccept, isActor, isAdd, isAnnounce, isBlock, isCollection, isCollectionOrOrderedCollection, isCreate, isDelete, isFlag, isFollow, isLike, isMove, isPost, isReject, isRemove, isTombstone, isUndo, isUpdate, validActor, validPost } from './type.js'; import { ApNoteService } from './models/ApNoteService.js'; import { ApLoggerService } from './ApLoggerService.js'; diff --git a/packages/backend/src/core/activitypub/ApMfmService.ts b/packages/backend/src/core/activitypub/ApMfmService.ts index 5dd4b7f6df..60868627a2 100644 --- a/packages/backend/src/core/activitypub/ApMfmService.ts +++ b/packages/backend/src/core/activitypub/ApMfmService.ts @@ -6,7 +6,7 @@ import { Injectable } from '@nestjs/common'; import * as mfm from 'mfm-js'; import { MfmService } from '@/core/MfmService.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import { bindThis } from '@/decorators.js'; import { extractApHashtagObjects } from './models/tag.js'; import type { IObject } from './type.js'; diff --git a/packages/backend/src/core/activitypub/ApRendererService.ts b/packages/backend/src/core/activitypub/ApRendererService.ts index a2f174e235..7a9d2e21d8 100644 --- a/packages/backend/src/core/activitypub/ApRendererService.ts +++ b/packages/backend/src/core/activitypub/ApRendererService.ts @@ -9,20 +9,20 @@ import { In } from 'typeorm'; import * as mfm from 'mfm-js'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; -import type { MiPartialLocalUser, MiLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/entities/User.js'; -import type { IMentionedRemoteUsers, MiNote } from '@/models/entities/Note.js'; -import type { MiBlocking } from '@/models/entities/Blocking.js'; -import type { MiRelay } from '@/models/entities/Relay.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiNoteReaction } from '@/models/entities/NoteReaction.js'; -import type { MiEmoji } from '@/models/entities/Emoji.js'; -import type { MiPoll } from '@/models/entities/Poll.js'; -import type { MiPollVote } from '@/models/entities/PollVote.js'; +import type { MiPartialLocalUser, MiLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.js'; +import type { IMentionedRemoteUsers, MiNote } from '@/models/Note.js'; +import type { MiBlocking } from '@/models/Blocking.js'; +import type { MiRelay } from '@/models/Relay.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiNoteReaction } from '@/models/NoteReaction.js'; +import type { MiEmoji } from '@/models/Emoji.js'; +import type { MiPoll } from '@/models/Poll.js'; +import type { MiPollVote } from '@/models/PollVote.js'; import { UserKeypairService } from '@/core/UserKeypairService.js'; import { MfmService } from '@/core/MfmService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; -import type { MiUserKeypair } from '@/models/entities/UserKeypair.js'; +import type { MiUserKeypair } from '@/models/UserKeypair.js'; import type { UsersRepository, UserProfilesRepository, NotesRepository, DriveFilesRepository, PollsRepository } from '@/models/_.js'; import { bindThis } from '@/decorators.js'; import { CustomEmojiService } from '@/core/CustomEmojiService.js'; diff --git a/packages/backend/src/core/activitypub/ApRequestService.ts b/packages/backend/src/core/activitypub/ApRequestService.ts index fb44a55de2..b59ce5241f 100644 --- a/packages/backend/src/core/activitypub/ApRequestService.ts +++ b/packages/backend/src/core/activitypub/ApRequestService.ts @@ -8,7 +8,7 @@ import { URL } from 'node:url'; import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { UserKeypairService } from '@/core/UserKeypairService.js'; import { HttpRequestService } from '@/core/HttpRequestService.js'; import { LoggerService } from '@/core/LoggerService.js'; diff --git a/packages/backend/src/core/activitypub/ApResolverService.ts b/packages/backend/src/core/activitypub/ApResolverService.ts index 0d70807335..058869ca77 100644 --- a/packages/backend/src/core/activitypub/ApResolverService.ts +++ b/packages/backend/src/core/activitypub/ApResolverService.ts @@ -4,7 +4,7 @@ */ import { Inject, Injectable } from '@nestjs/common'; -import type { MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiRemoteUser } from '@/models/User.js'; import { InstanceActorService } from '@/core/InstanceActorService.js'; import type { NotesRepository, PollsRepository, NoteReactionsRepository, UsersRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; diff --git a/packages/backend/src/core/activitypub/models/ApImageService.ts b/packages/backend/src/core/activitypub/models/ApImageService.ts index 906a2f3fb1..a4cd533892 100644 --- a/packages/backend/src/core/activitypub/models/ApImageService.ts +++ b/packages/backend/src/core/activitypub/models/ApImageService.ts @@ -6,8 +6,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository } from '@/models/_.js'; -import type { MiRemoteUser } from '@/models/entities/User.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiRemoteUser } from '@/models/User.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { MetaService } from '@/core/MetaService.js'; import { truncate } from '@/misc/truncate.js'; import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/const.js'; diff --git a/packages/backend/src/core/activitypub/models/ApNoteService.ts b/packages/backend/src/core/activitypub/models/ApNoteService.ts index 392bdf33ed..573dff5b91 100644 --- a/packages/backend/src/core/activitypub/models/ApNoteService.ts +++ b/packages/backend/src/core/activitypub/models/ApNoteService.ts @@ -9,13 +9,13 @@ import { In } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { PollsRepository, EmojisRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; -import type { MiRemoteUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiRemoteUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; import { toArray, toSingle, unique } from '@/misc/prelude/array.js'; -import type { MiEmoji } from '@/models/entities/Emoji.js'; +import type { MiEmoji } from '@/models/Emoji.js'; import { MetaService } from '@/core/MetaService.js'; import { AppLockService } from '@/core/AppLockService.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { NoteCreateService } from '@/core/NoteCreateService.js'; import type Logger from '@/logger.js'; import { IdService } from '@/core/IdService.js'; diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index d233bcc8b8..ea64883395 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -10,26 +10,26 @@ import { ModuleRef } from '@nestjs/core'; import { DI } from '@/di-symbols.js'; import type { FollowingsRepository, InstancesRepository, UserProfilesRepository, UserPublickeysRepository, UsersRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; -import type { MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; -import { MiUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiRemoteUser } from '@/models/User.js'; +import { MiUser } from '@/models/User.js'; import { truncate } from '@/misc/truncate.js'; import type { CacheService } from '@/core/CacheService.js'; import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js'; import type Logger from '@/logger.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import type { IdService } from '@/core/IdService.js'; import type { MfmService } from '@/core/MfmService.js'; import { toArray } from '@/misc/prelude/array.js'; import type { GlobalEventService } from '@/core/GlobalEventService.js'; import type { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import type { FetchInstanceMetadataService } from '@/core/FetchInstanceMetadataService.js'; -import { MiUserProfile } from '@/models/entities/UserProfile.js'; -import { MiUserPublickey } from '@/models/entities/UserPublickey.js'; +import { MiUserProfile } from '@/models/UserProfile.js'; +import { MiUserPublickey } from '@/models/UserPublickey.js'; import type UsersChart from '@/core/chart/charts/users.js'; import type InstanceChart from '@/core/chart/charts/instance.js'; import type { HashtagService } from '@/core/HashtagService.js'; -import { MiUserNotePining } from '@/models/entities/UserNotePining.js'; +import { MiUserNotePining } from '@/models/UserNotePining.js'; import { StatusError } from '@/misc/status-error.js'; import type { UtilityService } from '@/core/UtilityService.js'; import type { UserEntityService } from '@/core/entities/UserEntityService.js'; diff --git a/packages/backend/src/core/activitypub/models/ApQuestionService.ts b/packages/backend/src/core/activitypub/models/ApQuestionService.ts index 85e97e0e83..27bd62268b 100644 --- a/packages/backend/src/core/activitypub/models/ApQuestionService.ts +++ b/packages/backend/src/core/activitypub/models/ApQuestionService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NotesRepository, PollsRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; -import type { IPoll } from '@/models/entities/Poll.js'; +import type { IPoll } from '@/models/Poll.js'; import type Logger from '@/logger.js'; import { bindThis } from '@/decorators.js'; import { isQuestion } from '../type.js'; diff --git a/packages/backend/src/core/chart/charts/active-users.ts b/packages/backend/src/core/chart/charts/active-users.ts index ff9db46bc2..55da1469e5 100644 --- a/packages/backend/src/core/chart/charts/active-users.ts +++ b/packages/backend/src/core/chart/charts/active-users.ts @@ -6,7 +6,7 @@ import { Injectable, Inject } from '@nestjs/common'; import { DataSource } from 'typeorm'; import { AppLockService } from '@/core/AppLockService.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import Chart from '../core.js'; diff --git a/packages/backend/src/core/chart/charts/drive.ts b/packages/backend/src/core/chart/charts/drive.ts index 2fe0f76163..bbcbf1a955 100644 --- a/packages/backend/src/core/chart/charts/drive.ts +++ b/packages/backend/src/core/chart/charts/drive.ts @@ -5,7 +5,7 @@ import { Injectable, Inject } from '@nestjs/common'; import { DataSource } from 'typeorm'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/chart/charts/instance.ts b/packages/backend/src/core/chart/charts/instance.ts index fe38b647b1..9df0afb02e 100644 --- a/packages/backend/src/core/chart/charts/instance.ts +++ b/packages/backend/src/core/chart/charts/instance.ts @@ -6,8 +6,8 @@ import { Injectable, Inject } from '@nestjs/common'; import { DataSource } from 'typeorm'; import type { DriveFilesRepository, FollowingsRepository, UsersRepository, NotesRepository } from '@/models/_.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiNote } from '@/models/Note.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { UtilityService } from '@/core/UtilityService.js'; diff --git a/packages/backend/src/core/chart/charts/notes.ts b/packages/backend/src/core/chart/charts/notes.ts index c1f3f13e0f..df3295dbac 100644 --- a/packages/backend/src/core/chart/charts/notes.ts +++ b/packages/backend/src/core/chart/charts/notes.ts @@ -6,7 +6,7 @@ import { Injectable, Inject } from '@nestjs/common'; import { Not, IsNull, DataSource } from 'typeorm'; import type { NotesRepository } from '@/models/_.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/chart/charts/per-user-drive.ts b/packages/backend/src/core/chart/charts/per-user-drive.ts index cf7e7c0d31..18354359c8 100644 --- a/packages/backend/src/core/chart/charts/per-user-drive.ts +++ b/packages/backend/src/core/chart/charts/per-user-drive.ts @@ -6,7 +6,7 @@ import { Injectable, Inject } from '@nestjs/common'; import { DataSource } from 'typeorm'; import type { DriveFilesRepository } from '@/models/_.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; diff --git a/packages/backend/src/core/chart/charts/per-user-following.ts b/packages/backend/src/core/chart/charts/per-user-following.ts index e080290662..79bff2cb66 100644 --- a/packages/backend/src/core/chart/charts/per-user-following.ts +++ b/packages/backend/src/core/chart/charts/per-user-following.ts @@ -5,7 +5,7 @@ import { Injectable, Inject } from '@nestjs/common'; import { Not, IsNull, DataSource } from 'typeorm'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; diff --git a/packages/backend/src/core/chart/charts/per-user-notes.ts b/packages/backend/src/core/chart/charts/per-user-notes.ts index 5215875cce..0db0e6f07f 100644 --- a/packages/backend/src/core/chart/charts/per-user-notes.ts +++ b/packages/backend/src/core/chart/charts/per-user-notes.ts @@ -5,8 +5,8 @@ import { Injectable, Inject } from '@nestjs/common'; import { DataSource } from 'typeorm'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import type { NotesRepository } from '@/models/_.js'; diff --git a/packages/backend/src/core/chart/charts/per-user-pv.ts b/packages/backend/src/core/chart/charts/per-user-pv.ts index ad01e0483e..cf1b4c71f6 100644 --- a/packages/backend/src/core/chart/charts/per-user-pv.ts +++ b/packages/backend/src/core/chart/charts/per-user-pv.ts @@ -5,7 +5,7 @@ import { Injectable, Inject } from '@nestjs/common'; import { DataSource } from 'typeorm'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/chart/charts/per-user-reactions.ts b/packages/backend/src/core/chart/charts/per-user-reactions.ts index d6d54bef3b..9f4f6e9651 100644 --- a/packages/backend/src/core/chart/charts/per-user-reactions.ts +++ b/packages/backend/src/core/chart/charts/per-user-reactions.ts @@ -5,8 +5,8 @@ import { Injectable, Inject } from '@nestjs/common'; import { DataSource } from 'typeorm'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; diff --git a/packages/backend/src/core/chart/charts/users.ts b/packages/backend/src/core/chart/charts/users.ts index ccf6912924..c2026c2aea 100644 --- a/packages/backend/src/core/chart/charts/users.ts +++ b/packages/backend/src/core/chart/charts/users.ts @@ -5,7 +5,7 @@ import { Injectable, Inject } from '@nestjs/common'; import { Not, IsNull, DataSource } from 'typeorm'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { AppLockService } from '@/core/AppLockService.js'; import { DI } from '@/di-symbols.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; diff --git a/packages/backend/src/core/entities/AbuseUserReportEntityService.ts b/packages/backend/src/core/entities/AbuseUserReportEntityService.ts index 194157136f..0e65a10d26 100644 --- a/packages/backend/src/core/entities/AbuseUserReportEntityService.ts +++ b/packages/backend/src/core/entities/AbuseUserReportEntityService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { AbuseUserReportsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { MiAbuseUserReport } from '@/models/entities/AbuseUserReport.js'; +import type { MiAbuseUserReport } from '@/models/AbuseUserReport.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/AntennaEntityService.ts b/packages/backend/src/core/entities/AntennaEntityService.ts index 073d0aa2a1..ed108f2ce5 100644 --- a/packages/backend/src/core/entities/AntennaEntityService.ts +++ b/packages/backend/src/core/entities/AntennaEntityService.ts @@ -7,7 +7,7 @@ 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/entities/Antenna.js'; +import type { MiAntenna } from '@/models/Antenna.js'; import { bindThis } from '@/decorators.js'; @Injectable() diff --git a/packages/backend/src/core/entities/AppEntityService.ts b/packages/backend/src/core/entities/AppEntityService.ts index e200e8ff4a..14a93cda5b 100644 --- a/packages/backend/src/core/entities/AppEntityService.ts +++ b/packages/backend/src/core/entities/AppEntityService.ts @@ -7,8 +7,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { AccessTokensRepository, AppsRepository } from '@/models/_.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { MiApp } from '@/models/entities/App.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiApp } from '@/models/App.js'; +import type { MiUser } from '@/models/User.js'; import { bindThis } from '@/decorators.js'; @Injectable() diff --git a/packages/backend/src/core/entities/AuthSessionEntityService.ts b/packages/backend/src/core/entities/AuthSessionEntityService.ts index bc87e26f21..fd356cc89d 100644 --- a/packages/backend/src/core/entities/AuthSessionEntityService.ts +++ b/packages/backend/src/core/entities/AuthSessionEntityService.ts @@ -7,8 +7,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { AuthSessionsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { MiAuthSession } from '@/models/entities/AuthSession.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiAuthSession } from '@/models/AuthSession.js'; +import type { MiUser } from '@/models/User.js'; import { bindThis } from '@/decorators.js'; import { AppEntityService } from './AppEntityService.js'; diff --git a/packages/backend/src/core/entities/BlockingEntityService.ts b/packages/backend/src/core/entities/BlockingEntityService.ts index 3773abaa8a..44466e24e8 100644 --- a/packages/backend/src/core/entities/BlockingEntityService.ts +++ b/packages/backend/src/core/entities/BlockingEntityService.ts @@ -8,8 +8,8 @@ import { DI } from '@/di-symbols.js'; import type { BlockingsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { MiBlocking } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiBlocking } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/ChannelEntityService.ts b/packages/backend/src/core/entities/ChannelEntityService.ts index 174f2befc0..094de4d2d5 100644 --- a/packages/backend/src/core/entities/ChannelEntityService.ts +++ b/packages/backend/src/core/entities/ChannelEntityService.ts @@ -7,9 +7,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { ChannelFavoritesRepository, ChannelFollowingsRepository, ChannelsRepository, DriveFilesRepository, NoteUnreadsRepository, NotesRepository } from '@/models/_.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiChannel } from '@/models/entities/Channel.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiChannel } from '@/models/Channel.js'; import { bindThis } from '@/decorators.js'; import { DriveFileEntityService } from './DriveFileEntityService.js'; import { NoteEntityService } from './NoteEntityService.js'; diff --git a/packages/backend/src/core/entities/ClipEntityService.ts b/packages/backend/src/core/entities/ClipEntityService.ts index 59615de159..e141db03f1 100644 --- a/packages/backend/src/core/entities/ClipEntityService.ts +++ b/packages/backend/src/core/entities/ClipEntityService.ts @@ -8,8 +8,8 @@ import { DI } from '@/di-symbols.js'; import type { ClipFavoritesRepository, ClipsRepository, MiUser } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiClip } from '@/models/entities/Clip.js'; +import type { } from '@/models/Blocking.js'; +import type { MiClip } from '@/models/Clip.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/DriveFileEntityService.ts b/packages/backend/src/core/entities/DriveFileEntityService.ts index f1629a33de..23273b0413 100644 --- a/packages/backend/src/core/entities/DriveFileEntityService.ts +++ b/packages/backend/src/core/entities/DriveFileEntityService.ts @@ -10,8 +10,8 @@ import type { DriveFilesRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; import type { Packed } from '@/misc/json-schema.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { appendQuery, query } from '@/misc/prelude/url.js'; import { deepClone } from '@/misc/clone.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/core/entities/DriveFolderEntityService.ts b/packages/backend/src/core/entities/DriveFolderEntityService.ts index f93899217c..55014284bd 100644 --- a/packages/backend/src/core/entities/DriveFolderEntityService.ts +++ b/packages/backend/src/core/entities/DriveFolderEntityService.ts @@ -8,8 +8,8 @@ import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, DriveFoldersRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiDriveFolder } from '@/models/entities/DriveFolder.js'; +import type { } from '@/models/Blocking.js'; +import type { MiDriveFolder } from '@/models/DriveFolder.js'; import { bindThis } from '@/decorators.js'; @Injectable() diff --git a/packages/backend/src/core/entities/EmojiEntityService.ts b/packages/backend/src/core/entities/EmojiEntityService.ts index dda55e01dc..5b97cfad5e 100644 --- a/packages/backend/src/core/entities/EmojiEntityService.ts +++ b/packages/backend/src/core/entities/EmojiEntityService.ts @@ -7,8 +7,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { EmojisRepository } from '@/models/_.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiEmoji } from '@/models/entities/Emoji.js'; +import type { } from '@/models/Blocking.js'; +import type { MiEmoji } from '@/models/Emoji.js'; import { bindThis } from '@/decorators.js'; @Injectable() diff --git a/packages/backend/src/core/entities/FlashEntityService.ts b/packages/backend/src/core/entities/FlashEntityService.ts index b52e9f6445..4701cddcba 100644 --- a/packages/backend/src/core/entities/FlashEntityService.ts +++ b/packages/backend/src/core/entities/FlashEntityService.ts @@ -8,9 +8,9 @@ import { DI } from '@/di-symbols.js'; import type { FlashsRepository, FlashLikesRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiFlash } from '@/models/entities/Flash.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiFlash } from '@/models/Flash.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/FlashLikeEntityService.ts b/packages/backend/src/core/entities/FlashLikeEntityService.ts index f5bdbe1de7..2eff86217a 100644 --- a/packages/backend/src/core/entities/FlashLikeEntityService.ts +++ b/packages/backend/src/core/entities/FlashLikeEntityService.ts @@ -6,9 +6,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { FlashLikesRepository } from '@/models/_.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiFlashLike } from '@/models/entities/FlashLike.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiFlashLike } from '@/models/FlashLike.js'; import { bindThis } from '@/decorators.js'; import { FlashEntityService } from './FlashEntityService.js'; diff --git a/packages/backend/src/core/entities/FollowRequestEntityService.ts b/packages/backend/src/core/entities/FollowRequestEntityService.ts index 45ab7d3302..0e0fec9f46 100644 --- a/packages/backend/src/core/entities/FollowRequestEntityService.ts +++ b/packages/backend/src/core/entities/FollowRequestEntityService.ts @@ -6,9 +6,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { FollowRequestsRepository } from '@/models/_.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiFollowRequest } from '@/models/entities/FollowRequest.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiFollowRequest } from '@/models/FollowRequest.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/FollowingEntityService.ts b/packages/backend/src/core/entities/FollowingEntityService.ts index 1faa051635..9f6eb51e8c 100644 --- a/packages/backend/src/core/entities/FollowingEntityService.ts +++ b/packages/backend/src/core/entities/FollowingEntityService.ts @@ -8,9 +8,9 @@ import { DI } from '@/di-symbols.js'; import type { FollowingsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiFollowing } from '@/models/entities/Following.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiFollowing } from '@/models/Following.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/GalleryLikeEntityService.ts b/packages/backend/src/core/entities/GalleryLikeEntityService.ts index 5f321da67c..e740701888 100644 --- a/packages/backend/src/core/entities/GalleryLikeEntityService.ts +++ b/packages/backend/src/core/entities/GalleryLikeEntityService.ts @@ -6,8 +6,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { GalleryLikesRepository } from '@/models/_.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiGalleryLike } from '@/models/entities/GalleryLike.js'; +import type { } from '@/models/Blocking.js'; +import type { MiGalleryLike } from '@/models/GalleryLike.js'; import { bindThis } from '@/decorators.js'; import { GalleryPostEntityService } from './GalleryPostEntityService.js'; diff --git a/packages/backend/src/core/entities/GalleryPostEntityService.ts b/packages/backend/src/core/entities/GalleryPostEntityService.ts index c05d6f5b24..bbaf70f0fd 100644 --- a/packages/backend/src/core/entities/GalleryPostEntityService.ts +++ b/packages/backend/src/core/entities/GalleryPostEntityService.ts @@ -8,9 +8,9 @@ import { DI } from '@/di-symbols.js'; import type { GalleryLikesRepository, GalleryPostsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiGalleryPost } from '@/models/entities/GalleryPost.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiGalleryPost } from '@/models/GalleryPost.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; import { DriveFileEntityService } from './DriveFileEntityService.js'; diff --git a/packages/backend/src/core/entities/HashtagEntityService.ts b/packages/backend/src/core/entities/HashtagEntityService.ts index 21c5d13926..006e267b12 100644 --- a/packages/backend/src/core/entities/HashtagEntityService.ts +++ b/packages/backend/src/core/entities/HashtagEntityService.ts @@ -5,8 +5,8 @@ import { Injectable } from '@nestjs/common'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiHashtag } from '@/models/entities/Hashtag.js'; +import type { } from '@/models/Blocking.js'; +import type { MiHashtag } from '@/models/Hashtag.js'; import { bindThis } from '@/decorators.js'; @Injectable() diff --git a/packages/backend/src/core/entities/InstanceEntityService.ts b/packages/backend/src/core/entities/InstanceEntityService.ts index 1de7564b0c..0e27e9df7f 100644 --- a/packages/backend/src/core/entities/InstanceEntityService.ts +++ b/packages/backend/src/core/entities/InstanceEntityService.ts @@ -5,8 +5,8 @@ import { Injectable } from '@nestjs/common'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiInstance } from '@/models/entities/Instance.js'; +import type { } from '@/models/Blocking.js'; +import type { MiInstance } from '@/models/Instance.js'; import { MetaService } from '@/core/MetaService.js'; import { bindThis } from '@/decorators.js'; import { UtilityService } from '../UtilityService.js'; diff --git a/packages/backend/src/core/entities/InviteCodeEntityService.ts b/packages/backend/src/core/entities/InviteCodeEntityService.ts index d3c197fbf0..914eaafe68 100644 --- a/packages/backend/src/core/entities/InviteCodeEntityService.ts +++ b/packages/backend/src/core/entities/InviteCodeEntityService.ts @@ -8,8 +8,8 @@ import { DI } from '@/di-symbols.js'; import type { RegistrationTicketsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiRegistrationTicket } from '@/models/entities/RegistrationTicket.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiRegistrationTicket } from '@/models/RegistrationTicket.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/ModerationLogEntityService.ts b/packages/backend/src/core/entities/ModerationLogEntityService.ts index 59bb0f32de..83b024d83b 100644 --- a/packages/backend/src/core/entities/ModerationLogEntityService.ts +++ b/packages/backend/src/core/entities/ModerationLogEntityService.ts @@ -7,8 +7,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { ModerationLogsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiModerationLog } from '@/models/entities/ModerationLog.js'; +import type { } from '@/models/Blocking.js'; +import type { MiModerationLog } from '@/models/ModerationLog.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/MutingEntityService.ts b/packages/backend/src/core/entities/MutingEntityService.ts index dcd1ddd034..e3d5d2e211 100644 --- a/packages/backend/src/core/entities/MutingEntityService.ts +++ b/packages/backend/src/core/entities/MutingEntityService.ts @@ -8,9 +8,9 @@ import { DI } from '@/di-symbols.js'; import type { MutingsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiMuting } from '@/models/entities/Muting.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiMuting } from '@/models/Muting.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/NoteEntityService.ts b/packages/backend/src/core/entities/NoteEntityService.ts index 242ef07e7c..bf42e98ce0 100644 --- a/packages/backend/src/core/entities/NoteEntityService.ts +++ b/packages/backend/src/core/entities/NoteEntityService.ts @@ -11,9 +11,9 @@ import { DI } from '@/di-symbols.js'; import type { Packed } from '@/misc/json-schema.js'; import { nyaize } from '@/misc/nyaize.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiNoteReaction } from '@/models/entities/NoteReaction.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiNoteReaction } from '@/models/NoteReaction.js'; import type { UsersRepository, NotesRepository, FollowingsRepository, PollsRepository, PollVotesRepository, NoteReactionsRepository, ChannelsRepository } from '@/models/_.js'; import { bindThis } from '@/decorators.js'; import { isNotNull } from '@/misc/is-not-null.js'; diff --git a/packages/backend/src/core/entities/NoteFavoriteEntityService.ts b/packages/backend/src/core/entities/NoteFavoriteEntityService.ts index ceddcfde50..808c8c9f69 100644 --- a/packages/backend/src/core/entities/NoteFavoriteEntityService.ts +++ b/packages/backend/src/core/entities/NoteFavoriteEntityService.ts @@ -6,9 +6,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NoteFavoritesRepository } from '@/models/_.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNoteFavorite } from '@/models/entities/NoteFavorite.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNoteFavorite } from '@/models/NoteFavorite.js'; import { bindThis } from '@/decorators.js'; import { NoteEntityService } from './NoteEntityService.js'; diff --git a/packages/backend/src/core/entities/NoteReactionEntityService.ts b/packages/backend/src/core/entities/NoteReactionEntityService.ts index ad8eb06e8f..9701f37fdb 100644 --- a/packages/backend/src/core/entities/NoteReactionEntityService.ts +++ b/packages/backend/src/core/entities/NoteReactionEntityService.ts @@ -9,9 +9,9 @@ import type { NoteReactionsRepository } from '@/models/_.js'; import type { Packed } from '@/misc/json-schema.js'; import { bindThis } from '@/decorators.js'; import type { OnModuleInit } from '@nestjs/common'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiNoteReaction } from '@/models/entities/NoteReaction.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiNoteReaction } from '@/models/NoteReaction.js'; import type { ReactionService } from '../ReactionService.js'; import type { UserEntityService } from './UserEntityService.js'; import type { NoteEntityService } from './NoteEntityService.js'; diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index 4cd4bc5881..75a2f62f6e 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -9,8 +9,8 @@ import { In } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { AccessTokensRepository, FollowRequestsRepository, NotesRepository, MiUser, UsersRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { MiNotification } from '@/models/entities/Notification.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNotification } from '@/models/Notification.js'; +import type { MiNote } from '@/models/Note.js'; import type { Packed } from '@/misc/json-schema.js'; import { bindThis } from '@/decorators.js'; import { isNotNull } from '@/misc/is-not-null.js'; diff --git a/packages/backend/src/core/entities/PageEntityService.ts b/packages/backend/src/core/entities/PageEntityService.ts index 3d03ac598e..e3a1e19ddd 100644 --- a/packages/backend/src/core/entities/PageEntityService.ts +++ b/packages/backend/src/core/entities/PageEntityService.ts @@ -8,10 +8,10 @@ import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, PagesRepository, PageLikesRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiPage } from '@/models/entities/Page.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiPage } from '@/models/Page.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; import { DriveFileEntityService } from './DriveFileEntityService.js'; diff --git a/packages/backend/src/core/entities/PageLikeEntityService.ts b/packages/backend/src/core/entities/PageLikeEntityService.ts index 8521352517..4dc691ab93 100644 --- a/packages/backend/src/core/entities/PageLikeEntityService.ts +++ b/packages/backend/src/core/entities/PageLikeEntityService.ts @@ -6,9 +6,9 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { PageLikesRepository } from '@/models/_.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiPageLike } from '@/models/entities/PageLike.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiPageLike } from '@/models/PageLike.js'; import { bindThis } from '@/decorators.js'; import { PageEntityService } from './PageEntityService.js'; diff --git a/packages/backend/src/core/entities/RenoteMutingEntityService.ts b/packages/backend/src/core/entities/RenoteMutingEntityService.ts index bb0aa7f26c..7111fab08a 100644 --- a/packages/backend/src/core/entities/RenoteMutingEntityService.ts +++ b/packages/backend/src/core/entities/RenoteMutingEntityService.ts @@ -8,9 +8,9 @@ import { DI } from '@/di-symbols.js'; import type { RenoteMutingsRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiRenoteMuting } from '@/models/entities/RenoteMuting.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiRenoteMuting } from '@/models/RenoteMuting.js'; import { bindThis } from '@/decorators.js'; import { UserEntityService } from './UserEntityService.js'; diff --git a/packages/backend/src/core/entities/RoleEntityService.ts b/packages/backend/src/core/entities/RoleEntityService.ts index 5510c75695..23e82561d6 100644 --- a/packages/backend/src/core/entities/RoleEntityService.ts +++ b/packages/backend/src/core/entities/RoleEntityService.ts @@ -8,8 +8,8 @@ import { Brackets } from 'typeorm'; import { DI } from '@/di-symbols.js'; import type { RoleAssignmentsRepository, RolesRepository } from '@/models/_.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiRole } from '@/models/entities/Role.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiRole } from '@/models/Role.js'; import { bindThis } from '@/decorators.js'; import { DEFAULT_POLICIES } from '@/core/RoleService.js'; diff --git a/packages/backend/src/core/entities/SigninEntityService.ts b/packages/backend/src/core/entities/SigninEntityService.ts index 59ad57e4a3..8c88e8560a 100644 --- a/packages/backend/src/core/entities/SigninEntityService.ts +++ b/packages/backend/src/core/entities/SigninEntityService.ts @@ -4,8 +4,8 @@ */ import { Injectable } from '@nestjs/common'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiSignin } from '@/models/entities/Signin.js'; +import type { } from '@/models/Blocking.js'; +import type { MiSignin } from '@/models/Signin.js'; import { bindThis } from '@/decorators.js'; @Injectable() diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 7c880e7c69..c0909a663d 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -13,8 +13,8 @@ import type { Packed } from '@/misc/json-schema.js'; import type { Promiseable } from '@/misc/prelude/await-all.js'; import { awaitAll } from '@/misc/prelude/await-all.js'; import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js'; -import type { MiLocalUser, MiPartialLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/entities/User.js'; -import { birthdaySchema, descriptionSchema, localUsernameSchema, locationSchema, nameSchema, passwordSchema } from '@/models/entities/User.js'; +import type { MiLocalUser, MiPartialLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.js'; +import { birthdaySchema, descriptionSchema, localUsernameSchema, locationSchema, nameSchema, passwordSchema } from '@/models/User.js'; import type { UsersRepository, UserSecurityKeysRepository, FollowingsRepository, FollowRequestsRepository, BlockingsRepository, MutingsRepository, DriveFilesRepository, NoteUnreadsRepository, UserNotePiningsRepository, UserProfilesRepository, AnnouncementReadsRepository, AnnouncementsRepository, MiUserProfile, RenoteMutingsRepository, UserMemoRepository } from '@/models/_.js'; import { bindThis } from '@/decorators.js'; import { RoleService } from '@/core/RoleService.js'; diff --git a/packages/backend/src/core/entities/UserListEntityService.ts b/packages/backend/src/core/entities/UserListEntityService.ts index 79974dd6f6..a7f2885194 100644 --- a/packages/backend/src/core/entities/UserListEntityService.ts +++ b/packages/backend/src/core/entities/UserListEntityService.ts @@ -7,8 +7,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { UserListJoiningsRepository, UserListsRepository } from '@/models/_.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { } from '@/models/entities/Blocking.js'; -import type { MiUserList } from '@/models/entities/UserList.js'; +import type { } from '@/models/Blocking.js'; +import type { MiUserList } from '@/models/UserList.js'; import { bindThis } from '@/decorators.js'; @Injectable() diff --git a/packages/backend/src/misc/check-word-mute.ts b/packages/backend/src/misc/check-word-mute.ts index a7a60c20e9..cef5595451 100644 --- a/packages/backend/src/misc/check-word-mute.ts +++ b/packages/backend/src/misc/check-word-mute.ts @@ -5,8 +5,8 @@ import { AhoCorasick } from 'slacc'; import RE2 from 're2'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiUser } from '@/models/User.js'; type NoteLike = { userId: MiNote['userId']; diff --git a/packages/backend/src/misc/is-quote.ts b/packages/backend/src/misc/is-quote.ts index c9f3af15fc..059f6a4b5f 100644 --- a/packages/backend/src/misc/is-quote.ts +++ b/packages/backend/src/misc/is-quote.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; // eslint-disable-next-line import/no-default-export export default function(note: MiNote): boolean { diff --git a/packages/backend/src/models/AbuseUserReport.ts b/packages/backend/src/models/AbuseUserReport.ts new file mode 100644 index 0000000000..2551af7cb6 --- /dev/null +++ b/packages/backend/src/models/AbuseUserReport.ts @@ -0,0 +1,84 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('abuse_user_report') +export class MiAbuseUserReport { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the AbuseUserReport.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public targetUserId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public targetUser: MiUser | null; + + @Index() + @Column(id()) + public reporterId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public reporter: MiUser | null; + + @Column({ + ...id(), + nullable: true, + }) + public assigneeId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public assignee: MiUser | null; + + @Index() + @Column('boolean', { + default: false, + }) + public resolved: boolean; + + @Column('boolean', { + default: false, + }) + public forwarded: boolean; + + @Column('varchar', { + length: 2048, + }) + public comment: string; + + //#region Denormalized fields + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public targetUserHost: string | null; + + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public reporterHost: string | null; + //#endregion +} diff --git a/packages/backend/src/models/AccessToken.ts b/packages/backend/src/models/AccessToken.ts new file mode 100644 index 0000000000..5a6269a729 --- /dev/null +++ b/packages/backend/src/models/AccessToken.ts @@ -0,0 +1,95 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiApp } from './App.js'; + +@Entity('access_token') +export class MiAccessToken { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the AccessToken.', + }) + public createdAt: Date; + + @Column('timestamp with time zone', { + nullable: true, + }) + public lastUsedAt: Date | null; + + @Index() + @Column('varchar', { + length: 128, + }) + public token: string; + + @Index() + @Column('varchar', { + length: 128, + nullable: true, + }) + public session: string | null; + + @Index() + @Column('varchar', { + length: 128, + }) + public hash: string; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column({ + ...id(), + nullable: true, + }) + public appId: MiApp['id'] | null; + + @ManyToOne(type => MiApp, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public app: MiApp | null; + + @Column('varchar', { + length: 128, + nullable: true, + }) + public name: string | null; + + @Column('varchar', { + length: 512, + nullable: true, + }) + public description: string | null; + + @Column('varchar', { + length: 512, + nullable: true, + }) + public iconUrl: string | null; + + @Column('varchar', { + length: 64, array: true, + default: '{}', + }) + public permission: string[]; + + @Column('boolean', { + default: false, + }) + public fetched: boolean; +} diff --git a/packages/backend/src/models/Ad.ts b/packages/backend/src/models/Ad.ts new file mode 100644 index 0000000000..6dfc9cb30e --- /dev/null +++ b/packages/backend/src/models/Ad.ts @@ -0,0 +1,74 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; +import { id } from './util/id.js'; + +@Entity('ad') +export class MiAd { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Ad.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + comment: 'The expired date of the Ad.', + }) + public expiresAt: Date; + + @Index() + @Column('timestamp with time zone', { + comment: 'The expired date of the Ad.', + default: () => 'now()', + }) + public startsAt: Date; + + @Column('varchar', { + length: 32, nullable: false, + }) + public place: string; + + // 今は使われていないが将来的に活用される可能性はある + @Column('varchar', { + length: 32, nullable: false, + }) + public priority: string; + + @Column('integer', { + default: 1, nullable: false, + }) + public ratio: number; + + @Column('varchar', { + length: 1024, nullable: false, + }) + public url: string; + + @Column('varchar', { + length: 1024, nullable: false, + }) + public imageUrl: string; + + @Column('varchar', { + length: 8192, nullable: false, + }) + public memo: string; + @Column('integer', { + default: 0, nullable: false, + }) + public dayOfWeek: number; + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/Announcement.ts b/packages/backend/src/models/Announcement.ts new file mode 100644 index 0000000000..34b092a8d4 --- /dev/null +++ b/packages/backend/src/models/Announcement.ts @@ -0,0 +1,95 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('announcement') +export class MiAnnouncement { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Announcement.', + }) + public createdAt: Date; + + @Column('timestamp with time zone', { + comment: 'The updated date of the Announcement.', + nullable: true, + }) + public updatedAt: Date | null; + + @Column('varchar', { + length: 8192, nullable: false, + }) + public text: string; + + @Column('varchar', { + length: 256, nullable: false, + }) + public title: string; + + @Column('varchar', { + length: 1024, nullable: true, + }) + public imageUrl: string | null; + + // info, warning, error, success + @Column('varchar', { + length: 256, nullable: false, + default: 'info', + }) + public icon: string; + + // normal ... お知らせページ掲載 + // banner ... お知らせページ掲載 + バナー表示 + // dialog ... お知らせページ掲載 + ダイアログ表示 + @Column('varchar', { + length: 256, nullable: false, + default: 'normal', + }) + public display: string; + + @Column('boolean', { + default: false, + }) + public needConfirmationToRead: boolean; + + @Index() + @Column('boolean', { + default: true, + }) + public isActive: boolean; + + @Index() + @Column('boolean', { + default: false, + }) + public forExistingUsers: boolean; + + @Index() + @Column({ + ...id(), + nullable: true, + }) + public userId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/AnnouncementRead.ts b/packages/backend/src/models/AnnouncementRead.ts new file mode 100644 index 0000000000..3d6ec5652c --- /dev/null +++ b/packages/backend/src/models/AnnouncementRead.ts @@ -0,0 +1,41 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiAnnouncement } from './Announcement.js'; + +@Entity('announcement_read') +@Index(['userId', 'announcementId'], { unique: true }) +export class MiAnnouncementRead { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the AnnouncementRead.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column(id()) + public announcementId: MiAnnouncement['id']; + + @ManyToOne(type => MiAnnouncement, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public announcement: MiAnnouncement | null; +} diff --git a/packages/backend/src/models/Antenna.ts b/packages/backend/src/models/Antenna.ts new file mode 100644 index 0000000000..7c1d80cc46 --- /dev/null +++ b/packages/backend/src/models/Antenna.ts @@ -0,0 +1,101 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiUserList } from './UserList.js'; + +@Entity('antenna') +export class MiAntenna { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the Antenna.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone') + public lastUsedAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The owner ID.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, + comment: 'The name of the Antenna.', + }) + public name: string; + + @Column('enum', { enum: ['home', 'all', 'users', 'list'] }) + public src: 'home' | 'all' | 'users' | 'list'; + + @Column({ + ...id(), + nullable: true, + }) + public userListId: MiUserList['id'] | null; + + @ManyToOne(type => MiUserList, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public userList: MiUserList | null; + + @Column('varchar', { + length: 1024, array: true, + default: '{}', + }) + public users: string[]; + + @Column('jsonb', { + default: [], + }) + public keywords: string[][]; + + @Column('jsonb', { + default: [], + }) + public excludeKeywords: string[][]; + + @Column('boolean', { + default: false, + }) + public caseSensitive: boolean; + + @Column('boolean', { + default: false, + }) + public withReplies: boolean; + + @Column('boolean') + public withFile: boolean; + + @Column('varchar', { + length: 2048, nullable: true, + }) + public expression: string | null; + + @Column('boolean') + public notify: boolean; + + @Index() + @Column('boolean', { + default: true, + }) + public isActive: boolean; +} diff --git a/packages/backend/src/models/App.ts b/packages/backend/src/models/App.ts new file mode 100644 index 0000000000..c599ef8be0 --- /dev/null +++ b/packages/backend/src/models/App.ts @@ -0,0 +1,65 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('app') +export class MiApp { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the App.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The owner ID.', + }) + public userId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'SET NULL', + nullable: true, + }) + public user: MiUser | null; + + @Index() + @Column('varchar', { + length: 64, + comment: 'The secret key of the App.', + }) + public secret: string; + + @Column('varchar', { + length: 128, + comment: 'The name of the App.', + }) + public name: string; + + @Column('varchar', { + length: 512, + comment: 'The description of the App.', + }) + public description: string; + + @Column('varchar', { + length: 64, array: true, + comment: 'The permission of the App.', + }) + public permission: string[]; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The callbackUrl of the App.', + }) + public callbackUrl: string | null; +} diff --git a/packages/backend/src/models/AuthSession.ts b/packages/backend/src/models/AuthSession.ts new file mode 100644 index 0000000000..d9de6b6979 --- /dev/null +++ b/packages/backend/src/models/AuthSession.ts @@ -0,0 +1,48 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiApp } from './App.js'; + +@Entity('auth_session') +export class MiAuthSession { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the AuthSession.', + }) + public createdAt: Date; + + @Index() + @Column('varchar', { + length: 128, + }) + public token: string; + + @Column({ + ...id(), + nullable: true, + }) + public userId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + nullable: true, + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public appId: MiApp['id']; + + @ManyToOne(type => MiApp, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public app: MiApp | null; +} diff --git a/packages/backend/src/models/Blocking.ts b/packages/backend/src/models/Blocking.ts new file mode 100644 index 0000000000..1e3dd3a644 --- /dev/null +++ b/packages/backend/src/models/Blocking.ts @@ -0,0 +1,47 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('blocking') +@Index(['blockerId', 'blockeeId'], { unique: true }) +export class MiBlocking { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Blocking.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The blockee user ID.', + }) + public blockeeId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public blockee: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The blocker user ID.', + }) + public blockerId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public blocker: MiUser | null; +} diff --git a/packages/backend/src/models/Channel.ts b/packages/backend/src/models/Channel.ts new file mode 100644 index 0000000000..ae3886a657 --- /dev/null +++ b/packages/backend/src/models/Channel.ts @@ -0,0 +1,102 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiDriveFile } from './DriveFile.js'; + +@Entity('channel') +export class MiChannel { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Channel.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + nullable: true, + }) + public lastNotedAt: Date | null; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The owner ID.', + }) + public userId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, + comment: 'The name of the Channel.', + }) + public name: string; + + @Column('varchar', { + length: 2048, nullable: true, + comment: 'The description of the Channel.', + }) + public description: string | null; + + @Column({ + ...id(), + nullable: true, + comment: 'The ID of banner Channel.', + }) + public bannerId: MiDriveFile['id'] | null; + + @ManyToOne(type => MiDriveFile, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public banner: MiDriveFile | null; + + @Column('varchar', { + array: true, length: 128, default: '{}', + }) + public pinnedNoteIds: string[]; + + @Column('varchar', { + length: 16, + default: '#86b300', + }) + public color: string; + + @Index() + @Column('boolean', { + default: false, + }) + public isArchived: boolean; + + @Index() + @Column('integer', { + default: 0, + comment: 'The count of notes.', + }) + public notesCount: number; + + @Index() + @Column('integer', { + default: 0, + comment: 'The count of users.', + }) + public usersCount: number; + + @Column('boolean', { + default: false, + }) + public isSensitive: boolean; +} diff --git a/packages/backend/src/models/ChannelFavorite.ts b/packages/backend/src/models/ChannelFavorite.ts new file mode 100644 index 0000000000..ab74aa5530 --- /dev/null +++ b/packages/backend/src/models/ChannelFavorite.ts @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiChannel } from './Channel.js'; + +@Entity('channel_favorite') +@Index(['userId', 'channelId'], { unique: true }) +export class MiChannelFavorite { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the ChannelFavorite.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + }) + public channelId: MiChannel['id']; + + @ManyToOne(type => MiChannel, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public channel: MiChannel | null; + + @Index() + @Column({ + ...id(), + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; +} diff --git a/packages/backend/src/models/ChannelFollowing.ts b/packages/backend/src/models/ChannelFollowing.ts new file mode 100644 index 0000000000..c62a95332a --- /dev/null +++ b/packages/backend/src/models/ChannelFollowing.ts @@ -0,0 +1,48 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiChannel } from './Channel.js'; + +@Entity('channel_following') +@Index(['followerId', 'followeeId'], { unique: true }) +export class MiChannelFollowing { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the ChannelFollowing.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The followee channel ID.', + }) + public followeeId: MiChannel['id']; + + @ManyToOne(type => MiChannel, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public followee: MiChannel | null; + + @Index() + @Column({ + ...id(), + comment: 'The follower user ID.', + }) + public followerId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public follower: MiUser | null; +} diff --git a/packages/backend/src/models/Clip.ts b/packages/backend/src/models/Clip.ts new file mode 100644 index 0000000000..c60b2964e0 --- /dev/null +++ b/packages/backend/src/models/Clip.ts @@ -0,0 +1,55 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('clip') +export class MiClip { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the Clip.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + nullable: true, + }) + public lastClippedAt: Date | null; + + @Index() + @Column({ + ...id(), + comment: 'The owner ID.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, + comment: 'The name of the Clip.', + }) + public name: string; + + @Column('boolean', { + default: false, + }) + public isPublic: boolean; + + @Column('varchar', { + length: 2048, nullable: true, + comment: 'The description of the Clip.', + }) + public description: string | null; +} diff --git a/packages/backend/src/models/ClipFavorite.ts b/packages/backend/src/models/ClipFavorite.ts new file mode 100644 index 0000000000..054764389b --- /dev/null +++ b/packages/backend/src/models/ClipFavorite.ts @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiClip } from './Clip.js'; + +@Entity('clip_favorite') +@Index(['userId', 'clipId'], { unique: true }) +export class MiClipFavorite { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public clipId: MiClip['id']; + + @ManyToOne(type => MiClip, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public clip: MiClip | null; +} diff --git a/packages/backend/src/models/ClipNote.ts b/packages/backend/src/models/ClipNote.ts new file mode 100644 index 0000000000..b7cc5ee39b --- /dev/null +++ b/packages/backend/src/models/ClipNote.ts @@ -0,0 +1,42 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiNote } from './Note.js'; +import { MiClip } from './Clip.js'; + +@Entity('clip_note') +@Index(['noteId', 'clipId'], { unique: true }) +export class MiClipNote { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column({ + ...id(), + comment: 'The note ID.', + }) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; + + @Index() + @Column({ + ...id(), + comment: 'The clip ID.', + }) + public clipId: MiClip['id']; + + @ManyToOne(type => MiClip, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public clip: MiClip | null; +} diff --git a/packages/backend/src/models/DriveFile.ts b/packages/backend/src/models/DriveFile.ts new file mode 100644 index 0000000000..c12f0e0f02 --- /dev/null +++ b/packages/backend/src/models/DriveFile.ts @@ -0,0 +1,197 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiDriveFolder } from './DriveFolder.js'; + +@Entity('drive_file') +@Index(['userId', 'folderId', 'id']) +export class MiDriveFile { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the DriveFile.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The owner ID.', + }) + public userId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: 'The host of owner. It will be null if the user in local.', + }) + public userHost: string | null; + + @Index() + @Column('varchar', { + length: 32, + comment: 'The MD5 hash of the DriveFile.', + }) + public md5: string; + + @Column('varchar', { + length: 256, + comment: 'The file name of the DriveFile.', + }) + public name: string; + + @Index() + @Column('varchar', { + length: 128, + comment: 'The content type (MIME) of the DriveFile.', + }) + public type: string; + + @Column('integer', { + comment: 'The file size (bytes) of the DriveFile.', + }) + public size: number; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The comment of the DriveFile.', + }) + public comment: string | null; + + @Column('varchar', { + length: 128, nullable: true, + comment: 'The BlurHash string.', + }) + public blurhash: string | null; + + @Column('jsonb', { + default: {}, + comment: 'The any properties of the DriveFile. For example, it includes image width/height.', + }) + public properties: { width?: number; height?: number; orientation?: number; avgColor?: string }; + + @Column('boolean') + public storedInternal: boolean; + + @Column('varchar', { + length: 512, + comment: 'The URL of the DriveFile.', + }) + public url: string; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The URL of the thumbnail of the DriveFile.', + }) + public thumbnailUrl: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The URL of the webpublic of the DriveFile.', + }) + public webpublicUrl: string | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public webpublicType: string | null; + + @Index({ unique: true }) + @Column('varchar', { + length: 256, nullable: true, + }) + public accessKey: string | null; + + @Index({ unique: true }) + @Column('varchar', { + length: 256, nullable: true, + }) + public thumbnailAccessKey: string | null; + + @Index({ unique: true }) + @Column('varchar', { + length: 256, nullable: true, + }) + public webpublicAccessKey: string | null; + + @Index() + @Column('varchar', { + length: 512, nullable: true, + comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.', + }) + public uri: string | null; + + @Column('varchar', { + length: 512, nullable: true, + }) + public src: string | null; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The parent folder ID. If null, it means the DriveFile is located in root.', + }) + public folderId: MiDriveFolder['id'] | null; + + @ManyToOne(type => MiDriveFolder, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public folder: MiDriveFolder | null; + + @Index() + @Column('boolean', { + default: false, + comment: 'Whether the DriveFile is NSFW.', + }) + public isSensitive: boolean; + + @Index() + @Column('boolean', { + default: false, + comment: 'Whether the DriveFile is NSFW. (predict)', + }) + public maybeSensitive: boolean; + + @Index() + @Column('boolean', { + default: false, + }) + public maybePorn: boolean; + + /** + * 外部の(信頼されていない)URLへの直リンクか否か + */ + @Index() + @Column('boolean', { + default: false, + comment: 'Whether the DriveFile is direct link to remote server.', + }) + public isLink: boolean; + + @Column('jsonb', { + default: {}, + nullable: true, + }) + public requestHeaders: Record | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public requestIp: string | null; +} diff --git a/packages/backend/src/models/DriveFolder.ts b/packages/backend/src/models/DriveFolder.ts new file mode 100644 index 0000000000..3e049136bd --- /dev/null +++ b/packages/backend/src/models/DriveFolder.ts @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('drive_folder') +export class MiDriveFolder { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the DriveFolder.', + }) + public createdAt: Date; + + @Column('varchar', { + length: 128, + comment: 'The name of the DriveFolder.', + }) + public name: string; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The owner ID.', + }) + public userId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.', + }) + public parentId: MiDriveFolder['id'] | null; + + @ManyToOne(type => MiDriveFolder, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public parent: MiDriveFolder | null; +} diff --git a/packages/backend/src/models/Emoji.ts b/packages/backend/src/models/Emoji.ts new file mode 100644 index 0000000000..563ac1d9d3 --- /dev/null +++ b/packages/backend/src/models/Emoji.ts @@ -0,0 +1,84 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; + +@Entity('emoji') +@Index(['name', 'host'], { unique: true }) +export class MiEmoji { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + nullable: true, + }) + public updatedAt: Date | null; + + @Index() + @Column('varchar', { + length: 128, + }) + public name: string; + + @Index() + @Column('varchar', { + length: 128, nullable: true, + }) + public host: string | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public category: string | null; + + @Column('varchar', { + length: 512, + }) + public originalUrl: string; + + @Column('varchar', { + length: 512, + default: '', + }) + public publicUrl: string; + + @Column('varchar', { + length: 512, nullable: true, + }) + public uri: string | null; + + // publicUrlの方のtypeが入る + @Column('varchar', { + length: 64, nullable: true, + }) + public type: string | null; + + @Column('varchar', { + array: true, length: 128, default: '{}', + }) + public aliases: string[]; + + @Column('varchar', { + length: 1024, nullable: true, + }) + public license: string | null; + + @Column('boolean', { + default: false, + }) + public localOnly: boolean; + + @Column('boolean', { + default: false, + }) + public isSensitive: boolean; + + // TODO: 定期ジョブで存在しなくなったロールIDを除去するようにする + @Column('varchar', { + array: true, length: 128, default: '{}', + }) + public roleIdsThatCanBeUsedThisEmojiAsReaction: string[]; +} diff --git a/packages/backend/src/models/Flash.ts b/packages/backend/src/models/Flash.ts new file mode 100644 index 0000000000..185063029d --- /dev/null +++ b/packages/backend/src/models/Flash.ts @@ -0,0 +1,73 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('flash') +export class MiFlash { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Flash.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + comment: 'The updated date of the Flash.', + }) + public updatedAt: Date; + + @Column('varchar', { + length: 256, + }) + public title: string; + + @Column('varchar', { + length: 1024, + }) + public summary: string; + + @Index() + @Column({ + ...id(), + comment: 'The ID of author.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 65536, + }) + public script: string; + + @Column('varchar', { + length: 256, array: true, default: '{}', + }) + public permissions: string[]; + + @Column('integer', { + default: 0, + }) + public likedCount: number; + + /** + * public ... 公開 + * private ... プロフィールには表示しない + */ + @Column('varchar', { + length: 512, default: 'public', + }) + public visibility: 'public' | 'private'; +} diff --git a/packages/backend/src/models/FlashLike.ts b/packages/backend/src/models/FlashLike.ts new file mode 100644 index 0000000000..7c66010ae6 --- /dev/null +++ b/packages/backend/src/models/FlashLike.ts @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiFlash } from './Flash.js'; + +@Entity('flash_like') +@Index(['userId', 'flashId'], { unique: true }) +export class MiFlashLike { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public flashId: MiFlash['id']; + + @ManyToOne(type => MiFlash, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public flash: MiFlash | null; +} diff --git a/packages/backend/src/models/FollowRequest.ts b/packages/backend/src/models/FollowRequest.ts new file mode 100644 index 0000000000..769b9a6cb5 --- /dev/null +++ b/packages/backend/src/models/FollowRequest.ts @@ -0,0 +1,90 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('follow_request') +@Index(['followerId', 'followeeId'], { unique: true }) +export class MiFollowRequest { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the FollowRequest.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The followee user ID.', + }) + public followeeId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public followee: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The follower user ID.', + }) + public followerId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public follower: MiUser | null; + + @Column('varchar', { + length: 128, nullable: true, + comment: 'id of Follow Activity.', + }) + public requestId: string | null; + + //#region Denormalized fields + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public followerHost: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followerInbox: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followerSharedInbox: string | null; + + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public followeeHost: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followeeInbox: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followeeSharedInbox: string | null; + //#endregion +} diff --git a/packages/backend/src/models/Following.ts b/packages/backend/src/models/Following.ts new file mode 100644 index 0000000000..05b729412f --- /dev/null +++ b/packages/backend/src/models/Following.ts @@ -0,0 +1,87 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('following') +@Index(['followerId', 'followeeId'], { unique: true }) +export class MiFollowing { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Following.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The followee user ID.', + }) + public followeeId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public followee: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The follower user ID.', + }) + public followerId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public follower: MiUser | null; + + //#region Denormalized fields + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public followerHost: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followerInbox: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followerSharedInbox: string | null; + + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public followeeHost: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followeeInbox: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: '[Denormalized]', + }) + public followeeSharedInbox: string | null; + //#endregion +} diff --git a/packages/backend/src/models/GalleryLike.ts b/packages/backend/src/models/GalleryLike.ts new file mode 100644 index 0000000000..b5f71764aa --- /dev/null +++ b/packages/backend/src/models/GalleryLike.ts @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiGalleryPost } from './GalleryPost.js'; + +@Entity('gallery_like') +@Index(['userId', 'postId'], { unique: true }) +export class MiGalleryLike { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public postId: MiGalleryPost['id']; + + @ManyToOne(type => MiGalleryPost, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public post: MiGalleryPost | null; +} diff --git a/packages/backend/src/models/GalleryPost.ts b/packages/backend/src/models/GalleryPost.ts new file mode 100644 index 0000000000..4c6063f32b --- /dev/null +++ b/packages/backend/src/models/GalleryPost.ts @@ -0,0 +1,84 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import type { MiDriveFile } from './DriveFile.js'; + +@Entity('gallery_post') +export class MiGalleryPost { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the GalleryPost.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + comment: 'The updated date of the GalleryPost.', + }) + public updatedAt: Date; + + @Column('varchar', { + length: 256, + }) + public title: string; + + @Column('varchar', { + length: 2048, nullable: true, + }) + public description: string | null; + + @Index() + @Column({ + ...id(), + comment: 'The ID of author.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column({ + ...id(), + array: true, default: '{}', + }) + public fileIds: MiDriveFile['id'][]; + + @Index() + @Column('boolean', { + default: false, + comment: 'Whether the post is sensitive.', + }) + public isSensitive: boolean; + + @Index() + @Column('integer', { + default: 0, + }) + public likedCount: number; + + @Index() + @Column('varchar', { + length: 128, array: true, default: '{}', + }) + public tags: string[]; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/Hashtag.ts b/packages/backend/src/models/Hashtag.ts new file mode 100644 index 0000000000..1493774752 --- /dev/null +++ b/packages/backend/src/models/Hashtag.ts @@ -0,0 +1,92 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; +import type { MiUser } from './User.js'; + +@Entity('hashtag') +export class MiHashtag { + @PrimaryColumn(id()) + public id: string; + + @Index({ unique: true }) + @Column('varchar', { + length: 128, + }) + public name: string; + + @Column({ + ...id(), + array: true, + }) + public mentionedUserIds: MiUser['id'][]; + + @Index() + @Column('integer', { + default: 0, + }) + public mentionedUsersCount: number; + + @Column({ + ...id(), + array: true, + }) + public mentionedLocalUserIds: MiUser['id'][]; + + @Index() + @Column('integer', { + default: 0, + }) + public mentionedLocalUsersCount: number; + + @Column({ + ...id(), + array: true, + }) + public mentionedRemoteUserIds: MiUser['id'][]; + + @Index() + @Column('integer', { + default: 0, + }) + public mentionedRemoteUsersCount: number; + + @Column({ + ...id(), + array: true, + }) + public attachedUserIds: MiUser['id'][]; + + @Index() + @Column('integer', { + default: 0, + }) + public attachedUsersCount: number; + + @Column({ + ...id(), + array: true, + }) + public attachedLocalUserIds: MiUser['id'][]; + + @Index() + @Column('integer', { + default: 0, + }) + public attachedLocalUsersCount: number; + + @Column({ + ...id(), + array: true, + }) + public attachedRemoteUserIds: MiUser['id'][]; + + @Index() + @Column('integer', { + default: 0, + }) + public attachedRemoteUsersCount: number; +} diff --git a/packages/backend/src/models/Instance.ts b/packages/backend/src/models/Instance.ts new file mode 100644 index 0000000000..b225d918d6 --- /dev/null +++ b/packages/backend/src/models/Instance.ts @@ -0,0 +1,147 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; + +@Entity('instance') +export class MiInstance { + @PrimaryColumn(id()) + public id: string; + + /** + * このインスタンスを捕捉した日時 + */ + @Index() + @Column('timestamp with time zone', { + comment: 'The caught date of the Instance.', + }) + public firstRetrievedAt: Date; + + /** + * ホスト + */ + @Index({ unique: true }) + @Column('varchar', { + length: 128, + comment: 'The host of the Instance.', + }) + public host: string; + + /** + * インスタンスのユーザー数 + */ + @Column('integer', { + default: 0, + comment: 'The count of the users of the Instance.', + }) + public usersCount: number; + + /** + * インスタンスの投稿数 + */ + @Column('integer', { + default: 0, + comment: 'The count of the notes of the Instance.', + }) + public notesCount: number; + + /** + * このインスタンスのユーザーからフォローされている、自インスタンスのユーザーの数 + */ + @Column('integer', { + default: 0, + }) + public followingCount: number; + + /** + * このインスタンスのユーザーをフォローしている、自インスタンスのユーザーの数 + */ + @Column('integer', { + default: 0, + }) + public followersCount: number; + + /** + * 直近のリクエスト受信日時 + */ + @Column('timestamp with time zone', { + nullable: true, + }) + public latestRequestReceivedAt: Date | null; + + /** + * このインスタンスと不通かどうか + */ + @Column('boolean', { + default: false, + }) + public isNotResponding: boolean; + + /** + * このインスタンスへの配信を停止するか + */ + @Index() + @Column('boolean', { + default: false, + }) + public isSuspended: boolean; + + @Column('varchar', { + length: 64, nullable: true, + comment: 'The software of the Instance.', + }) + public softwareName: string | null; + + @Column('varchar', { + length: 64, nullable: true, + }) + public softwareVersion: string | null; + + @Column('boolean', { + nullable: true, + }) + public openRegistrations: boolean | null; + + @Column('varchar', { + length: 256, nullable: true, + }) + public name: string | null; + + @Column('varchar', { + length: 4096, nullable: true, + }) + public description: string | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public maintainerName: string | null; + + @Column('varchar', { + length: 256, nullable: true, + }) + public maintainerEmail: string | null; + + @Column('varchar', { + length: 256, nullable: true, + }) + public iconUrl: string | null; + + @Column('varchar', { + length: 256, nullable: true, + }) + public faviconUrl: string | null; + + @Column('varchar', { + length: 64, nullable: true, + }) + public themeColor: string | null; + + @Column('timestamp with time zone', { + nullable: true, + }) + public infoUpdatedAt: Date | null; +} diff --git a/packages/backend/src/models/Meta.ts b/packages/backend/src/models/Meta.ts new file mode 100644 index 0000000000..a9e116341f --- /dev/null +++ b/packages/backend/src/models/Meta.ts @@ -0,0 +1,469 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('meta') +export class MiMeta { + @PrimaryColumn({ + type: 'varchar', + length: 32, + }) + public id: string; + + @Column('varchar', { + length: 1024, nullable: true, + }) + public name: string | null; + + @Column('varchar', { + length: 1024, nullable: true, + }) + public description: string | null; + + /** + * メンテナの名前 + */ + @Column('varchar', { + length: 1024, nullable: true, + }) + public maintainerName: string | null; + + /** + * メンテナの連絡先 + */ + @Column('varchar', { + length: 1024, nullable: true, + }) + public maintainerEmail: string | null; + + @Column('boolean', { + default: false, + }) + public disableRegistration: boolean; + + @Column('varchar', { + length: 1024, array: true, default: '{}', + }) + public langs: string[]; + + @Column('varchar', { + length: 1024, array: true, default: '{}', + }) + public pinnedUsers: string[]; + + @Column('varchar', { + length: 1024, array: true, default: '{}', + }) + public hiddenTags: string[]; + + @Column('varchar', { + length: 1024, array: true, default: '{}', + }) + public blockedHosts: string[]; + + @Column('varchar', { + length: 1024, array: true, default: '{}', + }) + public sensitiveWords: string[]; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public themeColor: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public mascotImageUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public bannerUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public backgroundImageUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public logoImageUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public iconUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public app192IconUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public app512IconUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public serverErrorImageUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public notFoundImageUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public infoImageUrl: string | null; + + @Column('boolean', { + default: false, + }) + public cacheRemoteFiles: boolean; + + @Column('boolean', { + default: true, + }) + public cacheRemoteSensitiveFiles: boolean; + + @Column({ + ...id(), + nullable: true, + }) + public proxyAccountId: MiUser['id'] | null; + + @ManyToOne(type => MiUser, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public proxyAccount: MiUser | null; + + @Column('boolean', { + default: false, + }) + public emailRequiredForSignup: boolean; + + @Column('boolean', { + default: false, + }) + public enableHcaptcha: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public hcaptchaSiteKey: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public hcaptchaSecretKey: string | null; + + @Column('boolean', { + default: false, + }) + public enableRecaptcha: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public recaptchaSiteKey: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public recaptchaSecretKey: string | null; + + @Column('boolean', { + default: false, + }) + public enableTurnstile: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public turnstileSiteKey: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public turnstileSecretKey: string | null; + + @Column('enum', { + enum: ['none', 'all', 'local', 'remote'], + default: 'none', + }) + public sensitiveMediaDetection: 'none' | 'all' | 'local' | 'remote'; + + @Column('enum', { + enum: ['medium', 'low', 'high', 'veryLow', 'veryHigh'], + default: 'medium', + }) + public sensitiveMediaDetectionSensitivity: 'medium' | 'low' | 'high' | 'veryLow' | 'veryHigh'; + + @Column('boolean', { + default: false, + }) + public setSensitiveFlagAutomatically: boolean; + + @Column('boolean', { + default: false, + }) + public enableSensitiveMediaDetectionForVideos: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public summalyProxy: string | null; + + @Column('boolean', { + default: false, + }) + public enableEmail: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public email: string | null; + + @Column('boolean', { + default: false, + }) + public smtpSecure: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public smtpHost: string | null; + + @Column('integer', { + nullable: true, + }) + public smtpPort: number | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public smtpUser: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public smtpPass: string | null; + + @Column('boolean', { + default: false, + }) + public enableServiceWorker: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public swPublicKey: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public swPrivateKey: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public deeplAuthKey: string | null; + + @Column('boolean', { + default: false, + }) + public deeplIsPro: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public termsOfServiceUrl: string | null; + + @Column('varchar', { + length: 1024, + default: 'https://github.com/misskey-dev/misskey', + nullable: false, + }) + public repositoryUrl: string; + + @Column('varchar', { + length: 1024, + default: 'https://github.com/misskey-dev/misskey/issues/new', + nullable: true, + }) + public feedbackUrl: string | null; + + @Column('varchar', { + length: 8192, + nullable: true, + }) + public defaultLightTheme: string | null; + + @Column('varchar', { + length: 8192, + nullable: true, + }) + public defaultDarkTheme: string | null; + + @Column('boolean', { + default: false, + }) + public useObjectStorage: boolean; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public objectStorageBucket: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public objectStoragePrefix: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public objectStorageBaseUrl: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public objectStorageEndpoint: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public objectStorageRegion: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public objectStorageAccessKey: string | null; + + @Column('varchar', { + length: 1024, + nullable: true, + }) + public objectStorageSecretKey: string | null; + + @Column('integer', { + nullable: true, + }) + public objectStoragePort: number | null; + + @Column('boolean', { + default: true, + }) + public objectStorageUseSSL: boolean; + + @Column('boolean', { + default: true, + }) + public objectStorageUseProxy: boolean; + + @Column('boolean', { + default: false, + }) + public objectStorageSetPublicRead: boolean; + + @Column('boolean', { + default: true, + }) + public objectStorageS3ForcePathStyle: boolean; + + @Column('boolean', { + default: false, + }) + public enableIpLogging: boolean; + + @Column('boolean', { + default: true, + }) + public enableActiveEmailValidation: boolean; + + @Column('boolean', { + default: true, + }) + public enableChartsForRemoteUser: boolean; + + @Column('boolean', { + default: true, + }) + public enableChartsForFederatedInstances: boolean; + + @Column('boolean', { + default: false, + }) + public enableServerMachineStats: boolean; + + @Column('boolean', { + default: true, + }) + public enableIdenticonGeneration: boolean; + + @Column('jsonb', { + default: { }, + }) + public policies: Record; + + @Column('varchar', { + length: 280, + array: true, + default: '{}', + }) + public serverRules: string[]; + + @Column('varchar', { + length: 8192, + default: '{}', + }) + public manifestJsonOverride: string; + + @Column('varchar', { + length: 1024, array: true, default: '{ "admin", "administrator", "root", "system", "maintainer", "host", "mod", "moderator", "owner", "superuser", "staff", "auth", "i", "me", "everyone", "all", "mention", "mentions", "example", "user", "users", "account", "accounts", "official", "help", "helps", "support", "supports", "info", "information", "informations", "announce", "announces", "announcement", "announcements", "notice", "notification", "notifications", "dev", "developer", "developers", "tech", "misskey" }', + }) + public preservedUsernames: string[]; +} diff --git a/packages/backend/src/models/ModerationLog.ts b/packages/backend/src/models/ModerationLog.ts new file mode 100644 index 0000000000..a12b6ab614 --- /dev/null +++ b/packages/backend/src/models/ModerationLog.ts @@ -0,0 +1,37 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('moderation_log') +export class MiModerationLog { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the ModerationLog.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, + }) + public type: string; + + @Column('jsonb') + public info: Record; +} diff --git a/packages/backend/src/models/MutedNote.ts b/packages/backend/src/models/MutedNote.ts new file mode 100644 index 0000000000..75b7ab5fe9 --- /dev/null +++ b/packages/backend/src/models/MutedNote.ts @@ -0,0 +1,53 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { mutedNoteReasons } from '../../types.js'; +import { MiNote } from './Note.js'; +import { MiUser } from './User.js'; + +@Entity('muted_note') +@Index(['noteId', 'userId'], { unique: true }) +export class MiMutedNote { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column({ + ...id(), + comment: 'The note ID.', + }) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; + + @Index() + @Column({ + ...id(), + comment: 'The user ID.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + /** + * ミュートされた理由。 + */ + @Index() + @Column('enum', { + enum: mutedNoteReasons, + comment: 'The reason of the MutedNote.', + }) + public reason: typeof mutedNoteReasons[number]; +} diff --git a/packages/backend/src/models/Muting.ts b/packages/backend/src/models/Muting.ts new file mode 100644 index 0000000000..2f06ca8e5e --- /dev/null +++ b/packages/backend/src/models/Muting.ts @@ -0,0 +1,53 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('muting') +@Index(['muterId', 'muteeId'], { unique: true }) +export class MiMuting { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Muting.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + nullable: true, + }) + public expiresAt: Date | null; + + @Index() + @Column({ + ...id(), + comment: 'The mutee user ID.', + }) + public muteeId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public mutee: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The muter user ID.', + }) + public muterId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public muter: MiUser | null; +} diff --git a/packages/backend/src/models/Note.ts b/packages/backend/src/models/Note.ts new file mode 100644 index 0000000000..549e9cfe90 --- /dev/null +++ b/packages/backend/src/models/Note.ts @@ -0,0 +1,258 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { noteVisibilities } from '../../types.js'; +import { MiUser } from './User.js'; +import { MiChannel } from './Channel.js'; +import type { MiDriveFile } from './DriveFile.js'; + +@Entity('note') +@Index('IDX_NOTE_TAGS', { synchronize: false }) +@Index('IDX_NOTE_MENTIONS', { synchronize: false }) +@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false }) +export class MiNote { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Note.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The ID of reply target.', + }) + public replyId: MiNote['id'] | null; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public reply: MiNote | null; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The ID of renote target.', + }) + public renoteId: MiNote['id'] | null; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public renote: MiNote | null; + + @Index() + @Column('varchar', { + length: 256, nullable: true, + }) + public threadId: string | null; + + // TODO: varcharにしたい + @Column('text', { + nullable: true, + }) + public text: string | null; + + @Column('varchar', { + length: 256, nullable: true, + }) + public name: string | null; + + @Column('varchar', { + length: 512, nullable: true, + }) + public cw: string | null; + + @Index() + @Column({ + ...id(), + comment: 'The ID of author.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('boolean', { + default: false, + }) + public localOnly: boolean; + + @Column('varchar', { + length: 64, nullable: true, + }) + public reactionAcceptance: 'likeOnly' | 'likeOnlyForRemote' | 'nonSensitiveOnly' | 'nonSensitiveOnlyForLocalLikeOnlyForRemote' | null; + + @Column('smallint', { + default: 0, + }) + public renoteCount: number; + + @Column('smallint', { + default: 0, + }) + public repliesCount: number; + + @Column('smallint', { + default: 0, + }) + public clippedCount: number; + + @Column('jsonb', { + default: {}, + }) + public reactions: Record; + + /** + * public ... 公開 + * home ... ホームタイムライン(ユーザーページのタイムライン含む)のみに流す + * followers ... フォロワーのみ + * specified ... visibleUserIds で指定したユーザーのみ + */ + @Column('enum', { enum: noteVisibilities }) + public visibility: typeof noteVisibilities[number]; + + @Index({ unique: true }) + @Column('varchar', { + length: 512, nullable: true, + comment: 'The URI of a note. it will be null when the note is local.', + }) + public uri: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The human readable url of a note. it will be null when the note is local.', + }) + public url: string | null; + + @Column('integer', { + default: 0, select: false, + }) + public score: number; + + @Index() + @Column({ + ...id(), + array: true, default: '{}', + }) + public fileIds: MiDriveFile['id'][]; + + @Index() + @Column('varchar', { + length: 256, array: true, default: '{}', + }) + public attachedFileTypes: string[]; + + @Index() + @Column({ + ...id(), + array: true, default: '{}', + }) + public visibleUserIds: MiUser['id'][]; + + @Index() + @Column({ + ...id(), + array: true, default: '{}', + }) + public mentions: MiUser['id'][]; + + @Column('text', { + default: '[]', + }) + public mentionedRemoteUsers: string; + + @Column('varchar', { + length: 128, array: true, default: '{}', + }) + public emojis: string[]; + + @Index() + @Column('varchar', { + length: 128, array: true, default: '{}', + }) + public tags: string[]; + + @Column('boolean', { + default: false, + }) + public hasPoll: boolean; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: 'The ID of source channel.', + }) + public channelId: MiChannel['id'] | null; + + @ManyToOne(type => MiChannel, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public channel: MiChannel | null; + + //#region Denormalized fields + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public userHost: string | null; + + @Column({ + ...id(), + nullable: true, + comment: '[Denormalized]', + }) + public replyUserId: MiUser['id'] | null; + + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public replyUserHost: string | null; + + @Column({ + ...id(), + nullable: true, + comment: '[Denormalized]', + }) + public renoteUserId: MiUser['id'] | null; + + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public renoteUserHost: string | null; + //#endregion + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} + +export type IMentionedRemoteUsers = { + uri: string; + url?: string; + username: string; + host: string; +}[]; diff --git a/packages/backend/src/models/NoteFavorite.ts b/packages/backend/src/models/NoteFavorite.ts new file mode 100644 index 0000000000..1171684bcf --- /dev/null +++ b/packages/backend/src/models/NoteFavorite.ts @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiNote } from './Note.js'; +import { MiUser } from './User.js'; + +@Entity('note_favorite') +@Index(['userId', 'noteId'], { unique: true }) +export class MiNoteFavorite { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the NoteFavorite.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; +} diff --git a/packages/backend/src/models/NoteReaction.ts b/packages/backend/src/models/NoteReaction.ts new file mode 100644 index 0000000000..7c08d31c6d --- /dev/null +++ b/packages/backend/src/models/NoteReaction.ts @@ -0,0 +1,49 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiNote } from './Note.js'; + +@Entity('note_reaction') +@Index(['userId', 'noteId'], { unique: true }) +export class MiNoteReaction { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the NoteReaction.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user?: MiUser | null; + + @Index() + @Column(id()) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note?: MiNote | null; + + // TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため) + + @Column('varchar', { + length: 260, + }) + public reaction: string; +} diff --git a/packages/backend/src/models/NoteThreadMuting.ts b/packages/backend/src/models/NoteThreadMuting.ts new file mode 100644 index 0000000000..2d120e4c25 --- /dev/null +++ b/packages/backend/src/models/NoteThreadMuting.ts @@ -0,0 +1,37 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('note_thread_muting') +@Index(['userId', 'threadId'], { unique: true }) +export class MiNoteThreadMuting { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column('varchar', { + length: 256, + }) + public threadId: string; +} diff --git a/packages/backend/src/models/NoteUnread.ts b/packages/backend/src/models/NoteUnread.ts new file mode 100644 index 0000000000..d86a474553 --- /dev/null +++ b/packages/backend/src/models/NoteUnread.ts @@ -0,0 +1,68 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiNote } from './Note.js'; +import type { MiChannel } from './Channel.js'; + +@Entity('note_unread') +@Index(['userId', 'noteId'], { unique: true }) +export class MiNoteUnread { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column(id()) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; + + /** + * メンションか否か + */ + @Index() + @Column('boolean') + public isMentioned: boolean; + + /** + * ダイレクト投稿か否か + */ + @Index() + @Column('boolean') + public isSpecified: boolean; + + //#region Denormalized fields + @Index() + @Column({ + ...id(), + comment: '[Denormalized]', + }) + public noteUserId: MiUser['id']; + + @Index() + @Column({ + ...id(), + nullable: true, + comment: '[Denormalized]', + }) + public noteChannelId: MiChannel['id'] | null; + //#endregion +} diff --git a/packages/backend/src/models/Notification.ts b/packages/backend/src/models/Notification.ts new file mode 100644 index 0000000000..fb7f67dfd8 --- /dev/null +++ b/packages/backend/src/models/Notification.ts @@ -0,0 +1,71 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { notificationTypes } from '@/types.js'; +import { MiUser } from './User.js'; +import { MiNote } from './Note.js'; +import { MiFollowRequest } from './FollowRequest.js'; +import { MiAccessToken } from './AccessToken.js'; + +export type MiNotification = { + id: string; + + // RedisのためDateではなくstring + createdAt: string; + + /** + * 通知の送信者(initiator) + */ + notifierId: MiUser['id'] | null; + + /** + * 通知の種類。 + * follow - フォローされた + * mention - 投稿で自分が言及された + * reply - 投稿に返信された + * renote - 投稿がRenoteされた + * quote - 投稿が引用Renoteされた + * reaction - 投稿にリアクションされた + * pollEnded - 自分のアンケートもしくは自分が投票したアンケートが終了した + * receiveFollowRequest - フォローリクエストされた + * followRequestAccepted - 自分の送ったフォローリクエストが承認された + * achievementEarned - 実績を獲得 + * app - アプリ通知 + * test - テスト通知(サーバー側) + */ + type: typeof notificationTypes[number]; + + noteId: MiNote['id'] | null; + + followRequestId: MiFollowRequest['id'] | null; + + reaction: string | null; + + choice: number | null; + + achievement: string | null; + + /** + * アプリ通知のbody + */ + customBody: string | null; + + /** + * アプリ通知のheader + * (省略時はアプリ名で表示されることを期待) + */ + customHeader: string | null; + + /** + * アプリ通知のicon(URL) + * (省略時はアプリアイコンで表示されることを期待) + */ + customIcon: string | null; + + /** + * アプリ通知のアプリ(のトークン) + */ + appAccessTokenId: MiAccessToken['id'] | null; +} diff --git a/packages/backend/src/models/Page.ts b/packages/backend/src/models/Page.ts new file mode 100644 index 0000000000..3cb986f4ee --- /dev/null +++ b/packages/backend/src/models/Page.ts @@ -0,0 +1,126 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiDriveFile } from './DriveFile.js'; + +@Entity('page') +@Index(['userId', 'name'], { unique: true }) +export class MiPage { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Page.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + comment: 'The updated date of the Page.', + }) + public updatedAt: Date; + + @Column('varchar', { + length: 256, + }) + public title: string; + + @Index() + @Column('varchar', { + length: 256, + }) + public name: string; + + @Column('varchar', { + length: 256, nullable: true, + }) + public summary: string | null; + + @Column('boolean') + public alignCenter: boolean; + + @Column('boolean', { + default: false, + }) + public hideTitleWhenPinned: boolean; + + @Column('varchar', { + length: 32, + }) + public font: string; + + @Index() + @Column({ + ...id(), + comment: 'The ID of author.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column({ + ...id(), + nullable: true, + }) + public eyeCatchingImageId: MiDriveFile['id'] | null; + + @ManyToOne(type => MiDriveFile, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public eyeCatchingImage: MiDriveFile | null; + + @Column('jsonb', { + default: [], + }) + public content: Record[]; + + @Column('jsonb', { + default: [], + }) + public variables: Record[]; + + @Column('varchar', { + length: 16384, + default: '', + }) + public script: string; + + /** + * public ... 公開 + * followers ... フォロワーのみ + * specified ... visibleUserIds で指定したユーザーのみ + */ + @Column('enum', { enum: ['public', 'followers', 'specified'] }) + public visibility: 'public' | 'followers' | 'specified'; + + @Index() + @Column({ + ...id(), + array: true, default: '{}', + }) + public visibleUserIds: MiUser['id'][]; + + @Column('integer', { + default: 0, + }) + public likedCount: number; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/PageLike.ts b/packages/backend/src/models/PageLike.ts new file mode 100644 index 0000000000..92adf9bcc2 --- /dev/null +++ b/packages/backend/src/models/PageLike.ts @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiPage } from './Page.js'; + +@Entity('page_like') +@Index(['userId', 'pageId'], { unique: true }) +export class MiPageLike { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public pageId: MiPage['id']; + + @ManyToOne(type => MiPage, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public page: MiPage | null; +} diff --git a/packages/backend/src/models/PasswordResetRequest.ts b/packages/backend/src/models/PasswordResetRequest.ts new file mode 100644 index 0000000000..79f2e984b8 --- /dev/null +++ b/packages/backend/src/models/PasswordResetRequest.ts @@ -0,0 +1,35 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('password_reset_request') +export class MiPasswordResetRequest { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index({ unique: true }) + @Column('varchar', { + length: 256, + }) + public token: string; + + @Index() + @Column({ + ...id(), + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; +} diff --git a/packages/backend/src/models/Poll.ts b/packages/backend/src/models/Poll.ts new file mode 100644 index 0000000000..6863a78b7a --- /dev/null +++ b/packages/backend/src/models/Poll.ts @@ -0,0 +1,77 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { noteVisibilities } from '../../types.js'; +import { MiNote } from './Note.js'; +import type { MiUser } from './User.js'; + +@Entity('poll') +export class MiPoll { + @PrimaryColumn(id()) + public noteId: MiNote['id']; + + @OneToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; + + @Column('timestamp with time zone', { + nullable: true, + }) + public expiresAt: Date | null; + + @Column('boolean') + public multiple: boolean; + + @Column('varchar', { + length: 256, array: true, default: '{}', + }) + public choices: string[]; + + @Column('integer', { + array: true, + }) + public votes: number[]; + + //#region Denormalized fields + @Column('enum', { + enum: noteVisibilities, + comment: '[Denormalized]', + }) + public noteVisibility: typeof noteVisibilities[number]; + + @Index() + @Column({ + ...id(), + comment: '[Denormalized]', + }) + public userId: MiUser['id']; + + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public userHost: string | null; + //#endregion + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} + +export type IPoll = { + choices: string[]; + votes?: number[]; + multiple: boolean; + expiresAt: Date | null; +}; diff --git a/packages/backend/src/models/PollVote.ts b/packages/backend/src/models/PollVote.ts new file mode 100644 index 0000000000..37cd55fc18 --- /dev/null +++ b/packages/backend/src/models/PollVote.ts @@ -0,0 +1,45 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiNote } from './Note.js'; + +@Entity('poll_vote') +@Index(['userId', 'noteId', 'choice'], { unique: true }) +export class MiPollVote { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the PollVote.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column(id()) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; + + @Column('integer') + public choice: number; +} diff --git a/packages/backend/src/models/PromoNote.ts b/packages/backend/src/models/PromoNote.ts new file mode 100644 index 0000000000..f4425fe88b --- /dev/null +++ b/packages/backend/src/models/PromoNote.ts @@ -0,0 +1,33 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiNote } from './Note.js'; +import type { MiUser } from './User.js'; + +@Entity('promo_note') +export class MiPromoNote { + @PrimaryColumn(id()) + public noteId: MiNote['id']; + + @OneToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; + + @Column('timestamp with time zone') + public expiresAt: Date; + + //#region Denormalized fields + @Index() + @Column({ + ...id(), + comment: '[Denormalized]', + }) + public userId: MiUser['id']; + //#endregion +} diff --git a/packages/backend/src/models/PromoRead.ts b/packages/backend/src/models/PromoRead.ts new file mode 100644 index 0000000000..09ebfc8346 --- /dev/null +++ b/packages/backend/src/models/PromoRead.ts @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiNote } from './Note.js'; +import { MiUser } from './User.js'; + +@Entity('promo_read') +@Index(['userId', 'noteId'], { unique: true }) +export class MiPromoRead { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the PromoRead.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; +} diff --git a/packages/backend/src/models/RegistrationTicket.ts b/packages/backend/src/models/RegistrationTicket.ts new file mode 100644 index 0000000000..d94f465916 --- /dev/null +++ b/packages/backend/src/models/RegistrationTicket.ts @@ -0,0 +1,65 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn, OneToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('registration_ticket') +export class MiRegistrationTicket { + @PrimaryColumn(id()) + public id: string; + + @Index({ unique: true }) + @Column('varchar', { + length: 64, + }) + public code: string; + + @Column('timestamp with time zone', { + nullable: true, + }) + public expiresAt: Date | null; + + @Column('timestamp with time zone') + public createdAt: Date; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public createdBy: MiUser | null; + + @Index() + @Column({ + ...id(), + nullable: true, + }) + public createdById: MiUser['id'] | null; + + @OneToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public usedBy: MiUser | null; + + @Index() + @Column({ + ...id(), + nullable: true, + }) + public usedById: MiUser['id'] | null; + + @Column('timestamp with time zone', { + nullable: true, + }) + public usedAt: Date | null; + + @Column('varchar', { + length: 32, + nullable: true, + }) + public pendingUserId: string | null; +} diff --git a/packages/backend/src/models/RegistryItem.ts b/packages/backend/src/models/RegistryItem.ts new file mode 100644 index 0000000000..fdce57c467 --- /dev/null +++ b/packages/backend/src/models/RegistryItem.ts @@ -0,0 +1,63 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +// TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい +@Entity('registry_item') +export class MiRegistryItem { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the RegistryItem.', + }) + public createdAt: Date; + + @Column('timestamp with time zone', { + comment: 'The updated date of the RegistryItem.', + }) + public updatedAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The owner ID.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 1024, + comment: 'The key of the RegistryItem.', + }) + public key: string; + + @Column('jsonb', { + default: {}, nullable: true, + comment: 'The value of the RegistryItem.', + }) + public value: any | null; + + @Index() + @Column('varchar', { + length: 1024, array: true, default: '{}', + }) + public scope: string[]; + + // サードパーティアプリに開放するときのためのカラム + @Index() + @Column('varchar', { + length: 512, nullable: true, + }) + public domain: string | null; +} diff --git a/packages/backend/src/models/Relay.ts b/packages/backend/src/models/Relay.ts new file mode 100644 index 0000000000..293fccecfc --- /dev/null +++ b/packages/backend/src/models/Relay.ts @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; + +@Entity('relay') +export class MiRelay { + @PrimaryColumn(id()) + public id: string; + + @Index({ unique: true }) + @Column('varchar', { + length: 512, nullable: false, + }) + public inbox: string; + + @Column('enum', { + enum: ['requesting', 'accepted', 'rejected'], + }) + public status: 'requesting' | 'accepted' | 'rejected'; +} diff --git a/packages/backend/src/models/RenoteMuting.ts b/packages/backend/src/models/RenoteMuting.ts new file mode 100644 index 0000000000..d2a36249dc --- /dev/null +++ b/packages/backend/src/models/RenoteMuting.ts @@ -0,0 +1,47 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('renote_muting') +@Index(['muterId', 'muteeId'], { unique: true }) +export class MiRenoteMuting { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Muting.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The mutee user ID.', + }) + public muteeId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public mutee: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The muter user ID.', + }) + public muterId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public muter: MiUser | null; +} diff --git a/packages/backend/src/models/RetentionAggregation.ts b/packages/backend/src/models/RetentionAggregation.ts new file mode 100644 index 0000000000..9da401597c --- /dev/null +++ b/packages/backend/src/models/RetentionAggregation.ts @@ -0,0 +1,46 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; +import type { MiUser } from './User.js'; + +@Entity('retention_aggregation') +export class MiRetentionAggregation { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the Note.', + }) + public createdAt: Date; + + @Column('timestamp with time zone', { + comment: 'The updated date of the GalleryPost.', + }) + public updatedAt: Date; + + @Index({ unique: true }) + @Column('varchar', { + length: 512, nullable: false, + }) + public dateKey: string; + + @Column({ + ...id(), + array: true, + }) + public userIds: MiUser['id'][]; + + @Column('integer', { + }) + public usersCount: number; + + @Column('jsonb', { + default: {}, + }) + public data: Record; +} diff --git a/packages/backend/src/models/Role.ts b/packages/backend/src/models/Role.ts new file mode 100644 index 0000000000..df7541db3d --- /dev/null +++ b/packages/backend/src/models/Role.ts @@ -0,0 +1,183 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Column, PrimaryColumn } from 'typeorm'; +import { id } from './util/id.js'; + +type CondFormulaValueAnd = { + type: 'and'; + values: RoleCondFormulaValue[]; +}; + +type CondFormulaValueOr = { + type: 'or'; + values: RoleCondFormulaValue[]; +}; + +type CondFormulaValueNot = { + type: 'not'; + value: RoleCondFormulaValue; +}; + +type CondFormulaValueIsLocal = { + type: 'isLocal'; +}; + +type CondFormulaValueIsRemote = { + type: 'isRemote'; +}; + +type CondFormulaValueCreatedLessThan = { + type: 'createdLessThan'; + sec: number; +}; + +type CondFormulaValueCreatedMoreThan = { + type: 'createdMoreThan'; + sec: number; +}; + +type CondFormulaValueFollowersLessThanOrEq = { + type: 'followersLessThanOrEq'; + value: number; +}; + +type CondFormulaValueFollowersMoreThanOrEq = { + type: 'followersMoreThanOrEq'; + value: number; +}; + +type CondFormulaValueFollowingLessThanOrEq = { + type: 'followingLessThanOrEq'; + value: number; +}; + +type CondFormulaValueFollowingMoreThanOrEq = { + type: 'followingMoreThanOrEq'; + value: number; +}; + +type CondFormulaValueNotesLessThanOrEq = { + type: 'notesLessThanOrEq'; + value: number; +}; + +type CondFormulaValueNotesMoreThanOrEq = { + type: 'notesMoreThanOrEq'; + value: number; +}; + +export type RoleCondFormulaValue = + CondFormulaValueAnd | + CondFormulaValueOr | + CondFormulaValueNot | + CondFormulaValueIsLocal | + CondFormulaValueIsRemote | + CondFormulaValueCreatedLessThan | + CondFormulaValueCreatedMoreThan | + CondFormulaValueFollowersLessThanOrEq | + CondFormulaValueFollowersMoreThanOrEq | + CondFormulaValueFollowingLessThanOrEq | + CondFormulaValueFollowingMoreThanOrEq | + CondFormulaValueNotesLessThanOrEq | + CondFormulaValueNotesMoreThanOrEq; + +@Entity('role') +export class MiRole { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the Role.', + }) + public createdAt: Date; + + @Column('timestamp with time zone', { + comment: 'The updated date of the Role.', + }) + public updatedAt: Date; + + @Column('timestamp with time zone', { + comment: 'The last used date of the Role.', + }) + public lastUsedAt: Date; + + @Column('varchar', { + length: 256, + }) + public name: string; + + @Column('varchar', { + length: 1024, + }) + public description: string; + + @Column('varchar', { + length: 256, nullable: true, + }) + public color: string | null; + + @Column('varchar', { + length: 512, nullable: true, + }) + public iconUrl: string | null; + + @Column('enum', { + enum: ['manual', 'conditional'], + default: 'manual', + }) + public target: 'manual' | 'conditional'; + + @Column('jsonb', { + default: { }, + }) + public condFormula: RoleCondFormulaValue; + + @Column('boolean', { + default: false, + }) + public isPublic: boolean; + + // trueの場合ユーザー名の横にバッジとして表示 + @Column('boolean', { + default: false, + }) + public asBadge: boolean; + + @Column('boolean', { + default: false, + }) + public isModerator: boolean; + + @Column('boolean', { + default: false, + }) + public isAdministrator: boolean; + + @Column('boolean', { + default: false, + }) + public isExplorable: boolean; + + @Column('boolean', { + default: false, + }) + public canEditMembersByModerator: boolean; + + // UIに表示する際の並び順用(大きいほど先頭) + @Column('integer', { + default: 0, + }) + public displayOrder: number; + + @Column('jsonb', { + default: { }, + }) + public policies: Record; +} diff --git a/packages/backend/src/models/RoleAssignment.ts b/packages/backend/src/models/RoleAssignment.ts new file mode 100644 index 0000000000..4e5322c60b --- /dev/null +++ b/packages/backend/src/models/RoleAssignment.ts @@ -0,0 +1,53 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiRole } from './Role.js'; +import { MiUser } from './User.js'; + +@Entity('role_assignment') +@Index(['userId', 'roleId'], { unique: true }) +export class MiRoleAssignment { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the RoleAssignment.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The user ID.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The role ID.', + }) + public roleId: MiRole['id']; + + @ManyToOne(type => MiRole, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public role: MiRole | null; + + @Index() + @Column('timestamp with time zone', { + nullable: true, + }) + public expiresAt: Date | null; +} diff --git a/packages/backend/src/models/Signin.ts b/packages/backend/src/models/Signin.ts new file mode 100644 index 0000000000..a8b1a45c53 --- /dev/null +++ b/packages/backend/src/models/Signin.ts @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('signin') +export class MiSignin { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the Signin.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, + }) + public ip: string; + + @Column('jsonb') + public headers: Record; + + @Column('boolean') + public success: boolean; +} diff --git a/packages/backend/src/models/SwSubscription.ts b/packages/backend/src/models/SwSubscription.ts new file mode 100644 index 0000000000..be1e4e3687 --- /dev/null +++ b/packages/backend/src/models/SwSubscription.ts @@ -0,0 +1,47 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('sw_subscription') +export class MiSwSubscription { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 512, + }) + public endpoint: string; + + @Column('varchar', { + length: 256, + }) + public auth: string; + + @Column('varchar', { + length: 128, + }) + public publickey: string; + + @Column('boolean', { + default: false, + }) + public sendReadMessage: boolean; +} diff --git a/packages/backend/src/models/UsedUsername.ts b/packages/backend/src/models/UsedUsername.ts new file mode 100644 index 0000000000..c75bf424c1 --- /dev/null +++ b/packages/backend/src/models/UsedUsername.ts @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Column } from 'typeorm'; + +@Entity('used_username') +export class MiUsedUsername { + @PrimaryColumn('varchar', { + length: 128, + }) + public username: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts new file mode 100644 index 0000000000..b040d302ce --- /dev/null +++ b/packages/backend/src/models/User.ts @@ -0,0 +1,283 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiDriveFile } from './DriveFile.js'; + +@Entity('user') +@Index(['usernameLower', 'host'], { unique: true }) +export class MiUser { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column('timestamp with time zone', { + comment: 'The created date of the User.', + }) + public createdAt: Date; + + @Index() + @Column('timestamp with time zone', { + nullable: true, + comment: 'The updated date of the User.', + }) + public updatedAt: Date | null; + + @Column('timestamp with time zone', { + nullable: true, + }) + public lastFetchedAt: Date | null; + + @Index() + @Column('timestamp with time zone', { + nullable: true, + }) + public lastActiveDate: Date | null; + + @Column('boolean', { + default: false, + }) + public hideOnlineStatus: boolean; + + @Column('varchar', { + length: 128, + comment: 'The username of the User.', + }) + public username: string; + + @Index() + @Column('varchar', { + length: 128, select: false, + comment: 'The username (lowercased) of the User.', + }) + public usernameLower: string; + + @Column('varchar', { + length: 128, nullable: true, + comment: 'The name of the User.', + }) + public name: string | null; + + @Column('integer', { + default: 0, + comment: 'The count of followers.', + }) + public followersCount: number; + + @Column('integer', { + default: 0, + comment: 'The count of following.', + }) + public followingCount: number; + + @Column('varchar', { + length: 512, + nullable: true, + comment: 'The URI of the new account of the User', + }) + public movedToUri: string | null; + + @Column('timestamp with time zone', { + nullable: true, + comment: 'When the user moved to another account', + }) + public movedAt: Date | null; + + @Column('simple-array', { + nullable: true, + comment: 'URIs the user is known as too', + }) + public alsoKnownAs: string[] | null; + + @Column('integer', { + default: 0, + comment: 'The count of notes.', + }) + public notesCount: number; + + @Column({ + ...id(), + nullable: true, + comment: 'The ID of avatar DriveFile.', + }) + public avatarId: MiDriveFile['id'] | null; + + @OneToOne(type => MiDriveFile, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public avatar: MiDriveFile | null; + + @Column({ + ...id(), + nullable: true, + comment: 'The ID of banner DriveFile.', + }) + public bannerId: MiDriveFile['id'] | null; + + @OneToOne(type => MiDriveFile, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public banner: MiDriveFile | null; + + @Column('varchar', { + length: 512, nullable: true, + }) + public avatarUrl: string | null; + + @Column('varchar', { + length: 512, nullable: true, + }) + public bannerUrl: string | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public avatarBlurhash: string | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public bannerBlurhash: string | null; + + @Index() + @Column('varchar', { + length: 128, array: true, default: '{}', + }) + public tags: string[]; + + @Column('boolean', { + default: false, + comment: 'Whether the User is suspended.', + }) + public isSuspended: boolean; + + @Column('boolean', { + default: false, + comment: 'Whether the User is locked.', + }) + public isLocked: boolean; + + @Column('boolean', { + default: false, + comment: 'Whether the User is a bot.', + }) + public isBot: boolean; + + @Column('boolean', { + default: false, + comment: 'Whether the User is a cat.', + }) + public isCat: boolean; + + @Column('boolean', { + default: false, + comment: 'Whether the User is the root.', + }) + public isRoot: boolean; + + @Index() + @Column('boolean', { + default: true, + comment: 'Whether the User is explorable.', + }) + public isExplorable: boolean; + + // アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ + @Column('boolean', { + default: false, + comment: 'Whether the User is deleted.', + }) + public isDeleted: boolean; + + @Column('varchar', { + length: 128, array: true, default: '{}', + }) + public emojis: string[]; + + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: 'The host of the User. It will be null if the origin of the user is local.', + }) + public host: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The inbox URL of the User. It will be null if the origin of the user is local.', + }) + public inbox: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.', + }) + public sharedInbox: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The featured URL of the User. It will be null if the origin of the user is local.', + }) + public featured: string | null; + + @Index() + @Column('varchar', { + length: 512, nullable: true, + comment: 'The URI of the User. It will be null if the origin of the user is local.', + }) + public uri: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.', + }) + public followersUri: string | null; + + @Index({ unique: true }) + @Column('char', { + length: 16, nullable: true, unique: true, + comment: 'The native access token of the User. It will be null if the origin of the user is local.', + }) + public token: string | null; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} + +export type MiLocalUser = MiUser & { + host: null; + uri: null; +} + +export type MiPartialLocalUser = Partial & { + id: MiUser['id']; + host: null; + uri: null; +} + +export type MiRemoteUser = MiUser & { + host: string; + uri: string; +} + +export type MiPartialRemoteUser = Partial & { + id: MiUser['id']; + host: string; + uri: string; +} + +export const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const; +export const passwordSchema = { type: 'string', minLength: 1 } as const; +export const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; +export const descriptionSchema = { type: 'string', minLength: 1, maxLength: 1500 } as const; +export const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; +export const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const; diff --git a/packages/backend/src/models/UserIp.ts b/packages/backend/src/models/UserIp.ts new file mode 100644 index 0000000000..60a7bc8b01 --- /dev/null +++ b/packages/backend/src/models/UserIp.ts @@ -0,0 +1,28 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'; +import { id } from './util/id.js'; +import type { MiUser } from './User.js'; + +@Entity('user_ip') +@Index(['userId', 'ip'], { unique: true }) +export class MiUserIp { + @PrimaryGeneratedColumn() + public id: string; + + @Column('timestamp with time zone', { + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @Column('varchar', { + length: 128, + }) + public ip: string; +} diff --git a/packages/backend/src/models/UserKeypair.ts b/packages/backend/src/models/UserKeypair.ts new file mode 100644 index 0000000000..a316dbaeb4 --- /dev/null +++ b/packages/backend/src/models/UserKeypair.ts @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('user_keypair') +export class MiUserKeypair { + @PrimaryColumn(id()) + public userId: MiUser['id']; + + @OneToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 4096, + }) + public publicKey: string; + + @Column('varchar', { + length: 4096, + }) + public privateKey: string; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/UserList.ts b/packages/backend/src/models/UserList.ts new file mode 100644 index 0000000000..9af85af97e --- /dev/null +++ b/packages/backend/src/models/UserList.ts @@ -0,0 +1,44 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('user_list') +export class MiUserList { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the UserList.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The owner ID.', + }) + public userId: MiUser['id']; + + @Index() + @Column('boolean', { + default: false, + }) + public isPublic: boolean; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, + comment: 'The name of the UserList.', + }) + public name: string; +} diff --git a/packages/backend/src/models/UserListFavorite.ts b/packages/backend/src/models/UserListFavorite.ts new file mode 100644 index 0000000000..d0b054b932 --- /dev/null +++ b/packages/backend/src/models/UserListFavorite.ts @@ -0,0 +1,38 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiUserList } from './UserList.js'; + +@Entity('user_list_favorite') +@Index(['userId', 'userListId'], { unique: true }) +export class MiUserListFavorite { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public userListId: MiUserList['id']; + + @ManyToOne(type => MiUserList, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public userList: MiUserList | null; +} diff --git a/packages/backend/src/models/UserListJoining.ts b/packages/backend/src/models/UserListJoining.ts new file mode 100644 index 0000000000..4918f2f700 --- /dev/null +++ b/packages/backend/src/models/UserListJoining.ts @@ -0,0 +1,47 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiUserList } from './UserList.js'; + +@Entity('user_list_joining') +@Index(['userId', 'userListId'], { unique: true }) +export class MiUserListJoining { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the UserListJoining.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The user ID.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The list ID.', + }) + public userListId: MiUserList['id']; + + @ManyToOne(type => MiUserList, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public userList: MiUserList | null; +} diff --git a/packages/backend/src/models/UserMemo.ts b/packages/backend/src/models/UserMemo.ts new file mode 100644 index 0000000000..ab5e812c44 --- /dev/null +++ b/packages/backend/src/models/UserMemo.ts @@ -0,0 +1,47 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('user_memo') +@Index(['userId', 'targetUserId'], { unique: true }) +export class MiUserMemo { + @PrimaryColumn(id()) + public id: string; + + @Index() + @Column({ + ...id(), + comment: 'The ID of author.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index() + @Column({ + ...id(), + comment: 'The ID of target user.', + }) + public targetUserId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public targetUser: MiUser | null; + + @Column('varchar', { + length: 2048, + comment: 'Memo.', + }) + public memo: string; +} diff --git a/packages/backend/src/models/UserNotePining.ts b/packages/backend/src/models/UserNotePining.ts new file mode 100644 index 0000000000..1d50a5068e --- /dev/null +++ b/packages/backend/src/models/UserNotePining.ts @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiNote } from './Note.js'; +import { MiUser } from './User.js'; + +@Entity('user_note_pining') +@Index(['userId', 'noteId'], { unique: true }) +export class MiUserNotePining { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the UserNotePinings.', + }) + public createdAt: Date; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column(id()) + public noteId: MiNote['id']; + + @ManyToOne(type => MiNote, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public note: MiNote | null; +} diff --git a/packages/backend/src/models/UserPending.ts b/packages/backend/src/models/UserPending.ts new file mode 100644 index 0000000000..b15ededa14 --- /dev/null +++ b/packages/backend/src/models/UserPending.ts @@ -0,0 +1,37 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; +import { id } from './util/id.js'; + +@Entity('user_pending') +export class MiUserPending { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone') + public createdAt: Date; + + @Index({ unique: true }) + @Column('varchar', { + length: 128, + }) + public code: string; + + @Column('varchar', { + length: 128, + }) + public username: string; + + @Column('varchar', { + length: 128, + }) + public email: string; + + @Column('varchar', { + length: 128, + }) + public password: string; +} diff --git a/packages/backend/src/models/UserProfile.ts b/packages/backend/src/models/UserProfile.ts new file mode 100644 index 0000000000..6c7ffe4c39 --- /dev/null +++ b/packages/backend/src/models/UserProfile.ts @@ -0,0 +1,259 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; +import { obsoleteNotificationTypes, ffVisibility, notificationTypes } from '@/types.js'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; +import { MiPage } from './Page.js'; + +// TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも +// ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン +@Entity('user_profile') +export class MiUserProfile { + @PrimaryColumn(id()) + public userId: MiUser['id']; + + @OneToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, nullable: true, + comment: 'The location of the User.', + }) + public location: string | null; + + @Column('char', { + length: 10, nullable: true, + comment: 'The birthday (YYYY-MM-DD) of the User.', + }) + public birthday: string | null; + + @Column('varchar', { + length: 2048, nullable: true, + comment: 'The description (bio) of the User.', + }) + public description: string | null; + + @Column('jsonb', { + default: [], + }) + public fields: { + name: string; + value: string; + }[]; + + @Column('varchar', { + length: 32, nullable: true, + }) + public lang: string | null; + + @Column('varchar', { + length: 512, nullable: true, + comment: 'Remote URL of the user.', + }) + public url: string | null; + + @Column('varchar', { + length: 128, nullable: true, + comment: 'The email address of the User.', + }) + public email: string | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public emailVerifyCode: string | null; + + @Column('boolean', { + default: false, + }) + public emailVerified: boolean; + + @Column('jsonb', { + default: ['follow', 'receiveFollowRequest'], + }) + public emailNotificationTypes: string[]; + + @Column('boolean', { + default: true, + }) + public publicReactions: boolean; + + @Column('enum', { + enum: ffVisibility, + default: 'public', + }) + public ffVisibility: typeof ffVisibility[number]; + + @Column('varchar', { + length: 128, nullable: true, + }) + public twoFactorTempSecret: string | null; + + @Column('varchar', { + length: 128, nullable: true, + }) + public twoFactorSecret: string | null; + + @Column('varchar', { + nullable: true, array: true, + }) + public twoFactorBackupSecret: string[] | null; + + @Column('boolean', { + default: false, + }) + public twoFactorEnabled: boolean; + + @Column('boolean', { + default: false, + }) + public securityKeysAvailable: boolean; + + @Column('boolean', { + default: false, + }) + public usePasswordLessLogin: boolean; + + @Column('varchar', { + length: 128, nullable: true, + comment: 'The password hash of the User. It will be null if the origin of the user is local.', + }) + public password: string | null; + + @Column('varchar', { + length: 8192, default: '', + }) + public moderationNote: string | null; + + // TODO: そのうち消す + @Column('jsonb', { + default: {}, + comment: 'The client-specific data of the User.', + }) + public clientData: Record; + + // TODO: そのうち消す + @Column('jsonb', { + default: {}, + comment: 'The room data of the User.', + }) + public room: Record; + + @Column('boolean', { + default: false, + }) + public autoAcceptFollowed: boolean; + + @Column('boolean', { + default: false, + comment: 'Whether reject index by crawler.', + }) + public noCrawle: boolean; + + @Column('boolean', { + default: true, + }) + public preventAiLearning: boolean; + + @Column('boolean', { + default: false, + }) + public alwaysMarkNsfw: boolean; + + @Column('boolean', { + default: false, + }) + public autoSensitive: boolean; + + @Column('boolean', { + default: false, + }) + public carefulBot: boolean; + + @Column('boolean', { + default: true, + }) + public injectFeaturedNote: boolean; + + @Column('boolean', { + default: true, + }) + public receiveAnnouncementEmail: boolean; + + @Column({ + ...id(), + nullable: true, + }) + public pinnedPageId: MiPage['id'] | null; + + @OneToOne(type => MiPage, { + onDelete: 'SET NULL', + }) + @JoinColumn() + public pinnedPage: MiPage | null; + + @Index() + @Column('boolean', { + default: false, select: false, + }) + public enableWordMute: boolean; + + @Column('jsonb', { + default: [], + }) + public mutedWords: string[][]; + + @Column('jsonb', { + default: [], + comment: 'List of instances muted by the user.', + }) + public mutedInstances: string[]; + + @Column('enum', { + enum: [ + ...notificationTypes, + // マイグレーションで削除が困難なので古いenumは残しておく + ...obsoleteNotificationTypes, + ], + array: true, + default: [], + }) + public mutingNotificationTypes: typeof notificationTypes[number][]; + + @Column('varchar', { + length: 32, array: true, default: '{}', + }) + public loggedInDates: string[]; + + @Column('jsonb', { + default: [], + }) + public achievements: { + name: string; + unlockedAt: number; + }[]; + + //#region Denormalized fields + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]', + }) + public userHost: string | null; + //#endregion + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/UserPublickey.ts b/packages/backend/src/models/UserPublickey.ts new file mode 100644 index 0000000000..33de73c636 --- /dev/null +++ b/packages/backend/src/models/UserPublickey.ts @@ -0,0 +1,39 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('user_publickey') +export class MiUserPublickey { + @PrimaryColumn(id()) + public userId: MiUser['id']; + + @OneToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Index({ unique: true }) + @Column('varchar', { + length: 256, + }) + public keyId: string; + + @Column('varchar', { + length: 4096, + }) + public keyPem: string; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/UserSecurityKey.ts b/packages/backend/src/models/UserSecurityKey.ts new file mode 100644 index 0000000000..02c29bfbb5 --- /dev/null +++ b/packages/backend/src/models/UserSecurityKey.ts @@ -0,0 +1,76 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +@Entity('user_security_key') +export class MiUserSecurityKey { + @PrimaryColumn('varchar', { + comment: 'Variable-length id given to navigator.credentials.get()', + }) + public id: string; + + @Index() + @Column(id()) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + comment: 'User-defined name for this key', + length: 30, + }) + public name: string; + + @Index() + @Column('varchar', { + comment: 'The public key of the UserSecurityKey, hex-encoded.', + }) + public publicKey: string; + + @Column('bigint', { + comment: 'The number of times the UserSecurityKey was validated.', + default: 0, + }) + public counter: number; + + @Column('timestamp with time zone', { + comment: 'Timestamp of the last time the UserSecurityKey was used.', + default: () => 'now()', + }) + public lastUsed: Date; + + @Column('varchar', { + comment: 'The type of Backup Eligibility in authenticator data', + length: 32, nullable: true, + }) + public credentialDeviceType: string | null; + + @Column('boolean', { + comment: 'Whether or not the credential has been backed up', + nullable: true, + }) + public credentialBackedUp: boolean | null; + + @Column('varchar', { + comment: 'The type of the credential returned by the browser', + length: 32, array: true, nullable: true, + }) + public transports: string[] | null; + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } +} diff --git a/packages/backend/src/models/Webhook.ts b/packages/backend/src/models/Webhook.ts new file mode 100644 index 0000000000..5b009c18a6 --- /dev/null +++ b/packages/backend/src/models/Webhook.ts @@ -0,0 +1,78 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; +import { id } from './util/id.js'; +import { MiUser } from './User.js'; + +export const webhookEventTypes = ['mention', 'unfollow', 'follow', 'followed', 'note', 'reply', 'renote', 'reaction'] as const; + +@Entity('webhook') +export class MiWebhook { + @PrimaryColumn(id()) + public id: string; + + @Column('timestamp with time zone', { + comment: 'The created date of the Antenna.', + }) + public createdAt: Date; + + @Index() + @Column({ + ...id(), + comment: 'The owner ID.', + }) + public userId: MiUser['id']; + + @ManyToOne(type => MiUser, { + onDelete: 'CASCADE', + }) + @JoinColumn() + public user: MiUser | null; + + @Column('varchar', { + length: 128, + comment: 'The name of the Antenna.', + }) + public name: string; + + @Index() + @Column('varchar', { + length: 128, array: true, default: '{}', + }) + public on: (typeof webhookEventTypes)[number][]; + + @Column('varchar', { + length: 1024, + }) + public url: string; + + @Column('varchar', { + length: 1024, + }) + public secret: string; + + @Index() + @Column('boolean', { + default: true, + }) + public active: boolean; + + /** + * 直近のリクエスト送信日時 + */ + @Column('timestamp with time zone', { + nullable: true, + }) + public latestSentAt: Date | null; + + /** + * 直近のリクエスト送信時のHTTPステータスコード + */ + @Column('integer', { + nullable: true, + }) + public latestStatus: number | null; +} diff --git a/packages/backend/src/models/_.ts b/packages/backend/src/models/_.ts index e4f4dce7d6..6be7bd0df6 100644 --- a/packages/backend/src/models/_.ts +++ b/packages/backend/src/models/_.ts @@ -3,71 +3,71 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { MiAbuseUserReport } from '@/models/entities/AbuseUserReport.js'; -import { MiAccessToken } from '@/models/entities/AccessToken.js'; -import { MiAd } from '@/models/entities/Ad.js'; -import { MiAnnouncement } from '@/models/entities/Announcement.js'; -import { MiAnnouncementRead } from '@/models/entities/AnnouncementRead.js'; -import { MiAntenna } from '@/models/entities/Antenna.js'; -import { MiApp } from '@/models/entities/App.js'; -import { MiAuthSession } from '@/models/entities/AuthSession.js'; -import { MiBlocking } from '@/models/entities/Blocking.js'; -import { MiChannelFollowing } from '@/models/entities/ChannelFollowing.js'; -import { MiChannelFavorite } from '@/models/entities/ChannelFavorite.js'; -import { MiClip } from '@/models/entities/Clip.js'; -import { MiClipNote } from '@/models/entities/ClipNote.js'; -import { MiClipFavorite } from '@/models/entities/ClipFavorite.js'; -import { MiDriveFile } from '@/models/entities/DriveFile.js'; -import { MiDriveFolder } from '@/models/entities/DriveFolder.js'; -import { MiEmoji } from '@/models/entities/Emoji.js'; -import { MiFollowing } from '@/models/entities/Following.js'; -import { MiFollowRequest } from '@/models/entities/FollowRequest.js'; -import { MiGalleryLike } from '@/models/entities/GalleryLike.js'; -import { MiGalleryPost } from '@/models/entities/GalleryPost.js'; -import { MiHashtag } from '@/models/entities/Hashtag.js'; -import { MiInstance } from '@/models/entities/Instance.js'; -import { MiMeta } from '@/models/entities/Meta.js'; -import { MiModerationLog } from '@/models/entities/ModerationLog.js'; -import { MiMutedNote } from '@/models/entities/MutedNote.js'; -import { MiMuting } from '@/models/entities/Muting.js'; -import { MiRenoteMuting } from '@/models/entities/RenoteMuting.js'; -import { MiNote } from '@/models/entities/Note.js'; -import { MiNoteFavorite } from '@/models/entities/NoteFavorite.js'; -import { MiNoteReaction } from '@/models/entities/NoteReaction.js'; -import { MiNoteThreadMuting } from '@/models/entities/NoteThreadMuting.js'; -import { MiNoteUnread } from '@/models/entities/NoteUnread.js'; -import { MiPage } from '@/models/entities/Page.js'; -import { MiPageLike } from '@/models/entities/PageLike.js'; -import { MiPasswordResetRequest } from '@/models/entities/PasswordResetRequest.js'; -import { MiPoll } from '@/models/entities/Poll.js'; -import { MiPollVote } from '@/models/entities/PollVote.js'; -import { MiPromoNote } from '@/models/entities/PromoNote.js'; -import { MiPromoRead } from '@/models/entities/PromoRead.js'; -import { MiRegistrationTicket } from '@/models/entities/RegistrationTicket.js'; -import { MiRegistryItem } from '@/models/entities/RegistryItem.js'; -import { MiRelay } from '@/models/entities/Relay.js'; -import { MiSignin } from '@/models/entities/Signin.js'; -import { MiSwSubscription } from '@/models/entities/SwSubscription.js'; -import { MiUsedUsername } from '@/models/entities/UsedUsername.js'; -import { MiUser } from '@/models/entities/User.js'; -import { MiUserIp } from '@/models/entities/UserIp.js'; -import { MiUserKeypair } from '@/models/entities/UserKeypair.js'; -import { MiUserList } from '@/models/entities/UserList.js'; -import { MiUserListJoining } from '@/models/entities/UserListJoining.js'; -import { MiUserNotePining } from '@/models/entities/UserNotePining.js'; -import { MiUserPending } from '@/models/entities/UserPending.js'; -import { MiUserProfile } from '@/models/entities/UserProfile.js'; -import { MiUserPublickey } from '@/models/entities/UserPublickey.js'; -import { MiUserSecurityKey } from '@/models/entities/UserSecurityKey.js'; -import { MiUserMemo } from '@/models/entities/UserMemo.js'; -import { MiWebhook } from '@/models/entities/Webhook.js'; -import { MiChannel } from '@/models/entities/Channel.js'; -import { MiRetentionAggregation } from '@/models/entities/RetentionAggregation.js'; -import { MiRole } from '@/models/entities/Role.js'; -import { MiRoleAssignment } from '@/models/entities/RoleAssignment.js'; -import { MiFlash } from '@/models/entities/Flash.js'; -import { MiFlashLike } from '@/models/entities/FlashLike.js'; -import { MiUserListFavorite } from './entities/UserListFavorite.js'; +import { MiAbuseUserReport } from '@/models/AbuseUserReport.js'; +import { MiAccessToken } from '@/models/AccessToken.js'; +import { MiAd } from '@/models/Ad.js'; +import { MiAnnouncement } from '@/models/Announcement.js'; +import { MiAnnouncementRead } from '@/models/AnnouncementRead.js'; +import { MiAntenna } from '@/models/Antenna.js'; +import { MiApp } from '@/models/App.js'; +import { MiAuthSession } from '@/models/AuthSession.js'; +import { MiBlocking } from '@/models/Blocking.js'; +import { MiChannelFollowing } from '@/models/ChannelFollowing.js'; +import { MiChannelFavorite } from '@/models/ChannelFavorite.js'; +import { MiClip } from '@/models/Clip.js'; +import { MiClipNote } from '@/models/ClipNote.js'; +import { MiClipFavorite } from '@/models/ClipFavorite.js'; +import { MiDriveFile } from '@/models/DriveFile.js'; +import { MiDriveFolder } from '@/models/DriveFolder.js'; +import { MiEmoji } from '@/models/Emoji.js'; +import { MiFollowing } from '@/models/Following.js'; +import { MiFollowRequest } from '@/models/FollowRequest.js'; +import { MiGalleryLike } from '@/models/GalleryLike.js'; +import { MiGalleryPost } from '@/models/GalleryPost.js'; +import { MiHashtag } from '@/models/Hashtag.js'; +import { MiInstance } from '@/models/Instance.js'; +import { MiMeta } from '@/models/Meta.js'; +import { MiModerationLog } from '@/models/ModerationLog.js'; +import { MiMutedNote } from '@/models/MutedNote.js'; +import { MiMuting } from '@/models/Muting.js'; +import { MiRenoteMuting } from '@/models/RenoteMuting.js'; +import { MiNote } from '@/models/Note.js'; +import { MiNoteFavorite } from '@/models/NoteFavorite.js'; +import { MiNoteReaction } from '@/models/NoteReaction.js'; +import { MiNoteThreadMuting } from '@/models/NoteThreadMuting.js'; +import { MiNoteUnread } from '@/models/NoteUnread.js'; +import { MiPage } from '@/models/Page.js'; +import { MiPageLike } from '@/models/PageLike.js'; +import { MiPasswordResetRequest } from '@/models/PasswordResetRequest.js'; +import { MiPoll } from '@/models/Poll.js'; +import { MiPollVote } from '@/models/PollVote.js'; +import { MiPromoNote } from '@/models/PromoNote.js'; +import { MiPromoRead } from '@/models/PromoRead.js'; +import { MiRegistrationTicket } from '@/models/RegistrationTicket.js'; +import { MiRegistryItem } from '@/models/RegistryItem.js'; +import { MiRelay } from '@/models/Relay.js'; +import { MiSignin } from '@/models/Signin.js'; +import { MiSwSubscription } from '@/models/SwSubscription.js'; +import { MiUsedUsername } from '@/models/UsedUsername.js'; +import { MiUser } from '@/models/User.js'; +import { MiUserIp } from '@/models/UserIp.js'; +import { MiUserKeypair } from '@/models/UserKeypair.js'; +import { MiUserList } from '@/models/UserList.js'; +import { MiUserListJoining } from '@/models/UserListJoining.js'; +import { MiUserNotePining } from '@/models/UserNotePining.js'; +import { MiUserPending } from '@/models/UserPending.js'; +import { MiUserProfile } from '@/models/UserProfile.js'; +import { MiUserPublickey } from '@/models/UserPublickey.js'; +import { MiUserSecurityKey } from '@/models/UserSecurityKey.js'; +import { MiUserMemo } from '@/models/UserMemo.js'; +import { MiWebhook } from '@/models/Webhook.js'; +import { MiChannel } from '@/models/Channel.js'; +import { MiRetentionAggregation } from '@/models/RetentionAggregation.js'; +import { MiRole } from '@/models/Role.js'; +import { MiRoleAssignment } from '@/models/RoleAssignment.js'; +import { MiFlash } from '@/models/Flash.js'; +import { MiFlashLike } from '@/models/FlashLike.js'; +import { MiUserListFavorite } from '@/models/UserListFavorite.js'; import type { Repository } from 'typeorm'; export { diff --git a/packages/backend/src/models/entities/AbuseUserReport.ts b/packages/backend/src/models/entities/AbuseUserReport.ts deleted file mode 100644 index 522cc502cc..0000000000 --- a/packages/backend/src/models/entities/AbuseUserReport.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('abuse_user_report') -export class MiAbuseUserReport { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the AbuseUserReport.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public targetUserId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public targetUser: MiUser | null; - - @Index() - @Column(id()) - public reporterId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public reporter: MiUser | null; - - @Column({ - ...id(), - nullable: true, - }) - public assigneeId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public assignee: MiUser | null; - - @Index() - @Column('boolean', { - default: false, - }) - public resolved: boolean; - - @Column('boolean', { - default: false, - }) - public forwarded: boolean; - - @Column('varchar', { - length: 2048, - }) - public comment: string; - - //#region Denormalized fields - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public targetUserHost: string | null; - - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public reporterHost: string | null; - //#endregion -} diff --git a/packages/backend/src/models/entities/AccessToken.ts b/packages/backend/src/models/entities/AccessToken.ts deleted file mode 100644 index 08bd2483ee..0000000000 --- a/packages/backend/src/models/entities/AccessToken.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiApp } from './App.js'; - -@Entity('access_token') -export class MiAccessToken { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the AccessToken.', - }) - public createdAt: Date; - - @Column('timestamp with time zone', { - nullable: true, - }) - public lastUsedAt: Date | null; - - @Index() - @Column('varchar', { - length: 128, - }) - public token: string; - - @Index() - @Column('varchar', { - length: 128, - nullable: true, - }) - public session: string | null; - - @Index() - @Column('varchar', { - length: 128, - }) - public hash: string; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column({ - ...id(), - nullable: true, - }) - public appId: MiApp['id'] | null; - - @ManyToOne(type => MiApp, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public app: MiApp | null; - - @Column('varchar', { - length: 128, - nullable: true, - }) - public name: string | null; - - @Column('varchar', { - length: 512, - nullable: true, - }) - public description: string | null; - - @Column('varchar', { - length: 512, - nullable: true, - }) - public iconUrl: string | null; - - @Column('varchar', { - length: 64, array: true, - default: '{}', - }) - public permission: string[]; - - @Column('boolean', { - default: false, - }) - public fetched: boolean; -} diff --git a/packages/backend/src/models/entities/Ad.ts b/packages/backend/src/models/entities/Ad.ts deleted file mode 100644 index 2f84e7144e..0000000000 --- a/packages/backend/src/models/entities/Ad.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; -import { id } from '../id.js'; - -@Entity('ad') -export class MiAd { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Ad.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - comment: 'The expired date of the Ad.', - }) - public expiresAt: Date; - - @Index() - @Column('timestamp with time zone', { - comment: 'The expired date of the Ad.', - default: () => 'now()', - }) - public startsAt: Date; - - @Column('varchar', { - length: 32, nullable: false, - }) - public place: string; - - // 今は使われていないが将来的に活用される可能性はある - @Column('varchar', { - length: 32, nullable: false, - }) - public priority: string; - - @Column('integer', { - default: 1, nullable: false, - }) - public ratio: number; - - @Column('varchar', { - length: 1024, nullable: false, - }) - public url: string; - - @Column('varchar', { - length: 1024, nullable: false, - }) - public imageUrl: string; - - @Column('varchar', { - length: 8192, nullable: false, - }) - public memo: string; - @Column('integer', { - default: 0, nullable: false, - }) - public dayOfWeek: number; - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/Announcement.ts b/packages/backend/src/models/entities/Announcement.ts deleted file mode 100644 index 9a2722b39c..0000000000 --- a/packages/backend/src/models/entities/Announcement.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('announcement') -export class MiAnnouncement { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Announcement.', - }) - public createdAt: Date; - - @Column('timestamp with time zone', { - comment: 'The updated date of the Announcement.', - nullable: true, - }) - public updatedAt: Date | null; - - @Column('varchar', { - length: 8192, nullable: false, - }) - public text: string; - - @Column('varchar', { - length: 256, nullable: false, - }) - public title: string; - - @Column('varchar', { - length: 1024, nullable: true, - }) - public imageUrl: string | null; - - // info, warning, error, success - @Column('varchar', { - length: 256, nullable: false, - default: 'info', - }) - public icon: string; - - // normal ... お知らせページ掲載 - // banner ... お知らせページ掲載 + バナー表示 - // dialog ... お知らせページ掲載 + ダイアログ表示 - @Column('varchar', { - length: 256, nullable: false, - default: 'normal', - }) - public display: string; - - @Column('boolean', { - default: false, - }) - public needConfirmationToRead: boolean; - - @Index() - @Column('boolean', { - default: true, - }) - public isActive: boolean; - - @Index() - @Column('boolean', { - default: false, - }) - public forExistingUsers: boolean; - - @Index() - @Column({ - ...id(), - nullable: true, - }) - public userId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/AnnouncementRead.ts b/packages/backend/src/models/entities/AnnouncementRead.ts deleted file mode 100644 index 89dadaab37..0000000000 --- a/packages/backend/src/models/entities/AnnouncementRead.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiAnnouncement } from './Announcement.js'; - -@Entity('announcement_read') -@Index(['userId', 'announcementId'], { unique: true }) -export class MiAnnouncementRead { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the AnnouncementRead.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column(id()) - public announcementId: MiAnnouncement['id']; - - @ManyToOne(type => MiAnnouncement, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public announcement: MiAnnouncement | null; -} diff --git a/packages/backend/src/models/entities/Antenna.ts b/packages/backend/src/models/entities/Antenna.ts deleted file mode 100644 index e73a4d55c6..0000000000 --- a/packages/backend/src/models/entities/Antenna.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiUserList } from './UserList.js'; - -@Entity('antenna') -export class MiAntenna { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the Antenna.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone') - public lastUsedAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The owner ID.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, - comment: 'The name of the Antenna.', - }) - public name: string; - - @Column('enum', { enum: ['home', 'all', 'users', 'list'] }) - public src: 'home' | 'all' | 'users' | 'list'; - - @Column({ - ...id(), - nullable: true, - }) - public userListId: MiUserList['id'] | null; - - @ManyToOne(type => MiUserList, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public userList: MiUserList | null; - - @Column('varchar', { - length: 1024, array: true, - default: '{}', - }) - public users: string[]; - - @Column('jsonb', { - default: [], - }) - public keywords: string[][]; - - @Column('jsonb', { - default: [], - }) - public excludeKeywords: string[][]; - - @Column('boolean', { - default: false, - }) - public caseSensitive: boolean; - - @Column('boolean', { - default: false, - }) - public withReplies: boolean; - - @Column('boolean') - public withFile: boolean; - - @Column('varchar', { - length: 2048, nullable: true, - }) - public expression: string | null; - - @Column('boolean') - public notify: boolean; - - @Index() - @Column('boolean', { - default: true, - }) - public isActive: boolean; -} diff --git a/packages/backend/src/models/entities/App.ts b/packages/backend/src/models/entities/App.ts deleted file mode 100644 index 99c41a2035..0000000000 --- a/packages/backend/src/models/entities/App.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('app') -export class MiApp { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the App.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The owner ID.', - }) - public userId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'SET NULL', - nullable: true, - }) - public user: MiUser | null; - - @Index() - @Column('varchar', { - length: 64, - comment: 'The secret key of the App.', - }) - public secret: string; - - @Column('varchar', { - length: 128, - comment: 'The name of the App.', - }) - public name: string; - - @Column('varchar', { - length: 512, - comment: 'The description of the App.', - }) - public description: string; - - @Column('varchar', { - length: 64, array: true, - comment: 'The permission of the App.', - }) - public permission: string[]; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The callbackUrl of the App.', - }) - public callbackUrl: string | null; -} diff --git a/packages/backend/src/models/entities/AuthSession.ts b/packages/backend/src/models/entities/AuthSession.ts deleted file mode 100644 index 1aabf836db..0000000000 --- a/packages/backend/src/models/entities/AuthSession.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiApp } from './App.js'; - -@Entity('auth_session') -export class MiAuthSession { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the AuthSession.', - }) - public createdAt: Date; - - @Index() - @Column('varchar', { - length: 128, - }) - public token: string; - - @Column({ - ...id(), - nullable: true, - }) - public userId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - nullable: true, - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public appId: MiApp['id']; - - @ManyToOne(type => MiApp, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public app: MiApp | null; -} diff --git a/packages/backend/src/models/entities/Blocking.ts b/packages/backend/src/models/entities/Blocking.ts deleted file mode 100644 index 8bedb4395c..0000000000 --- a/packages/backend/src/models/entities/Blocking.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('blocking') -@Index(['blockerId', 'blockeeId'], { unique: true }) -export class MiBlocking { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Blocking.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The blockee user ID.', - }) - public blockeeId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public blockee: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The blocker user ID.', - }) - public blockerId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public blocker: MiUser | null; -} diff --git a/packages/backend/src/models/entities/Channel.ts b/packages/backend/src/models/entities/Channel.ts deleted file mode 100644 index 9a89b650a9..0000000000 --- a/packages/backend/src/models/entities/Channel.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiDriveFile } from './DriveFile.js'; - -@Entity('channel') -export class MiChannel { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Channel.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - nullable: true, - }) - public lastNotedAt: Date | null; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The owner ID.', - }) - public userId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, - comment: 'The name of the Channel.', - }) - public name: string; - - @Column('varchar', { - length: 2048, nullable: true, - comment: 'The description of the Channel.', - }) - public description: string | null; - - @Column({ - ...id(), - nullable: true, - comment: 'The ID of banner Channel.', - }) - public bannerId: MiDriveFile['id'] | null; - - @ManyToOne(type => MiDriveFile, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public banner: MiDriveFile | null; - - @Column('varchar', { - array: true, length: 128, default: '{}', - }) - public pinnedNoteIds: string[]; - - @Column('varchar', { - length: 16, - default: '#86b300', - }) - public color: string; - - @Index() - @Column('boolean', { - default: false, - }) - public isArchived: boolean; - - @Index() - @Column('integer', { - default: 0, - comment: 'The count of notes.', - }) - public notesCount: number; - - @Index() - @Column('integer', { - default: 0, - comment: 'The count of users.', - }) - public usersCount: number; - - @Column('boolean', { - default: false, - }) - public isSensitive: boolean; -} diff --git a/packages/backend/src/models/entities/ChannelFavorite.ts b/packages/backend/src/models/entities/ChannelFavorite.ts deleted file mode 100644 index c2be68ab7d..0000000000 --- a/packages/backend/src/models/entities/ChannelFavorite.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiChannel } from './Channel.js'; - -@Entity('channel_favorite') -@Index(['userId', 'channelId'], { unique: true }) -export class MiChannelFavorite { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the ChannelFavorite.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - }) - public channelId: MiChannel['id']; - - @ManyToOne(type => MiChannel, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public channel: MiChannel | null; - - @Index() - @Column({ - ...id(), - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; -} diff --git a/packages/backend/src/models/entities/ChannelFollowing.ts b/packages/backend/src/models/entities/ChannelFollowing.ts deleted file mode 100644 index dc33eb144b..0000000000 --- a/packages/backend/src/models/entities/ChannelFollowing.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiChannel } from './Channel.js'; - -@Entity('channel_following') -@Index(['followerId', 'followeeId'], { unique: true }) -export class MiChannelFollowing { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the ChannelFollowing.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The followee channel ID.', - }) - public followeeId: MiChannel['id']; - - @ManyToOne(type => MiChannel, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public followee: MiChannel | null; - - @Index() - @Column({ - ...id(), - comment: 'The follower user ID.', - }) - public followerId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public follower: MiUser | null; -} diff --git a/packages/backend/src/models/entities/Clip.ts b/packages/backend/src/models/entities/Clip.ts deleted file mode 100644 index f8bc2f2173..0000000000 --- a/packages/backend/src/models/entities/Clip.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('clip') -export class MiClip { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the Clip.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - nullable: true, - }) - public lastClippedAt: Date | null; - - @Index() - @Column({ - ...id(), - comment: 'The owner ID.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, - comment: 'The name of the Clip.', - }) - public name: string; - - @Column('boolean', { - default: false, - }) - public isPublic: boolean; - - @Column('varchar', { - length: 2048, nullable: true, - comment: 'The description of the Clip.', - }) - public description: string | null; -} diff --git a/packages/backend/src/models/entities/ClipFavorite.ts b/packages/backend/src/models/entities/ClipFavorite.ts deleted file mode 100644 index 74d765411d..0000000000 --- a/packages/backend/src/models/entities/ClipFavorite.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiClip } from './Clip.js'; - -@Entity('clip_favorite') -@Index(['userId', 'clipId'], { unique: true }) -export class MiClipFavorite { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public clipId: MiClip['id']; - - @ManyToOne(type => MiClip, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public clip: MiClip | null; -} diff --git a/packages/backend/src/models/entities/ClipNote.ts b/packages/backend/src/models/entities/ClipNote.ts deleted file mode 100644 index ed5458864f..0000000000 --- a/packages/backend/src/models/entities/ClipNote.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiNote } from './Note.js'; -import { MiClip } from './Clip.js'; - -@Entity('clip_note') -@Index(['noteId', 'clipId'], { unique: true }) -export class MiClipNote { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column({ - ...id(), - comment: 'The note ID.', - }) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; - - @Index() - @Column({ - ...id(), - comment: 'The clip ID.', - }) - public clipId: MiClip['id']; - - @ManyToOne(type => MiClip, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public clip: MiClip | null; -} diff --git a/packages/backend/src/models/entities/DriveFile.ts b/packages/backend/src/models/entities/DriveFile.ts deleted file mode 100644 index 55d6a9826c..0000000000 --- a/packages/backend/src/models/entities/DriveFile.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiDriveFolder } from './DriveFolder.js'; - -@Entity('drive_file') -@Index(['userId', 'folderId', 'id']) -export class MiDriveFile { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the DriveFile.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The owner ID.', - }) - public userId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: 'The host of owner. It will be null if the user in local.', - }) - public userHost: string | null; - - @Index() - @Column('varchar', { - length: 32, - comment: 'The MD5 hash of the DriveFile.', - }) - public md5: string; - - @Column('varchar', { - length: 256, - comment: 'The file name of the DriveFile.', - }) - public name: string; - - @Index() - @Column('varchar', { - length: 128, - comment: 'The content type (MIME) of the DriveFile.', - }) - public type: string; - - @Column('integer', { - comment: 'The file size (bytes) of the DriveFile.', - }) - public size: number; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The comment of the DriveFile.', - }) - public comment: string | null; - - @Column('varchar', { - length: 128, nullable: true, - comment: 'The BlurHash string.', - }) - public blurhash: string | null; - - @Column('jsonb', { - default: {}, - comment: 'The any properties of the DriveFile. For example, it includes image width/height.', - }) - public properties: { width?: number; height?: number; orientation?: number; avgColor?: string }; - - @Column('boolean') - public storedInternal: boolean; - - @Column('varchar', { - length: 512, - comment: 'The URL of the DriveFile.', - }) - public url: string; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URL of the thumbnail of the DriveFile.', - }) - public thumbnailUrl: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URL of the webpublic of the DriveFile.', - }) - public webpublicUrl: string | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public webpublicType: string | null; - - @Index({ unique: true }) - @Column('varchar', { - length: 256, nullable: true, - }) - public accessKey: string | null; - - @Index({ unique: true }) - @Column('varchar', { - length: 256, nullable: true, - }) - public thumbnailAccessKey: string | null; - - @Index({ unique: true }) - @Column('varchar', { - length: 256, nullable: true, - }) - public webpublicAccessKey: string | null; - - @Index() - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of the DriveFile. it will be null when the DriveFile is local.', - }) - public uri: string | null; - - @Column('varchar', { - length: 512, nullable: true, - }) - public src: string | null; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The parent folder ID. If null, it means the DriveFile is located in root.', - }) - public folderId: MiDriveFolder['id'] | null; - - @ManyToOne(type => MiDriveFolder, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public folder: MiDriveFolder | null; - - @Index() - @Column('boolean', { - default: false, - comment: 'Whether the DriveFile is NSFW.', - }) - public isSensitive: boolean; - - @Index() - @Column('boolean', { - default: false, - comment: 'Whether the DriveFile is NSFW. (predict)', - }) - public maybeSensitive: boolean; - - @Index() - @Column('boolean', { - default: false, - }) - public maybePorn: boolean; - - /** - * 外部の(信頼されていない)URLへの直リンクか否か - */ - @Index() - @Column('boolean', { - default: false, - comment: 'Whether the DriveFile is direct link to remote server.', - }) - public isLink: boolean; - - @Column('jsonb', { - default: {}, - nullable: true, - }) - public requestHeaders: Record | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public requestIp: string | null; -} diff --git a/packages/backend/src/models/entities/DriveFolder.ts b/packages/backend/src/models/entities/DriveFolder.ts deleted file mode 100644 index 614974af13..0000000000 --- a/packages/backend/src/models/entities/DriveFolder.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('drive_folder') -export class MiDriveFolder { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the DriveFolder.', - }) - public createdAt: Date; - - @Column('varchar', { - length: 128, - comment: 'The name of the DriveFolder.', - }) - public name: string; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The owner ID.', - }) - public userId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The parent folder ID. If null, it means the DriveFolder is located in root.', - }) - public parentId: MiDriveFolder['id'] | null; - - @ManyToOne(type => MiDriveFolder, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public parent: MiDriveFolder | null; -} diff --git a/packages/backend/src/models/entities/Emoji.ts b/packages/backend/src/models/entities/Emoji.ts deleted file mode 100644 index a3ae1f2580..0000000000 --- a/packages/backend/src/models/entities/Emoji.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id.js'; - -@Entity('emoji') -@Index(['name', 'host'], { unique: true }) -export class MiEmoji { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - nullable: true, - }) - public updatedAt: Date | null; - - @Index() - @Column('varchar', { - length: 128, - }) - public name: string; - - @Index() - @Column('varchar', { - length: 128, nullable: true, - }) - public host: string | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public category: string | null; - - @Column('varchar', { - length: 512, - }) - public originalUrl: string; - - @Column('varchar', { - length: 512, - default: '', - }) - public publicUrl: string; - - @Column('varchar', { - length: 512, nullable: true, - }) - public uri: string | null; - - // publicUrlの方のtypeが入る - @Column('varchar', { - length: 64, nullable: true, - }) - public type: string | null; - - @Column('varchar', { - array: true, length: 128, default: '{}', - }) - public aliases: string[]; - - @Column('varchar', { - length: 1024, nullable: true, - }) - public license: string | null; - - @Column('boolean', { - default: false, - }) - public localOnly: boolean; - - @Column('boolean', { - default: false, - }) - public isSensitive: boolean; - - // TODO: 定期ジョブで存在しなくなったロールIDを除去するようにする - @Column('varchar', { - array: true, length: 128, default: '{}', - }) - public roleIdsThatCanBeUsedThisEmojiAsReaction: string[]; -} diff --git a/packages/backend/src/models/entities/Flash.ts b/packages/backend/src/models/entities/Flash.ts deleted file mode 100644 index 38e023332e..0000000000 --- a/packages/backend/src/models/entities/Flash.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('flash') -export class MiFlash { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Flash.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - comment: 'The updated date of the Flash.', - }) - public updatedAt: Date; - - @Column('varchar', { - length: 256, - }) - public title: string; - - @Column('varchar', { - length: 1024, - }) - public summary: string; - - @Index() - @Column({ - ...id(), - comment: 'The ID of author.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 65536, - }) - public script: string; - - @Column('varchar', { - length: 256, array: true, default: '{}', - }) - public permissions: string[]; - - @Column('integer', { - default: 0, - }) - public likedCount: number; - - /** - * public ... 公開 - * private ... プロフィールには表示しない - */ - @Column('varchar', { - length: 512, default: 'public', - }) - public visibility: 'public' | 'private'; -} diff --git a/packages/backend/src/models/entities/FlashLike.ts b/packages/backend/src/models/entities/FlashLike.ts deleted file mode 100644 index 9486be3ea6..0000000000 --- a/packages/backend/src/models/entities/FlashLike.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiFlash } from './Flash.js'; - -@Entity('flash_like') -@Index(['userId', 'flashId'], { unique: true }) -export class MiFlashLike { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public flashId: MiFlash['id']; - - @ManyToOne(type => MiFlash, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public flash: MiFlash | null; -} diff --git a/packages/backend/src/models/entities/FollowRequest.ts b/packages/backend/src/models/entities/FollowRequest.ts deleted file mode 100644 index 28385931b7..0000000000 --- a/packages/backend/src/models/entities/FollowRequest.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('follow_request') -@Index(['followerId', 'followeeId'], { unique: true }) -export class MiFollowRequest { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the FollowRequest.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The followee user ID.', - }) - public followeeId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public followee: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The follower user ID.', - }) - public followerId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public follower: MiUser | null; - - @Column('varchar', { - length: 128, nullable: true, - comment: 'id of Follow Activity.', - }) - public requestId: string | null; - - //#region Denormalized fields - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public followerHost: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followerInbox: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followerSharedInbox: string | null; - - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public followeeHost: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followeeInbox: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followeeSharedInbox: string | null; - //#endregion -} diff --git a/packages/backend/src/models/entities/Following.ts b/packages/backend/src/models/entities/Following.ts deleted file mode 100644 index df509cf944..0000000000 --- a/packages/backend/src/models/entities/Following.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('following') -@Index(['followerId', 'followeeId'], { unique: true }) -export class MiFollowing { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Following.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The followee user ID.', - }) - public followeeId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public followee: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The follower user ID.', - }) - public followerId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public follower: MiUser | null; - - //#region Denormalized fields - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public followerHost: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followerInbox: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followerSharedInbox: string | null; - - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public followeeHost: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followeeInbox: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: '[Denormalized]', - }) - public followeeSharedInbox: string | null; - //#endregion -} diff --git a/packages/backend/src/models/entities/GalleryLike.ts b/packages/backend/src/models/entities/GalleryLike.ts deleted file mode 100644 index 40aeeaad0c..0000000000 --- a/packages/backend/src/models/entities/GalleryLike.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiGalleryPost } from './GalleryPost.js'; - -@Entity('gallery_like') -@Index(['userId', 'postId'], { unique: true }) -export class MiGalleryLike { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public postId: MiGalleryPost['id']; - - @ManyToOne(type => MiGalleryPost, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public post: MiGalleryPost | null; -} diff --git a/packages/backend/src/models/entities/GalleryPost.ts b/packages/backend/src/models/entities/GalleryPost.ts deleted file mode 100644 index 777fe942e1..0000000000 --- a/packages/backend/src/models/entities/GalleryPost.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import type { MiDriveFile } from './DriveFile.js'; - -@Entity('gallery_post') -export class MiGalleryPost { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the GalleryPost.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - comment: 'The updated date of the GalleryPost.', - }) - public updatedAt: Date; - - @Column('varchar', { - length: 256, - }) - public title: string; - - @Column('varchar', { - length: 2048, nullable: true, - }) - public description: string | null; - - @Index() - @Column({ - ...id(), - comment: 'The ID of author.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column({ - ...id(), - array: true, default: '{}', - }) - public fileIds: MiDriveFile['id'][]; - - @Index() - @Column('boolean', { - default: false, - comment: 'Whether the post is sensitive.', - }) - public isSensitive: boolean; - - @Index() - @Column('integer', { - default: 0, - }) - public likedCount: number; - - @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', - }) - public tags: string[]; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/Hashtag.ts b/packages/backend/src/models/entities/Hashtag.ts deleted file mode 100644 index 30fea91b7d..0000000000 --- a/packages/backend/src/models/entities/Hashtag.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id.js'; -import type { MiUser } from './User.js'; - -@Entity('hashtag') -export class MiHashtag { - @PrimaryColumn(id()) - public id: string; - - @Index({ unique: true }) - @Column('varchar', { - length: 128, - }) - public name: string; - - @Column({ - ...id(), - array: true, - }) - public mentionedUserIds: MiUser['id'][]; - - @Index() - @Column('integer', { - default: 0, - }) - public mentionedUsersCount: number; - - @Column({ - ...id(), - array: true, - }) - public mentionedLocalUserIds: MiUser['id'][]; - - @Index() - @Column('integer', { - default: 0, - }) - public mentionedLocalUsersCount: number; - - @Column({ - ...id(), - array: true, - }) - public mentionedRemoteUserIds: MiUser['id'][]; - - @Index() - @Column('integer', { - default: 0, - }) - public mentionedRemoteUsersCount: number; - - @Column({ - ...id(), - array: true, - }) - public attachedUserIds: MiUser['id'][]; - - @Index() - @Column('integer', { - default: 0, - }) - public attachedUsersCount: number; - - @Column({ - ...id(), - array: true, - }) - public attachedLocalUserIds: MiUser['id'][]; - - @Index() - @Column('integer', { - default: 0, - }) - public attachedLocalUsersCount: number; - - @Column({ - ...id(), - array: true, - }) - public attachedRemoteUserIds: MiUser['id'][]; - - @Index() - @Column('integer', { - default: 0, - }) - public attachedRemoteUsersCount: number; -} diff --git a/packages/backend/src/models/entities/Instance.ts b/packages/backend/src/models/entities/Instance.ts deleted file mode 100644 index 8c562ffa80..0000000000 --- a/packages/backend/src/models/entities/Instance.ts +++ /dev/null @@ -1,147 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id.js'; - -@Entity('instance') -export class MiInstance { - @PrimaryColumn(id()) - public id: string; - - /** - * このインスタンスを捕捉した日時 - */ - @Index() - @Column('timestamp with time zone', { - comment: 'The caught date of the Instance.', - }) - public firstRetrievedAt: Date; - - /** - * ホスト - */ - @Index({ unique: true }) - @Column('varchar', { - length: 128, - comment: 'The host of the Instance.', - }) - public host: string; - - /** - * インスタンスのユーザー数 - */ - @Column('integer', { - default: 0, - comment: 'The count of the users of the Instance.', - }) - public usersCount: number; - - /** - * インスタンスの投稿数 - */ - @Column('integer', { - default: 0, - comment: 'The count of the notes of the Instance.', - }) - public notesCount: number; - - /** - * このインスタンスのユーザーからフォローされている、自インスタンスのユーザーの数 - */ - @Column('integer', { - default: 0, - }) - public followingCount: number; - - /** - * このインスタンスのユーザーをフォローしている、自インスタンスのユーザーの数 - */ - @Column('integer', { - default: 0, - }) - public followersCount: number; - - /** - * 直近のリクエスト受信日時 - */ - @Column('timestamp with time zone', { - nullable: true, - }) - public latestRequestReceivedAt: Date | null; - - /** - * このインスタンスと不通かどうか - */ - @Column('boolean', { - default: false, - }) - public isNotResponding: boolean; - - /** - * このインスタンスへの配信を停止するか - */ - @Index() - @Column('boolean', { - default: false, - }) - public isSuspended: boolean; - - @Column('varchar', { - length: 64, nullable: true, - comment: 'The software of the Instance.', - }) - public softwareName: string | null; - - @Column('varchar', { - length: 64, nullable: true, - }) - public softwareVersion: string | null; - - @Column('boolean', { - nullable: true, - }) - public openRegistrations: boolean | null; - - @Column('varchar', { - length: 256, nullable: true, - }) - public name: string | null; - - @Column('varchar', { - length: 4096, nullable: true, - }) - public description: string | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public maintainerName: string | null; - - @Column('varchar', { - length: 256, nullable: true, - }) - public maintainerEmail: string | null; - - @Column('varchar', { - length: 256, nullable: true, - }) - public iconUrl: string | null; - - @Column('varchar', { - length: 256, nullable: true, - }) - public faviconUrl: string | null; - - @Column('varchar', { - length: 64, nullable: true, - }) - public themeColor: string | null; - - @Column('timestamp with time zone', { - nullable: true, - }) - public infoUpdatedAt: Date | null; -} diff --git a/packages/backend/src/models/entities/Meta.ts b/packages/backend/src/models/entities/Meta.ts deleted file mode 100644 index 4bb77b792d..0000000000 --- a/packages/backend/src/models/entities/Meta.ts +++ /dev/null @@ -1,469 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('meta') -export class MiMeta { - @PrimaryColumn({ - type: 'varchar', - length: 32, - }) - public id: string; - - @Column('varchar', { - length: 1024, nullable: true, - }) - public name: string | null; - - @Column('varchar', { - length: 1024, nullable: true, - }) - public description: string | null; - - /** - * メンテナの名前 - */ - @Column('varchar', { - length: 1024, nullable: true, - }) - public maintainerName: string | null; - - /** - * メンテナの連絡先 - */ - @Column('varchar', { - length: 1024, nullable: true, - }) - public maintainerEmail: string | null; - - @Column('boolean', { - default: false, - }) - public disableRegistration: boolean; - - @Column('varchar', { - length: 1024, array: true, default: '{}', - }) - public langs: string[]; - - @Column('varchar', { - length: 1024, array: true, default: '{}', - }) - public pinnedUsers: string[]; - - @Column('varchar', { - length: 1024, array: true, default: '{}', - }) - public hiddenTags: string[]; - - @Column('varchar', { - length: 1024, array: true, default: '{}', - }) - public blockedHosts: string[]; - - @Column('varchar', { - length: 1024, array: true, default: '{}', - }) - public sensitiveWords: string[]; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public themeColor: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public mascotImageUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public bannerUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public backgroundImageUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public logoImageUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public iconUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public app192IconUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public app512IconUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public serverErrorImageUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public notFoundImageUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public infoImageUrl: string | null; - - @Column('boolean', { - default: false, - }) - public cacheRemoteFiles: boolean; - - @Column('boolean', { - default: true, - }) - public cacheRemoteSensitiveFiles: boolean; - - @Column({ - ...id(), - nullable: true, - }) - public proxyAccountId: MiUser['id'] | null; - - @ManyToOne(type => MiUser, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public proxyAccount: MiUser | null; - - @Column('boolean', { - default: false, - }) - public emailRequiredForSignup: boolean; - - @Column('boolean', { - default: false, - }) - public enableHcaptcha: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public hcaptchaSiteKey: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public hcaptchaSecretKey: string | null; - - @Column('boolean', { - default: false, - }) - public enableRecaptcha: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public recaptchaSiteKey: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public recaptchaSecretKey: string | null; - - @Column('boolean', { - default: false, - }) - public enableTurnstile: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public turnstileSiteKey: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public turnstileSecretKey: string | null; - - @Column('enum', { - enum: ['none', 'all', 'local', 'remote'], - default: 'none', - }) - public sensitiveMediaDetection: 'none' | 'all' | 'local' | 'remote'; - - @Column('enum', { - enum: ['medium', 'low', 'high', 'veryLow', 'veryHigh'], - default: 'medium', - }) - public sensitiveMediaDetectionSensitivity: 'medium' | 'low' | 'high' | 'veryLow' | 'veryHigh'; - - @Column('boolean', { - default: false, - }) - public setSensitiveFlagAutomatically: boolean; - - @Column('boolean', { - default: false, - }) - public enableSensitiveMediaDetectionForVideos: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public summalyProxy: string | null; - - @Column('boolean', { - default: false, - }) - public enableEmail: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public email: string | null; - - @Column('boolean', { - default: false, - }) - public smtpSecure: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public smtpHost: string | null; - - @Column('integer', { - nullable: true, - }) - public smtpPort: number | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public smtpUser: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public smtpPass: string | null; - - @Column('boolean', { - default: false, - }) - public enableServiceWorker: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public swPublicKey: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public swPrivateKey: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public deeplAuthKey: string | null; - - @Column('boolean', { - default: false, - }) - public deeplIsPro: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public termsOfServiceUrl: string | null; - - @Column('varchar', { - length: 1024, - default: 'https://github.com/misskey-dev/misskey', - nullable: false, - }) - public repositoryUrl: string; - - @Column('varchar', { - length: 1024, - default: 'https://github.com/misskey-dev/misskey/issues/new', - nullable: true, - }) - public feedbackUrl: string | null; - - @Column('varchar', { - length: 8192, - nullable: true, - }) - public defaultLightTheme: string | null; - - @Column('varchar', { - length: 8192, - nullable: true, - }) - public defaultDarkTheme: string | null; - - @Column('boolean', { - default: false, - }) - public useObjectStorage: boolean; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public objectStorageBucket: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public objectStoragePrefix: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public objectStorageBaseUrl: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public objectStorageEndpoint: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public objectStorageRegion: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public objectStorageAccessKey: string | null; - - @Column('varchar', { - length: 1024, - nullable: true, - }) - public objectStorageSecretKey: string | null; - - @Column('integer', { - nullable: true, - }) - public objectStoragePort: number | null; - - @Column('boolean', { - default: true, - }) - public objectStorageUseSSL: boolean; - - @Column('boolean', { - default: true, - }) - public objectStorageUseProxy: boolean; - - @Column('boolean', { - default: false, - }) - public objectStorageSetPublicRead: boolean; - - @Column('boolean', { - default: true, - }) - public objectStorageS3ForcePathStyle: boolean; - - @Column('boolean', { - default: false, - }) - public enableIpLogging: boolean; - - @Column('boolean', { - default: true, - }) - public enableActiveEmailValidation: boolean; - - @Column('boolean', { - default: true, - }) - public enableChartsForRemoteUser: boolean; - - @Column('boolean', { - default: true, - }) - public enableChartsForFederatedInstances: boolean; - - @Column('boolean', { - default: false, - }) - public enableServerMachineStats: boolean; - - @Column('boolean', { - default: true, - }) - public enableIdenticonGeneration: boolean; - - @Column('jsonb', { - default: { }, - }) - public policies: Record; - - @Column('varchar', { - length: 280, - array: true, - default: '{}', - }) - public serverRules: string[]; - - @Column('varchar', { - length: 8192, - default: '{}', - }) - public manifestJsonOverride: string; - - @Column('varchar', { - length: 1024, array: true, default: '{ "admin", "administrator", "root", "system", "maintainer", "host", "mod", "moderator", "owner", "superuser", "staff", "auth", "i", "me", "everyone", "all", "mention", "mentions", "example", "user", "users", "account", "accounts", "official", "help", "helps", "support", "supports", "info", "information", "informations", "announce", "announces", "announcement", "announcements", "notice", "notification", "notifications", "dev", "developer", "developers", "tech", "misskey" }', - }) - public preservedUsernames: string[]; -} diff --git a/packages/backend/src/models/entities/ModerationLog.ts b/packages/backend/src/models/entities/ModerationLog.ts deleted file mode 100644 index 027645de6b..0000000000 --- a/packages/backend/src/models/entities/ModerationLog.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('moderation_log') -export class MiModerationLog { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the ModerationLog.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, - }) - public type: string; - - @Column('jsonb') - public info: Record; -} diff --git a/packages/backend/src/models/entities/MutedNote.ts b/packages/backend/src/models/entities/MutedNote.ts deleted file mode 100644 index d33af90a97..0000000000 --- a/packages/backend/src/models/entities/MutedNote.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; -import { id } from '../id.js'; -import { mutedNoteReasons } from '../../types.js'; -import { MiNote } from './Note.js'; -import { MiUser } from './User.js'; - -@Entity('muted_note') -@Index(['noteId', 'userId'], { unique: true }) -export class MiMutedNote { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column({ - ...id(), - comment: 'The note ID.', - }) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; - - @Index() - @Column({ - ...id(), - comment: 'The user ID.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - /** - * ミュートされた理由。 - */ - @Index() - @Column('enum', { - enum: mutedNoteReasons, - comment: 'The reason of the MutedNote.', - }) - public reason: typeof mutedNoteReasons[number]; -} diff --git a/packages/backend/src/models/entities/Muting.ts b/packages/backend/src/models/entities/Muting.ts deleted file mode 100644 index b1f12f0118..0000000000 --- a/packages/backend/src/models/entities/Muting.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('muting') -@Index(['muterId', 'muteeId'], { unique: true }) -export class MiMuting { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Muting.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - nullable: true, - }) - public expiresAt: Date | null; - - @Index() - @Column({ - ...id(), - comment: 'The mutee user ID.', - }) - public muteeId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public mutee: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The muter user ID.', - }) - public muterId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public muter: MiUser | null; -} diff --git a/packages/backend/src/models/entities/Note.ts b/packages/backend/src/models/entities/Note.ts deleted file mode 100644 index effc1509e5..0000000000 --- a/packages/backend/src/models/entities/Note.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { noteVisibilities } from '../../types.js'; -import { MiUser } from './User.js'; -import { MiChannel } from './Channel.js'; -import type { MiDriveFile } from './DriveFile.js'; - -@Entity('note') -@Index('IDX_NOTE_TAGS', { synchronize: false }) -@Index('IDX_NOTE_MENTIONS', { synchronize: false }) -@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false }) -export class MiNote { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Note.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The ID of reply target.', - }) - public replyId: MiNote['id'] | null; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public reply: MiNote | null; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The ID of renote target.', - }) - public renoteId: MiNote['id'] | null; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public renote: MiNote | null; - - @Index() - @Column('varchar', { - length: 256, nullable: true, - }) - public threadId: string | null; - - // TODO: varcharにしたい - @Column('text', { - nullable: true, - }) - public text: string | null; - - @Column('varchar', { - length: 256, nullable: true, - }) - public name: string | null; - - @Column('varchar', { - length: 512, nullable: true, - }) - public cw: string | null; - - @Index() - @Column({ - ...id(), - comment: 'The ID of author.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('boolean', { - default: false, - }) - public localOnly: boolean; - - @Column('varchar', { - length: 64, nullable: true, - }) - public reactionAcceptance: 'likeOnly' | 'likeOnlyForRemote' | 'nonSensitiveOnly' | 'nonSensitiveOnlyForLocalLikeOnlyForRemote' | null; - - @Column('smallint', { - default: 0, - }) - public renoteCount: number; - - @Column('smallint', { - default: 0, - }) - public repliesCount: number; - - @Column('smallint', { - default: 0, - }) - public clippedCount: number; - - @Column('jsonb', { - default: {}, - }) - public reactions: Record; - - /** - * public ... 公開 - * home ... ホームタイムライン(ユーザーページのタイムライン含む)のみに流す - * followers ... フォロワーのみ - * specified ... visibleUserIds で指定したユーザーのみ - */ - @Column('enum', { enum: noteVisibilities }) - public visibility: typeof noteVisibilities[number]; - - @Index({ unique: true }) - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of a note. it will be null when the note is local.', - }) - public uri: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The human readable url of a note. it will be null when the note is local.', - }) - public url: string | null; - - @Column('integer', { - default: 0, select: false, - }) - public score: number; - - @Index() - @Column({ - ...id(), - array: true, default: '{}', - }) - public fileIds: MiDriveFile['id'][]; - - @Index() - @Column('varchar', { - length: 256, array: true, default: '{}', - }) - public attachedFileTypes: string[]; - - @Index() - @Column({ - ...id(), - array: true, default: '{}', - }) - public visibleUserIds: MiUser['id'][]; - - @Index() - @Column({ - ...id(), - array: true, default: '{}', - }) - public mentions: MiUser['id'][]; - - @Column('text', { - default: '[]', - }) - public mentionedRemoteUsers: string; - - @Column('varchar', { - length: 128, array: true, default: '{}', - }) - public emojis: string[]; - - @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', - }) - public tags: string[]; - - @Column('boolean', { - default: false, - }) - public hasPoll: boolean; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: 'The ID of source channel.', - }) - public channelId: MiChannel['id'] | null; - - @ManyToOne(type => MiChannel, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public channel: MiChannel | null; - - //#region Denormalized fields - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public userHost: string | null; - - @Column({ - ...id(), - nullable: true, - comment: '[Denormalized]', - }) - public replyUserId: MiUser['id'] | null; - - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public replyUserHost: string | null; - - @Column({ - ...id(), - nullable: true, - comment: '[Denormalized]', - }) - public renoteUserId: MiUser['id'] | null; - - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public renoteUserHost: string | null; - //#endregion - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} - -export type IMentionedRemoteUsers = { - uri: string; - url?: string; - username: string; - host: string; -}[]; diff --git a/packages/backend/src/models/entities/NoteFavorite.ts b/packages/backend/src/models/entities/NoteFavorite.ts deleted file mode 100644 index 1b637e6b92..0000000000 --- a/packages/backend/src/models/entities/NoteFavorite.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiNote } from './Note.js'; -import { MiUser } from './User.js'; - -@Entity('note_favorite') -@Index(['userId', 'noteId'], { unique: true }) -export class MiNoteFavorite { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the NoteFavorite.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; -} diff --git a/packages/backend/src/models/entities/NoteReaction.ts b/packages/backend/src/models/entities/NoteReaction.ts deleted file mode 100644 index 19511abd12..0000000000 --- a/packages/backend/src/models/entities/NoteReaction.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiNote } from './Note.js'; - -@Entity('note_reaction') -@Index(['userId', 'noteId'], { unique: true }) -export class MiNoteReaction { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the NoteReaction.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user?: MiUser | null; - - @Index() - @Column(id()) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note?: MiNote | null; - - // TODO: 対象noteのuserIdを非正規化したい(「受け取ったリアクション一覧」のようなものを(JOIN無しで)実装したいため) - - @Column('varchar', { - length: 260, - }) - public reaction: string; -} diff --git a/packages/backend/src/models/entities/NoteThreadMuting.ts b/packages/backend/src/models/entities/NoteThreadMuting.ts deleted file mode 100644 index d8ccbe0f74..0000000000 --- a/packages/backend/src/models/entities/NoteThreadMuting.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('note_thread_muting') -@Index(['userId', 'threadId'], { unique: true }) -export class MiNoteThreadMuting { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column('varchar', { - length: 256, - }) - public threadId: string; -} diff --git a/packages/backend/src/models/entities/NoteUnread.ts b/packages/backend/src/models/entities/NoteUnread.ts deleted file mode 100644 index 0f111cc1b0..0000000000 --- a/packages/backend/src/models/entities/NoteUnread.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiNote } from './Note.js'; -import type { MiChannel } from './Channel.js'; - -@Entity('note_unread') -@Index(['userId', 'noteId'], { unique: true }) -export class MiNoteUnread { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column(id()) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; - - /** - * メンションか否か - */ - @Index() - @Column('boolean') - public isMentioned: boolean; - - /** - * ダイレクト投稿か否か - */ - @Index() - @Column('boolean') - public isSpecified: boolean; - - //#region Denormalized fields - @Index() - @Column({ - ...id(), - comment: '[Denormalized]', - }) - public noteUserId: MiUser['id']; - - @Index() - @Column({ - ...id(), - nullable: true, - comment: '[Denormalized]', - }) - public noteChannelId: MiChannel['id'] | null; - //#endregion -} diff --git a/packages/backend/src/models/entities/Notification.ts b/packages/backend/src/models/entities/Notification.ts deleted file mode 100644 index fb7f67dfd8..0000000000 --- a/packages/backend/src/models/entities/Notification.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { notificationTypes } from '@/types.js'; -import { MiUser } from './User.js'; -import { MiNote } from './Note.js'; -import { MiFollowRequest } from './FollowRequest.js'; -import { MiAccessToken } from './AccessToken.js'; - -export type MiNotification = { - id: string; - - // RedisのためDateではなくstring - createdAt: string; - - /** - * 通知の送信者(initiator) - */ - notifierId: MiUser['id'] | null; - - /** - * 通知の種類。 - * follow - フォローされた - * mention - 投稿で自分が言及された - * reply - 投稿に返信された - * renote - 投稿がRenoteされた - * quote - 投稿が引用Renoteされた - * reaction - 投稿にリアクションされた - * pollEnded - 自分のアンケートもしくは自分が投票したアンケートが終了した - * receiveFollowRequest - フォローリクエストされた - * followRequestAccepted - 自分の送ったフォローリクエストが承認された - * achievementEarned - 実績を獲得 - * app - アプリ通知 - * test - テスト通知(サーバー側) - */ - type: typeof notificationTypes[number]; - - noteId: MiNote['id'] | null; - - followRequestId: MiFollowRequest['id'] | null; - - reaction: string | null; - - choice: number | null; - - achievement: string | null; - - /** - * アプリ通知のbody - */ - customBody: string | null; - - /** - * アプリ通知のheader - * (省略時はアプリ名で表示されることを期待) - */ - customHeader: string | null; - - /** - * アプリ通知のicon(URL) - * (省略時はアプリアイコンで表示されることを期待) - */ - customIcon: string | null; - - /** - * アプリ通知のアプリ(のトークン) - */ - appAccessTokenId: MiAccessToken['id'] | null; -} diff --git a/packages/backend/src/models/entities/Page.ts b/packages/backend/src/models/entities/Page.ts deleted file mode 100644 index 30131af85c..0000000000 --- a/packages/backend/src/models/entities/Page.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiDriveFile } from './DriveFile.js'; - -@Entity('page') -@Index(['userId', 'name'], { unique: true }) -export class MiPage { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Page.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - comment: 'The updated date of the Page.', - }) - public updatedAt: Date; - - @Column('varchar', { - length: 256, - }) - public title: string; - - @Index() - @Column('varchar', { - length: 256, - }) - public name: string; - - @Column('varchar', { - length: 256, nullable: true, - }) - public summary: string | null; - - @Column('boolean') - public alignCenter: boolean; - - @Column('boolean', { - default: false, - }) - public hideTitleWhenPinned: boolean; - - @Column('varchar', { - length: 32, - }) - public font: string; - - @Index() - @Column({ - ...id(), - comment: 'The ID of author.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column({ - ...id(), - nullable: true, - }) - public eyeCatchingImageId: MiDriveFile['id'] | null; - - @ManyToOne(type => MiDriveFile, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public eyeCatchingImage: MiDriveFile | null; - - @Column('jsonb', { - default: [], - }) - public content: Record[]; - - @Column('jsonb', { - default: [], - }) - public variables: Record[]; - - @Column('varchar', { - length: 16384, - default: '', - }) - public script: string; - - /** - * public ... 公開 - * followers ... フォロワーのみ - * specified ... visibleUserIds で指定したユーザーのみ - */ - @Column('enum', { enum: ['public', 'followers', 'specified'] }) - public visibility: 'public' | 'followers' | 'specified'; - - @Index() - @Column({ - ...id(), - array: true, default: '{}', - }) - public visibleUserIds: MiUser['id'][]; - - @Column('integer', { - default: 0, - }) - public likedCount: number; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/PageLike.ts b/packages/backend/src/models/entities/PageLike.ts deleted file mode 100644 index 36f5177cff..0000000000 --- a/packages/backend/src/models/entities/PageLike.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiPage } from './Page.js'; - -@Entity('page_like') -@Index(['userId', 'pageId'], { unique: true }) -export class MiPageLike { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public pageId: MiPage['id']; - - @ManyToOne(type => MiPage, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public page: MiPage | null; -} diff --git a/packages/backend/src/models/entities/PasswordResetRequest.ts b/packages/backend/src/models/entities/PasswordResetRequest.ts deleted file mode 100644 index 4c608d979c..0000000000 --- a/packages/backend/src/models/entities/PasswordResetRequest.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('password_reset_request') -export class MiPasswordResetRequest { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index({ unique: true }) - @Column('varchar', { - length: 256, - }) - public token: string; - - @Index() - @Column({ - ...id(), - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; -} diff --git a/packages/backend/src/models/entities/Poll.ts b/packages/backend/src/models/entities/Poll.ts deleted file mode 100644 index 557fd1be11..0000000000 --- a/packages/backend/src/models/entities/Poll.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { id } from '../id.js'; -import { noteVisibilities } from '../../types.js'; -import { MiNote } from './Note.js'; -import type { MiUser } from './User.js'; - -@Entity('poll') -export class MiPoll { - @PrimaryColumn(id()) - public noteId: MiNote['id']; - - @OneToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; - - @Column('timestamp with time zone', { - nullable: true, - }) - public expiresAt: Date | null; - - @Column('boolean') - public multiple: boolean; - - @Column('varchar', { - length: 256, array: true, default: '{}', - }) - public choices: string[]; - - @Column('integer', { - array: true, - }) - public votes: number[]; - - //#region Denormalized fields - @Column('enum', { - enum: noteVisibilities, - comment: '[Denormalized]', - }) - public noteVisibility: typeof noteVisibilities[number]; - - @Index() - @Column({ - ...id(), - comment: '[Denormalized]', - }) - public userId: MiUser['id']; - - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public userHost: string | null; - //#endregion - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} - -export type IPoll = { - choices: string[]; - votes?: number[]; - multiple: boolean; - expiresAt: Date | null; -}; diff --git a/packages/backend/src/models/entities/PollVote.ts b/packages/backend/src/models/entities/PollVote.ts deleted file mode 100644 index 5070ab16c0..0000000000 --- a/packages/backend/src/models/entities/PollVote.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiNote } from './Note.js'; - -@Entity('poll_vote') -@Index(['userId', 'noteId', 'choice'], { unique: true }) -export class MiPollVote { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the PollVote.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column(id()) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; - - @Column('integer') - public choice: number; -} diff --git a/packages/backend/src/models/entities/PromoNote.ts b/packages/backend/src/models/entities/PromoNote.ts deleted file mode 100644 index 9daf915b51..0000000000 --- a/packages/backend/src/models/entities/PromoNote.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiNote } from './Note.js'; -import type { MiUser } from './User.js'; - -@Entity('promo_note') -export class MiPromoNote { - @PrimaryColumn(id()) - public noteId: MiNote['id']; - - @OneToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; - - @Column('timestamp with time zone') - public expiresAt: Date; - - //#region Denormalized fields - @Index() - @Column({ - ...id(), - comment: '[Denormalized]', - }) - public userId: MiUser['id']; - //#endregion -} diff --git a/packages/backend/src/models/entities/PromoRead.ts b/packages/backend/src/models/entities/PromoRead.ts deleted file mode 100644 index 83a12858e8..0000000000 --- a/packages/backend/src/models/entities/PromoRead.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiNote } from './Note.js'; -import { MiUser } from './User.js'; - -@Entity('promo_read') -@Index(['userId', 'noteId'], { unique: true }) -export class MiPromoRead { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the PromoRead.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; -} diff --git a/packages/backend/src/models/entities/RegistrationTicket.ts b/packages/backend/src/models/entities/RegistrationTicket.ts deleted file mode 100644 index 2b1c541a28..0000000000 --- a/packages/backend/src/models/entities/RegistrationTicket.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn, OneToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('registration_ticket') -export class MiRegistrationTicket { - @PrimaryColumn(id()) - public id: string; - - @Index({ unique: true }) - @Column('varchar', { - length: 64, - }) - public code: string; - - @Column('timestamp with time zone', { - nullable: true, - }) - public expiresAt: Date | null; - - @Column('timestamp with time zone') - public createdAt: Date; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public createdBy: MiUser | null; - - @Index() - @Column({ - ...id(), - nullable: true, - }) - public createdById: MiUser['id'] | null; - - @OneToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public usedBy: MiUser | null; - - @Index() - @Column({ - ...id(), - nullable: true, - }) - public usedById: MiUser['id'] | null; - - @Column('timestamp with time zone', { - nullable: true, - }) - public usedAt: Date | null; - - @Column('varchar', { - length: 32, - nullable: true, - }) - public pendingUserId: string | null; -} diff --git a/packages/backend/src/models/entities/RegistryItem.ts b/packages/backend/src/models/entities/RegistryItem.ts deleted file mode 100644 index fdfa4212d0..0000000000 --- a/packages/backend/src/models/entities/RegistryItem.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -// TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい -@Entity('registry_item') -export class MiRegistryItem { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the RegistryItem.', - }) - public createdAt: Date; - - @Column('timestamp with time zone', { - comment: 'The updated date of the RegistryItem.', - }) - public updatedAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The owner ID.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 1024, - comment: 'The key of the RegistryItem.', - }) - public key: string; - - @Column('jsonb', { - default: {}, nullable: true, - comment: 'The value of the RegistryItem.', - }) - public value: any | null; - - @Index() - @Column('varchar', { - length: 1024, array: true, default: '{}', - }) - public scope: string[]; - - // サードパーティアプリに開放するときのためのカラム - @Index() - @Column('varchar', { - length: 512, nullable: true, - }) - public domain: string | null; -} diff --git a/packages/backend/src/models/entities/Relay.ts b/packages/backend/src/models/entities/Relay.ts deleted file mode 100644 index f73ab193a6..0000000000 --- a/packages/backend/src/models/entities/Relay.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id.js'; - -@Entity('relay') -export class MiRelay { - @PrimaryColumn(id()) - public id: string; - - @Index({ unique: true }) - @Column('varchar', { - length: 512, nullable: false, - }) - public inbox: string; - - @Column('enum', { - enum: ['requesting', 'accepted', 'rejected'], - }) - public status: 'requesting' | 'accepted' | 'rejected'; -} diff --git a/packages/backend/src/models/entities/RenoteMuting.ts b/packages/backend/src/models/entities/RenoteMuting.ts deleted file mode 100644 index fc87b82b7d..0000000000 --- a/packages/backend/src/models/entities/RenoteMuting.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('renote_muting') -@Index(['muterId', 'muteeId'], { unique: true }) -export class MiRenoteMuting { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Muting.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The mutee user ID.', - }) - public muteeId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public mutee: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The muter user ID.', - }) - public muterId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public muter: MiUser | null; -} diff --git a/packages/backend/src/models/entities/RetentionAggregation.ts b/packages/backend/src/models/entities/RetentionAggregation.ts deleted file mode 100644 index 7d7874a601..0000000000 --- a/packages/backend/src/models/entities/RetentionAggregation.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; -import { id } from '../id.js'; -import type { MiUser } from './User.js'; - -@Entity('retention_aggregation') -export class MiRetentionAggregation { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the Note.', - }) - public createdAt: Date; - - @Column('timestamp with time zone', { - comment: 'The updated date of the GalleryPost.', - }) - public updatedAt: Date; - - @Index({ unique: true }) - @Column('varchar', { - length: 512, nullable: false, - }) - public dateKey: string; - - @Column({ - ...id(), - array: true, - }) - public userIds: MiUser['id'][]; - - @Column('integer', { - }) - public usersCount: number; - - @Column('jsonb', { - default: {}, - }) - public data: Record; -} diff --git a/packages/backend/src/models/entities/Role.ts b/packages/backend/src/models/entities/Role.ts deleted file mode 100644 index 52e1f0c347..0000000000 --- a/packages/backend/src/models/entities/Role.ts +++ /dev/null @@ -1,183 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Column, PrimaryColumn } from 'typeorm'; -import { id } from '../id.js'; - -type CondFormulaValueAnd = { - type: 'and'; - values: RoleCondFormulaValue[]; -}; - -type CondFormulaValueOr = { - type: 'or'; - values: RoleCondFormulaValue[]; -}; - -type CondFormulaValueNot = { - type: 'not'; - value: RoleCondFormulaValue; -}; - -type CondFormulaValueIsLocal = { - type: 'isLocal'; -}; - -type CondFormulaValueIsRemote = { - type: 'isRemote'; -}; - -type CondFormulaValueCreatedLessThan = { - type: 'createdLessThan'; - sec: number; -}; - -type CondFormulaValueCreatedMoreThan = { - type: 'createdMoreThan'; - sec: number; -}; - -type CondFormulaValueFollowersLessThanOrEq = { - type: 'followersLessThanOrEq'; - value: number; -}; - -type CondFormulaValueFollowersMoreThanOrEq = { - type: 'followersMoreThanOrEq'; - value: number; -}; - -type CondFormulaValueFollowingLessThanOrEq = { - type: 'followingLessThanOrEq'; - value: number; -}; - -type CondFormulaValueFollowingMoreThanOrEq = { - type: 'followingMoreThanOrEq'; - value: number; -}; - -type CondFormulaValueNotesLessThanOrEq = { - type: 'notesLessThanOrEq'; - value: number; -}; - -type CondFormulaValueNotesMoreThanOrEq = { - type: 'notesMoreThanOrEq'; - value: number; -}; - -export type RoleCondFormulaValue = - CondFormulaValueAnd | - CondFormulaValueOr | - CondFormulaValueNot | - CondFormulaValueIsLocal | - CondFormulaValueIsRemote | - CondFormulaValueCreatedLessThan | - CondFormulaValueCreatedMoreThan | - CondFormulaValueFollowersLessThanOrEq | - CondFormulaValueFollowersMoreThanOrEq | - CondFormulaValueFollowingLessThanOrEq | - CondFormulaValueFollowingMoreThanOrEq | - CondFormulaValueNotesLessThanOrEq | - CondFormulaValueNotesMoreThanOrEq; - -@Entity('role') -export class MiRole { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the Role.', - }) - public createdAt: Date; - - @Column('timestamp with time zone', { - comment: 'The updated date of the Role.', - }) - public updatedAt: Date; - - @Column('timestamp with time zone', { - comment: 'The last used date of the Role.', - }) - public lastUsedAt: Date; - - @Column('varchar', { - length: 256, - }) - public name: string; - - @Column('varchar', { - length: 1024, - }) - public description: string; - - @Column('varchar', { - length: 256, nullable: true, - }) - public color: string | null; - - @Column('varchar', { - length: 512, nullable: true, - }) - public iconUrl: string | null; - - @Column('enum', { - enum: ['manual', 'conditional'], - default: 'manual', - }) - public target: 'manual' | 'conditional'; - - @Column('jsonb', { - default: { }, - }) - public condFormula: RoleCondFormulaValue; - - @Column('boolean', { - default: false, - }) - public isPublic: boolean; - - // trueの場合ユーザー名の横にバッジとして表示 - @Column('boolean', { - default: false, - }) - public asBadge: boolean; - - @Column('boolean', { - default: false, - }) - public isModerator: boolean; - - @Column('boolean', { - default: false, - }) - public isAdministrator: boolean; - - @Column('boolean', { - default: false, - }) - public isExplorable: boolean; - - @Column('boolean', { - default: false, - }) - public canEditMembersByModerator: boolean; - - // UIに表示する際の並び順用(大きいほど先頭) - @Column('integer', { - default: 0, - }) - public displayOrder: number; - - @Column('jsonb', { - default: { }, - }) - public policies: Record; -} diff --git a/packages/backend/src/models/entities/RoleAssignment.ts b/packages/backend/src/models/entities/RoleAssignment.ts deleted file mode 100644 index 5a2dacb91a..0000000000 --- a/packages/backend/src/models/entities/RoleAssignment.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiRole } from './Role.js'; -import { MiUser } from './User.js'; - -@Entity('role_assignment') -@Index(['userId', 'roleId'], { unique: true }) -export class MiRoleAssignment { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the RoleAssignment.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The user ID.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The role ID.', - }) - public roleId: MiRole['id']; - - @ManyToOne(type => MiRole, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public role: MiRole | null; - - @Index() - @Column('timestamp with time zone', { - nullable: true, - }) - public expiresAt: Date | null; -} diff --git a/packages/backend/src/models/entities/Signin.ts b/packages/backend/src/models/entities/Signin.ts deleted file mode 100644 index 709a998889..0000000000 --- a/packages/backend/src/models/entities/Signin.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('signin') -export class MiSignin { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the Signin.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, - }) - public ip: string; - - @Column('jsonb') - public headers: Record; - - @Column('boolean') - public success: boolean; -} diff --git a/packages/backend/src/models/entities/SwSubscription.ts b/packages/backend/src/models/entities/SwSubscription.ts deleted file mode 100644 index 9c3f97cf99..0000000000 --- a/packages/backend/src/models/entities/SwSubscription.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('sw_subscription') -export class MiSwSubscription { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 512, - }) - public endpoint: string; - - @Column('varchar', { - length: 256, - }) - public auth: string; - - @Column('varchar', { - length: 128, - }) - public publickey: string; - - @Column('boolean', { - default: false, - }) - public sendReadMessage: boolean; -} diff --git a/packages/backend/src/models/entities/UsedUsername.ts b/packages/backend/src/models/entities/UsedUsername.ts deleted file mode 100644 index c75bf424c1..0000000000 --- a/packages/backend/src/models/entities/UsedUsername.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Column } from 'typeorm'; - -@Entity('used_username') -export class MiUsedUsername { - @PrimaryColumn('varchar', { - length: 128, - }) - public username: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/User.ts b/packages/backend/src/models/entities/User.ts deleted file mode 100644 index 9db141becf..0000000000 --- a/packages/backend/src/models/entities/User.ts +++ /dev/null @@ -1,283 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiDriveFile } from './DriveFile.js'; - -@Entity('user') -@Index(['usernameLower', 'host'], { unique: true }) -export class MiUser { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column('timestamp with time zone', { - comment: 'The created date of the User.', - }) - public createdAt: Date; - - @Index() - @Column('timestamp with time zone', { - nullable: true, - comment: 'The updated date of the User.', - }) - public updatedAt: Date | null; - - @Column('timestamp with time zone', { - nullable: true, - }) - public lastFetchedAt: Date | null; - - @Index() - @Column('timestamp with time zone', { - nullable: true, - }) - public lastActiveDate: Date | null; - - @Column('boolean', { - default: false, - }) - public hideOnlineStatus: boolean; - - @Column('varchar', { - length: 128, - comment: 'The username of the User.', - }) - public username: string; - - @Index() - @Column('varchar', { - length: 128, select: false, - comment: 'The username (lowercased) of the User.', - }) - public usernameLower: string; - - @Column('varchar', { - length: 128, nullable: true, - comment: 'The name of the User.', - }) - public name: string | null; - - @Column('integer', { - default: 0, - comment: 'The count of followers.', - }) - public followersCount: number; - - @Column('integer', { - default: 0, - comment: 'The count of following.', - }) - public followingCount: number; - - @Column('varchar', { - length: 512, - nullable: true, - comment: 'The URI of the new account of the User', - }) - public movedToUri: string | null; - - @Column('timestamp with time zone', { - nullable: true, - comment: 'When the user moved to another account', - }) - public movedAt: Date | null; - - @Column('simple-array', { - nullable: true, - comment: 'URIs the user is known as too', - }) - public alsoKnownAs: string[] | null; - - @Column('integer', { - default: 0, - comment: 'The count of notes.', - }) - public notesCount: number; - - @Column({ - ...id(), - nullable: true, - comment: 'The ID of avatar DriveFile.', - }) - public avatarId: MiDriveFile['id'] | null; - - @OneToOne(type => MiDriveFile, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public avatar: MiDriveFile | null; - - @Column({ - ...id(), - nullable: true, - comment: 'The ID of banner DriveFile.', - }) - public bannerId: MiDriveFile['id'] | null; - - @OneToOne(type => MiDriveFile, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public banner: MiDriveFile | null; - - @Column('varchar', { - length: 512, nullable: true, - }) - public avatarUrl: string | null; - - @Column('varchar', { - length: 512, nullable: true, - }) - public bannerUrl: string | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public avatarBlurhash: string | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public bannerBlurhash: string | null; - - @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', - }) - public tags: string[]; - - @Column('boolean', { - default: false, - comment: 'Whether the User is suspended.', - }) - public isSuspended: boolean; - - @Column('boolean', { - default: false, - comment: 'Whether the User is locked.', - }) - public isLocked: boolean; - - @Column('boolean', { - default: false, - comment: 'Whether the User is a bot.', - }) - public isBot: boolean; - - @Column('boolean', { - default: false, - comment: 'Whether the User is a cat.', - }) - public isCat: boolean; - - @Column('boolean', { - default: false, - comment: 'Whether the User is the root.', - }) - public isRoot: boolean; - - @Index() - @Column('boolean', { - default: true, - comment: 'Whether the User is explorable.', - }) - public isExplorable: boolean; - - // アカウントが削除されたかどうかのフラグだが、完全に削除される際は物理削除なので実質削除されるまでの「削除が進行しているかどうか」のフラグ - @Column('boolean', { - default: false, - comment: 'Whether the User is deleted.', - }) - public isDeleted: boolean; - - @Column('varchar', { - length: 128, array: true, default: '{}', - }) - public emojis: string[]; - - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: 'The host of the User. It will be null if the origin of the user is local.', - }) - public host: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The inbox URL of the User. It will be null if the origin of the user is local.', - }) - public inbox: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.', - }) - public sharedInbox: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The featured URL of the User. It will be null if the origin of the user is local.', - }) - public featured: string | null; - - @Index() - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of the User. It will be null if the origin of the user is local.', - }) - public uri: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'The URI of the user Follower Collection. It will be null if the origin of the user is local.', - }) - public followersUri: string | null; - - @Index({ unique: true }) - @Column('char', { - length: 16, nullable: true, unique: true, - comment: 'The native access token of the User. It will be null if the origin of the user is local.', - }) - public token: string | null; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} - -export type MiLocalUser = MiUser & { - host: null; - uri: null; -} - -export type MiPartialLocalUser = Partial & { - id: MiUser['id']; - host: null; - uri: null; -} - -export type MiRemoteUser = MiUser & { - host: string; - uri: string; -} - -export type MiPartialRemoteUser = Partial & { - id: MiUser['id']; - host: string; - uri: string; -} - -export const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const; -export const passwordSchema = { type: 'string', minLength: 1 } as const; -export const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; -export const descriptionSchema = { type: 'string', minLength: 1, maxLength: 1500 } as const; -export const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const; -export const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const; diff --git a/packages/backend/src/models/entities/UserIp.ts b/packages/backend/src/models/entities/UserIp.ts deleted file mode 100644 index 8384984e6b..0000000000 --- a/packages/backend/src/models/entities/UserIp.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'; -import { id } from '../id.js'; -import type { MiUser } from './User.js'; - -@Entity('user_ip') -@Index(['userId', 'ip'], { unique: true }) -export class MiUserIp { - @PrimaryGeneratedColumn() - public id: string; - - @Column('timestamp with time zone', { - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @Column('varchar', { - length: 128, - }) - public ip: string; -} diff --git a/packages/backend/src/models/entities/UserKeypair.ts b/packages/backend/src/models/entities/UserKeypair.ts deleted file mode 100644 index c9ea7d11f8..0000000000 --- a/packages/backend/src/models/entities/UserKeypair.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('user_keypair') -export class MiUserKeypair { - @PrimaryColumn(id()) - public userId: MiUser['id']; - - @OneToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 4096, - }) - public publicKey: string; - - @Column('varchar', { - length: 4096, - }) - public privateKey: string; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/UserList.ts b/packages/backend/src/models/entities/UserList.ts deleted file mode 100644 index a6216b5670..0000000000 --- a/packages/backend/src/models/entities/UserList.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('user_list') -export class MiUserList { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the UserList.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The owner ID.', - }) - public userId: MiUser['id']; - - @Index() - @Column('boolean', { - default: false, - }) - public isPublic: boolean; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, - comment: 'The name of the UserList.', - }) - public name: string; -} diff --git a/packages/backend/src/models/entities/UserListFavorite.ts b/packages/backend/src/models/entities/UserListFavorite.ts deleted file mode 100644 index f3c4c1a4d8..0000000000 --- a/packages/backend/src/models/entities/UserListFavorite.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiUserList } from './UserList.js'; - -@Entity('user_list_favorite') -@Index(['userId', 'userListId'], { unique: true }) -export class MiUserListFavorite { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public userListId: MiUserList['id']; - - @ManyToOne(type => MiUserList, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public userList: MiUserList | null; -} diff --git a/packages/backend/src/models/entities/UserListJoining.ts b/packages/backend/src/models/entities/UserListJoining.ts deleted file mode 100644 index e4912024c1..0000000000 --- a/packages/backend/src/models/entities/UserListJoining.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiUserList } from './UserList.js'; - -@Entity('user_list_joining') -@Index(['userId', 'userListId'], { unique: true }) -export class MiUserListJoining { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the UserListJoining.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The user ID.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The list ID.', - }) - public userListId: MiUserList['id']; - - @ManyToOne(type => MiUserList, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public userList: MiUserList | null; -} diff --git a/packages/backend/src/models/entities/UserMemo.ts b/packages/backend/src/models/entities/UserMemo.ts deleted file mode 100644 index 9b89080509..0000000000 --- a/packages/backend/src/models/entities/UserMemo.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Column, Entity, Index, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('user_memo') -@Index(['userId', 'targetUserId'], { unique: true }) -export class MiUserMemo { - @PrimaryColumn(id()) - public id: string; - - @Index() - @Column({ - ...id(), - comment: 'The ID of author.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index() - @Column({ - ...id(), - comment: 'The ID of target user.', - }) - public targetUserId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public targetUser: MiUser | null; - - @Column('varchar', { - length: 2048, - comment: 'Memo.', - }) - public memo: string; -} diff --git a/packages/backend/src/models/entities/UserNotePining.ts b/packages/backend/src/models/entities/UserNotePining.ts deleted file mode 100644 index 95bcb158b6..0000000000 --- a/packages/backend/src/models/entities/UserNotePining.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiNote } from './Note.js'; -import { MiUser } from './User.js'; - -@Entity('user_note_pining') -@Index(['userId', 'noteId'], { unique: true }) -export class MiUserNotePining { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the UserNotePinings.', - }) - public createdAt: Date; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column(id()) - public noteId: MiNote['id']; - - @ManyToOne(type => MiNote, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public note: MiNote | null; -} diff --git a/packages/backend/src/models/entities/UserPending.ts b/packages/backend/src/models/entities/UserPending.ts deleted file mode 100644 index 8c9e01e59c..0000000000 --- a/packages/backend/src/models/entities/UserPending.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; -import { id } from '../id.js'; - -@Entity('user_pending') -export class MiUserPending { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone') - public createdAt: Date; - - @Index({ unique: true }) - @Column('varchar', { - length: 128, - }) - public code: string; - - @Column('varchar', { - length: 128, - }) - public username: string; - - @Column('varchar', { - length: 128, - }) - public email: string; - - @Column('varchar', { - length: 128, - }) - public password: string; -} diff --git a/packages/backend/src/models/entities/UserProfile.ts b/packages/backend/src/models/entities/UserProfile.ts deleted file mode 100644 index 0fd26f4d63..0000000000 --- a/packages/backend/src/models/entities/UserProfile.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm'; -import { obsoleteNotificationTypes, ffVisibility, notificationTypes } from '@/types.js'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; -import { MiPage } from './Page.js'; - -// TODO: このテーブルで管理している情報すべてレジストリで管理するようにしても良いかも -// ただ、「emailVerified が true なユーザーを find する」のようなクエリは書けなくなるからウーン -@Entity('user_profile') -export class MiUserProfile { - @PrimaryColumn(id()) - public userId: MiUser['id']; - - @OneToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, nullable: true, - comment: 'The location of the User.', - }) - public location: string | null; - - @Column('char', { - length: 10, nullable: true, - comment: 'The birthday (YYYY-MM-DD) of the User.', - }) - public birthday: string | null; - - @Column('varchar', { - length: 2048, nullable: true, - comment: 'The description (bio) of the User.', - }) - public description: string | null; - - @Column('jsonb', { - default: [], - }) - public fields: { - name: string; - value: string; - }[]; - - @Column('varchar', { - length: 32, nullable: true, - }) - public lang: string | null; - - @Column('varchar', { - length: 512, nullable: true, - comment: 'Remote URL of the user.', - }) - public url: string | null; - - @Column('varchar', { - length: 128, nullable: true, - comment: 'The email address of the User.', - }) - public email: string | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public emailVerifyCode: string | null; - - @Column('boolean', { - default: false, - }) - public emailVerified: boolean; - - @Column('jsonb', { - default: ['follow', 'receiveFollowRequest'], - }) - public emailNotificationTypes: string[]; - - @Column('boolean', { - default: true, - }) - public publicReactions: boolean; - - @Column('enum', { - enum: ffVisibility, - default: 'public', - }) - public ffVisibility: typeof ffVisibility[number]; - - @Column('varchar', { - length: 128, nullable: true, - }) - public twoFactorTempSecret: string | null; - - @Column('varchar', { - length: 128, nullable: true, - }) - public twoFactorSecret: string | null; - - @Column('varchar', { - nullable: true, array: true, - }) - public twoFactorBackupSecret: string[] | null; - - @Column('boolean', { - default: false, - }) - public twoFactorEnabled: boolean; - - @Column('boolean', { - default: false, - }) - public securityKeysAvailable: boolean; - - @Column('boolean', { - default: false, - }) - public usePasswordLessLogin: boolean; - - @Column('varchar', { - length: 128, nullable: true, - comment: 'The password hash of the User. It will be null if the origin of the user is local.', - }) - public password: string | null; - - @Column('varchar', { - length: 8192, default: '', - }) - public moderationNote: string | null; - - // TODO: そのうち消す - @Column('jsonb', { - default: {}, - comment: 'The client-specific data of the User.', - }) - public clientData: Record; - - // TODO: そのうち消す - @Column('jsonb', { - default: {}, - comment: 'The room data of the User.', - }) - public room: Record; - - @Column('boolean', { - default: false, - }) - public autoAcceptFollowed: boolean; - - @Column('boolean', { - default: false, - comment: 'Whether reject index by crawler.', - }) - public noCrawle: boolean; - - @Column('boolean', { - default: true, - }) - public preventAiLearning: boolean; - - @Column('boolean', { - default: false, - }) - public alwaysMarkNsfw: boolean; - - @Column('boolean', { - default: false, - }) - public autoSensitive: boolean; - - @Column('boolean', { - default: false, - }) - public carefulBot: boolean; - - @Column('boolean', { - default: true, - }) - public injectFeaturedNote: boolean; - - @Column('boolean', { - default: true, - }) - public receiveAnnouncementEmail: boolean; - - @Column({ - ...id(), - nullable: true, - }) - public pinnedPageId: MiPage['id'] | null; - - @OneToOne(type => MiPage, { - onDelete: 'SET NULL', - }) - @JoinColumn() - public pinnedPage: MiPage | null; - - @Index() - @Column('boolean', { - default: false, select: false, - }) - public enableWordMute: boolean; - - @Column('jsonb', { - default: [], - }) - public mutedWords: string[][]; - - @Column('jsonb', { - default: [], - comment: 'List of instances muted by the user.', - }) - public mutedInstances: string[]; - - @Column('enum', { - enum: [ - ...notificationTypes, - // マイグレーションで削除が困難なので古いenumは残しておく - ...obsoleteNotificationTypes, - ], - array: true, - default: [], - }) - public mutingNotificationTypes: typeof notificationTypes[number][]; - - @Column('varchar', { - length: 32, array: true, default: '{}', - }) - public loggedInDates: string[]; - - @Column('jsonb', { - default: [], - }) - public achievements: { - name: string; - unlockedAt: number; - }[]; - - //#region Denormalized fields - @Index() - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]', - }) - public userHost: string | null; - //#endregion - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/UserPublickey.ts b/packages/backend/src/models/entities/UserPublickey.ts deleted file mode 100644 index afa37cf7ea..0000000000 --- a/packages/backend/src/models/entities/UserPublickey.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('user_publickey') -export class MiUserPublickey { - @PrimaryColumn(id()) - public userId: MiUser['id']; - - @OneToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Index({ unique: true }) - @Column('varchar', { - length: 256, - }) - public keyId: string; - - @Column('varchar', { - length: 4096, - }) - public keyPem: string; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/UserSecurityKey.ts b/packages/backend/src/models/entities/UserSecurityKey.ts deleted file mode 100644 index 96dd27d083..0000000000 --- a/packages/backend/src/models/entities/UserSecurityKey.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -@Entity('user_security_key') -export class MiUserSecurityKey { - @PrimaryColumn('varchar', { - comment: 'Variable-length id given to navigator.credentials.get()', - }) - public id: string; - - @Index() - @Column(id()) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - comment: 'User-defined name for this key', - length: 30, - }) - public name: string; - - @Index() - @Column('varchar', { - comment: 'The public key of the UserSecurityKey, hex-encoded.', - }) - public publicKey: string; - - @Column('bigint', { - comment: 'The number of times the UserSecurityKey was validated.', - default: 0, - }) - public counter: number; - - @Column('timestamp with time zone', { - comment: 'Timestamp of the last time the UserSecurityKey was used.', - default: () => 'now()', - }) - public lastUsed: Date; - - @Column('varchar', { - comment: 'The type of Backup Eligibility in authenticator data', - length: 32, nullable: true, - }) - public credentialDeviceType: string | null; - - @Column('boolean', { - comment: 'Whether or not the credential has been backed up', - nullable: true, - }) - public credentialBackedUp: boolean | null; - - @Column('varchar', { - comment: 'The type of the credential returned by the browser', - length: 32, array: true, nullable: true, - }) - public transports: string[] | null; - - constructor(data: Partial) { - if (data == null) return; - - for (const [k, v] of Object.entries(data)) { - (this as any)[k] = v; - } - } -} diff --git a/packages/backend/src/models/entities/Webhook.ts b/packages/backend/src/models/entities/Webhook.ts deleted file mode 100644 index f08d15825a..0000000000 --- a/packages/backend/src/models/entities/Webhook.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; -import { id } from '../id.js'; -import { MiUser } from './User.js'; - -export const webhookEventTypes = ['mention', 'unfollow', 'follow', 'followed', 'note', 'reply', 'renote', 'reaction'] as const; - -@Entity('webhook') -export class MiWebhook { - @PrimaryColumn(id()) - public id: string; - - @Column('timestamp with time zone', { - comment: 'The created date of the Antenna.', - }) - public createdAt: Date; - - @Index() - @Column({ - ...id(), - comment: 'The owner ID.', - }) - public userId: MiUser['id']; - - @ManyToOne(type => MiUser, { - onDelete: 'CASCADE', - }) - @JoinColumn() - public user: MiUser | null; - - @Column('varchar', { - length: 128, - comment: 'The name of the Antenna.', - }) - public name: string; - - @Index() - @Column('varchar', { - length: 128, array: true, default: '{}', - }) - public on: (typeof webhookEventTypes)[number][]; - - @Column('varchar', { - length: 1024, - }) - public url: string; - - @Column('varchar', { - length: 1024, - }) - public secret: string; - - @Index() - @Column('boolean', { - default: true, - }) - public active: boolean; - - /** - * 直近のリクエスト送信日時 - */ - @Column('timestamp with time zone', { - nullable: true, - }) - public latestSentAt: Date | null; - - /** - * 直近のリクエスト送信時のHTTPステータスコード - */ - @Column('integer', { - nullable: true, - }) - public latestStatus: number | null; -} diff --git a/packages/backend/src/models/id.ts b/packages/backend/src/models/id.ts deleted file mode 100644 index 81e83b8db9..0000000000 --- a/packages/backend/src/models/id.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * SPDX-FileCopyrightText: syuilo and other misskey contributors - * SPDX-License-Identifier: AGPL-3.0-only - */ - -export const id = () => ({ - type: 'varchar' as const, - length: 32, -}); diff --git a/packages/backend/src/models/util/id.ts b/packages/backend/src/models/util/id.ts new file mode 100644 index 0000000000..81e83b8db9 --- /dev/null +++ b/packages/backend/src/models/util/id.ts @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: syuilo and other misskey contributors + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export const id = () => ({ + type: 'varchar' as const, + length: 32, +}); diff --git a/packages/backend/src/postgres.ts b/packages/backend/src/postgres.ts index c5d9e41463..10126eab2b 100644 --- a/packages/backend/src/postgres.ts +++ b/packages/backend/src/postgres.ts @@ -11,71 +11,71 @@ import { DataSource, Logger } from 'typeorm'; import * as highlight from 'cli-highlight'; import { entities as charts } from '@/core/chart/entities.js'; -import { MiAbuseUserReport } from '@/models/entities/AbuseUserReport.js'; -import { MiAccessToken } from '@/models/entities/AccessToken.js'; -import { MiAd } from '@/models/entities/Ad.js'; -import { MiAnnouncement } from '@/models/entities/Announcement.js'; -import { MiAnnouncementRead } from '@/models/entities/AnnouncementRead.js'; -import { MiAntenna } from '@/models/entities/Antenna.js'; -import { MiApp } from '@/models/entities/App.js'; -import { MiAuthSession } from '@/models/entities/AuthSession.js'; -import { MiBlocking } from '@/models/entities/Blocking.js'; -import { MiChannelFollowing } from '@/models/entities/ChannelFollowing.js'; -import { MiChannelFavorite } from '@/models/entities/ChannelFavorite.js'; -import { MiClip } from '@/models/entities/Clip.js'; -import { MiClipNote } from '@/models/entities/ClipNote.js'; -import { MiClipFavorite } from '@/models/entities/ClipFavorite.js'; -import { MiDriveFile } from '@/models/entities/DriveFile.js'; -import { MiDriveFolder } from '@/models/entities/DriveFolder.js'; -import { MiEmoji } from '@/models/entities/Emoji.js'; -import { MiFollowing } from '@/models/entities/Following.js'; -import { MiFollowRequest } from '@/models/entities/FollowRequest.js'; -import { MiGalleryLike } from '@/models/entities/GalleryLike.js'; -import { MiGalleryPost } from '@/models/entities/GalleryPost.js'; -import { MiHashtag } from '@/models/entities/Hashtag.js'; -import { MiInstance } from '@/models/entities/Instance.js'; -import { MiMeta } from '@/models/entities/Meta.js'; -import { MiModerationLog } from '@/models/entities/ModerationLog.js'; -import { MiMutedNote } from '@/models/entities/MutedNote.js'; -import { MiMuting } from '@/models/entities/Muting.js'; -import { MiRenoteMuting } from '@/models/entities/RenoteMuting.js'; -import { MiNote } from '@/models/entities/Note.js'; -import { MiNoteFavorite } from '@/models/entities/NoteFavorite.js'; -import { MiNoteReaction } from '@/models/entities/NoteReaction.js'; -import { MiNoteThreadMuting } from '@/models/entities/NoteThreadMuting.js'; -import { MiNoteUnread } from '@/models/entities/NoteUnread.js'; -import { MiPage } from '@/models/entities/Page.js'; -import { MiPageLike } from '@/models/entities/PageLike.js'; -import { MiPasswordResetRequest } from '@/models/entities/PasswordResetRequest.js'; -import { MiPoll } from '@/models/entities/Poll.js'; -import { MiPollVote } from '@/models/entities/PollVote.js'; -import { MiPromoNote } from '@/models/entities/PromoNote.js'; -import { MiPromoRead } from '@/models/entities/PromoRead.js'; -import { MiRegistrationTicket } from '@/models/entities/RegistrationTicket.js'; -import { MiRegistryItem } from '@/models/entities/RegistryItem.js'; -import { MiRelay } from '@/models/entities/Relay.js'; -import { MiSignin } from '@/models/entities/Signin.js'; -import { MiSwSubscription } from '@/models/entities/SwSubscription.js'; -import { MiUsedUsername } from '@/models/entities/UsedUsername.js'; -import { MiUser } from '@/models/entities/User.js'; -import { MiUserIp } from '@/models/entities/UserIp.js'; -import { MiUserKeypair } from '@/models/entities/UserKeypair.js'; -import { MiUserList } from '@/models/entities/UserList.js'; -import { MiUserListFavorite } from '@/models/entities/UserListFavorite.js'; -import { MiUserListJoining } from '@/models/entities/UserListJoining.js'; -import { MiUserNotePining } from '@/models/entities/UserNotePining.js'; -import { MiUserPending } from '@/models/entities/UserPending.js'; -import { MiUserProfile } from '@/models/entities/UserProfile.js'; -import { MiUserPublickey } from '@/models/entities/UserPublickey.js'; -import { MiUserSecurityKey } from '@/models/entities/UserSecurityKey.js'; -import { MiWebhook } from '@/models/entities/Webhook.js'; -import { MiChannel } from '@/models/entities/Channel.js'; -import { MiRetentionAggregation } from '@/models/entities/RetentionAggregation.js'; -import { MiRole } from '@/models/entities/Role.js'; -import { MiRoleAssignment } from '@/models/entities/RoleAssignment.js'; -import { MiFlash } from '@/models/entities/Flash.js'; -import { MiFlashLike } from '@/models/entities/FlashLike.js'; -import { MiUserMemo } from '@/models/entities/UserMemo.js'; +import { MiAbuseUserReport } from '@/models/AbuseUserReport.js'; +import { MiAccessToken } from '@/models/AccessToken.js'; +import { MiAd } from '@/models/Ad.js'; +import { MiAnnouncement } from '@/models/Announcement.js'; +import { MiAnnouncementRead } from '@/models/AnnouncementRead.js'; +import { MiAntenna } from '@/models/Antenna.js'; +import { MiApp } from '@/models/App.js'; +import { MiAuthSession } from '@/models/AuthSession.js'; +import { MiBlocking } from '@/models/Blocking.js'; +import { MiChannelFollowing } from '@/models/ChannelFollowing.js'; +import { MiChannelFavorite } from '@/models/ChannelFavorite.js'; +import { MiClip } from '@/models/Clip.js'; +import { MiClipNote } from '@/models/ClipNote.js'; +import { MiClipFavorite } from '@/models/ClipFavorite.js'; +import { MiDriveFile } from '@/models/DriveFile.js'; +import { MiDriveFolder } from '@/models/DriveFolder.js'; +import { MiEmoji } from '@/models/Emoji.js'; +import { MiFollowing } from '@/models/Following.js'; +import { MiFollowRequest } from '@/models/FollowRequest.js'; +import { MiGalleryLike } from '@/models/GalleryLike.js'; +import { MiGalleryPost } from '@/models/GalleryPost.js'; +import { MiHashtag } from '@/models/Hashtag.js'; +import { MiInstance } from '@/models/Instance.js'; +import { MiMeta } from '@/models/Meta.js'; +import { MiModerationLog } from '@/models/ModerationLog.js'; +import { MiMutedNote } from '@/models/MutedNote.js'; +import { MiMuting } from '@/models/Muting.js'; +import { MiRenoteMuting } from '@/models/RenoteMuting.js'; +import { MiNote } from '@/models/Note.js'; +import { MiNoteFavorite } from '@/models/NoteFavorite.js'; +import { MiNoteReaction } from '@/models/NoteReaction.js'; +import { MiNoteThreadMuting } from '@/models/NoteThreadMuting.js'; +import { MiNoteUnread } from '@/models/NoteUnread.js'; +import { MiPage } from '@/models/Page.js'; +import { MiPageLike } from '@/models/PageLike.js'; +import { MiPasswordResetRequest } from '@/models/PasswordResetRequest.js'; +import { MiPoll } from '@/models/Poll.js'; +import { MiPollVote } from '@/models/PollVote.js'; +import { MiPromoNote } from '@/models/PromoNote.js'; +import { MiPromoRead } from '@/models/PromoRead.js'; +import { MiRegistrationTicket } from '@/models/RegistrationTicket.js'; +import { MiRegistryItem } from '@/models/RegistryItem.js'; +import { MiRelay } from '@/models/Relay.js'; +import { MiSignin } from '@/models/Signin.js'; +import { MiSwSubscription } from '@/models/SwSubscription.js'; +import { MiUsedUsername } from '@/models/UsedUsername.js'; +import { MiUser } from '@/models/User.js'; +import { MiUserIp } from '@/models/UserIp.js'; +import { MiUserKeypair } from '@/models/UserKeypair.js'; +import { MiUserList } from '@/models/UserList.js'; +import { MiUserListFavorite } from '@/models/UserListFavorite.js'; +import { MiUserListJoining } from '@/models/UserListJoining.js'; +import { MiUserNotePining } from '@/models/UserNotePining.js'; +import { MiUserPending } from '@/models/UserPending.js'; +import { MiUserProfile } from '@/models/UserProfile.js'; +import { MiUserPublickey } from '@/models/UserPublickey.js'; +import { MiUserSecurityKey } from '@/models/UserSecurityKey.js'; +import { MiWebhook } from '@/models/Webhook.js'; +import { MiChannel } from '@/models/Channel.js'; +import { MiRetentionAggregation } from '@/models/RetentionAggregation.js'; +import { MiRole } from '@/models/Role.js'; +import { MiRoleAssignment } from '@/models/RoleAssignment.js'; +import { MiFlash } from '@/models/Flash.js'; +import { MiFlashLike } from '@/models/FlashLike.js'; +import { MiUserMemo } from '@/models/UserMemo.js'; import { Config } from '@/config.js'; import MisskeyLogger from '@/logger.js'; diff --git a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts index 5ffd8cea95..39967165d4 100644 --- a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts +++ b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts @@ -9,8 +9,8 @@ import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, NotesRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js'; import type Logger from '@/logger.js'; import { DriveService } from '@/core/DriveService.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiNote } from '@/models/Note.js'; import { EmailService } from '@/core/EmailService.js'; import { bindThis } from '@/decorators.js'; import { SearchService } from '@/core/SearchService.js'; diff --git a/packages/backend/src/queue/processors/DeliverProcessorService.ts b/packages/backend/src/queue/processors/DeliverProcessorService.ts index f600bb25c0..4a1d9f28b4 100644 --- a/packages/backend/src/queue/processors/DeliverProcessorService.ts +++ b/packages/backend/src/queue/processors/DeliverProcessorService.ts @@ -13,7 +13,7 @@ import { ApRequestService } from '@/core/activitypub/ApRequestService.js'; import { FederatedInstanceService } from '@/core/FederatedInstanceService.js'; import { FetchInstanceMetadataService } from '@/core/FetchInstanceMetadataService.js'; import { MemorySingleCache } from '@/misc/cache.js'; -import type { MiInstance } from '@/models/entities/Instance.js'; +import type { MiInstance } from '@/models/Instance.js'; import InstanceChart from '@/core/chart/charts/instance.js'; import ApRequestChart from '@/core/chart/charts/ap-request.js'; import FederationChart from '@/core/chart/charts/federation.js'; diff --git a/packages/backend/src/queue/processors/ExportFavoritesProcessorService.ts b/packages/backend/src/queue/processors/ExportFavoritesProcessorService.ts index 68aaf10388..7248c7a649 100644 --- a/packages/backend/src/queue/processors/ExportFavoritesProcessorService.ts +++ b/packages/backend/src/queue/processors/ExportFavoritesProcessorService.ts @@ -12,8 +12,8 @@ import type { MiNoteFavorite, NoteFavoritesRepository, PollsRepository, MiUser, import type Logger from '@/logger.js'; import { DriveService } from '@/core/DriveService.js'; import { createTemp } from '@/misc/create-temp.js'; -import type { MiPoll } from '@/models/entities/Poll.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiPoll } from '@/models/Poll.js'; +import type { MiNote } from '@/models/Note.js'; import { bindThis } from '@/decorators.js'; import { QueueLoggerService } from '../QueueLoggerService.js'; import type * as Bull from 'bullmq'; diff --git a/packages/backend/src/queue/processors/ExportFollowingProcessorService.ts b/packages/backend/src/queue/processors/ExportFollowingProcessorService.ts index 1aec36d6de..c9739eb1cb 100644 --- a/packages/backend/src/queue/processors/ExportFollowingProcessorService.ts +++ b/packages/backend/src/queue/processors/ExportFollowingProcessorService.ts @@ -12,7 +12,7 @@ import type { UsersRepository, FollowingsRepository, MutingsRepository } from '@ import type Logger from '@/logger.js'; import { DriveService } from '@/core/DriveService.js'; import { createTemp } from '@/misc/create-temp.js'; -import type { MiFollowing } from '@/models/entities/Following.js'; +import type { MiFollowing } from '@/models/Following.js'; import { UtilityService } from '@/core/UtilityService.js'; import { bindThis } from '@/decorators.js'; import { QueueLoggerService } from '../QueueLoggerService.js'; diff --git a/packages/backend/src/queue/processors/ExportNotesProcessorService.ts b/packages/backend/src/queue/processors/ExportNotesProcessorService.ts index 2c6d2f04d8..e0bc80e190 100644 --- a/packages/backend/src/queue/processors/ExportNotesProcessorService.ts +++ b/packages/backend/src/queue/processors/ExportNotesProcessorService.ts @@ -12,8 +12,8 @@ import type { NotesRepository, PollsRepository, UsersRepository } from '@/models import type Logger from '@/logger.js'; import { DriveService } from '@/core/DriveService.js'; import { createTemp } from '@/misc/create-temp.js'; -import type { MiPoll } from '@/models/entities/Poll.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiPoll } from '@/models/Poll.js'; +import type { MiNote } from '@/models/Note.js'; import { bindThis } from '@/decorators.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; import { Packed } from '@/misc/json-schema.js'; diff --git a/packages/backend/src/queue/processors/InboxProcessorService.ts b/packages/backend/src/queue/processors/InboxProcessorService.ts index ba00cc2ac8..99e823f9fa 100644 --- a/packages/backend/src/queue/processors/InboxProcessorService.ts +++ b/packages/backend/src/queue/processors/InboxProcessorService.ts @@ -15,8 +15,8 @@ import InstanceChart from '@/core/chart/charts/instance.js'; import ApRequestChart from '@/core/chart/charts/ap-request.js'; import FederationChart from '@/core/chart/charts/federation.js'; import { getApId } from '@/core/activitypub/type.js'; -import type { MiRemoteUser } from '@/models/entities/User.js'; -import type { MiUserPublickey } from '@/models/entities/UserPublickey.js'; +import type { MiRemoteUser } from '@/models/User.js'; +import type { MiUserPublickey } from '@/models/UserPublickey.js'; import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js'; import { StatusError } from '@/misc/status-error.js'; import { UtilityService } from '@/core/UtilityService.js'; diff --git a/packages/backend/src/queue/processors/RelationshipProcessorService.ts b/packages/backend/src/queue/processors/RelationshipProcessorService.ts index 6ed3e6c4d4..5b2d2ef313 100644 --- a/packages/backend/src/queue/processors/RelationshipProcessorService.ts +++ b/packages/backend/src/queue/processors/RelationshipProcessorService.ts @@ -12,7 +12,7 @@ import type Logger from '@/logger.js'; import type { UsersRepository } from '@/models/_.js'; import { DI } from '@/di-symbols.js'; -import { MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; +import { MiLocalUser, MiRemoteUser } from '@/models/User.js'; import { RelationshipJobData } from '../types.js'; import { QueueLoggerService } from '../QueueLoggerService.js'; import type * as Bull from 'bullmq'; diff --git a/packages/backend/src/queue/types.ts b/packages/backend/src/queue/types.ts index 85af9d5315..c9122f5ca2 100644 --- a/packages/backend/src/queue/types.ts +++ b/packages/backend/src/queue/types.ts @@ -4,10 +4,10 @@ */ import type { Antenna } from '@/server/api/endpoints/i/import-antennas.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiWebhook } from '@/models/entities/Webhook.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiWebhook } from '@/models/Webhook.js'; import type { IActivity } from '@/core/activitypub/type.js'; import type httpSignature from '@peertube/http-signature'; diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index a42495db5f..2428fa2792 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -16,11 +16,11 @@ import * as url from '@/misc/prelude/url.js'; import type { Config } from '@/config.js'; import { ApRendererService } from '@/core/activitypub/ApRendererService.js'; import { QueueService } from '@/core/QueueService.js'; -import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/entities/User.js'; +import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/User.js'; import { UserKeypairService } from '@/core/UserKeypairService.js'; -import type { MiFollowing } from '@/models/entities/Following.js'; +import type { MiFollowing } from '@/models/Following.js'; import { countIf } from '@/misc/prelude/array.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import { QueryService } from '@/core/QueryService.js'; import { UtilityService } from '@/core/UtilityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; diff --git a/packages/backend/src/server/WellKnownServerService.ts b/packages/backend/src/server/WellKnownServerService.ts index 833031e23a..8fc3c96de6 100644 --- a/packages/backend/src/server/WellKnownServerService.ts +++ b/packages/backend/src/server/WellKnownServerService.ts @@ -11,7 +11,7 @@ import { DI } from '@/di-symbols.js'; import type { UsersRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; import { escapeAttribute, escapeValue } from '@/misc/prelude/xml.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import * as Acct from '@/misc/acct.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/ApiCallService.ts b/packages/backend/src/server/api/ApiCallService.ts index 07ef127322..085a0fd58a 100644 --- a/packages/backend/src/server/api/ApiCallService.ts +++ b/packages/backend/src/server/api/ApiCallService.ts @@ -9,8 +9,8 @@ import * as stream from 'node:stream/promises'; import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import { getIpHash } from '@/misc/get-ip-hash.js'; -import type { MiLocalUser, MiUser } from '@/models/entities/User.js'; -import type { MiAccessToken } from '@/models/entities/AccessToken.js'; +import type { MiLocalUser, MiUser } from '@/models/User.js'; +import type { MiAccessToken } from '@/models/AccessToken.js'; import type Logger from '@/logger.js'; import type { UserIpsRepository } from '@/models/_.js'; import { MetaService } from '@/core/MetaService.js'; diff --git a/packages/backend/src/server/api/AuthenticateService.ts b/packages/backend/src/server/api/AuthenticateService.ts index c470a20758..f075688194 100644 --- a/packages/backend/src/server/api/AuthenticateService.ts +++ b/packages/backend/src/server/api/AuthenticateService.ts @@ -6,10 +6,10 @@ import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { AccessTokensRepository, AppsRepository, UsersRepository } from '@/models/_.js'; -import type { MiLocalUser } from '@/models/entities/User.js'; -import type { MiAccessToken } from '@/models/entities/AccessToken.js'; +import type { MiLocalUser } from '@/models/User.js'; +import type { MiAccessToken } from '@/models/AccessToken.js'; import { MemoryKVCache } from '@/misc/cache.js'; -import type { MiApp } from '@/models/entities/App.js'; +import type { MiApp } from '@/models/App.js'; import { CacheService } from '@/core/CacheService.js'; import isNativeToken from '@/misc/is-native-token.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/GetterService.ts b/packages/backend/src/server/api/GetterService.ts index 020bcad12d..e2b98c34e7 100644 --- a/packages/backend/src/server/api/GetterService.ts +++ b/packages/backend/src/server/api/GetterService.ts @@ -7,8 +7,8 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { NotesRepository, UsersRepository } from '@/models/_.js'; import { IdentifiableError } from '@/misc/identifiable-error.js'; -import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/entities/User.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiLocalUser, MiRemoteUser, MiUser } from '@/models/User.js'; +import type { MiNote } from '@/models/Note.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/SigninApiService.ts b/packages/backend/src/server/api/SigninApiService.ts index 9a395a25d6..48d74e2b02 100644 --- a/packages/backend/src/server/api/SigninApiService.ts +++ b/packages/backend/src/server/api/SigninApiService.ts @@ -15,7 +15,7 @@ import type { } from '@/models/_.js'; import type { Config } from '@/config.js'; import { getIpHash } from '@/misc/get-ip-hash.js'; -import type { MiLocalUser } from '@/models/entities/User.js'; +import type { MiLocalUser } from '@/models/User.js'; import { IdService } from '@/core/IdService.js'; import { bindThis } from '@/decorators.js'; import { WebAuthnService } from '@/core/WebAuthnService.js'; diff --git a/packages/backend/src/server/api/SigninService.ts b/packages/backend/src/server/api/SigninService.ts index 25882fecf3..cebba8c8ee 100644 --- a/packages/backend/src/server/api/SigninService.ts +++ b/packages/backend/src/server/api/SigninService.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { DI } from '@/di-symbols.js'; import type { SigninsRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; -import type { MiLocalUser } from '@/models/entities/User.js'; +import type { MiLocalUser } from '@/models/User.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { SigninEntityService } from '@/core/entities/SigninEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts index dac3e02ddb..431df581b5 100644 --- a/packages/backend/src/server/api/SignupApiService.ts +++ b/packages/backend/src/server/api/SignupApiService.ts @@ -15,7 +15,7 @@ import { IdService } from '@/core/IdService.js'; import { SignupService } from '@/core/SignupService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { EmailService } from '@/core/EmailService.js'; -import { MiLocalUser } from '@/models/entities/User.js'; +import { MiLocalUser } from '@/models/User.js'; import { FastifyReplyError } from '@/misc/fastify-reply-error.js'; import { bindThis } from '@/decorators.js'; import { L_CHARS, secureRndstr } from '@/misc/secure-rndstr.js'; diff --git a/packages/backend/src/server/api/StreamingApiServerService.ts b/packages/backend/src/server/api/StreamingApiServerService.ts index a1766d5889..9acaa688c5 100644 --- a/packages/backend/src/server/api/StreamingApiServerService.ts +++ b/packages/backend/src/server/api/StreamingApiServerService.ts @@ -13,7 +13,7 @@ import { NoteReadService } from '@/core/NoteReadService.js'; import { NotificationService } from '@/core/NotificationService.js'; import { bindThis } from '@/decorators.js'; import { CacheService } from '@/core/CacheService.js'; -import { MiLocalUser } from '@/models/entities/User.js'; +import { MiLocalUser } from '@/models/User.js'; import { AuthenticateService, AuthenticationError } from './AuthenticateService.js'; import MainStreamConnection from './stream/Connection.js'; import { ChannelsService } from './stream/ChannelsService.js'; diff --git a/packages/backend/src/server/api/endpoint-base.ts b/packages/backend/src/server/api/endpoint-base.ts index 531311e475..d5279faa1c 100644 --- a/packages/backend/src/server/api/endpoint-base.ts +++ b/packages/backend/src/server/api/endpoint-base.ts @@ -6,8 +6,8 @@ import * as fs from 'node:fs'; import _Ajv from 'ajv'; import type { Schema, SchemaType } from '@/misc/json-schema.js'; -import type { MiLocalUser } from '@/models/entities/User.js'; -import type { MiAccessToken } from '@/models/entities/AccessToken.js'; +import type { MiLocalUser } from '@/models/User.js'; +import type { MiAccessToken } from '@/models/AccessToken.js'; import { ApiError } from './error.js'; import type { IEndpointMeta } from './endpoints.js'; diff --git a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts index 861a91d6d8..070e88f6f3 100644 --- a/packages/backend/src/server/api/endpoints/admin/accounts/create.ts +++ b/packages/backend/src/server/api/endpoints/admin/accounts/create.ts @@ -9,7 +9,7 @@ import { Endpoint } from '@/server/api/endpoint-base.js'; import type { UsersRepository } from '@/models/_.js'; import { SignupService } from '@/core/SignupService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; -import { localUsernameSchema, passwordSchema } from '@/models/entities/User.js'; +import { localUsernameSchema, passwordSchema } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; export const meta = { diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index 82dc1fcdff..c82e702eef 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { AnnouncementsRepository, AnnouncementReadsRepository } from '@/models/_.js'; -import type { MiAnnouncement } from '@/models/entities/Announcement.js'; +import type { MiAnnouncement } from '@/models/Announcement.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { QueryService } from '@/core/QueryService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts index f374b31303..c5f986ff02 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/copy.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { EmojisRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { DI } from '@/di-symbols.js'; import { DriveService } from '@/core/DriveService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index 2bd77219b3..ab16d86a3d 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { EmojisRepository } from '@/models/_.js'; -import type { MiEmoji } from '@/models/entities/Emoji.js'; +import type { MiEmoji } from '@/models/Emoji.js'; import { QueryService } from '@/core/QueryService.js'; import { DI } from '@/di-symbols.js'; import { EmojiEntityService } from '@/core/entities/EmojiEntityService.js'; diff --git a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts index 01c220a93a..bcf12fa4e8 100644 --- a/packages/backend/src/server/api/endpoints/admin/suspend-user.ts +++ b/packages/backend/src/server/api/endpoints/admin/suspend-user.ts @@ -7,7 +7,7 @@ import { IsNull, Not } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { UsersRepository, FollowingsRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import type { RelationshipJobData } from '@/queue/types.js'; import { ModerationLogService } from '@/core/ModerationLogService.js'; import { UserSuspendService } from '@/core/UserSuspendService.js'; diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 65b7736d1a..614e0a95d7 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -4,7 +4,7 @@ */ import { Injectable } from '@nestjs/common'; -import type { MiMeta } from '@/models/entities/Meta.js'; +import type { MiMeta } from '@/models/Meta.js'; import { ModerationLogService } from '@/core/ModerationLogService.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { MetaService } from '@/core/MetaService.js'; diff --git a/packages/backend/src/server/api/endpoints/ap/show.ts b/packages/backend/src/server/api/endpoints/ap/show.ts index f3ca931f24..f442fbdd2f 100644 --- a/packages/backend/src/server/api/endpoints/ap/show.ts +++ b/packages/backend/src/server/api/endpoints/ap/show.ts @@ -6,8 +6,8 @@ import { Injectable } from '@nestjs/common'; import ms from 'ms'; import { Endpoint } from '@/server/api/endpoint-base.js'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiLocalUser, MiUser } from '@/models/entities/User.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiLocalUser, MiUser } from '@/models/User.js'; import { isActor, isPost, getApId } from '@/core/activitypub/type.js'; import type { SchemaType } from '@/misc/json-schema.js'; import { ApResolverService } from '@/core/activitypub/ApResolverService.js'; diff --git a/packages/backend/src/server/api/endpoints/channels/create.ts b/packages/backend/src/server/api/endpoints/channels/create.ts index 9806f90972..e72120e156 100644 --- a/packages/backend/src/server/api/endpoints/channels/create.ts +++ b/packages/backend/src/server/api/endpoints/channels/create.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import ms from 'ms'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { ChannelsRepository, DriveFilesRepository } from '@/models/_.js'; -import type { MiChannel } from '@/models/entities/Channel.js'; +import type { MiChannel } from '@/models/Channel.js'; import { IdService } from '@/core/IdService.js'; import { ChannelEntityService } from '@/core/entities/ChannelEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/drive/files/show.ts b/packages/backend/src/server/api/endpoints/drive/files/show.ts index c52fa28732..474c7f02d3 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/show.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/show.ts @@ -4,7 +4,7 @@ */ import { Inject, Injectable } from '@nestjs/common'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import type { DriveFilesRepository } from '@/models/_.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts index 3a0590f1d1..94701712de 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/create.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/create.ts @@ -7,8 +7,8 @@ import ms from 'ms'; import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { DriveFilesRepository, GalleryPostsRepository } from '@/models/_.js'; -import { MiGalleryPost } from '@/models/entities/GalleryPost.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import { MiGalleryPost } from '@/models/GalleryPost.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { IdService } from '@/core/IdService.js'; import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts index 4ef414a83c..632214a0c2 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts/update.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts/update.ts @@ -7,7 +7,7 @@ import ms from 'ms'; import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { DriveFilesRepository, GalleryPostsRepository } from '@/models/_.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; import { GalleryPostEntityService } from '@/core/entities/GalleryPostEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index ab65699a5a..75d4fe3819 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -7,7 +7,7 @@ import { Brackets } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { NotesRepository } from '@/models/_.js'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import { safeForSql } from '@/misc/safe-for-sql.js'; import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import { MetaService } from '@/core/MetaService.js'; diff --git a/packages/backend/src/server/api/endpoints/i/move.ts b/packages/backend/src/server/api/endpoints/i/move.ts index eb67e171fe..86b726e054 100644 --- a/packages/backend/src/server/api/endpoints/i/move.ts +++ b/packages/backend/src/server/api/endpoints/i/move.ts @@ -9,7 +9,7 @@ import ms from 'ms'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { ApiError } from '@/server/api/error.js'; -import { MiLocalUser, MiRemoteUser } from '@/models/entities/User.js'; +import { MiLocalUser, MiRemoteUser } from '@/models/User.js'; import { AccountMoveService } from '@/core/AccountMoveService.js'; import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js'; diff --git a/packages/backend/src/server/api/endpoints/i/notifications.ts b/packages/backend/src/server/api/endpoints/i/notifications.ts index 51de5205c3..91dd72e805 100644 --- a/packages/backend/src/server/api/endpoints/i/notifications.ts +++ b/packages/backend/src/server/api/endpoints/i/notifications.ts @@ -14,7 +14,7 @@ import { NotificationEntityService } from '@/core/entities/NotificationEntitySer import { NotificationService } from '@/core/NotificationService.js'; import { DI } from '@/di-symbols.js'; import { IdService } from '@/core/IdService.js'; -import { MiNotification } from '@/models/entities/Notification.js'; +import { MiNotification } from '@/models/Notification.js'; export const meta = { tags: ['account', 'notifications'], diff --git a/packages/backend/src/server/api/endpoints/i/update.ts b/packages/backend/src/server/api/endpoints/i/update.ts index 6c5d8eaa4c..3953b19002 100644 --- a/packages/backend/src/server/api/endpoints/i/update.ts +++ b/packages/backend/src/server/api/endpoints/i/update.ts @@ -10,9 +10,9 @@ import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mf import { extractHashtags } from '@/misc/extract-hashtags.js'; import * as Acct from '@/misc/acct.js'; import type { UsersRepository, DriveFilesRepository, UserProfilesRepository, PagesRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; -import { birthdaySchema, descriptionSchema, locationSchema, nameSchema } from '@/models/entities/User.js'; -import type { MiUserProfile } from '@/models/entities/UserProfile.js'; +import type { MiUser } from '@/models/User.js'; +import { birthdaySchema, descriptionSchema, locationSchema, nameSchema } from '@/models/User.js'; +import type { MiUserProfile } from '@/models/UserProfile.js'; import { notificationTypes } from '@/types.js'; import { normalizeForSearch } from '@/misc/normalize-for-search.js'; import { langmap } from '@/misc/langmap.js'; diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts index 1bf0d666df..48eaeff406 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/create.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/create.ts @@ -7,7 +7,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { IdService } from '@/core/IdService.js'; import type { WebhooksRepository } from '@/models/_.js'; -import { webhookEventTypes } from '@/models/entities/Webhook.js'; +import { webhookEventTypes } from '@/models/Webhook.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; import { RoleService } from '@/core/RoleService.js'; diff --git a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts index ccd247d550..b3e000524d 100644 --- a/packages/backend/src/server/api/endpoints/i/webhooks/update.ts +++ b/packages/backend/src/server/api/endpoints/i/webhooks/update.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import { Endpoint } from '@/server/api/endpoint-base.js'; import type { WebhooksRepository } from '@/models/_.js'; -import { webhookEventTypes } from '@/models/entities/Webhook.js'; +import { webhookEventTypes } from '@/models/Webhook.js'; import { GlobalEventService } from '@/core/GlobalEventService.js'; import { DI } from '@/di-symbols.js'; import { ApiError } from '../../../error.js'; diff --git a/packages/backend/src/server/api/endpoints/notes/conversation.ts b/packages/backend/src/server/api/endpoints/notes/conversation.ts index 5f4db5ca79..b94a019da4 100644 --- a/packages/backend/src/server/api/endpoints/notes/conversation.ts +++ b/packages/backend/src/server/api/endpoints/notes/conversation.ts @@ -4,7 +4,7 @@ */ import { Inject, Injectable } from '@nestjs/common'; -import type { MiNote } from '@/models/entities/Note.js'; +import type { MiNote } from '@/models/Note.js'; import type { NotesRepository } from '@/models/_.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index c7e7ca30c2..2e4d316c47 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -6,11 +6,11 @@ import ms from 'ms'; import { In } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import type { UsersRepository, NotesRepository, BlockingsRepository, DriveFilesRepository, ChannelsRepository } from '@/models/_.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiChannel } from '@/models/entities/Channel.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiChannel } from '@/models/Channel.js'; import { MAX_NOTE_TEXT_LENGTH } from '@/const.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; diff --git a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts index 82195a10b4..a58bf09b85 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/vote.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/vote.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository, PollsRepository, PollVotesRepository } from '@/models/_.js'; -import type { MiRemoteUser } from '@/models/entities/User.js'; +import type { MiRemoteUser } from '@/models/User.js'; import { IdService } from '@/core/IdService.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { GetterService } from '@/server/api/GetterService.js'; diff --git a/packages/backend/src/server/api/endpoints/notes/reactions.ts b/packages/backend/src/server/api/endpoints/notes/reactions.ts index 92ee06b7da..dae31364ee 100644 --- a/packages/backend/src/server/api/endpoints/notes/reactions.ts +++ b/packages/backend/src/server/api/endpoints/notes/reactions.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { NoteReactionsRepository } from '@/models/_.js'; -import type { MiNoteReaction } from '@/models/entities/NoteReaction.js'; +import type { MiNoteReaction } from '@/models/NoteReaction.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { NoteReactionEntityService } from '@/core/entities/NoteReactionEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index 67ebceb0d5..c0e8fab16c 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -7,7 +7,7 @@ import ms from 'ms'; import { Inject, Injectable } from '@nestjs/common'; import type { DriveFilesRepository, PagesRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; -import { MiPage } from '@/models/entities/Page.js'; +import { MiPage } from '@/models/Page.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { PageEntityService } from '@/core/entities/PageEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/pages/show.ts b/packages/backend/src/server/api/endpoints/pages/show.ts index 5279088cf0..efb0bd0677 100644 --- a/packages/backend/src/server/api/endpoints/pages/show.ts +++ b/packages/backend/src/server/api/endpoints/pages/show.ts @@ -6,7 +6,7 @@ import { IsNull } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository, PagesRepository } from '@/models/_.js'; -import type { MiPage } from '@/models/entities/Page.js'; +import type { MiPage } from '@/models/Page.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { PageEntityService } from '@/core/entities/PageEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index 610d606d97..390042c815 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -7,7 +7,7 @@ import { IsNull } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository } from '@/models/_.js'; import * as Acct from '@/misc/acct.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { MetaService } from '@/core/MetaService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; diff --git a/packages/backend/src/server/api/endpoints/renote-mute/create.ts b/packages/backend/src/server/api/endpoints/renote-mute/create.ts index 0ebf6937d4..3c9d266e21 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/create.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/create.ts @@ -8,7 +8,7 @@ import ms from 'ms'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { IdService } from '@/core/IdService.js'; import type { RenoteMutingsRepository } from '@/models/_.js'; -import type { MiRenoteMuting } from '@/models/entities/RenoteMuting.js'; +import type { MiRenoteMuting } from '@/models/RenoteMuting.js'; import { DI } from '@/di-symbols.js'; import { GetterService } from '@/server/api/GetterService.js'; import { ApiError } from '../../error.js'; diff --git a/packages/backend/src/server/api/endpoints/username/available.ts b/packages/backend/src/server/api/endpoints/username/available.ts index da8c844e64..e37df62c0c 100644 --- a/packages/backend/src/server/api/endpoints/username/available.ts +++ b/packages/backend/src/server/api/endpoints/username/available.ts @@ -7,7 +7,7 @@ import { IsNull } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import type { UsedUsernamesRepository, UsersRepository } from '@/models/_.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; -import { localUsernameSchema } from '@/models/entities/User.js'; +import { localUsernameSchema } from '@/models/User.js'; import { DI } from '@/di-symbols.js'; import { MetaService } from '@/core/MetaService.js'; diff --git a/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts b/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts index dc60552f6f..fd1bb48a4e 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create-from-public.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UserListsRepository, UserListJoiningsRepository, BlockingsRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; -import type { MiUserList } from '@/models/entities/UserList.js'; +import type { MiUserList } from '@/models/UserList.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { GetterService } from '@/server/api/GetterService.js'; import { UserListEntityService } from '@/core/entities/UserListEntityService.js'; diff --git a/packages/backend/src/server/api/endpoints/users/lists/create.ts b/packages/backend/src/server/api/endpoints/users/lists/create.ts index 02d29ae0b3..60b2b3f17e 100644 --- a/packages/backend/src/server/api/endpoints/users/lists/create.ts +++ b/packages/backend/src/server/api/endpoints/users/lists/create.ts @@ -6,7 +6,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UserListsRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; -import type { MiUserList } from '@/models/entities/UserList.js'; +import type { MiUserList } from '@/models/UserList.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { UserListEntityService } from '@/core/entities/UserListEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index 1842b77ce1..74408cc64a 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -7,7 +7,7 @@ import { Brackets } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository, FollowingsRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 3da3324c7e..aff5b98779 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -6,7 +6,7 @@ import { Brackets } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository, UserProfilesRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { DI } from '@/di-symbols.js'; diff --git a/packages/backend/src/server/api/endpoints/users/show.ts b/packages/backend/src/server/api/endpoints/users/show.ts index 25f18037ec..389497301d 100644 --- a/packages/backend/src/server/api/endpoints/users/show.ts +++ b/packages/backend/src/server/api/endpoints/users/show.ts @@ -6,7 +6,7 @@ import { In, IsNull } from 'typeorm'; import { Inject, Injectable } from '@nestjs/common'; import type { UsersRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js'; diff --git a/packages/backend/src/server/api/stream/Connection.ts b/packages/backend/src/server/api/stream/Connection.ts index 9ada6c559e..fd91681fc1 100644 --- a/packages/backend/src/server/api/stream/Connection.ts +++ b/packages/backend/src/server/api/stream/Connection.ts @@ -4,8 +4,8 @@ */ import * as WebSocket from 'ws'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiAccessToken } from '@/models/entities/AccessToken.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiAccessToken } from '@/models/AccessToken.js'; import type { Packed } from '@/misc/json-schema.js'; import type { NoteReadService } from '@/core/NoteReadService.js'; import type { NotificationService } from '@/core/NotificationService.js'; diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts index 051b0bf502..8bbba0b6db 100644 --- a/packages/backend/src/server/api/stream/channels/user-list.ts +++ b/packages/backend/src/server/api/stream/channels/user-list.ts @@ -5,7 +5,7 @@ import { Inject, Injectable } from '@nestjs/common'; import type { UserListJoiningsRepository, UserListsRepository } from '@/models/_.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { isUserRelated } from '@/misc/is-user-related.js'; import type { Packed } from '@/misc/json-schema.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; diff --git a/packages/backend/src/server/api/stream/types.ts b/packages/backend/src/server/api/stream/types.ts index c8e168519a..90e0a61f26 100644 --- a/packages/backend/src/server/api/stream/types.ts +++ b/packages/backend/src/server/api/stream/types.ts @@ -3,20 +3,20 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import type { MiChannel } from '@/models/entities/Channel.js'; -import type { MiUser } from '@/models/entities/User.js'; -import type { MiUserProfile } from '@/models/entities/UserProfile.js'; -import type { MiNote } from '@/models/entities/Note.js'; -import type { MiAntenna } from '@/models/entities/Antenna.js'; -import type { MiDriveFile } from '@/models/entities/DriveFile.js'; -import type { MiDriveFolder } from '@/models/entities/DriveFolder.js'; -import type { MiUserList } from '@/models/entities/UserList.js'; -import type { MiAbuseUserReport } from '@/models/entities/AbuseUserReport.js'; -import type { MiSignin } from '@/models/entities/Signin.js'; -import type { MiPage } from '@/models/entities/Page.js'; +import type { MiChannel } from '@/models/Channel.js'; +import type { MiUser } from '@/models/User.js'; +import type { MiUserProfile } from '@/models/UserProfile.js'; +import type { MiNote } from '@/models/Note.js'; +import type { MiAntenna } from '@/models/Antenna.js'; +import type { MiDriveFile } from '@/models/DriveFile.js'; +import type { MiDriveFolder } from '@/models/DriveFolder.js'; +import type { MiUserList } from '@/models/UserList.js'; +import type { MiAbuseUserReport } from '@/models/AbuseUserReport.js'; +import type { MiSignin } from '@/models/Signin.js'; +import type { MiPage } from '@/models/Page.js'; import type { Packed } from '@/misc/json-schema.js'; -import type { MiWebhook } from '@/models/entities/Webhook.js'; -import type { MiMeta } from '@/models/entities/Meta.js'; +import type { MiWebhook } from '@/models/Webhook.js'; +import type { MiMeta } from '@/models/Meta.js'; import { MiRole, MiRoleAssignment } from '@/models/_.js'; import type Emitter from 'strict-event-emitter-types'; import type { EventEmitter } from 'events'; diff --git a/packages/backend/src/server/oauth/OAuth2ProviderService.ts b/packages/backend/src/server/oauth/OAuth2ProviderService.ts index f2991b3aa5..c3a78561c2 100644 --- a/packages/backend/src/server/oauth/OAuth2ProviderService.ts +++ b/packages/backend/src/server/oauth/OAuth2ProviderService.ts @@ -26,7 +26,7 @@ import { bindThis } from '@/decorators.js'; import type { AccessTokensRepository, UsersRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; import { CacheService } from '@/core/CacheService.js'; -import type { MiLocalUser } from '@/models/entities/User.js'; +import type { MiLocalUser } from '@/models/User.js'; import { MemoryKVCache } from '@/misc/cache.js'; import { LoggerService } from '@/core/LoggerService.js'; import Logger from '@/logger.js'; @@ -125,7 +125,7 @@ async function discoverClientInformation(logger: Logger, httpRequestService: Htt let name = id; if (text) { const microformats = mf2(text, { baseUrl: res.url }); - const nameProperty = microformats.items.find(item => item.type?.includes('h-app') && item.properties.url?.includes(id))?.properties.name[0]; + const nameProperty = microformats.items.find(item => item.type?.includes('h-app') && item.properties.url.includes(id))?.properties.name[0]; if (typeof nameProperty === 'string') { name = nameProperty; } diff --git a/packages/backend/src/server/web/FeedService.ts b/packages/backend/src/server/web/FeedService.ts index f0f4e6bf3d..78551e800b 100644 --- a/packages/backend/src/server/web/FeedService.ts +++ b/packages/backend/src/server/web/FeedService.ts @@ -9,7 +9,7 @@ import { Feed } from 'feed'; import { DI } from '@/di-symbols.js'; import type { DriveFilesRepository, NotesRepository, UserProfilesRepository } from '@/models/_.js'; import type { Config } from '@/config.js'; -import type { MiUser } from '@/models/entities/User.js'; +import type { MiUser } from '@/models/User.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js'; import { bindThis } from '@/decorators.js'; diff --git a/packages/backend/test/e2e/note.ts b/packages/backend/test/e2e/note.ts index 20208c4571..961df99cc2 100644 --- a/packages/backend/test/e2e/note.ts +++ b/packages/backend/test/e2e/note.ts @@ -6,7 +6,7 @@ process.env.NODE_ENV = 'test'; import * as assert from 'assert'; -import { MiNote } from '@/models/entities/Note.js'; +import { MiNote } from '@/models/Note.js'; import { MAX_NOTE_TEXT_LENGTH } from '@/const.js'; import { signup, post, uploadUrl, startServer, initTestDb, api, uploadFile } from '../utils.js'; import type { INestApplicationContext } from '@nestjs/common'; diff --git a/packages/backend/test/e2e/streaming.ts b/packages/backend/test/e2e/streaming.ts index 0dd97069a0..77de144882 100644 --- a/packages/backend/test/e2e/streaming.ts +++ b/packages/backend/test/e2e/streaming.ts @@ -6,7 +6,7 @@ process.env.NODE_ENV = 'test'; import * as assert from 'assert'; -import { MiFollowing } from '@/models/entities/Following.js'; +import { MiFollowing } from '@/models/Following.js'; import { connectStream, signup, api, post, startServer, initTestDb, waitFire } from '../utils.js'; import type { INestApplicationContext } from '@nestjs/common'; import type * as misskey from 'misskey-js'; diff --git a/packages/backend/test/unit/activitypub.ts b/packages/backend/test/unit/activitypub.ts index 75235b7948..dbc446d12d 100644 --- a/packages/backend/test/unit/activitypub.ts +++ b/packages/backend/test/unit/activitypub.ts @@ -22,7 +22,7 @@ import { MiMeta, MiNote } from '@/models/_.js'; import { secureRndstr } from '@/misc/secure-rndstr.js'; import { DownloadService } from '@/core/DownloadService.js'; import { MetaService } from '@/core/MetaService.js'; -import type { MiRemoteUser } from '@/models/entities/User.js'; +import type { MiRemoteUser } from '@/models/User.js'; import { MockResolver } from '../misc/mock-resolver.js'; const host = 'https://host1.test'; -- cgit v1.2.3-freya