iceshrimp-legacy/packages/backend/src/queue/types.ts

83 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-01-13 05:40:33 +01:00
import type { DriveFile } from "@/models/entities/drive-file.js";
import type { Note } from "@/models/entities/note";
import type { User } from "@/models/entities/user.js";
import type { Webhook } from "@/models/entities/webhook";
import type { IActivity } from "@/remote/activitypub/type.js";
import type httpSignature from "@peertube/http-signature";
2021-05-08 11:56:21 +02:00
export type DeliverJobData = {
/** Actor */
user: ThinUser;
/** Activity */
content: unknown;
/** inbox URL to deliver */
to: string;
};
export type InboxJobData = {
activity: IActivity;
signature: httpSignature.IParsedSignature;
};
2023-01-13 05:40:33 +01:00
export type DbJobData =
| DbUserJobData
2023-03-30 17:31:29 +02:00
| DbUserImportPostsJobData
2023-01-13 05:40:33 +01:00
| DbUserImportJobData
2023-05-14 18:46:48 +02:00
| DbUserDeleteJobData
| DbUserImportMastoPostJobData;
2021-05-08 11:56:21 +02:00
export type DbUserJobData = {
user: ThinUser;
2021-12-09 17:22:35 +01:00
excludeMuting: boolean;
excludeInactive: boolean;
2021-05-08 11:56:21 +02:00
};
export type DbUserDeleteJobData = {
user: ThinUser;
soft?: boolean;
};
2021-05-08 11:56:21 +02:00
export type DbUserImportJobData = {
user: ThinUser;
2023-01-13 05:40:33 +01:00
fileId: DriveFile["id"];
2021-05-08 11:56:21 +02:00
};
2023-03-30 17:31:29 +02:00
export type DbUserImportPostsJobData = {
user: ThinUser;
fileId: DriveFile["id"];
signatureCheck: boolean;
};
2023-05-14 18:46:48 +02:00
export type DbUserImportMastoPostJobData = {
user: ThinUser;
post: any;
signatureCheck: boolean;
};
2023-01-13 05:40:33 +01:00
export type ObjectStorageJobData =
| ObjectStorageFileJobData
| Record<string, unknown>;
2021-05-08 11:56:21 +02:00
export type ObjectStorageFileJobData = {
key: string;
};
export type EndedPollNotificationJobData = {
2023-01-13 05:40:33 +01:00
noteId: Note["id"];
};
export type WebhookDeliverJobData = {
2022-04-03 15:36:30 +02:00
type: string;
content: unknown;
2023-01-13 05:40:33 +01:00
webhookId: Webhook["id"];
userId: User["id"];
to: string;
secret: string;
2022-04-03 15:36:30 +02:00
createdAt: number;
eventId: string;
};
2021-05-08 11:56:21 +02:00
export type ThinUser = {
2023-01-13 05:40:33 +01:00
id: User["id"];
2021-05-08 11:56:21 +02:00
};