Files
outline/server/models/ImportTask.ts
codegen-sh[bot] 879c568a2c Upgrade Prettier to v3.6.2 (#9500)
* Upgrade Prettier to v3.6.2 and eslint-plugin-prettier to v5.5.1

- Upgraded prettier from ^2.8.8 to ^3.6.2 (latest version)
- Upgraded eslint-plugin-prettier from ^4.2.1 to ^5.5.1 for compatibility
- Applied automatic formatting changes from new Prettier version
- All existing ESLint and Prettier configurations remain compatible

* Applied automatic fixes

* Trigger CI

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-06-28 10:22:28 -04:00

62 lines
1.6 KiB
TypeScript

import { InferAttributes, InferCreationAttributes } from "sequelize";
import {
AllowNull,
BelongsTo,
Column,
DataType,
ForeignKey,
IsIn,
Table,
} from "sequelize-typescript";
import { type ImportTaskInput, ImportTaskOutput } from "@shared/schema";
import { ImportableIntegrationService, ImportTaskState } from "@shared/types";
import Import from "./Import";
import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
// Not all fields are automatically inferred by Sequelize.
// see https://sequelize.org/docs/v7/models/model-typing/#manual-attribute-typing
type NonInferredAttributes<T extends ImportableIntegrationService> = {
input: ImportTaskInput<T>;
};
export type ImportTaskAttributes<T extends ImportableIntegrationService> =
InferAttributes<ImportTask<T>> & NonInferredAttributes<T>;
export type ImportTaskCreationAttributes<
T extends ImportableIntegrationService,
> = Partial<InferCreationAttributes<ImportTask<T>>> &
Partial<NonInferredAttributes<T>>;
@Table({ tableName: "import_tasks", modelName: "import_task" })
@Fix
class ImportTask<T extends ImportableIntegrationService> extends IdModel<
ImportTaskAttributes<T>,
ImportTaskCreationAttributes<T>
> {
@IsIn([Object.values(ImportTaskState)])
@Column(DataType.STRING)
state: ImportTaskState;
@Column(DataType.JSONB)
input: ImportTaskInput<T>;
@AllowNull
@Column(DataType.JSONB)
output: ImportTaskOutput | null;
@Column
error: string | null;
// associations
@BelongsTo(() => Import, "importId")
import: Import<T>;
@ForeignKey(() => Import)
@Column(DataType.UUID)
importId: string;
}
export default ImportTask;