mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-08 03:32:27 +09:00
refactor(api)!: drop unused helpers, parameters and a route (#2511)
This commit is contained in:
@@ -423,20 +423,6 @@ export function MessageController(app: HonoApp) {
|
||||
return ctx.body(null, 204);
|
||||
},
|
||||
);
|
||||
app.post(
|
||||
'/channels/:channel_id/messages/bulk_delete',
|
||||
RateLimitMiddleware(RateLimitConfigs.CHANNEL_MESSAGE_BULK_DELETE),
|
||||
LoginRequired,
|
||||
Validator('param', ChannelIdParam),
|
||||
Validator('json', BulkDeleteMessagesRequest),
|
||||
async (ctx) => {
|
||||
const userId = ctx.get('user').id;
|
||||
const channelId = createChannelID(ctx.req.valid('param').channel_id);
|
||||
const messageIds = ctx.req.valid('json').message_ids.map(createMessageID);
|
||||
await ctx.get('channelService').messages.deletion.bulkDeleteMessages({userId, channelId, messageIds});
|
||||
return ctx.body(null, 204);
|
||||
},
|
||||
);
|
||||
app.post(
|
||||
'/channels/:channel_id/messages/purge',
|
||||
RateLimitMiddleware(RateLimitConfigs.CHANNEL_MESSAGE_PURGE),
|
||||
|
||||
@@ -76,7 +76,6 @@ interface UploadFormDataAttachmentsParams {
|
||||
id: number;
|
||||
filename: string;
|
||||
}>;
|
||||
expiresAt?: Date;
|
||||
}
|
||||
|
||||
interface RequestPresignedAttachmentUploadUrlsParams {
|
||||
@@ -113,7 +112,6 @@ export class AttachmentUploadService {
|
||||
clientIp,
|
||||
files,
|
||||
attachmentMetadata,
|
||||
expiresAt,
|
||||
}: UploadFormDataAttachmentsParams): Promise<Array<UploadedAttachment>> {
|
||||
const {maxFileSize} = await this.getUploadPermissionAndLimit({userId, channelId});
|
||||
assertAttachmentFileSizesWithinLimit(
|
||||
@@ -138,7 +136,6 @@ export class AttachmentUploadService {
|
||||
key: uploadKey,
|
||||
body,
|
||||
contentType,
|
||||
expiresAt: expiresAt ?? undefined,
|
||||
}),
|
||||
);
|
||||
await this.attachmentUploadTraceRepository.recordRequestedUpload({
|
||||
|
||||
@@ -33,7 +33,6 @@ type MultipartBody = Record<string, string | File | Array<string | File>>;
|
||||
type AttachmentMetadata = ClientAttachmentRequest | ClientUploadedAttachmentRequest | ClientAttachmentReferenceRequest;
|
||||
|
||||
interface ParseMultipartMessageDataOptions {
|
||||
uploadExpiresAt?: Date;
|
||||
onPayloadParsed?: (payload: unknown) => void;
|
||||
}
|
||||
|
||||
@@ -159,7 +158,6 @@ export async function parseMultipartMessageData(
|
||||
clientIp,
|
||||
files: filesWithIndices,
|
||||
attachmentMetadata: inlineNewAttachments,
|
||||
expiresAt: options?.uploadExpiresAt,
|
||||
});
|
||||
const uploadedMap = new Map(uploadedAttachments.map((attachment) => [attachment.id, attachment]));
|
||||
const processedInlineAttachments = inlineNewAttachments.map((clientData) => {
|
||||
|
||||
@@ -281,14 +281,6 @@ export class UserAccountLookupService {
|
||||
}));
|
||||
}
|
||||
|
||||
async generateUniqueDiscriminator(username: string): Promise<number> {
|
||||
const usedDiscriminators = await this.deps.userAccountRepository.findDiscriminatorsByUsername(username);
|
||||
for (let i = 1; i <= 9999; i++) {
|
||||
if (!usedDiscriminators.has(i)) return i;
|
||||
}
|
||||
throw new Error('No available discriminators for this username');
|
||||
}
|
||||
|
||||
async checkUsernameDiscriminatorAvailability(params: {username: string; discriminator: number}): Promise<boolean> {
|
||||
const {username, discriminator} = params;
|
||||
const isAvailable = await this.deps.discriminatorService.isDiscriminatorAvailableForUsername(
|
||||
|
||||
Reference in New Issue
Block a user