refactor(imports): replace relative imports with path aliases (#2741)

This commit is contained in:
Hampus authored and GitHub committed 2026-09-13 20:18:22 +02:00
1 parent a59b80ce11
commit 84dcf6b8a8
1834 files changed
+11601 -10725

No files matched your search

@@ -1,15 +1,15 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import type {ChannelID, GuildID, MessageID, ReportID, UserID} from '../BrandedTypes';
import type {MessageAttachment, MessageEmbed, MessageStickerItem} from '../database/types/MessageTypes';
import type {ChannelID, GuildID, MessageID, ReportID, UserID} from '@app/api/BrandedTypes';
import type {MessageAttachment, MessageEmbed, MessageStickerItem} from '@app/api/database/types/MessageTypes';
import type {
DSAReportEmailVerificationRow,
DSAReportTicketRow,
IARSubmissionRow,
MessageReportSubmissionByReporterRow,
} from '../database/types/ReportTypes';
} from '@app/api/database/types/ReportTypes';
export type {IARMessageContextRow, IARSubmissionRow} from '../database/types/ReportTypes';
export type {IARMessageContextRow, IARSubmissionRow} from '@app/api/database/types/ReportTypes';
export enum ReportStatus {
PENDING = 0,
@@ -1,5 +1,11 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {DefaultUserOnly, LoginRequired} from '@app/api/middleware/AuthMiddleware';
import {RateLimitMiddleware} from '@app/api/middleware/RateLimitMiddleware';
import {OpenAPI} from '@app/api/middleware/ResponseTypeMiddleware';
import {RateLimitConfigs} from '@app/api/RateLimitConfig';
import type {HonoApp} from '@app/api/types/HonoEnv';
import {Validator} from '@app/api/Validator';
import {
DsaReportEmailSendRequest,
DsaReportEmailVerifyRequest,
@@ -11,12 +17,6 @@ import {
ReportUserRequest,
TicketResponse,
} from '@fluxer/schema/src/domains/report/ReportSchemas';
import {DefaultUserOnly, LoginRequired} from '../middleware/AuthMiddleware';
import {RateLimitMiddleware} from '../middleware/RateLimitMiddleware';
import {OpenAPI} from '../middleware/ResponseTypeMiddleware';
import {RateLimitConfigs} from '../RateLimitConfig';
import type {HonoApp} from '../types/HonoEnv';
import {Validator} from '../Validator';
export function ReportController(app: HonoApp) {
app.post(
+14 -14
View File
@@ -1,29 +1,29 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {ReportAlreadyResolvedError} from '@fluxer/errors/src/domains/moderation/ReportAlreadyResolvedError';
import {UnknownReportError} from '@fluxer/errors/src/domains/moderation/UnknownReportError';
import type {ChannelID, MessageID, ReportID, UserID} from '../BrandedTypes';
import {createChannelID, createGuildID, createMessageID, createReportID, createUserID} from '../BrandedTypes';
import {fetchMany, fetchOne, upsertOne} from '../database/CassandraQueryExecution';
import {Db} from '../database/CassandraTypes';
import type {ChannelID, MessageID, ReportID, UserID} from '@app/api/BrandedTypes';
import {createChannelID, createGuildID, createMessageID, createReportID, createUserID} from '@app/api/BrandedTypes';
import {fetchMany, fetchOne, upsertOne} from '@app/api/database/CassandraQueryExecution';
import {Db} from '@app/api/database/CassandraTypes';
import type {
DSAReportEmailVerificationRow,
DSAReportTicketRow,
MessageReportSubmissionByReporterRow,
} from '../database/types/ReportTypes';
import {
DSAReportEmailVerifications,
DSAReportTickets,
IARSubmissions,
MessageReportSubmissionsByReporter,
} from '../Tables';
} from '@app/api/database/types/ReportTypes';
import type {
IARMessageContext,
IARMessageContextRow,
IARSubmission,
IARSubmissionRow,
IReportRepository,
} from './IReportRepository';
} from '@app/api/report/IReportRepository';
import {
DSAReportEmailVerifications,
DSAReportTickets,
IARSubmissions,
MessageReportSubmissionsByReporter,
} from '@app/api/Tables';
import {ReportAlreadyResolvedError} from '@fluxer/errors/src/domains/moderation/ReportAlreadyResolvedError';
import {UnknownReportError} from '@fluxer/errors/src/domains/moderation/UnknownReportError';
const GET_REPORT_QUERY = IARSubmissions.select({
where: IARSubmissions.where.eq('report_id'),
@@ -1,5 +1,10 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {requireEmailVerified} from '@app/api/auth/EmailVerificationUtils';
import {createChannelID, createGuildID, createInviteCode, createMessageID, createUserID} from '@app/api/BrandedTypes';
import type {User} from '@app/api/models/User';
import {type ReportStatus, reportStatusToString} from '@app/api/report/IReportRepository';
import type {ReportService} from '@app/api/report/ReportService';
import {UnclaimedAccountCannotSubmitReportsError} from '@fluxer/errors/src/domains/moderation/UnclaimedAccountCannotSubmitReportsError';
import type {
DsaReportEmailSendRequest,
@@ -11,11 +16,6 @@ import type {
ReportUserRequest,
TicketResponse,
} from '@fluxer/schema/src/domains/report/ReportSchemas';
import {requireEmailVerified} from '../auth/EmailVerificationUtils';
import {createChannelID, createGuildID, createInviteCode, createMessageID, createUserID} from '../BrandedTypes';
import type {User} from '../models/User';
import {type ReportStatus, reportStatusToString} from './IReportRepository';
import type {ReportService} from './ReportService';
interface ReportUserRequestContext<T> {
user: User;
+44 -39
View File
@@ -1,6 +1,50 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {createHash, randomBytes, randomInt} from 'node:crypto';
import type {ChannelID, GuildID, InviteCode, MessageID, ReportID, UserID} from '@app/api/BrandedTypes';
import {
createChannelID,
createGuildID,
createInviteCode,
createMessageID,
createReportID,
createUserID,
} from '@app/api/BrandedTypes';
import {Config} from '@app/api/Config';
import type {IChannelRepository} from '@app/api/channel/IChannelRepository';
import type {AuthenticatedChannel} from '@app/api/channel/services/AuthenticatedChannel';
import {MessageChannelAuthService} from '@app/api/channel/services/message/MessageChannelAuthService';
import * as MessageHelpers from '@app/api/channel/services/message/MessageHelpers';
import type {ContentWarningChannelLike} from '@app/api/channel/utils/EffectiveContentWarning';
import {
channelToContentWarningView,
computeEffectiveChannelNsfw,
computeEffectiveContentWarning,
guildToContentWarningView,
} from '@app/api/channel/utils/EffectiveContentWarning';
import type {MessageAttachment} from '@app/api/database/types/MessageTypes';
import type {DSAReportTicketRow} from '@app/api/database/types/ReportTypes';
import type {IGuildRepositoryAggregate} from '@app/api/guild/repositories/IGuildRepositoryAggregate';
import type {IEmailDnsValidationService} from '@app/api/infrastructure/IEmailDnsValidationService';
import type {IGatewayService} from '@app/api/infrastructure/IGatewayService';
import type {ISnowflakeService} from '@app/api/infrastructure/ISnowflakeService';
import type {IStorageService} from '@app/api/infrastructure/IStorageService';
import type {IInviteRepository} from '@app/api/invite/IInviteRepository';
import {Logger} from '@app/api/Logger';
import type {Attachment} from '@app/api/models/Attachment';
import type {Channel} from '@app/api/models/Channel';
import type {Guild} from '@app/api/models/Guild';
import type {Message} from '@app/api/models/Message';
import type {User} from '@app/api/models/User';
import type {
IARMessageContextRow,
IARSubmission,
IARSubmissionRow,
IReportRepository,
} from '@app/api/report/IReportRepository';
import {ReportStatus, ReportType} from '@app/api/report/IReportRepository';
import type {IReportSearchService} from '@app/api/search/IReportSearchService';
import type {IUserRepository} from '@app/api/user/IUserRepository';
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {InviteTypes, Permissions} from '@fluxer/constants/src/ChannelConstants';
import {GuildFeatures} from '@fluxer/constants/src/GuildConstants';
@@ -30,45 +74,6 @@ import {snowflakeToDate} from '@fluxer/snowflake/src/Snowflake';
import type {IEmailService} from '@pkgs/email/src/IEmailService';
import type {IRateLimitService} from '@pkgs/rate_limit/src/IRateLimitService';
import {ms} from 'itty-time';
import type {ChannelID, GuildID, InviteCode, MessageID, ReportID, UserID} from '../BrandedTypes';
import {
createChannelID,
createGuildID,
createInviteCode,
createMessageID,
createReportID,
createUserID,
} from '../BrandedTypes';
import {Config} from '../Config';
import type {IChannelRepository} from '../channel/IChannelRepository';
import type {AuthenticatedChannel} from '../channel/services/AuthenticatedChannel';
import {MessageChannelAuthService} from '../channel/services/message/MessageChannelAuthService';
import * as MessageHelpers from '../channel/services/message/MessageHelpers';
import type {ContentWarningChannelLike} from '../channel/utils/EffectiveContentWarning';
import {
channelToContentWarningView,
computeEffectiveChannelNsfw,
computeEffectiveContentWarning,
guildToContentWarningView,
} from '../channel/utils/EffectiveContentWarning';
import type {MessageAttachment} from '../database/types/MessageTypes';
import type {DSAReportTicketRow} from '../database/types/ReportTypes';
import type {IGuildRepositoryAggregate} from '../guild/repositories/IGuildRepositoryAggregate';
import type {IEmailDnsValidationService} from '../infrastructure/IEmailDnsValidationService';
import type {IGatewayService} from '../infrastructure/IGatewayService';
import type {ISnowflakeService} from '../infrastructure/ISnowflakeService';
import type {IStorageService} from '../infrastructure/IStorageService';
import type {IInviteRepository} from '../invite/IInviteRepository';
import {Logger} from '../Logger';
import type {Attachment} from '../models/Attachment';
import type {Channel} from '../models/Channel';
import type {Guild} from '../models/Guild';
import type {Message} from '../models/Message';
import type {User} from '../models/User';
import type {IReportSearchService} from '../search/IReportSearchService';
import type {IUserRepository} from '../user/IUserRepository';
import type {IARMessageContextRow, IARSubmission, IARSubmissionRow, IReportRepository} from './IReportRepository';
import {ReportStatus, ReportType} from './IReportRepository';
interface ReporterMetadata {
id: UserID | null;
@@ -1,10 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
import type {GuildResponse} from '@fluxer/schema/src/domains/guild/GuildResponseSchemas';
import {getEmailTemplate} from '@pkgs/email/src/email_i18n/EmailI18n';
import {afterEach, beforeEach, describe, expect, test} from 'vitest';
import {
clearTestEmails,
createTestAccount,
@@ -13,8 +8,8 @@ import {
listTestEmails,
setUserACLs,
type TestAccount,
} from '../../auth/tests/AuthTestUtils';
import {createUserID} from '../../BrandedTypes';
} from '@app/api/auth/tests/AuthTestUtils';
import {createUserID} from '@app/api/BrandedTypes';
import {
acceptInvite,
createChannel,
@@ -26,13 +21,18 @@ import {
getChannel,
sendChannelMessage,
setupTestGuildWithMembers,
} from '../../channel/tests/ChannelTestUtils';
import {ensureSessionStarted} from '../../message/tests/MessageTestUtils';
import {ReadStateRepository} from '../../read_state/ReadStateRepository';
import {type ApiTestHarness, createApiTestHarness} from '../../test/ApiTestHarness';
import {HTTP_STATUS, TEST_IDS} from '../../test/TestConstants';
import {createBuilder, createBuilderWithoutAuth} from '../../test/TestRequestBuilder';
import {ReportRepository} from '../ReportRepository';
} from '@app/api/channel/tests/ChannelTestUtils';
import {ensureSessionStarted} from '@app/api/message/tests/MessageTestUtils';
import {ReadStateRepository} from '@app/api/read_state/ReadStateRepository';
import {ReportRepository} from '@app/api/report/ReportRepository';
import {type ApiTestHarness, createApiTestHarness} from '@app/api/test/ApiTestHarness';
import {HTTP_STATUS, TEST_IDS} from '@app/api/test/TestConstants';
import {createBuilder, createBuilderWithoutAuth} from '@app/api/test/TestRequestBuilder';
import {APIErrorCodes} from '@fluxer/constants/src/ApiErrorCodes';
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
import type {GuildResponse} from '@fluxer/schema/src/domains/guild/GuildResponseSchemas';
import {getEmailTemplate} from '@pkgs/email/src/email_i18n/EmailI18n';
import {afterEach, beforeEach, describe, expect, test} from 'vitest';
interface ReportResponse {
report_id: string;